from Francesco Blanco (based on code from Grenoble): QA update - adding L1 checks...
authordsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Feb 2012 08:24:43 +0000 (08:24 +0000)
committerdsilverm <dsilverm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Feb 2012 08:24:43 +0000 (08:24 +0000)
EMCAL/AliEMCALQAChecker.cxx
EMCAL/AliEMCALQAChecker.h
EMCAL/AliEMCALQADataMakerRec.cxx

index ad93586..79f7cfb 100644 (file)
@@ -82,6 +82,10 @@ fText(new TPaveText(0.2,0.7,0.8,0.9,"NDC"))
                fLineRow[i]->SetLineWidth(2);
        }
 
+       for(int i = 0; i < 3; i++) {
+               fTextL1[i] = new TPaveText(0.2,0.7,0.8,0.9,"NDC");
+       }
+
 
 }          
 
@@ -154,97 +158,202 @@ void AliEMCALQAChecker::CheckRaws(Double_t * test, TObjArray ** list)
   //adding new checking method: 25/04/2010, Yaxian Mao
   //Comparing the amplitude from current run to the reference run, if the ratio in the range [0.8, .12], count as a good tower.
   //If more than 90% towers are good, EMCAL works fine, otherwise experts should be contacted. 
-  
                                
-  //Float_t kThreshold = 80. ; 
   Int_t nTowersPerSM = 24*48; // number of towers in a SuperModule; 24x48
   Double_t nTot = fgknSM * nTowersPerSM ;
   TList *lstF = 0;
   for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
     test[specie] = 0.0 ; 
