]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
RawData QA update: added expert histograms, changed some histogram ranges, inserted...
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Mar 2010 14:34:46 +0000 (14:34 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Mar 2010 14:34:46 +0000 (14:34 +0000)
TOF/AliTOFLvHvDataPoints.cxx
TOF/AliTOFPreprocessor.cxx
TOF/AliTOFQADataMakerRec.cxx
TOF/AliTOFQADataMakerRec.h

index 9c708e87fd5d6c45a318b4ede7e3f7d445668c68..4e2e19351c5089b9b9c0403b069f6b331b2a3485 100644 (file)
@@ -177,7 +177,7 @@ Bool_t AliTOFLvHvDataPoints::ProcessData(TMap& aliasMap) {
   AliDebug(1,Form(" Number of LV dps = %d",fNumberOfLVdataPoints));
 
   if (!MergeHVmap()) return kFALSE;
-  if (fNumberOfLVdataPoints==0) return kFALSE;
+
   if (!MergeLVmap()) return kFALSE;
 
   if (!MergeMaps()) return kFALSE;
index 5b6d0a01e9bee3ea00f064b3a2d95e2543a9710e..bc0b304fedecfc50aa35fb4c84711f6e90e8180a 100644 (file)
@@ -890,7 +890,7 @@ AliTOFPreprocessor::ProcessT0Fill()
 
   /* rebin until maximum bin has required minimum entries */
   Int_t maxBin = hT0Fill->GetMaximumBin();
-  Int_t maxBinContent = hT0Fill->GetBinContent(maxBin);
+  Float_t maxBinContent = hT0Fill->GetBinContent(maxBin);
   Float_t binWidth = hT0Fill->GetBinWidth(maxBin);
   while (maxBinContent < 400 && binWidth < 90.) {
     hT0Fill->Rebin(2);
index ef18d79a6107ea543bcf44fe0bfe316e8528df56..5ffae105b4091553994544feae4e02fec3216bd7 100644 (file)
 //  QA objects are 1 & 2 Dimensional histograms.                     //
 //  author: S.Arcelli                                                //
 //                                                                   //
+// last modified by F. Bellini (fbellini@cern.ch) on 02/03/2010      //
 ///////////////////////////////////////////////////////////////////////
 
 #include <TClonesArray.h>
-//#include <TFile.h> 
-//#include <TH1I.h> 
 #include <TH1F.h> 
 #include <TH2F.h> 
 
 #include "AliLog.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliCDBEntry.h"
 #include "AliESDEvent.h"
 #include "AliESDtrack.h"
+#include "AliQA.h"
 #include "AliQAChecker.h"
 #include "AliRawReader.h"
 
 #include "AliTOFrawData.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFdigit.h"
+#include "AliTOFChannelOnlineStatusArray.h"
+
 
 ClassImp(AliTOFQADataMakerRec)
            
 //____________________________________________________________________________ 
   AliTOFQADataMakerRec::AliTOFQADataMakerRec() : 
-  AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker")
+  AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
+  fCalibData(0x0),
+  fEnableNoiseFiltering(kFALSE)
 {
   //
   // ctor
@@ -53,7 +61,9 @@ ClassImp(AliTOFQADataMakerRec)
 
 //____________________________________________________________________________ 
 AliTOFQADataMakerRec::AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) :
-  AliQADataMakerRec()
+  AliQADataMakerRec(),
+  fCalibData(qadm.fCalibData),
+  fEnableNoiseFiltering(qadm.fEnableNoiseFiltering)
 {
   //
   //copy ctor 
@@ -73,6 +83,32 @@ AliTOFQADataMakerRec& AliTOFQADataMakerRec::operator = (const AliTOFQADataMakerR
   return *this;
 }
  
+//----------------------------------------------------------------------------
+AliTOFChannelOnlineStatusArray* AliTOFQADataMakerRec::GetCalibData() const
+{
+    AliCDBManager *man = AliCDBManager::Instance();
+
+    AliCDBEntry *cdbe=0;
+
+    cdbe = man->Get("TOF/Calib/Status",fRun);
+    if(!cdbe){
+       AliWarning("Load of calibration data from default storage failed!");
+       AliWarning("Calibration data will be loaded from local storage ($ALICE_ROOT)");
+       man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+       cdbe = man->Get("TOF/Calib/Status",fRun);
+    }
+    // Retrieval of data in directory TOF/Calib/Data:
+    
+    AliTOFChannelOnlineStatusArray * array = 0;
+    if (cdbe) array = (AliTOFChannelOnlineStatusArray *)cdbe->GetObject();
+    if (!array)  AliFatal("No calibration data from calibration database !");
+    
+    return array;
+    
+}
+
+
+
 //____________________________________________________________________________ 
 void AliTOFQADataMakerRec::InitRaws()
 {
@@ -83,52 +119,76 @@ void AliTOFQADataMakerRec::InitRaws()
   const Bool_t expert   = kTRUE ; 
   const Bool_t saveCorr = kTRUE ; 
   const Bool_t image    = kTRUE ; 
-  
-  TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws;TOF raw number [10 power];Counts ",301, -1.02, 5.) ;
-  h0->Sumw2() ;
-  Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
-
-  TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns);Measured TOF time [ns];Counts", 20000, 0., 2000) ; 
-  h1->Sumw2() ;
-  Add2RawsList(h1, 1, !expert, image, !saveCorr) ;
 
-  TH1F * h2  = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns);Measured TOT time [ns];Counts", 500, 0., 50) ; 
-  h2->Sumw2() ;
-  Add2RawsList(h2, 2, !expert, image, !saveCorr) ;
-
-  TH2F * h3  = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
-  h3->Sumw2() ;
-  h3->GetYaxis()->SetTitleOffset(1.15);
-  Add2RawsList(h3, 3, !expert, image, !saveCorr) ;
-
-}
-
-//____________________________________________________________________________ 
-void AliTOFQADataMakerRec::InitDigits()
-{
-  //
-  // create Digits histograms in Digits subdir
-  //
-  
-  const Bool_t expert   = kTRUE ; 
-  const Bool_t image    = kTRUE ; 
+  TH1F * h0 = new TH1F("hTOFRaws",      "Number of TOF Raw Hits; TOF raw hits number;Counts ",1001, -1., 1000.) ;
+  TH1F * h1 = new TH1F("hTOFRawsIA",    "Number of TOF Raw Hits - I/A side; TOF raw hits number [10 power];Counts ",1001, -1., 1000.) ;
+  TH1F * h2 = new TH1F("hTOFRawsOA",    "Number of TOF Raw Hits - O/A side; TOF raw hits number [10 power];Counts ",1001, -1., 1000.) ;
+  TH1F * h3 = new TH1F("hTOFRawsIC",    "Number of TOF Raw Hits - I/C side; TOF raw hits number [10 power];Counts ",1001, -1., 1000.) ;
+  TH1F * h4 = new TH1F("hTOFRawsOC",    "Number of TOF Raw Hits - O/C side; TOF raw hits number [10 power] ;Counts ",1001, -1., 1000.) ;
+  TH1F * h5  = new TH1F("hTOFRawsTimeIA", "Raws Time Spectrum in TOF (ns) - I/A side;Measured raw TOF time [ns];Counts", 100000,0. ,2440.) ; 
+  TH1F * h6  = new TH1F("hTOFRawsTimeOA", "Raws Time Spectrum in TOF (ns) - O/A side;Measured raw TOF time [ns];Counts", 100000,0. ,2440.) ; 
+  TH1F * h7  = new TH1F("hTOFRawsTimeIC", "Raws Time Spectrum in TOF (ns) - I/C side;Measured raw TOF time [ns];Counts", 100000,0. ,2440.) ; 
+  TH1F * h8  = new TH1F("hTOFRawsTimeOC", "Raws Time Spectrum in TOF (ns) - O/C side;Measured raw TOF time [ns];Counts", 100000,0. ,2440.) ; 
+  TH1F * h9  = new TH1F("hTOFRawsToTIA",  "Raws ToT Spectrum in TOF (ns) - I/A side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; 
+  TH1F * h10  = new TH1F("hTOFRawsToTOA", "Raws ToT Spectrum in TOF (ns) - O/A side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; 
+  TH1F * h11  = new TH1F("hTOFRawsToTIC", "Raws ToT Spectrum in TOF (ns) - I/C side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; 
+  TH1F * h12  = new TH1F("hTOFRawsToTOC", "Raws ToT Spectrum in TOF (ns) - O/C side;Measured raw ToT [ns];Counts", 10000, 0., 244.) ; 
+  TH1F * h13  = new TH1F("hTOFRawsTRMHitRate035", "TRM hit rate - crates 0 to 35 ;TRM index = DDL*10+TRM(0-9);Counts",  361, 0., 361.) ; 
+  TH1F * h14  = new TH1F("hTOFRawsTRMHitRate3671","TRM hit rate - crates 36 to 71 ;TRM index = DDL*10+TRM(0-9);Counts", 361, 361., 722.) ; 
+  TH1F * h15  = new TH1F("hTOFRawsVolumeErrorCounter","Invalid hit/volume association error counter per DDL; DDL; error counter ",73, -1., 72.) ; 
+  TH2F * h16  = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi;eta (2*strip+padz);phi (48*sector+padx)",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH1F * h17  = new TH1F("hTOFOrphansTime", "Raws Time Spectrum in TOF (ns) for hits with no ToT measurement;Measured raw TOF time [ns];Counts", 100000,0. ,2440.) ; 
+  TH1F * h18  = new TH1F("hTOFRawsDecodingErrorCounter",  "Invalid hit/equipment association error counter per DDL; DDL; error counter ",73, -1., 72.) ; 
+  TH1F * h19 = new TH1F("hTOFRawsWords",    "Number of TOF Raw words per event; TOF raw words number;Counts ",1001, -1., 1000.) ;
+  TH2F * h20 = new TH2F("hTOFRawTimeVsDDL",    "TOF raw time spectrum vs DDL; TOF raw time [ns];DDL ",1000,0. ,2440., 72, 0., 72.) ;
+  TH2F * h21 = new TH2F("hTOFRawToTVsDDL",     "TOF raw ToT spectrum vs DDL; TOF raw ToT [ns];DDL ",   100, 0., 244., 72, 0., 72.) ;
   
-  TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digits;TOF digit number [10 power];Counts ",301, -1.02, 5.) ;
-  h0->Sumw2() ;
-  Add2DigitsList(h0, 0, !expert, image) ;
-  
-  TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 20000, 0., 2000) ; 
-  h1->Sumw2() ;
-  Add2DigitsList(h1, 1, !expert, image) ;
-  
-  TH1F * h2  = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 500, 0., 50) ; 
-  h2->Sumw2() ;
-  Add2DigitsList(h2, 2, !expert, image) ;
-  
-  TH2F * h3  = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
-  h3->Sumw2() ;
-  h3->GetYaxis()->SetTitleOffset(1.15);
-  Add2DigitsList(h3, 3, !expert, image) ;
+    h0->Sumw2() ;
+    h1->Sumw2() ;
+    h2->Sumw2() ;
+    h3->Sumw2() ;
+    h4->Sumw2() ;
+    h5->Sumw2() ;
+    h6->Sumw2() ;
+    h7->Sumw2() ;
+    h8->Sumw2() ;
+    h9->Sumw2() ;
+    h10->Sumw2() ;
+    h11->Sumw2() ;
+    h12->Sumw2() ;
+    h13->Sumw2() ;
+    h14->Sumw2() ;
+    h15->Sumw2() ;
+    h16->Sumw2() ;
+    h17->Sumw2() ;
+    h18->Sumw2() ;
+    h19->Sumw2() ;
+    h20->Sumw2() ;
+    h21->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(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(h10, 10, !expert,  image, !saveCorr) ;
+  Add2RawsList(h11, 11, !expert,  image, !saveCorr) ;
+  Add2RawsList(h12, 12, !expert,  image, !saveCorr) ;
+  Add2RawsList(h13, 13,  expert, !image, !saveCorr) ;
+  Add2RawsList(h14, 14,  expert, !image, !saveCorr) ;
+  Add2RawsList(h15, 15,  expert, !image, !saveCorr) ;
+  Add2RawsList(h16, 16, !expert,  image, !saveCorr) ;
+  Add2RawsList(h17, 17,  expert, !image, !saveCorr) ;
+  Add2RawsList(h18, 18,  expert, !image, !saveCorr) ;
+  Add2RawsList(h19, 19,  expert, !image, !saveCorr) ;
+  Add2RawsList(h20, 20,  expert, !image, !saveCorr) ;
+  Add2RawsList(h21, 21,  expert, !image, !saveCorr) ;
+
 }
 
 //____________________________________________________________________________ 
@@ -138,29 +198,27 @@ void AliTOFQADataMakerRec::InitRecPoints()
   // create RecPoints histograms in RecPoints subdir
   //
 
-  const Bool_t expert   = kTRUE ; 
-  const Bool_t image    = kTRUE ; 
+  Bool_t expert = kFALSE;
 
-  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints;TOF recPoint number [10 power];Counts",301, -1.02, 5.) ;
-  h0->Sumw2() ;
-  Add2RecPointsList(h0, 0, !expert, image) ;
+  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints ",301, -1.02, 5.) ;   h0->Sumw2() ;
+  Add2RecPointsList(h0, 0, expert) ;
 
-  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns);Calibrated TOF time [ns];Counts", 20000, 0., 2000) ; 
+  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
   h1->Sumw2() ;
-  Add2RecPointsList(h1, 1, !expert, image) ;
+  Add2RecPointsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns);Measured TOF time [ns];Counts", 20000, 0., 2000) ; 
+  TH1F * h2  = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
   h2->Sumw2() ;
-  Add2RecPointsList(h2, 2, !expert, image) ;
+  Add2RecPointsList(h2, 2, expert) ;
 
-  TH1F * h3  = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns);Measured TOT [ns];Counts", 500, 0., 50) ; 
+  TH1F * h3  = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
   h3->Sumw2() ;
-  Add2RecPointsList(h3, 3, !expert, image) ;
+  Add2RecPointsList(h3, 3, expert) ;
 
-  TH2F * h4  = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h4  = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h4->Sumw2() ;
-  h4->GetYaxis()->SetTitleOffset(1.15);
-  Add2RecPointsList(h4, 4, !expert, image) ;
+  Add2RecPointsList(h4, 4, expert) ;
+
 }
 
 //____________________________________________________________________________ 
