[Halld-offline] GetSingle() issue to get associated object.

zihlmann zihlmann at jlab.org
Wed Aug 13 09:59:40 EDT 2025


issue:
while looping over DTAGMHit ojects I want to get the associated object 
DTAGMDigiHit since
a DTAGMHit object is made as a match between DTAGMDigiHit and 
DTAGMTDCDigiHit.
However, when using the GetSingle() method it returns at times NULL. 
This should
not be possible.
Any idea why that can be?

here the code I use:
   vector <const DTAGMHit*> TagMHits = event->Get<DTAGMHit>();
   for (unsigned int k=0; k<TagMHits.size(); k++){

     const DTAGMHit *hit = TagMHits[k];
     const DTAGMDigiHit *dh = hit->GetSingle<DTAGMDigiHit>();
     if (!dh){
       //cout<<"Error no associated object DTAGMDigiHit found!" << endl;
       continue;
     }
     tagmAMPmatched->Fill((double)dh->column, (double)dh->pulse_peak);
     tagmADCtimeMatched->Fill((double)dh->column, 
(double)dh->pulse_time*0.0625);
   }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/halld-offline/attachments/20250813/094a631f/attachment.htm>


More information about the Halld-offline mailing list