Fix for Bug: 58726 including a new QA histogram for ACORDE ESDs (Multiplicity of...
authormrodrigu <mrodrigu@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 14 Nov 2009 23:29:29 +0000 (23:29 +0000)
committermrodrigu <mrodrigu@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 14 Nov 2009 23:29:29 +0000 (23:29 +0000)
ACORDE/AliACORDEQAChecker.cxx
ACORDE/AliACORDEQAChecker.h
ACORDE/AliACORDEQADataMakerRec.cxx

index 2c13bc5..36b3cfb 100755 (executable)
@@ -19,6 +19,7 @@
 //     Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP) 
 //     Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
 //     Arturo Fernandez <afernan@mail.cern.ch> (FCFM-BUAP)
+//  Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP) 
 //...
 
 // --- ROOT system ---
 
 ClassImp(AliACORDEQAChecker)
 
-//__________________________________________________________________
+//____________________________________________________________________________
+Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
+{
+  Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; 
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+    rv[specie] = 0.0 ; 
+  return rv ;  
+}
+//____________________________________________________________________________
 Double_t * AliACORDEQAChecker::Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list, AliDetectorRecoParam * /*recoParam*/)
 {
 
-       Double_t * test = new Double_t[AliRecoParam::kNSpecies] ; 
-       Int_t * count   = new Int_t[AliRecoParam::kNSpecies] ; 
-       Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies];
-
-       // Look at the QAref data for ACORDE
+// Close version to the final one for the ACORDE QA Checker
 
-       char * acoOCDBDir = Form("ACORDE/%s/%s",AliQAv1::GetRefOCDBDirName(),AliQAv1::GetRefDataDirName());
-       AliCDBEntry *acoQARefDir = AliQAManager::QAManager()->Get(acoOCDBDir);
-
-       // Check variables set to 0
-
-       for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
-       {
-               test[specie] = 0.0 ; 
-               count[specie] = 0 ; 
-               acoTest[specie] = 0.0;
-       }
+  Double_t * test = new Double_t[AliRecoParam::kNSpecies]  ; 
+  Double_t * acoTest = new Double_t[AliRecoParam::kNSpecies] ;
   