@@ -170,27 +228,27 @@ void AliTOFQADataMakerRec::InitESDs()
   //create ESDs histograms in ESDs subdir
   //
 
-  const Bool_t expert   = kTRUE ; 
-  const Bool_t image    = kTRUE ; 
-  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs;Number of TOF matched ESD tracks [10 power];Counts",       250, -1., 4.) ;  
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs",       250, -1., 4.) ;  
   h0->Sumw2() ; 
-  Add2ESDsList(h0, 0, !expert, image) ;
+  Add2ESDsList(h0, 0, expert) ;
 
-  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns);Calibrated TOF time [ns];Counts", 20000, 0., 2000) ; 
+  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
   h1->Sumw2() ;
-  Add2ESDsList(h1, 1, !expert, image) ;
+  Add2ESDsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns);Measured TOF time [ns];Counts", 20000, 0., 2000) ; 
+  TH1F * h2  = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
   h2->Sumw2() ;
-  Add2ESDsList(h2, 2, !expert, image) ;
+  Add2ESDsList(h2, 2, expert) ;
 
-  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns);Measured TOF time [ns];Counts", 500, 0., 50) ; 
+  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
   h3->Sumw2() ;
-  Add2ESDsList(h3, 3, !expert, image) ;
+  Add2ESDsList(h3, 3, expert) ;
 
