]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDQADataMakerRec.cxx
Moved a methof from private to public
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMakerRec.cxx
index 8d3b519d6004be01e8d3411b4fd5a66e3e28543e..50a0d19769d4bd5720eded493412b2947c161012 100644 (file)
@@ -21,6 +21,7 @@
 #include <TFile.h> 
 #include <TH1F.h> 
 #include <TH2F.h>
+#include <TProfile.h>
 #include <Riostream.h>
 // --- Standard library ---
 
 
 ClassImp(AliHMPIDQADataMakerRec)
            
-//____________________________________________________________________________ 
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec() : 
-  AliQADataMakerRec(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
+  AliQADataMakerRec(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker"),fEvtRaw(0)
 {
   // ctor
 }
 
-//____________________________________________________________________________ 
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDQADataMakerRec::AliHMPIDQADataMakerRec(const AliHMPIDQADataMakerRec& qadm) :
-  AliQADataMakerRec() 
+  AliQADataMakerRec(),fEvtRaw(qadm.fEvtRaw)
 {
   //copy ctor 
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
 }
 
-//__________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPIDQADataMakerRec& AliHMPIDQADataMakerRec::operator = (const AliHMPIDQADataMakerRec& qadm )
 {
   // Equal operator.
@@ -71,61 +72,83 @@ AliHMPIDQADataMakerRec& AliHMPIDQADataMakerRec::operator = (const AliHMPIDQAData
   return *this;
 }
  
-//____________________________________________________________________________ 
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::InitRecPoints()
 {
   // create cluster histograms in RecPoint subdir
 
-  TH1F *hCluEvt=new TH1F("CluPerEvt","Cluster multiplicity"   ,100,0,100);
-  TH1F *hCluChi2  =new TH1F("CluChi2"  ,"Chi2 "               ,1000,0,100);
-  TH1F *hCluFlg   =new TH1F("CluFlg"   ,"Cluster flag"        ,14,-1.5,12.5);
-  TH1F *hCluSize     =new TH1F("CluSize"  ,"Cluster size        ",100,0,100);
-  TH1F *hCluSizeMip  =new TH1F("CluSizeMip"  ,"Cluster size  (cluster Q > 100 ADC)   ",100,0,100);
-  TH1F *hCluQ     =new TH1F("CluQ"     ,"Cluster charge (ADC)",5000,0,5000);
-  TH1F *hCluQSect[42];
+  Bool_t expert = kTRUE;
+  TProfile *hCluMult          = new TProfile("CluMult"   ,"Cluster multiplicity per chamber"    , 16, -1 , 7  , 0, 500);
+  Add2RecPointsList(hCluMult    , 0,expert);
+  
+  TH2F *hCluFlg          = new TH2F("CluFlg"      ,"Cluster flag  "                              ,  56  ,-1.5, 12.5, 70, -0.5, 6.5);
+  Add2RecPointsList(hCluFlg    , 1,expert);
+  
+  TH1F *hCluSizeMip[7], *hCluSizePho[7];
+  
+  TH1F *hCluQSect[42], *hCluQSectZoom[42];
+  
   for(Int_t iCh =0; iCh <7; iCh++){
-   for(Int_t iSect =0; iSect < 6; iSect++){
-      hCluQSect[iCh*6+iSect] = new TH1F(Form("QClusCh%iSect%i",iCh,iSect) ,Form("Cluster charge (ADC) in Chamber %i and sector %i",iCh,iSect),5000,0,5000);
-     }  
-  }
+   hCluSizeMip[iCh] = new TH1F(Form("CluSizeMipCh%i",iCh),Form("Cluster size  MIP  (cluster Q > 100 ADC) in Chamber %i",iCh),  50  , 0  , 50  );
+  Add2RecPointsList(hCluSizeMip[iCh], iCh+2,expert);
 
-  Add2RecPointsList(hCluEvt , 0);
-  Add2RecPointsList(hCluChi2, 1);
-  Add2RecPointsList(hCluFlg , 2);
-  Add2RecPointsList(hCluSize, 3);
-  Add2RecPointsList(hCluSizeMip, 4);
-  Add2RecPointsList(hCluQ   , 5);
-  for(Int_t i=0; i< 42; i++)  Add2RecPointsList(hCluQSect[i],i+6);
-}
-//____________________________________________________________________________
+   hCluSizePho[iCh]  = new TH1F(Form("CluSizePho%i",iCh ),Form("Cluster size  Phots(cluster Q < 100 ADC) in Chamber %i",iCh),  50  , 0  , 50  );
+  Add2RecPointsList(hCluSizePho[iCh], iCh+7+2,expert);
+
+    for(Int_t iSect =0; iSect < 6; iSect++){
+      hCluQSectZoom[iCh*6+iSect] = new TH1F(Form("QClusCh%iSect%iZoom",iCh,iSect) ,Form("Zoom on Cluster charge (ADC) in Chamber %i and sector %i",iCh,iSect),100,0,100);
+      Add2RecPointsList(hCluQSectZoom[iCh*6+iSect],2+14+iCh*6+iSect,expert);
 
+      hCluQSect[iCh*6+iSect] = new TH1F(Form("QClusCh%iSect%i",iCh,iSect) ,Form("Cluster charge (ADC) in Chamber %i and sector %i",iCh,iSect),250,0,5000);
+      Add2RecPointsList(hCluQSect[iCh*6+iSect],2+14+42+iCh*6+iSect);
+
+    }  
+  }
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::InitRaws()
 {
 //
 // Booking QA histo for Raw data
 //
+// All histograms implemented in InitRaws are used in AMORE. Any change here should be propagated to the amoreHMP-QA as well!!! (clm)
+//  
+  
+  Bool_t expert = kTRUE;
   const Int_t kNerr = (Int_t)AliHMPIDRawStream::kSumErr+1;
-  TH1F *hqPad[14], *hSumErr[14];
-
+  TH1F *hSumErr[14];
+  TH2F *hDilo[14];
+  TH2I *hPadMap[42]; //AMORE monitoring
+  TH1I *hPadQ[42]; //AMORE monitoring
   for(Int_t iddl =0; iddl<AliHMPIDRawStream::kNDDL; iddl++) {
-    hqPad[iddl] = new TH1F(Form("hqPadDDL%i",iddl), Form("Pad Q Entries at DDL %i",iddl), 500,0,5000);
-    Add2RawsList(hqPad[iddl],iddl);
-    hSumErr[iddl] = new TH1F(Form("SumErrDDL%i",iddl), Form("Error summary for ddl %i",iddl), 2*kNerr,0,2*kNerr);
-    hSumErr[iddl]->SetYTitle("%");
     
+    hSumErr[iddl] = new TH1F(Form("hSumErrDDL%i",iddl), Form("Error summary for DDL %i",iddl), 2*kNerr,0,2*kNerr);
     for(Int_t ilabel=0; ilabel< kNerr; ilabel++) {
       hSumErr[iddl]->GetXaxis()->CenterLabels(kTRUE);
-      //hSumErr[iddl]->GetXaxis()->SetBinLabel((2*ilabel+1),Form("%i  %s",ilabel+1,hnames[ilabel]));
       hSumErr[iddl]->GetXaxis()->SetBinLabel((2*ilabel+1),Form("%i  %s",ilabel+1,AliHMPIDRawStream::GetErrName(ilabel)));
       }
       
-    Add2RawsList(hSumErr[iddl],iddl+14);
- }
-  TH1F *hNevRaws = new TH1F("NevRaws","Events per DDL",15,0,15);
-  Add2RawsList(hNevRaws,28);
+    Add2RawsList(hSumErr[iddl],iddl,expert);
+    
+    hDilo[iddl] = new TH2F(Form("hDiloDDL%i",iddl),Form("Dilogic response at DDL;Row # ;Dilogic #",iddl),24,1,25,10,1,11);
+    Add2RawsList(hDilo[iddl],14+iddl,expert);
+  }//DDL loop
+ for(Int_t iCh = AliHMPIDParam::kMinCh; iCh <=AliHMPIDParam::kMaxCh ;iCh++) {
+   for(Int_t iPc = AliHMPIDParam::kMinPc; iPc <= AliHMPIDParam::kMaxPc ;iPc++) {
+      hPadMap[iPc+6*iCh] = new TH2I(Form("hPadMap_Ch_%i_Pc%i",iCh,iPc),Form("Pad Map of Ch: %i Pc: %i;Pad X;Pad Y;",iCh,iPc),80,0,80,48,0,48);
+      Add2RawsList(hPadMap[iPc+6*iCh],28+iPc+6*iCh,expert); 
+      hPadQ[iPc+6*iCh]   = new TH1I(Form("hPadQ_Ch_%i_Pc%i",iCh,iPc),Form("Pad Charge of Ch: %i Pc: %i;Pad Q;Entries;",iCh,iPc),4100,0,4100);
+      Add2RawsList(hPadQ[iPc+6*iCh],70+iPc+6*iCh,expert); 
+    }//PC loop
+  }//Ch loop  
+
+    TH2I *hGeneralErrorSummary = new TH2I("GeneralErrorSummary"," DDL index vs Error type plot", 2*kNerr, 0, 2*kNerr, 2*AliHMPIDRawStream::kNDDL,0,2*AliHMPIDRawStream::kNDDL);
+  for(Int_t igenlabel =0 ; igenlabel< kNerr; igenlabel++) hGeneralErrorSummary->GetXaxis()->SetBinLabel((2*igenlabel+1),Form("%i  %s",igenlabel+1,AliHMPIDRawStream::GetErrName(igenlabel)));
+   Add2RawsList(hGeneralErrorSummary,14+14+42+42);
+  
 }
-//____________________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::InitESDs()
 {
   //
@@ -139,74 +162,82 @@ void AliHMPIDQADataMakerRec::InitESDs()
    hPid[1] = new TH1F("PidMu","#mu response"                   , 101, -0.005,1.005)             ;
    hPid[2] = new TH1F("PidPi","#pi response"                   , 101, -0.005,1.005)             ;
    hPid[3] = new TH1F("PidK" ,"K response"                     , 101, -0.005,1.005)             ;
-   hPid[4] = new TH1F("PidP" ,"p response"                         ,101, -0.005,1.005)             ;
-
-Add2ESDsList(hCkovP,0);
-Add2ESDsList(hSigP ,1);
-Add2ESDsList(hDifXY,2);
-Add2ESDsList(hMvsP,3);
-for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4);
+   hPid[4] = new TH1F("PidP" ,"p response"                     , 101, -0.005,1.005)             ;
 
+   Add2ESDsList(hCkovP,0);
+   Add2ESDsList(hSigP ,1,kTRUE);
+   Add2ESDsList(hDifXY,2);
+   Add2ESDsList(hMvsP,3,kTRUE);
+   for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4,kTRUE);
 
 }