-       for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+// Loop over the run species (for specie!= cosmic by now we set QA to INFO) 
+  
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+  {
+       if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ; 
+       if (list[specie]->GetEntries() == 0) acoTest[specie] = 1.; // Nothing to check
+       else 
        {
-               if (list[specie]->GetEntries() == 0)
-               {  
-                       test[specie] = 1. ; // nothing to check
-                       acoTest[specie] = 1.;
-               }
-               else 
+               TIter next(list[specie]) ; 
+               TH1 * hdata ; // Data created by the AliACORDEQADataMakerXXX (Sim/Rec)
+               while ( (hdata = dynamic_cast<TH1 *>(next())) ) 
                {
-                       TIter next(list[specie]) ; 
-                       TH1 * hdata ;
-                       while ( (hdata = dynamic_cast<TH1 *>(next())) ) 
-                       {
-                               if (hdata) 
-                               { 
-                                       Double_t rv = 0.0 ; 
-                                       if(hdata->GetEntries()>0) rv=1; 
-                                       AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; 
-                                       count[specie]++ ; 
-                                       test[specie] += rv ; 
-                                       Double_t acoHitsNorm;
-                                       if (hdata->GetMaximum()==1) acoHitsNorm = 1;
-                                       else acoHitsNorm = (hdata->GetMaximum() - 0.50)/hdata->GetMaximum();
-                                       // here we implement the second version for ACORDEQAChecker
-                                       // by the moment we only compare the Mean between the QA histograms and the Reference data 
-                                       if  (acoQARefDir)
-                                       {
-                                               //AliWarning("Using the QA Reference data for ACORDE !!!");
-                                               Double_t acoHistChecked = CheckAcordeRefHits(list[specie],(TObjArray *)acoQARefDir->GetObject());
-                                               if ( (acoHistChecked>0.75) && (acoHistChecked<=1) ) acoTest[specie] = 0.86;
-                                               if ( (acoHistChecked>0.0020) && (acoHistChecked<=0.75) ) acoTest[specie] = 0.251;
-                                               if ( (acoHistChecked>0.0) && (acoHistChecked<=0.0020) ) acoTest[specie] = 0.0010;
-                                               if ( (acoHistChecked>-1.0) && (acoHistChecked<=0.0) ) acoTest[specie] = -0.5;
-       
-                                       }else
-                                       {
-                                               //AliWarning("Using the inner ACORDE QA Checker !!!");
-                                               if ( (acoHitsNorm>0.40) && (acoHitsNorm<=1) ) acoTest[specie] = 0.86;
-                                               if ( (acoHitsNorm>0.0020) && (acoHitsNorm<=0.40) ) acoTest[specie] = 0.251;
-                                               if ( (acoHitsNorm>0.0) && (acoHitsNorm<=0.0020) ) acoTest[specie] = 0.0010;
-                                               if ( (acoHitsNorm>-1.0) && (acoHitsNorm<=0.0) ) acoTest[specie] = -0.5;
-                                       }
-                               }
-                               else
-                               {
-                                       AliError("Data type cannot be processed") ;
-                               }
-                       }
-                       if (count[specie] != 0) 
+                       if (hdata) 
                        { 
-                               if (test[specie]==0) 
+                               Double_t rv = 0.0 ; 
+                               if(hdata->GetEntries()>0) rv=1; 
+                               AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv)) ; 
+                               TString hdataName = hdata->GetName();
+                               
+                               // Here we use the QAref ACORDE data from fRefOCDBSubDir
+                               
+                               if ( (fRefOCDBSubDir[specie]) && (hdataName.Contains("ACORDEBitPattern")) ) 
                                {
-                                       test[specie] = 0.5;  //upper limit value to set kWARNING flag for a task
-                               }
-                               else 
+                                       TH1 * href = NULL;
+                                       if (fRefSubDir) href = static_cast<TH1*>(fRefSubDir->Get(hdata->GetName()));
+                                       else if (fRefOCDBSubDir[specie]) href = static_cast<TH1*>(fRefOCDBSubDir[specie]->FindObject(hdata->GetName()));
+                                       acoTest[specie] = CheckAcordeRefHits(href,hdata);
+                               }else if (hdataName.Contains("ACORDEBitPattern"))
+                               // Here we use an inner QA Checher without the QAref data
                                {
-                                       if (acoQARefDir) test[specie] = acoTest[specie];
-                                       else
+                                       Float_t acoDataMax = hdata->GetMaximum();
+                                       Int_t flagAcoQA = 0;
+                                       for(Int_t i=0;i<60;i++)
                                        {
-                                               test[specie] = acoTest[specie];
+                                               if ((hdata->GetBinContent(i)/acoDataMax) < 0.75) flagAcoQA++; 
                                        }
-                               }
-                       }
-               }
-       }
+                                       Double_t simpleFlag = 1.-flagAcoQA/60.;
+                                       if ( (simpleFlag >= 0.90) && (simpleFlag <= 1.0) ) acoTest[specie] = 0.75; // INFO
+                                       if ( (simpleFlag >= 0.70) && (simpleFlag < 0.90) ) acoTest[specie] = 0.50; // WARNING
+                                       if ( (simpleFlag >= 0.25) && (simpleFlag < 0.70) ) acoTest[specie] = 0.25; // ERROR
+                                       if ( (simpleFlag >= 0.0) && (simpleFlag < 0.25) )  acoTest[specie] = -1.0; // FATAL
+                               }       
+                               // Setting Warning message for possible Empty Events with the ACORDE-Trigger
+                                       
+                               if (hdataName.Contains("ACORDEMultiplicity") && (hdata->GetBinContent(0)!=0)) AliWarning("Empty event registered with ACORDE Trigger !!!");
+                                       
+                               
+                       }else AliError("Data type cannot be processed") ;
+                               
+               }
+       }
+       if ( (specie == AliRecoParam::kHighMult) || (specie == AliRecoParam::kLowMult) || (specie == AliRecoParam::kCalib) ) acoTest[specie] = 0.75;
+       test[specie] = acoTest[specie]; // Assign of the acoTest to the test for final QAChecker value  
+  }
        return test ; 
 }