-  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID flag (%);Fraction of TOF matched ESD tracks with good flag [%];Counts", 101, 0., 101.) ;  
+  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID glag", 100, 0., 1.) ;  
   h4->Sumw2() ; 
-  Add2ESDsList(h4, 4, !expert, image) ;
+  Add2ESDsList(h4, 4, expert) ;
 }
 
 //____________________________________________________________________________
@@ -203,157 +261,172 @@ void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
 
+  Int_t nentries=0;
+  Int_t ntof[5]; /* 0=tot, 1=IA, 2=OA, 3=IC, 4=OC*/
+  for (Int_t j=0;j<5;j++){ ntof[j]=0;}
 
-  Int_t ntof = 0 ; 
-  Int_t in[5];
-  Int_t out[5];
+  Int_t equipmentID[5]; //(ddl, trm, chain,tdc,channel)
+  Int_t volumeID[5];   //(sector,plate,strip,padX,padZ)
+  Int_t volumeID2[5];   //(sector,plate,strip,padZ,padX) to use AliTOFGeometry::GetIndex()
+  Int_t out[5]; //   out=(indexZ,indexPhi)   
+  Int_t chIndex=-1;
 
   TClonesArray * clonesRawData;
   AliTOFRawStream tofInput(rawReader);
+
+  //uncomment if needed to apply DeltaBC correction
+  //tofInput.ApplyBCCorrections(kTRUE);
+  
   for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
     rawReader->Reset();