-    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) 
-      continue ; 
-    if (list[specie]->GetEntries() == 0)  
-      test[specie] = 0. ; // nothing to check
+    if ( !AliQAv1::Instance()->IsEventSpecieSet(specie)) continue ; 
+    if (list[specie]->GetEntries() == 0) test[specie] = 0. ; // nothing to check
     else {
-      TH2F * hdata  = (TH2F*)list[specie]->At(k2DRatioAmp) ; 
-      TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ;
-      if(hdata->GetEntries()==0 || ratio->GetEntries()==0)
-        continue;
-      //adding the lines to distinguish different SMs
-      lstF = hdata->GetListOfFunctions();
-      { // RS: clean list of functions
-       if (lstF) {
-         TObject *stats = lstF->FindObject("stats"); lstF->Remove(stats);
-         TObject *obj;
-         while ((obj = lstF->First())) { while(lstF->Remove(obj)) { } delete obj; }
-         if (stats) lstF->Add(stats);
-       }
-       else {
-         AliWarning(Form("Checker : empty list of data functions; returning"));
-         return;
-       }
-      }
-      lstF->Add(fLineCol->Clone()); 
-      for(Int_t iLine = 0; iLine < 4; iLine++) {
-       lstF->Add(fLineRow[iLine]->Clone());
-      } 
-      //Now adding the text to for each SM
-      for(Int_t iSM = 0 ; iSM < fgknSM ; iSM++){  //number of SMs loop start
-       lstF->Add(fTextSM[iSM]->Clone()); 
-      }
-      //
-      lstF = ratio->GetListOfFunctions();
-      { // RS: clean list of functions
-       if (lstF) {
-         TObject *stats = lstF->FindObject("stats"); lstF->Remove(stats);
-         TObject *obj;
-         while ((obj = lstF->First())) { while(lstF->Remove(obj)) { } delete obj; }
-         if (stats) lstF->Add(stats);
-       }
-       else {
-         AliWarning(Form("Checker : empty list of ratio functions; returning"));
-         return;
-       } 
-      }
-      //
-      //now check the ratio histogram
-      Double_t binContent = 0. ;  
-      Int_t NGoodTower = 0 ;
-      Double_t rv = 0. ;
-      for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) {
-        for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) {
-          binContent = hdata->GetBinContent(ix, iy) ; 
-          if (binContent < 1.2 && binContent > 0.8) 
-            NGoodTower++ ;
-        }
-      }
-      rv = NGoodTower/nTot ; 
-      printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100);
-      if(fText){
-       lstF->Add(fText->Clone()) ;
-        fText->Clear() ; 
+                       //get calib histos
+                       TH2F * hdata  = (TH2F*)list[specie]->At(k2DRatioAmp) ; 
+                       TH1F * ratio = (TH1F*)list[specie]->At(kRatioDist) ;
+                       
+                       //get L1 histos
+                       TH2F *hL1GammaPatch = (TH2F*)list[specie]->At(kGL1);
+                       TH2F *hL1JetPatch = (TH2F*)list[specie]->At(kJL1);
+                       TH1I *hFrameR = (TH1I*)list[specie]->At(kSTUTRU);
+
+                       //calib histo checker first:
+
+      if(hdata->GetEntries()!=0 && ratio->GetEntries()!=0) {
+                               //adding the lines to distinguish different SMs
+                               lstF = hdata->GetListOfFunctions();
+                               CleanListOfFunctions(lstF);
+                               lstF->Add(fLineCol->Clone()); 
+                               for(Int_t iLine = 0; iLine < 4; iLine++) {
+                                       lstF->Add(fLineRow[iLine]->Clone());
+                               } 
+                               //Now adding the text to for each SM
+                               for(Int_t iSM = 0 ; iSM < fgknSM ; iSM++){  //number of SMs loop start
+                                       lstF->Add(fTextSM[iSM]->Clone()); 
+                               }
+                               //
+                               lstF = ratio->GetListOfFunctions();
+                               CleanListOfFunctions(lstF);
+                               //
+                               //now check the ratio histogram
+                               Double_t binContent = 0. ;  
+                               Int_t NGoodTower = 0 ;
+                               Double_t rv = 0. ;
+                               for(Int_t ix = 1; ix <= hdata->GetNbinsX(); ix++) {
+                                       for(Int_t iy = 1; iy <= hdata->GetNbinsY(); iy++) {
+                                               binContent = hdata->GetBinContent(ix, iy) ; 
+                                               if (binContent < 1.2 && binContent > 0.8) NGoodTower++ ;
+                                       }
+                               }
+                               rv = NGoodTower/nTot ; 
+                               printf("%2.2f %% towers out of range [0.8, 1.2]\n", (1-rv)*100);
+                               if(fText){
+                                       lstF->Add(fText->Clone()) ;
+                                       fText->Clear() ; 
         
-        fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100));     
-        if (rv < 0.9) {
-          test[specie] = 0.9 ;
-          // 2 lines text info for quality         
-          fText->SetFillColor(2) ;
-          fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!")); 
-        }
-        else {
-          test[specie] = 0.1 ;
-          fText->SetFillColor(3) ;
-          fText->AddText(Form("EMCAL = OK, ENJOY...")); 
-        }
-        //hdata->Reset("ICE");
-        //ratio->Reset("ICE");
-      }//fText
-    } 
-  } //finish the checking
-}
+                                       fText->AddText(Form("%2.2f %% towers out of range [0.8, 1.2]", (1-rv)*100));     
+                                       if (rv < 0.9) {
+                                               test[specie] = 0.9 ;
+                                               // 2 lines text info for quality         
+                                               fText->SetFillColor(2) ;
+                                               fText->AddText(Form("EMCAL = NOK, CALL EXPERTS!!!")); 
+                                       }
+                                       else {
+                                               test[specie] = 0.1 ;
+                                               fText->SetFillColor(3) ;
+                                               fText->AddText(Form("EMCAL = OK, ENJOY...")); 
+                                       }
+                               }//fText
+                       } // calib histo checking done
+
+                       //now L1 checks:
+                       if(hL1GammaPatch->GetEntries() !=0) {
+                               lstF = hL1GammaPatch->GetListOfFunctions();
+                               CleanListOfFunctions(lstF);
+
+
+                               //Checker for L1GammaPatch (if a patch triggers > sigmaG * mean value (1/#patch positions total) says "hot spot !")
+                               Double_t L1GmeanTrig = 1/2961.; 
+                               Int_t sigmaG = 5; // deviation from mean value
+                               Double_t L1GEntries = hL1GammaPatch->GetEntries();
+                               Int_t BadL1G[48][64] = {{0}} ;
+                               Int_t NBadL1G = 0;
+                               for(Int_t ix = 1; ix <=  hL1GammaPatch->GetNbinsX(); ix++) {
+                                       for(Int_t iy = 1; iy <=  hL1GammaPatch->GetNbinsY(); iy++) {
+                                               Double_t binContent = hL1GammaPatch->GetBinContent(ix, iy) ; 
+                                               if (binContent != 0) {
+                                                       if ((double)binContent/(double)L1GEntries > sigmaG*L1GmeanTrig) {
+                                                               BadL1G[ix-1][iy-1] += 1;
+                                                               NBadL1G += 1;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if(fTextL1[0]){
+                                       lstF->Add(fTextL1[0]->Clone()) ;
+                                       fTextL1[0]->Clear() ; 
+
+                                       if (NBadL1G == 0) {
+                                               fTextL1[0]->SetFillColor(3) ;
+                                               fTextL1[0]->AddText(Form("L1 GAMMA TRIGGER = OK, ENJOY...")); 
+                                       }
+                                       else {
+                                               fTextL1[0]->SetFillColor(2) ;
+                                               fTextL1[0]->AddText(Form("HOT SPOT IN L1 GAMMA TRIGGER = CALL EXPERT!!"));
+/*
+                                               for(Int_t ix = 1; ix <=  hL1GammaPatch->GetNbinsX(); ix++) {
+                                                       for(Int_t iy = 1; iy <=  hL1GammaPatch->GetNbinsY(); iy++) {
+                                                               if(BadL1G[ix-1][iy-1] != 0) printf("L1 Gamma patch with position x = %d, y = %d is out of range\n",ix,iy);
+                                                       }
+                                               }
+*/
+                                       }
+                               }//fTextL1[0]
+                       }// L1 gamma patch checking done
+
+                       if(hL1JetPatch->GetEntries() !=0) {
+                               lstF = hL1JetPatch->GetListOfFunctions();
+                               CleanListOfFunctions(lstF);
+                       
+                               //Checker for L1JetPatch (if a patch triggers > sigmaJ * mean value (1/#patch positions total) says "hot spot !")
+                               Double_t L1JmeanTrig = 1/126.;
+                               Int_t sigmaJ = 5; // deviation from  mean value
+                               Double_t L1JEntries = hL1JetPatch->GetEntries();
+                               Int_t BadL1J[12][16] = {{0}} ;
+                               Int_t NBadL1J = 0;
+                               for(Int_t ix = 1; ix <=  hL1JetPatch->GetNbinsX(); ix++) {
+                                       for(Int_t iy = 1; iy <=  hL1JetPatch->GetNbinsY(); iy++) {
+                                               Double_t binContent = hL1JetPatch->GetBinContent(ix, iy) ; 
+                                               if (binContent != 0) {
+                                                       if ((double)binContent/(double)L1JEntries > sigmaJ*L1JmeanTrig) {
+                                                               BadL1J[ix-1][iy-1] += 1 ;
+                                                               NBadL1J += 1;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               if(fTextL1[1]){
+                                       lstF->Add(fTextL1[1]->Clone()) ;
+                                       fTextL1[1]->Clear() ; 
+
+                                       if (NBadL1J == 0) {
+                                               fTextL1[1]->SetFillColor(3) ;
+                                               fTextL1[1]->AddText(Form("L1 JET TRIGGER = OK, ENJOY...")); 
+                                       }
+                                       else {
+                                               fTextL1[1]->SetFillColor(2) ;
+                                               fTextL1[1]->AddText(Form("HOT SPOT IN L1 JET TRIGGER = CALL EXPERT!!")); 
+/*
+                                               for(Int_t ix = 1; ix <=  hL1JetPatch->GetNbinsX(); ix++) {
+                                                       for(Int_t iy = 1; iy <=  hL1JetPatch->GetNbinsY(); iy++) {
+                                                               if(BadL1J[ix-1][iy-1] != 0) printf("L1 Jet patch with position x = %d, y = %d is out of range\n",(4*ix-4),(4*iy-4));
+                                                       }
+                                               }
+*/
+
+                                       }
+                               }//fTextL1[1]
+                       } // L1 Jet patch checking done
+
+                       if(hFrameR->GetEntries() !=0) {
+                               lstF = hFrameR->GetListOfFunctions();
+                               CleanListOfFunctions(lstF);
+
+                               Int_t BadLink[32] = {0};
+                               Int_t NBadLink = 0;
+                               for(Int_t ix = 0; ix <= hFrameR->GetNbinsX(); ix++) {
+                                       Double_t binContent = hFrameR->GetBinContent(ix) ; 
+                                       if (binContent == 0) {
+                                               BadLink[ix] += 1;
+                                               NBadLink += 1;
+                                       }
+                               }
+                               if(fTextL1[2]){
+                                       lstF->Add(fTextL1[2]->Clone()) ;
+                                       fTextL1[2]->Clear() ; 
+       
+                               if (NBadLink == 0) {
+                                               fTextL1[2]->SetFillColor(3) ;
+                                               fTextL1[2]->AddText(Form("LINK TRU-STU = OK, ENJOY...")); 
+                                       }
+                                       else {
+                                               fTextL1[2]->SetFillColor(2) ;
+                                               fTextL1[2]->AddText(Form("PROBLEM WITH TRU-STU LINK = CALL EXPERT!!"));
+/*
+                                               for(Int_t ix = 0; ix <= hFrameR->GetNbinsX(); ix++) {
+                                                       if(BadLink[ix] != 0) printf("STU link with TRU %d is out\n",ix);
+                                               }
+*/
+                                       }   
+                               }//fTextL1[2]
+                       } // Checker for link TRU-STU done
+               }       
 
+       }
+}
 //______________________________________________________________________________
+
 void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det) 
 {
        /// intialises QA and QA checker settings
@@ -262,3 +371,22 @@ void AliEMCALQAChecker::Init(const AliQAv1::DETECTORINDEX_t det)
        SetHiLo(&hiValue[0], &lowValue[0]) ; 
 }
 
+//______________________________________________________________________________
+
+void AliEMCALQAChecker::CleanListOfFunctions(TList *list)
+{
+
+       if (list) {
+               TObject *stats = list->FindObject("stats"); list->Remove(stats);
+               TObject *obj;
+               while ((obj = list->First())) { while(list->Remove(obj)) { } delete obj; }
+                       if (stats) list->Add(stats);
+               }
+       else {
+               AliWarning(Form("Checker : empty list of data functions; returning"));
+               return;
+       }
+
+}
+
+
index b9ff843..7b37e06 100644 (file)
@@ -41,14 +41,17 @@ public:
     kPedLG,kPedHG,
     k2DRatioAmp,kRatioDist, kLEDMonRatio, kLEDMonRatioDist,
     // then TRU info
-    kNsmodTRU,kTimeTRU,
+    kNsmodTRU,
     kSigTRU,kNtotTRU,
-    kPedTRU,
     kNL0TRU, kTimeL0TRU,
+               kNL0FirstTRU, kTimeL0FirstTRU,
     // and also LED Mon info
     kNsmodLGLEDMon,kNsmodHGLEDMon,kTimeLGLEDMon,kTimeHGLEDMon,
     kSigLGLEDMon,kSigHGLEDMon,kNtotLGLEDMon,kNtotHGLEDMon,
-    kPedLGLEDMon,kPedHGLEDMon
+    kPedLGLEDMon,kPedHGLEDMon,
+               //and STU info
+               kAmpL1, kGL1, kJL1,
+               kGL1V0, kJL1V0, kSTUTRU  
   } ;
        //Histograms for RecPoints  control
        enum HRPType_t {kRecPE,kRecPM,kRecPDigM};
@@ -69,6 +72,7 @@ protected:
   void CheckRaws(Double_t* test, TObjArray ** list);
   void CheckRecPoints(Double_t* /*test*/, TObjArray** /*list*/) const {;}
   void CheckESD(Double_t* /*test*/, TObjArray** /*list*/) const {;}
+       void CleanListOfFunctions(TList *list);
   TH1* GetHisto(TObjArray* list, const char* hname, Int_t specie) const;
   Double_t MarkHisto(TH1& histo, Double_t value) const;
        
@@ -86,6 +90,7 @@ private:
   TLine *     fLineCol       ; //! line to distinguish the different SM side: A side and C side
   TLine *     fLineRow[5]       ; //! line to distinguish the different SM sectors (0-5) 
   TPaveText * fText          ;  //! Information text for the quality of each SM
+       TPaveText * fTextL1[3];       //! Information text for the quality of L1 plots (3 plots in total)
   ClassDef(AliEMCALQAChecker,4)  // description 
 
 };
index b1792f6..0657235 100644 (file)
@@ -397,12 +397,12 @@ void AliEMCALQADataMakerRec::InitRaws()
   TH2I * hT3 = new TH2I("hTRUEmcalL0hits", "L0 trigger hits: Total number of 2x2 L0 generated",  nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5);
   hT3->SetOption("COLZ");
   //hT3->Sumw2();
-  Add2RawsList(hT3, kNL0TRU, !expert, image, !saveCorr);
+  Add2RawsList(hT3, kNL0TRU, expert, image, !saveCorr);
 
   // L0 trigger hits: average time (bins are TRU channels)
   TProfile2D * hT4 = new TProfile2D("hTRUEmcalL0hitsAvgTime", "L0 trigger hits: average time bin", nTRUCols, -0.5, nTRUCols - 0.5, nTRURows, -0.5, nTRURows-0.5, profileOption);
   hT4->SetOption("COLZ");
-  Add2RawsList(hT4, kTimeL0TRU, !expert, image, !saveCorr);
+  Add2RawsList(hT4, kTimeL0TRU, expert, image, !saveCorr);
 
   // L0 trigger hits: first in the event (bins are TRU channels)
   TH1I * hT5 = new TH1I("hTRUEmcalL0hitsFirst", "L0 trigger hits: First hit in the event", nTot2x2, -0.5, nTot2x2);
@@ -474,7 +474,7 @@ void AliEMCALQADataMakerRec::InitRaws()
   h15->GetZaxis()->SetNdivisions(3);
   h15->UseCurrentStyle();
   h15->SetDirectory(0);
-  Add2RawsList(h15, k2DRatioAmp, !expert, image, !saveCorr) ;
+  Add2RawsList(h15, k2DRatioAmp, expert, image, !saveCorr) ;
 
   TH1F * h16 = new TH1F("hRatioDist", "Amplitude_{current run}/Amplitude_{reference run} ratio distribution", nTot, 0., 2.);
   h16->SetMinimum(0.1); 
@@ -495,14 +495,14 @@ void AliEMCALQADataMakerRec::InitRaws()
   hL10->UseCurrentStyle();
   hL10->SetDirectory(0);
 //  hL10->SetOption("E");
-  Add2RawsList(hL10, kLEDMonRatio, !expert, image, !saveCorr) ;
+  Add2RawsList(hL10, kLEDMonRatio, expert, image, !saveCorr) ;
 
   TH1F * hL11 = new TH1F("hMaxMinusMinLEDMonRatioDist", "LEDMon amplitude, Ratio distribution", nTotLEDMon, 0, 2);
   hL11->SetMinimum(0.1) ;
   gStyle->SetOptStat(0);
   hL11->UseCurrentStyle();
   hL11->SetDirectory(0);
-  Add2RawsList(hL11, kLEDMonRatioDist, !expert, image, !saveCorr) ;
+  Add2RawsList(hL11, kLEDMonRatioDist, expert, image, !saveCorr) ;
   
   GetCalibRefFromOCDB();   
 
@@ -519,10 +519,10 @@ void AliEMCALQADataMakerRec::InitRaws()
  Add2RawsList(hS0, kAmpL1, expert, !image, !saveCorr) ;
        
  TH2F *hS1 = new TH2F("hL1Gamma", "L1 Gamma patch position (FastOR top-left)", nSTUCols, -0.50, nSTUCols-0.5, nSTURows, -0.5, nSTURows-0.5);
- Add2RawsList(hS1, kGL1, expert, image, !saveCorr) ;
+ Add2RawsList(hS1, kGL1, !expert, image, !saveCorr) ;
        
  TH2F *hS2 = new TH2F("hL1Jet", "L1 Jet patch position (FastOR top-left)", 12, -0.5, nSTUCols-0.5, 16, 0, nSTURows-0.5);
- Add2RawsList(hS2, kJL1, expert, image, !saveCorr) ;
+ Add2RawsList(hS2, kJL1, !expert, image, !saveCorr) ;
        
  TH2I *hS3 = new TH2I("hL1GV0", "L1 Gamma patch amplitude versus V0 signal", 500, 0, 50000, 1500, 0, 1500);
  Add2RawsList(hS3, kGL1V0, expert, image, !saveCorr) ;
@@ -531,7 +531,7 @@ void AliEMCALQADataMakerRec::InitRaws()
  Add2RawsList(hS4, kJL1V0, expert, !image, !saveCorr) ;
 
  TH1I *hS5 = new TH1I("hFrameR","Link between TRU and STU", 32, 0, 32);
- Add2RawsList(hS5, kSTUTRU, expert, !image, !saveCorr) ;
+ Add2RawsList(hS5, kSTUTRU, !expert, image, !saveCorr) ;
 
  hS0->SetOption("COLZ");
  hS1->SetOption("COLZ");
@@ -1146,11 +1146,11 @@ void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader)
       Int_t sizeL1jpatch = 2+(fw >> 16);
 
       //To check link
-      Int_t mask = inSTU->GetFrameReceived();
+      Int_t mask = inSTU->GetFrameReceived() ^ inSTU->GetRegionEnable();
 
       for (int i = 0; i < 32; i++)
        {
-         if ((mask >> i) & 0x1) FillRawsData(kSTUTRU, i);
+               if (!((mask >> i) &  0x1)) FillRawsData(kSTUTRU, i);
        }
 
       //V0 signal in STU