-//____________________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::MakeRaws(AliRawReader *rawReader)
 {
 //
 // Filling Raws QA histos
 //
-    AliHMPIDRawStream stream(rawReader);
+         rawReader->Reset() ; 
+               AliHMPIDRawStream stream(rawReader);
+
+    fEvtRaw++;
 
     while(stream.Next())
      {
        UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13
-
-       for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
-       GetRawsData(ddl)->Fill(stream.GetChargeArray()[iPad]);}
-                                                           
-       GetRawsData(28)->Fill(ddl);
-
+       if(ddl > 13) continue;
        for(Int_t iErr =1; iErr<(Int_t)AliHMPIDRawStream::kSumErr; iErr++){
          Int_t numOfErr = stream.GetErrors(ddl,iErr);
-
-         GetRawsData(ddl+14)->Fill(iErr,numOfErr);
+         GetRawsData(ddl)->Fill(iErr,numOfErr);
+         //Printf("err type %i   ddl number %i  Num of errors %i",iErr,ddl,numOfErr);
+        ((TH2I*)GetRawsData(14+14+42+42))->Fill(iErr,ddl,iErr); //
        }
+       UInt_t word; Int_t Nddl, r, d, a;//pc,pcX,pcY;      
+       for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
+       AliHMPIDDigit dig(stream.GetPadArray()[iPad],stream.GetChargeArray()[iPad]);dig.Raw(word,Nddl,r,d,a);
+       GetRawsData(ddl+14)->Fill(r,d);
+       GetRawsData(28+stream.Pc(Nddl,r,d,a)+6*AliHMPIDParam::DDL2C(ddl))->Fill(stream.PadPcX(Nddl,r,d,a),stream.PadPcY(Nddl,r,d,a));
+       GetRawsData(70+stream.Pc(Nddl,r,d,a)+6*AliHMPIDParam::DDL2C(ddl))->Fill(stream.GetChargeArray()[iPad]);
+       }      
      }