-    tofInput.LoadRawData(iDDL);
+    tofInput.LoadRawDataBuffers(iDDL);
     clonesRawData = (TClonesArray*)tofInput.GetRawData();
     for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
-      AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-      if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
-      ntof++;
-      GetRawsData(1)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
-      GetRawsData(2)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
-
-      tofInput.EquipmentId2VolumeId(iDDL, 
-                                   tofRawDatum->GetTRM(), 
-                                   tofRawDatum->GetTRMchain(),
-                                   tofRawDatum->GetTDC(), 
-                                   tofRawDatum->GetTDCchannel(), 
-                                   in);
-    
-      GetMapIndeces(in,out);
-      GetRawsData(3)->Fill( out[0],out[1]) ;//raw map
-      
+       nentries++;
+       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
+
+       if (tofRawDatum->GetTOF()){
+       
+           equipmentID[0]=iDDL;
+           equipmentID[1]=tofRawDatum->GetTRM(); 
+           equipmentID[2]=tofRawDatum->GetTRMchain();
+           equipmentID[3]=tofRawDatum->GetTDC();
+           equipmentID[4]=tofRawDatum->GetTDCchannel();
+           
+           if (!CheckEquipID(equipmentID)) GetRawsData(18)->Fill(equipmentID[0]);
+           else {
+               tofInput.EquipmentId2VolumeId(iDDL, 
+                                             tofRawDatum->GetTRM(), 
+                                             tofRawDatum->GetTRMchain(),
+                                             tofRawDatum->GetTDC(), 
+                                             tofRawDatum->GetTDCchannel(), 
+                                             volumeID);
+               
+               if (!CheckVolumeID(volumeID)) GetRawsData(15)->Fill(equipmentID[0]);  
+               else {
+                   GetMapIndeces(volumeID,out);
+                   
+                   volumeID2[0]=volumeID[0];
+                   volumeID2[1]=volumeID[1];
+                   volumeID2[2]=volumeID[2];
+                   volumeID2[3]=volumeID[4];
+                   volumeID2[4]=volumeID[3];
+                   chIndex=AliTOFGeometry::GetIndex(volumeID2);
+                   
+                   if (tofRawDatum->GetTOT()){     
+                       if (!(fCalibData->GetNoiseStatus(chIndex)==AliTOFChannelOnlineStatusArray::kTOFNoiseBad)) {//noise filter
+                           ntof[0]++; //counter for tof hits
+                           if (volumeID2[0]>4 && volumeID2[0]<14){       //I side
+                               if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
+                                   ntof[1]++;
+                                   GetRawsData(5)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                                   GetRawsData(9)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
+                               } else {
+                                   if ((iDDL%4==2)|| (iDDL%4==3)){//C side
+                                       ntof[3]++;
+                                       GetRawsData(7)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                                       GetRawsData(11)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
+                                   }
+                               }
+                           } else {
+                               if (volumeID2[0]<5 || volumeID2[0]>13){       //O side
+                                   if ((iDDL%4==0)|| (iDDL%4==1)){ //A side
+                                       ntof[2]++;
+                                       GetRawsData(6)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                                       GetRawsData(10)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
+                                   } else {
+                                       if ((iDDL%4==2)|| (iDDL%4==3)){//C side
+                                           ntof[4]++;
+                                           GetRawsData(8)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                                           GetRawsData(12)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
+                                       }
+                                   }
+                               }
+                           }
+                           //compute TRM offset
+                           Int_t trm= iDDL*10+(volumeID[1]-3);
+                           if (iDDL>=0 && iDDL<36) GetRawsData(13)->Fill(trm) ;//in ns 
+                           if (iDDL>=36 && iDDL<72) GetRawsData(14)->Fill(trm) ;//in ns 
+                           GetRawsData(16)->Fill( out[0],out[1]) ;//raw map
+                           
+                           GetRawsData(20)->Fill(tofRawDatum->GetTOF()*tdc2ns,iDDL);
+                           GetRawsData(21)->Fill(tofRawDatum->GetTOT()*tot2ns,iDDL);
+                           
+                       }//noise filter
+                   }//end hit selection
+                   else { //orphans
+                       if (!(fCalibData->GetNoiseStatus(chIndex) == AliTOFChannelOnlineStatusArray::kTOFNoiseBad))
+                           GetRawsData(17)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+                   }//end orphans
+               }//end volumeID check
+           }//end equipID check
+       }
     } // while loop
     
     clonesRawData->Clear();