-Double_t AliACORDEQAChecker::CheckAcordeRefHits(TObjArray *HistAcordeList, TObjArray *AcordeRef) const
+//____________________________________________________________________________
+Double_t AliACORDEQAChecker::CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const
 {
-       Double_t acordeTest = 0;
-       TIter next(AcordeRef);
-       TIter next1(HistAcordeList);
-       TH1 *histoAcordeRef;
-       TH1 *histoAcorde;
-       Float_t acordeHistoQAMaker=0;
-       Float_t meanACOQAReference=0;
-       Float_t meanACOQAMaker=0;
-       Float_t test1ACORDE = 0;
-       while((histoAcordeRef=(TH1*)next()) && (histoAcorde=(TH1*)next1())) 
+       Double_t acoTest = 0.;
+       Int_t flag=0;
+       for (Int_t i=0;i<60;i++)
        {
-               for(Int_t i=0;i<60;i++) acordeHistoQAMaker=acordeHistoQAMaker + histoAcorde->GetBinContent(i)/histoAcorde->GetMaximum();
-               meanACOQAReference = histoAcordeRef->GetMean();
-               meanACOQAMaker = acordeHistoQAMaker/60;
-               test1ACORDE = TMath::Abs(meanACOQAReference-meanACOQAMaker);
-               if (test1ACORDE<0.45) acordeTest = 0.86;
-               if (test1ACORDE > 0.45) acordeTest = 0.50;
-               if (test1ACORDE > 0.70) acordeTest = 0.25;
+               if (TMath::Abs(href->GetBinContent(i)-hdata->GetBinContent(i))) flag++;
+               flag++;
        }
-       return acordeTest;
+       if ((flag/60>50)&&(flag/60<=60)) acoTest = -1.;
+       if ((flag/60>30)&&(flag/60<=50)) acoTest = 0.25;
+       if ((flag/60>10)&&(flag/60<=30)) acoTest = 0.5;
+       if ((flag/60>0)&&(flag/60<=10)) acoTest = 0.75;
+       return acoTest;
 }
index 51fa684..c0d05d0 100755 (executable)
@@ -5,12 +5,14 @@
 
 //
 //  Checks the quality assurance for ACORDE. 
-//  Default implementation
+//  Default implementation from Yves skeleton
 //
 //  Authors:
 //      Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch> (FCFM-BUAP)
 //      Luciano Diaz Gonzalez <luciano.diaz@nucleares.unam.mx> (ICN-UNAM)
 //      Arturo Fernandez <afernan@mail.cern.ch> (FCFM-BUAP)
+//  Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP) 
+//...
 
 
 // --- ROOT system ---
