Re: Bug in BrTofTdcGainCalModule::Event => BRAT-2-10-6

From: Ian Bearden (bearden@nbi.dk)
Date: Wed Sep 03 2003 - 06:46:35 EDT

  • Next message: Claus O. E. Jorgensen: "Committing ZDC gains to the db"
    Hej Alle,
    The number of hits can never be greater than the number of slats.
    I don't recall why this was done this (no-optimal) way, but it seems to 
    me it is OK, since you just have to be sure that
    you find all the hit slats.  At least it was OK until it gave a seg 
    fault...
    I think that the statistics should not be changed since you will only 
    pick up the N hits for the event (and thus that last
    NoSlats-N iterations of the loop are useless) and these N hits will be 
    associated with the correct slat.
    
    I also think that it is better to loop over the number of hits rather 
    than the number of slats, so thanks for making the change.
    Cheers,
    Ian
    On onsdag, sep 3, 2003, at 12:10 Europe/Copenhagen, Jens Ivar Jordre 
    wrote:
    
    > Hello out there.
    >
    > A bug in BrTofTdcGainCalModule::Event was discovered and corrected, 
    > leading to new revision.
    >
    > To illustrate the error I include the old 
    > BrTofTdcGainCalModule::Event, where the error is in the loop:
    >
    > <snip>
    >
    > //____________________________________________________________________
    > void BrTofTdcGainCalModule::Event(BrEventNode* inNode, BrEventNode* 
    > outNode)
    > {
    >   // Fill histograms with TDC values for top and bot tubes
    >   // note that you should use only a calibration run (e.g. 2544)
    >   // Per event method
    >
    >   SetState(kEvent);
    >
    >   if (fCommitAscii || fLoadAscii)
    >     return;
    >
    >   BrDataTable* hits =
    >     (BrDataTable*)inNode->GetDataTable(Form("DigTof %s", GetName()));
    >   if (!hits) {
    >     if (DebugLevel() > 5)
    >       Warning("Event", "No data table for %s", GetName());
    >     return;
    >   }
    >
    >   if (!hits->GetEntries()) {
    >     if (DebugLevel() > 5)
    >       Warning("Event", "No hits in datatable for %s", GetName());
    >     return;
    >   }
    >
    >   for(Int_t i = 0; i < fParamsTof->GetNoSlats(); i++) {
    >     BrTofDig* hit = (BrTofDig*)hits->At(i);
    >     Int_t slat = hit->GetSlatno();
    >
    >     if (hit->GetTdcUp() > 1 && hit->GetTdcUp() < 4095)
    >       fTTdc[slat-1]->Fill(hit->GetTdcUp());
    >
    >     if (hit->GetTdcDown() > 1 && hit->GetTdcDown() < 4095)
    >       fBTdc[slat-1]->Fill(hit->GetTdcDown());
    >   }
    > }
    >
    > </snip>
    >
    > The loop is run over number of slats and _not_ over number of hits as 
    > it should be. But at least the hit is matched to the correct slat. On 
    > rcas0032, with gcc 2.96 (RedHat version) it generated segmentation 
    > violation for a case with number of hits < number of slats.
    >
    > I don't know how much this affects the TOF TDC gain calibrations done 
    > so far, as I would guess that in most cases number of hits > number of 
    > slats. Is the production version which is installed in AFS compiled 
    > with the same version of gcc? In any case at least the statistics for 
    > this calibration has been lowered.
    >
    > Best wishes from
    > Jens Ivar
    >
    > -- 
    >           _____________________________________________________
    >  ________|                  Jens Ivar Jřrdre                   |_______
    >  \       | Dept. of Physics                        Office: 521 |      /
    >   \      | Allégt 55                    Phone: +47 55 58 27 92 |     /
    >    \     | 5007 Bergen                    Fax: +47 55 58 94 40 |    /
    >    /     | Norway            E-mail: jensivar.jordre@fi.uib.no |    \
    >   /      |_____________________________________________________|     \
    >  /__________)                                               (_________\
    >
    


    This archive was generated by hypermail 2.1.5 : Wed Sep 03 2003 - 06:47:44 EDT