-    
   } // DDL Loop
   
-  Int_t nentries=ntof;
-  if(nentries<=0){
-    GetRawsData(0)->Fill(-1.) ; 
-  }else{
-    GetRawsData(0)->Fill(TMath::Log10(nentries)) ; 
+  for (Int_t j=0;j<5;j++){
+      if(ntof[j]<=0) GetRawsData(j)->Fill(-1.) ; 
+      else GetRawsData(j)->Fill(ntof[j]);
   }
-}
-
-//____________________________________________________________________________
-void AliTOFQADataMakerRec::MakeDigits()
-{
-  //
-  // makes data from Digits
-  //
-  Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
-  Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
-  Int_t in[5];
-  Int_t out[5];
+  if (nentries<=0) GetRawsData(19)->Fill(-1.) ;
+  else GetRawsData(19)->Fill(nentries) ;
   
-  Int_t nentries=fDigitsArray->GetEntriesFast();
-  if(nentries<=0){
-    GetDigitsData(0)->Fill(-1.) ; 
-  }else{
-    GetDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
-  } 
-  
-  TIter next(fDigitsArray) ; 
-  AliTOFdigit * digit ; 
-  while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
-    
-    GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns
-    GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns
-      
-      in[0] = digit->GetSector();
-      in[1] = digit->GetPlate();
-      in[2] = digit->GetStrip();
-      in[3] = digit->GetPadx();
-      in[4]= digit->GetPadz();
-      GetMapIndeces(in,out);
-      GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
-  }
 }
 