@@ -27,12 +29,11 @@ class AliACORDEQAChecker: public AliQACheckerBase {
 
 public:
   AliACORDEQAChecker() : AliQACheckerBase("ACORDE","ACORDE Quality Assurance Data Checker") {;}          // constructor
-//  AliACORDEQAChecker(const AliACORDEQAChecker& qac) : AliQACheckerBase(qac.GetName(), qac.GetTitle()) {;} // constructor   
   virtual ~AliACORDEQAChecker() {;} // destructor
+  virtual Double_t * Check(AliQAv1::ALITASK_t /*index*/) ;
+  virtual Double_t * Check(AliQAv1::ALITASK_t /*index*/, TObjArray ** list, AliDetectorRecoParam */* recoParam*/) ;
 
-  virtual Double_t * Check(AliQAv1::ALITASK_t index, TObjArray ** list, AliDetectorRecoParam * recoParam) ;
-
-  Double_t CheckAcordeRefHits(TObjArray *AcordeList, TObjArray *AcordeRef) const;
+  Double_t CheckAcordeRefHits(const TH1 * href, const TH1 * hdata) const;
 
 private:
 
index c82d020..18e12de 100755 (executable)
@@ -26,6 +26,9 @@
 //  Created: June 13th 2008\r
 //---\r
 // Last Update: Aug. 27th 2008 --> Implementation to declare QA expert histogram\r
+//  Last update: Nov. 14t 2009 --> MRC <mrodrigu@mail.cern.ch> (FCFM-BUAP) \r
+//                     |--> Change in Multiplicity histogram for AMORE (to detect empty triggers events of ACORDE)\r
+\r
 \r
 \r
 // --- ROOT system ---\r
@@ -99,8 +102,8 @@ void AliACORDEQADataMakerRec::InitRaws()
   TH1F *fhACORDEBitPattern[4];\r
   fhACORDEBitPattern[0] = new TH1F("ACORDEBitPatternfromRAWSingle","Distribution of ACORDE fired modules from RAW-Single;Modules;Counts",60,1,60);//AcordeSingleMuon BitPattern\r
   fhACORDEBitPattern[1] = new TH1F("ACORDEBitPatternfromRAWMulti","Distribution of ACORDE fired modules from RAW-Multi;Modules;Counts",60,1,60);//AcordeMultiMuon BitPattern\r
-  fhACORDEBitPattern[2] = new TH1F("ACORDEMultiplicityfromRAWSingle","Number of fired ACORDE modules;No. of fired ACORDE modules;No. of events in ACORDE",60,1,60);//AcordeSingleMuon Multiplicity\r
-  fhACORDEBitPattern[3] = new TH1F("ACORDEMultiplicityfromRAWMulti","Number of fired ACORDE modules; No. of fired ACORDE modules;No. of events in ACORDE",60,1,60);//AcordeMultiMuon Multiplicity\r
+  fhACORDEBitPattern[2] = new TH1F("ACORDEMultiplicityfromRAWSingle","Number of fired ACORDE modules;No. of fired ACORDE modules;No. of events in ACORDE",60,-0.5,60);//AcordeSingleMuon Multiplicity\r
+  fhACORDEBitPattern[3] = new TH1F("ACORDEMultiplicityfromRAWMulti","Number of fired ACORDE modules; No. of fired ACORDE modules;No. of events in ACORDE",60,-0.5,60);//AcordeMultiMuon Multiplicity\r
   for(Int_t i=0;i<4;i++) \r
     Add2RawsList(fhACORDEBitPattern[i],i,!expert, image, !saveCorr);\r
   \r
@@ -150,6 +153,7 @@ void AliACORDEQADataMakerRec::InitESDs()
   \r
   TH1F *    fhESDsSingle;\r
   TH1F *    fhESDsMulti;\r
+  TH1F *       fhESDsMultiplicity;\r
    char *acoModule[60]={"0_0","0_1","0_2","0_3","0_4","0_5","0_6","0_7","0_8","0_9",\r
                         "1_0","1_1","1_2","1_3","1_4","1_5","1_6","1_7","1_8","1_9",\r
                         "2_0","2_1","2_2","2_3","2_4","2_5","2_6","2_7","2_8","2_9",\r
@@ -163,7 +167,9 @@ void AliACORDEQADataMakerRec::InitESDs()
 \r
    fhESDsMulti = new TH1F("ACORDEBitPatternfromESDsMulti","Distribution of ACORDE fired modules from ESDs-Multi;Modules;Counts",60,1,60);\r
    Add2ESDsList(fhESDsMulti,1,!expert,image);\r
-       \r
+   \r
+   fhESDsMultiplicity = new TH1F("ACORDEMultiplicityfromESD","Number of fired ACORDE modules; No. of fired ACORDE modules;No. of events in ACORDE",60,-0.5,60);\r
+   Add2ESDsList(fhESDsMultiplicity,2,!expert,image);   \r
    for (Int_t i=0;i<60;i++)\r
    {\r
        fhESDsSingle->GetXaxis()->SetBinLabel(i+1,acoModule[i]);\r
@@ -222,16 +228,16 @@ if(rawStream.Next())
        contMulti=0;\r
         for(Int_t r=0;r<60;r++)\r
         {\r
-                if(kroSingle[r]==1)\r
-                {\r
-                        GetRawsData(0)->Fill(r+1);\r
-                        contSingle++;\r
-                }\r
-               if(kroMulti[r]==1)\r
-               {\r
-                       GetRawsData(1)->Fill(r+1);\r
-                       contMulti++;\r
-               }\r
+                       if(kroSingle[r]==1)\r
+                       {\r
+                               GetRawsData(0)->Fill(r+1);\r
+                               contSingle=contSingle+1;\r
+                       }\r
+                       if(kroMulti[r]==1)\r
+                       {\r
+                               GetRawsData(1)->Fill(r+1);\r
+                               contMulti++;\r
+                       }\r
 \r
         }GetRawsData(2)->Fill(contSingle);GetRawsData(3)->Fill(contMulti);\r
 }\r
@@ -269,14 +275,15 @@ void AliACORDEQADataMakerRec::MakeESDs(AliESDEvent * esd)
   //fills QA histos for ESD\r
 \r
   AliESDACORDE * fESDACORDE= esd->GetACORDEData();\r
-       \r
+  Int_t acoMulti=0;\r
   for(int i=0;i<60;i++)\r
   {\r
        if(fESDACORDE->GetHitChannel(i)) \r
        {\r
-               GetESDsData(0)->Fill(i);\r
-               GetESDsData(1)->Fill(i);\r
+               GetESDsData(0)->Fill(i+1);\r
+               GetESDsData(1)->Fill(i+1);\r
+               acoMulti++;\r
        }\r
-  }\r
+  }GetESDsData(2)->Fill(acoMulti);\r
 \r
 }\r