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

From: Jens Ivar Jordre (jensivar.jordre@fi.uib.no)
Date: Wed Sep 03 2003 - 06:10:50 EDT

  • Next message: Ian Bearden: "Re: Bug in BrTofTdcGainCalModule::Event => BRAT-2-10-6"
    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:11:31 EDT