-//____________________________________________________________________________
-void AliTOFQADataMakerRec::MakeDigits(TTree * digitTree)
-{
-  //
-  // makes data from Digit Tree
-  //
-  
-  if (fDigitsArray) 
-    fDigitsArray->Clear() ; 
-  else
-    fDigitsArray = new TClonesArray("AliTOFdigit", 1000) ; 
-  
-  TBranch * branch = digitTree->GetBranch("TOF") ;
-  if ( ! branch ) {
-    AliError("TOF branch in Digit Tree not found") ; 
-    return;
-  }
-  branch->SetAddress(&fDigitsArray) ;
-  branch->GetEntry(0) ; 
-  MakeDigits() ; 
-}
 
 //____________________________________________________________________________
 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
 {
-  //
-  // Make data from Clusters
-  //
-  Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
-  Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
-
-  Int_t in[5];
-  Int_t out[5];
-
-  TBranch *branch=clustersTree->GetBranch("TOF");
-  if (!branch) { 
-    AliError("can't get the branch with the TOF clusters !");
-    return;
-  }
-
-  static TClonesArray dummy("AliTOFcluster",10000);
-  dummy.Clear();
-  TClonesArray *clusters=&dummy;
-  branch->SetAddress(&clusters);
-
-  // Import the tree
-  clustersTree->GetEvent(0);  
-  
-  Int_t nentries=clusters->GetEntriesFast();
-  if(nentries<=0){
-    GetRecPointsData(0)->Fill(-1.) ; 
-  }else{
-    GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ; 
-  } 
-  TIter next(clusters) ; 
-  AliTOFcluster * c ; 
-  while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
-    GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns);
-    GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns);
-    GetRecPointsData(3)->Fill(c->GetToT()*tot2ns);
+    //
+    // Make data from Clusters
+    //
     