+
    stream.Delete();
+   
 }
-//___________________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::MakeRecPoints(TTree * clustersTree)
 {
   //
   //filling QA histos for clusters
   //
-
   AliHMPIDParam *pPar =AliHMPIDParam::Instance();
-  TClonesArray *clusters = new TClonesArray("AliHMPIDCluster");
-  for(int i=AliHMPIDParam::kMinCh;i<=AliHMPIDParam::kMaxCh;i++){
-    TBranch *branch = clustersTree->GetBranch(Form("HMPID%d",i));
+  
+  static TClonesArray *clusters;
+  if(!clusters) clusters = new TClonesArray("AliHMPIDCluster");
+  
+  for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){
+    TBranch *branch = clustersTree->GetBranch(Form("HMPID%d",iCh));
     branch->SetAddress(&clusters);
     branch->GetEntry(0);
-    GetRecPointsData(0)->Fill(i,clusters->GetEntries());
+    GetRecPointsData(0)->Fill(iCh,clusters->GetEntries());
     TIter next(clusters);
     AliHMPIDCluster *clu;
     while ( (clu = dynamic_cast<AliHMPIDCluster *>(next())) ) {
-      GetRecPointsData(1)->Fill(clu->Chi2());
-      GetRecPointsData(2)->Fill(clu->Status());
-      GetRecPointsData(3)->Fill(clu->Size());
-      if(clu->Q()>100) GetRecPointsData(3)->Fill(clu->Size());
-      GetRecPointsData(5)->Fill(clu->Q());
-      Int_t hv =  pPar->InHVSector(clu->Y()); 
-      GetRecPointsData(6+clu->Ch()*6+hv)->Fill(clu->Q());     
+      GetRecPointsData(1)->Fill(clu->Status(),iCh);
+      Int_t sect =  pPar->InHVSector(clu->Y());
+      if(clu->Q()>100) GetRecPointsData(2+iCh)->Fill(clu->Size());
+      else {
+        GetRecPointsData(2+7+iCh)->Fill(clu->Size());
+       GetRecPointsData(2+14+iCh*6+sect)->Fill(clu->Q());
+      }    
+      GetRecPointsData(2+14+42+iCh*6+sect)->Fill(clu->Q());
     }
   }
 
-  clusters->Delete();
-  delete clusters;
+  clusters->Clear();
+  
 }
-
-//____________________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::MakeESDs(AliESDEvent * esd)
 {
   //
@@ -235,18 +266,27 @@ void AliHMPIDQADataMakerRec::MakeESDs(AliESDEvent * esd)
     for(Int_t i = 0 ; i < 5 ; i++) GetESDsData(4+i)->Fill(pid[i]) ;
   }
 }
-//____________________________________________________________________________
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDQADataMakerRec::StartOfDetectorCycle()
 {
   //Detector specific actions at start of cycle
   
 }
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
-void AliHMPIDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t , TObjArray *)
+void AliHMPIDQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray *histos)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
+  
+  if(task==AliQA::kRAWS) {
+    for(Int_t iddl=0;iddl<14;iddl++) {
+     TH1F *h = (TH1F*)histos->At(14+iddl); //ddl histos scaled by the number of events 
+     h->Scale(1./(Float_t)fEvtRaw);
+    }
+  }
+  
+   AliQAChecker::Instance()->Run(AliQA::kHMPID, task, histos);
 
- //  AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj);
 }