]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFQADataMakerRec.cxx
Savannah bug 71585 fixed (F.Bellini)
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerRec.cxx
index a83ece56292a0a9a33cf7f0142fef9067ae9a69a..93bd51441f2cd27c1bd2db2fdb140cfc334b13ab 100644 (file)
 //                                                                   //
 ///////////////////////////////////////////////////////////////////////
 
-/* Modified by fbellini on 22/04/2010
+/*
+    Modified by fbellini on 13/09/2010
+  - Set TLines as private members
+  - Set image flag for expert histos
+
+  Modified by fbellini on 14/06/2010
+  - Updated plots
+  - use LoadRawDataBuffersV2()
+
+  Modified by fbellini on 10/05/2010
+  - Fixed EndOfDetectorCycle() memory corruption bug
+
+  Modified by fbellini on 22/04/2010
    - Added filter for physics events
 
    Modified by fbellini on 16/04/2010
@@ -70,12 +82,21 @@ ClassImp(AliTOFQADataMakerRec)
   fCalibData(0x0),
   fEnableNoiseFiltering(kFALSE),
     fEnableDqmShifterOpt(kFALSE),
-    fProcessedRawEventN(0)
+    fProcessedRawEventN(0),
+    fLineExpTimeMin(0x0),
+    fLineExpTimeMax(0x0),
+    fLineExpTotMin(0x0),
+    fLineExpTotMax(0x0)
 {
   //
   // ctor
   //
    
+  for (Int_t sm=0;sm<10;sm++){
+      fLineSMid035[sm]=0x0;
+      fLineSMid3671[sm]=0x0;
+  }
+    
 }
 
 //____________________________________________________________________________ 
@@ -84,15 +105,22 @@ AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
   fCalibData(qadm.fCalibData),
   fEnableNoiseFiltering(qadm.fEnableNoiseFiltering),
   fEnableDqmShifterOpt(qadm.fEnableDqmShifterOpt),
-  fProcessedRawEventN(qadm.fProcessedRawEventN)
+  fProcessedRawEventN(qadm.fProcessedRawEventN),
+  fLineExpTimeMin(qadm.fLineExpTimeMin),
+  fLineExpTimeMax(qadm.fLineExpTimeMax),
+  fLineExpTotMin(qadm.fLineExpTotMin),
+  fLineExpTotMax(qadm.fLineExpTotMax)
 {
   //
   //copy ctor 
   //
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
-  
+   
+  for (Int_t sm=0;sm<10;sm++){
+      fLineSMid035[sm]=qadm.fLineSMid035[sm];
+      fLineSMid3671[sm]=qadm.fLineSMid3671[sm];
+  }
 }
 
 //__________________________________________________________________
@@ -166,11 +194,11 @@ void AliTOFQADataMakerRec::InitRaws()
   TH1F * h13  = new TH1F("hTOFRawsToTIC", "TOF Raws - Hit ToT (ns) - I/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
   TH1F * h14  = new TH1F("hTOFRawsToTOC", "TOF Raws - Hit ToT (ns) - O/C side;Measured Hit ToT (ns);Counts", 1000, 0., 48.8) ; 
 
-  TH1I * h15 = new TH1I("hTOFRawsLTMHits", "LTM hits ; Crate; Counts",  72, 0., 72.);
-  TH1I * h16  = new TH1I("hTOFRawsTRMHits035", "TRM hits  - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits",  361, 0., 361.) ;
-  TH1I * h17  = new TH1I("hTOFRawsTRMHits3671","TRM hits  - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
+  TH1F * h15 = new TH1F("hTOFRawsLTMHits", "LTMs OR signals; Crate; Counts",  72, 0., 72.);
+  TH1F * h16  = new TH1F("hTOFRawsTRMHits035", "TRM hits  - crates 0 to 35 ;TRM index = SMid(crate*10)+TRM(0-9);Hits",  361, 0., 361.) ;
+  TH1F * h17  = new TH1F("hTOFRawsTRMHits3671","TRM hits  - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Hits", 361, 360., 721.) ;
   
-  TH1I * h18 = new TH1I("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
+  TH1F * h18 = new TH1F("hTOFRawChannelHits","TOF channel hits count; Channel ID; Hits", 158000, 0., 158000);
   
   TH1F * h19  = new TH1F("hTOFOrphansTime", "TOF Raws - Orphans time (ns);Measured Hit time [ns];Counts", 25000, 0. ,610.) ; 
   TH2F * h20 = new TH2F("hTOFRawTimeVsTRM035", "TOF raws - Hit time vs TRM - crates 0 to 35; TRM index = DDL*10+TRM(0-9);TOF raw time [ns]", 361, 0., 361., 250, 0., 610.0) ;
@@ -208,15 +236,15 @@ void AliTOFQADataMakerRec::InitRaws()
   h24->Sumw2() ;
 
   Add2RawsList(h0,   0, !expert,  image, !saveCorr) ;
-  Add2RawsList(h1,   1,  expert, !image, !saveCorr) ;
-  Add2RawsList(h2,   2,  expert, !image, !saveCorr) ;
-  Add2RawsList(h3,   3,  expert, !image, !saveCorr) ;
-  Add2RawsList(h4,   4,  expert, !image, !saveCorr) ;
+  Add2RawsList(h1,   1,  expert,  image, !saveCorr) ;
+  Add2RawsList(h2,   2,  expert,  image, !saveCorr) ;
+  Add2RawsList(h3,   3,  expert,  image, !saveCorr) ;
+  Add2RawsList(h4,   4,  expert,  image, !saveCorr) ;
   Add2RawsList(h5,   5, !expert,  image, !saveCorr) ;
-  Add2RawsList(h6,   6,  expert, !image, !saveCorr) ;
-  Add2RawsList(h7,   7,  expert, !image, !saveCorr) ;
-  Add2RawsList(h8,   8,  expert, !image, !saveCorr) ;
-  Add2RawsList(h9,   9,  expert, !image, !saveCorr) ;
+  Add2RawsList(h6,   6,  expert,  image, !saveCorr) ;
+  Add2RawsList(h7,   7,  expert,  image, !saveCorr) ;
+  Add2RawsList(h8,   8,  expert,  image, !saveCorr) ;
+  Add2RawsList(h9,   9,  expert,  image, !saveCorr) ;
   Add2RawsList(h10, 10, !expert,  image, !saveCorr) ;
   Add2RawsList(h11, 11,  expert, !image, !saveCorr) ;
   Add2RawsList(h12, 12,  expert, !image, !saveCorr) ;
@@ -233,6 +261,39 @@ void AliTOFQADataMakerRec::InitRaws()
   Add2RawsList(h23, 23,  expert, !image, !saveCorr) ;
   Add2RawsList(h24, 24,  expert, !image, !saveCorr) ;
 
+  //add lines for DQM shifter
+  fLineExpTimeMin = new TLine(200., 0., 200., 0.);
+  fLineExpTimeMin->SetLineColor(kGreen);
+  fLineExpTimeMin->SetLineWidth(2);
+  
+  fLineExpTimeMax = new TLine(250., 0., 250., 0.);
+  fLineExpTimeMax->SetLineColor(kGreen);
+  fLineExpTimeMax->SetLineWidth(2);
+  
+  fLineExpTotMin = new TLine( 5., 0., 5., 0.);
+  fLineExpTotMin->SetLineColor(kGreen);
+  fLineExpTotMin->SetLineWidth(2);
+  
+  fLineExpTotMax = new TLine(20., 0., 20., 0.);
+  fLineExpTotMax->SetLineColor(kGreen);
+  fLineExpTotMax->SetLineWidth(2);
+  
+  h5->GetListOfFunctions()->Add(fLineExpTimeMin);
+  h5->GetListOfFunctions()->Add(fLineExpTimeMax);
+  h10->GetListOfFunctions()->Add(fLineExpTotMin);
+  h10->GetListOfFunctions()->Add(fLineExpTotMax);
+  
+  for (Int_t sm=0;sm<10;sm++){
+      fLineSMid035[sm] = new TLine( 40*sm, 0, 40*sm, 0.);
+      fLineSMid035[sm]->SetLineColor(kMagenta);
+      fLineSMid035[sm]->SetLineWidth(2);
+      GetRawsData(16)->GetListOfFunctions()->Add(fLineSMid035[sm]);
+      fLineSMid3671[sm] = new TLine( 40*sm+360, 0, 40*sm+360, 0.);
+      fLineSMid3671[sm]->SetLineColor(kMagenta);
+      fLineSMid3671[sm]->SetLineWidth(2);
+      GetRawsData(17)->GetListOfFunctions()->Add(fLineSMid3671[sm]);
+  }
+  
 }
 
 //____________________________________________________________________________ 
@@ -390,7 +451,7 @@ void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
        for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
            rawReader->Reset();
            
-           tofInput.LoadRawDataBuffers(iDDL);
+           tofInput.LoadRawDataBuffersV2(iDDL);
            clonesRawData = (TClonesArray*)tofInput.GetRawData();
            for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
                AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
@@ -691,92 +752,92 @@ void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArr
 {
   //Detector specific actions at end of cycle
   // do the QA checking
-    
     for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
        if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) 
            continue ; 
        
-       AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
-
        if (fEnableDqmShifterOpt){
            // Help make the raw qa histogram easier to interpret for the DQM shifter
-           // This is still to be optimized...
-
            if (!GetRawsData(0) || !GetRawsData(5) || !GetRawsData(10) 
                || !GetRawsData(15) || !GetRawsData(16) || !GetRawsData(17)) {
                printf("No histogram for DQM found - Possible memory corruption ???. Please check\n") ; 
                continue;
            }
+           AliInfo(Form("Processed %i physics raw events",fProcessedRawEventN));
            
-           Double_t yTimeMin = GetRawsData(5)->GetMinimum();
-           Double_t yTimeMax = GetRawsData(5)->GetMaximum();
-           Double_t yTotMin = GetRawsData(10)->GetMinimum();
-           Double_t yTotMax = GetRawsData(10)->GetMaximum();
-           
-           TLine* lineExpTimeMin = new TLine(200., yTimeMin, 200., yTimeMax);
-           lineExpTimeMin->SetLineColor(kGreen);
-           lineExpTimeMin->SetLineWidth(2);
-           
-           TLine* lineExpTimeMax = new TLine(250., yTimeMin, 250., yTimeMax);
-           lineExpTimeMax->SetLineColor(kGreen);
-           lineExpTimeMax->SetLineWidth(2);
-           
-           TLine* lineExpTotMin = new TLine( 5., yTotMin, 5., yTotMax);
-           lineExpTotMin->SetLineColor(kGreen);
-           lineExpTotMin->SetLineWidth(2);
            
-           TLine* lineExpTotMax = new TLine(20., yTotMin, 20., yTotMax);
-           lineExpTotMax->SetLineColor(kGreen);
-           lineExpTotMax->SetLineWidth(2);
-           
-           for(Int_t j=0;j<5;j++){
-               //make up for hits count
-               GetRawsData(j)->SetMarkerColor(kRed);
-               GetRawsData(j)->SetMarkerStyle(7);
-               //make up for time spectra
-               ((TH1F*)GetRawsData(j+5))->GetListOfFunctions()->Add(lineExpTimeMin);
-               ((TH1F*)GetRawsData(j+5))->GetListOfFunctions()->Add(lineExpTimeMax);
-               GetRawsData(j+5)->SetLineColor(kBlue+1);
-               GetRawsData(j+5)->SetMarkerColor(kBlue+1);
+           if (fCalibData){
+               //normalize TRM hits plots to the number of enabled channels from OCDB object
+               TH1F * hTrmChannels035 = new TH1F("hTrmchannels035", "Active channels per TRM - crates 0 to 35;TRM index = SMid(crate*10)+TRM(0-9);Active channels",  361, 0., 361.) ;
+               TH1F * hTrmChannels3671 = new TH1F("hTrmChannels3671","Active channels per TRM - crates 36 to 71 ;TRM index = SMid(crate*10)+TRM(0-9);Active channels", 361, 360., 721.) ;
                
-               //make up for tot spectra
-               ((TH1F*)GetRawsData(j+10))->GetListOfFunctions()->Add(lineExpTotMin);
-               ((TH1F*)GetRawsData(j+10))->GetListOfFunctions()->Add(lineExpTotMax);
-               GetRawsData(j+10)->SetLineColor(kBlue+1);
-               GetRawsData(j+10)->SetMarkerColor(kBlue+1);
+               for (Int_t ch = 0; ch <  fCalibData->GetSize(); ch++) {
+                   if (!(fCalibData->GetNoiseStatus(ch)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)
+                       && (fCalibData->GetHWStatus(ch) == AliTOFChannelOnlineStatusArray::kTOFHWOk)){
+                       Int_t geoId[5];
+                       Int_t detId[5];
+                       AliTOFGeometry::GetVolumeIndices(ch,geoId);
+                       AliTOFRawStream::Geant2EquipmentId(geoId,detId); //detID=(ddl,trm,tdc, chain,channel)
+                       if (detId[0]<36) hTrmChannels035->Fill((detId[1]-3)+detId[0]*10);
+                       else hTrmChannels3671->Fill((detId[1]-3)+detId[0]*10);
+                   }
+               }
+               GetRawsData(16)->Divide(hTrmChannels035);
+               GetRawsData(16)->SetTitle("TRMs average hit number per active channel - crates 0-35");
+               GetRawsData(16)->GetYaxis()->SetTitle("hits/active channels");
+               GetRawsData(17)->Divide(hTrmChannels3671);
+               GetRawsData(17)->SetTitle("TRMs average hit number per active channel - crates 36-71");
+               GetRawsData(17)->GetYaxis()->SetTitle("hits/active channels");
            }
            
-           //make up for equipment hits count 
-           for(Int_t j=15;j<18;j++){
-             GetRawsData(j)->SetLineColor(kBlue+1);
-             GetRawsData(j)->SetLineWidth(1);
-
-             if (j==15) {
-               GetRawsData(j)->SetMarkerStyle(8);
-               GetRawsData(j)->SetMarkerSize(0.7);
-               GetRawsData(j)->SetMarkerColor(kBlue+2);
-          
-             } else {
-               Int_t ySMmax=GetRawsData(j)->GetMaximum();
-               TLine* lineSMid[10];
-               
-               for (Int_t sm=0;sm<10;sm++){
-                 lineSMid[sm] = new TLine( 40*sm+360*(j%16), 0, 40*sm+360*(j%16), ySMmax);
-                 lineSMid[sm]->SetLineColor(kMagenta);
-                 lineSMid[sm]->SetLineWidth(2);
-                 GetRawsData(j)->GetListOfFunctions()->Add(lineSMid[sm]);
-                 GetRawsData(j)->SetFillColor(kBlue+1);
+           //set minima and maxima to allow log scale
+           Double_t yTimeMax = GetRawsData(5)->GetMaximum();
+           Double_t yTotMax = GetRawsData(10)->GetMaximum();
+           Double_t yTrmMax = TMath::Max(GetRawsData(16)->GetMaximum(),GetRawsData(17)->GetMaximum());
+           // Double_t yLtmMax = GetRawsData(15)->GetMaximum();
+           // Double_t yHitMax = GetRawsData(0)->GetMaximum();
+
+           // GetRawsData(0)->SetMinimum(0.1);
+           // GetRawsData(5)->SetMinimum(0.1);
+           // GetRawsData(10)->SetMinimum(0.1);
+           // GetRawsData(15)->SetMinimum(0.1);
+           GetRawsData(16)->SetMinimum(0.0001);
+           GetRawsData(17)->SetMinimum(0.0001);
+
+           // GetRawsData(0)->SetMaximum(yHitMax);
+           // GetRawsData(5)->SetMaximum(yTimeMax);
+           // GetRawsData(10)->SetMaximum(yTotMax);
+           // GetRawsData(15)->SetMaximum(yLtmMax);
+           GetRawsData(16)->SetMaximum(yTrmMax);
+           GetRawsData(17)->SetMaximum(yTrmMax);
+           
+           fLineExpTimeMin->SetY2(yTimeMax);
+           fLineExpTimeMax->SetY2(yTimeMax);
+           fLineExpTotMin->SetY2(yTotMax);
+           fLineExpTotMax->SetY2(yTotMax);
+           for (Int_t sm=0;sm<10;sm++){
+               fLineSMid035[sm]->SetY2(yTrmMax);
+               fLineSMid3671[sm]->SetY2(yTrmMax);
+           }
+
+
+            //make up for all histos 
+           for(Int_t j=0;j<20;j++){
+               if (j<5) {
+                   GetRawsData(j)->SetMarkerColor(kRed);
+                   GetRawsData(j)->SetMarkerStyle(7);
+               } else {
+                   GetRawsData(j)->SetLineColor(kBlue+1);
+                   GetRawsData(j)->SetLineWidth(1);
+                   GetRawsData(j)->SetMarkerColor(kBlue+1);
                }
-             }
            }
-           GetRawsData(18)->SetLineColor(kBlue+1);
-           GetRawsData(18)->SetMarkerColor(kBlue+1);
            
-           //make up for orphans histo
-           GetRawsData(19)->SetLineColor(kBlue+1);
-           GetRawsData(19)->SetMarkerColor(kBlue+1);
-           ((TH1F*)GetRawsData(19))->GetListOfFunctions()->Add(lineExpTimeMin);
-           ((TH1F*)GetRawsData(19))->GetListOfFunctions()->Add(lineExpTimeMax);
+           for (Int_t j=15;j<19;j++){
+               GetRawsData(j)->SetFillColor(kGray+1);
+               GetRawsData(j)->SetOption("bar");
+           }
+           
        }
     }
     AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;