-    in[0] = c->GetDetInd(0);
-    in[1] = c->GetDetInd(1);
-    in[2] = c->GetDetInd(2);
-    in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
-    in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
+    Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
+    Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
     
-    GetMapIndeces(in,out);
-    GetRecPointsData(4)->Fill(out[0],out[1]);
+    Int_t in[5];
+    Int_t out[5];
     
-  }
+    TBranch *branch=clustersTree->GetBranch("TOF");
+    if (!branch) { 
+       AliError("can't get the branch with the TOF clusters !");
+       return;
+    }
+    
+    static TClonesArray dummy("AliTOFcluster",10000);
+    dummy.Clear();
+    TClonesArray *clusters=&dummy;
+    branch->SetAddress(&clusters);
+    
+    // Import the tree
+    clustersTree->GetEvent(0);  
+    
+    Int_t nentries=clusters->GetEntriesFast();
+    if(nentries<=0){
+       GetRecPointsData(0)->Fill(-1.) ; 
+    }else{
+       GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ; 
+    } 
+    
+    TIter next(clusters) ; 
+    AliTOFcluster * c ; 
+    while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
+       GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns);
+       GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns);
+       GetRecPointsData(3)->Fill(c->GetToT()*tot2ns);
+       
+       in[0] = c->GetDetInd(0);
+       in[1] = c->GetDetInd(1);
+       in[2] = c->GetDetInd(2);
+       in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
+       in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
+       
+       GetMapIndeces(in,out);
+       GetRecPointsData(4)->Fill(out[0],out[1]);
+       
+    }
 }
 
 //____________________________________________________________________________
@@ -362,7 +435,6 @@ void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
   //
   // make QA data from ESDs
   //  
-  
   Int_t ntrk = esd->GetNumberOfTracks() ; 
   Int_t ntof=0;
   Int_t ntofpid=0;
@@ -390,10 +462,8 @@ void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
     GetESDsData(0)->Fill(TMath::Log10(nentries)) ;
   }
 
-  if(ntof>0) {
-    Float_t ratio = (Float_t)ntofpid/(Float_t)ntof*100.;
-    GetESDsData(4)->Fill(ratio) ;
-  }
+  if(ntof>0)GetESDsData(4)->Fill(ntofpid/ntof) ;
+
 }
 
 //____________________________________________________________________________ 
@@ -402,6 +472,9 @@ void AliTOFQADataMakerRec::StartOfDetectorCycle()
   //
   //Detector specific actions at start of cycle
   //to be implemented  
+
+  fCalibData = GetCalibData();
+
 }
 
 //____________________________________________________________________________ 
@@ -409,6 +482,7 @@ void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArr
 {
   //Detector specific actions at end of cycle
   // do the QA checking
+
   AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
 }
 //____________________________________________________________________________
@@ -448,7 +522,7 @@ void AliTOFQADataMakerRec::GetMapIndeces(Int_t* in , Int_t* out)
     stripOffset = nStripC+nStripB+nStripA+nStripB;
     break;
   default:
-    AliError(Form("Wrong plate number in TOF (%d) !",iplate));
+    AliDebug(1,Form("Wrong plate number in TOF (%d) !",iplate));
     break;
   };
   Int_t zindex=npadZ*(istrip+stripOffset)+(ipadZ+1);
@@ -457,3 +531,30 @@ void AliTOFQADataMakerRec::GetMapIndeces(Int_t* in , Int_t* out)
   out[1]=phiindex;  
   
 }
+//---------------------------------------------------------------
+Bool_t  AliTOFQADataMakerRec::CheckVolumeID(Int_t *volumeID)
+{
+   
+    for (Int_t j=0;j<5;j++){
+       if (volumeID[j]<0) {
+           AliDebug(1,Form("Invalid detector volume index for volumeID[%i]",j));
+           return kFALSE;
+       }
+    }
+    return kTRUE;
+    
+}
+
+//---------------------------------------------------------------
+Bool_t  AliTOFQADataMakerRec::CheckEquipID(Int_t *equipmentID)
+{
+   for (Int_t j=0;j<5;j++){
+       if (equipmentID[j]<0) {
+         if (j==0)equipmentID[j]=-1;
+         AliDebug(1,Form("Invalid equipment volume index for equipmentID[%i]",j));
+         return kFALSE;
+       }
+   }
+   return kTRUE;
+}
+
index 66c5784eb62eb9ca5e15e385a98bcbbc00baa8ed..1647837b35d8be2f250576a86c959fb31e1b5a26 100644 (file)
@@ -8,34 +8,48 @@
 //  Produces the data needed to calculate the quality assurance.  //
 //    All data must be mergeable objects.                         //
 //    S. Arcelli                                                  //
-//                                                                // 
+//                                                                //
+//    /* last modified by F. Bellini on 25/02/2010 */             // 
 ////////////////////////////////////////////////////////////////////
 
 
 #include "AliQADataMakerRec.h"
+#include "AliQAv1.h"
+#include "AliTOFChannelOnlineStatusArray.h"
+
+class AliCDBManager;
+class AliCDBEntry;
+class AliCDBStorage;
+class AliTOFChannelOnlineStatusArray;
+
 class AliTOFQADataMakerRec: public AliQADataMakerRec {
 
 public:
   AliTOFQADataMakerRec() ;          // ctor
   AliTOFQADataMakerRec(const AliTOFQADataMakerRec& qadm) ;   
   AliTOFQADataMakerRec& operator = (const AliTOFQADataMakerRec& qadm) ;
+  AliTOFChannelOnlineStatusArray *GetCalibData() const;
   virtual ~AliTOFQADataMakerRec() {;} // dtor
   
+protected: 
+  AliTOFChannelOnlineStatusArray * fCalibData;        //! calibration data
+
 private:
   virtual void   InitESDs() ; 
   virtual void   InitRecPoints() ; 
-  virtual void   InitDigits() ; 
   virtual void   InitRaws() ; 
   virtual void   MakeESDs(AliESDEvent * esd) ;
   virtual void   MakeRecPoints(TTree * recTree) ; 
-  virtual void   MakeDigits(TTree * recTree) ; 
-  virtual void   MakeDigits() ;
   virtual void   MakeRaws(AliRawReader* rawReader) ; 
   virtual void   StartOfDetectorCycle() ; 
   virtual void   EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) ;
   virtual void   GetMapIndeces(Int_t *in, Int_t *out) ; 
+  virtual void   EnableNoiseFiltering(Bool_t enable){fEnableNoiseFiltering = enable;};
+  Bool_t   CheckVolumeID(Int_t *equipmentID); 
+  Bool_t   CheckEquipID(Int_t *equipmentID); 
 
-  ClassDef(AliTOFQADataMakerRec,1)  // description 
+  Bool_t fEnableNoiseFiltering; //the choice is not implemented so far
+  ClassDef(AliTOFQADataMakerRec,2)  // description 
 
 };