Next version of Pb-Pb VZERO QA task + add macro (Raphael)
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Nov 2011 21:39:53 +0000 (21:39 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 4 Nov 2011 21:39:53 +0000 (21:39 +0000)
PWG1/VZERO/AddTaskVZEROPbPb.C [new file with mode: 0644]
PWG1/VZERO/AliAnaVZEROPbPb.cxx
PWG1/VZERO/AliAnaVZEROPbPb.h

diff --git a/PWG1/VZERO/AddTaskVZEROPbPb.C b/PWG1/VZERO/AddTaskVZEROPbPb.C
new file mode 100644 (file)
index 0000000..e309a63
--- /dev/null
@@ -0,0 +1,42 @@
+AliAnalysisTaskSE* AddTaskVZEROPbPb(Int_t runNumber)
+{
+  // Creates a PbPb QA task for VZERO
+  
+  // Get the pointer to the existing analysis manager via the static access method.
+  //==============================================================================
+  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+  if (!mgr) {
+    ::Error("AddTaskQAsym", "No analysis manager to connect to.");
+    return NULL;
+  }  
+  
+  // Check the analysis type using the event handlers connected to the analysis manager.
+  //==============================================================================
+  if (!mgr->GetInputEventHandler()) {
+    ::Error("AddTasQAsym", "This task requires an input event handler");
+    return NULL;
+  }
+   TString inputDataType = mgr->GetInputEventHandler()->GetDataType(); // can be "ESD" or "AOD"
+  
+   // Configure analysis
+   //===========================================================================
+   
+   AliAnaVZEROPbPb* task = new AliAnaVZEROPbPb("AliAnaVZEROPbPb");
+   task->SetClassesNames("CTRUE-,CVLN-,CVHN-,CPBI1-,CPBI2-,C0HWU-");
+   mgr->AddTask(task);
+  
+   AliAnalysisDataContainer *cout  = mgr->CreateContainer("PbPbVZEROHists",TList::Class(),
+                                                         AliAnalysisManager::kOutputContainer, Form("%s:VZERO_PbPb_Performance", 
+                                                                                                    mgr->GetCommonFileName()));
+
+   mgr->ConnectInput  (task, 0, mgr->GetCommonInputContainer());
+   mgr->ConnectOutput (task, 1, cout);
+
+   return task;
+   
+  
+}
+
+
index bcd3193..3e9b749 100644 (file)
 #include "AliESDInputHandler.h"
 #include "AliAnaVZEROPbPb.h"
 #include "AliMultiplicity.h"
-#include "AliESDtrackCuts.h"
 #include "AliESDUtils.h"
 #include "AliCentrality.h"
 
 // VZERO includes
 #include "AliESDVZERO.h"
-#include "AliESDVZEROfriend.h"
 
 ClassImp(AliAnaVZEROPbPb)
 
-  const Int_t   AliAnaVZEROPbPb::kNBinMult = 200;
-  const Float_t AliAnaVZEROPbPb::kMultMax  = 20000.;
-
-
 AliAnaVZEROPbPb::AliAnaVZEROPbPb() 
   : AliAnalysisTaskSE("AliAnaVZEROPbPb"), fESD(0), fEsdV0(0), fOutputList(0), fClassesNames(0),
   fNFlags(0),
@@ -50,8 +44,20 @@ fhTotRecoMult(0),
 fhCentrality(0),
 fhEqualizedMult(0),
 fhEqualizedMultSum(0),
-fhL2TriggersEfficiency(0),
-fhVBANDCounts(0)
+fNBinTotMult(100),
+fTotMultMax(30000),
+fNBinMult(100),
+fV0AMultMax(20000),
+fV0CMultMax(30000),
+fNBinOnlineCharge(100),
+fV0AOnlineChargeMax(20000),
+fV0COnlineChargeMax(30000),
+fNBinEquaMult(100),
+fEquaMultMax(50),
+fNBinSumsEqMult(100),
+fV0AEqMultMax(1000),
+fV0CEqMultMax(1000)
+
 {
   // Constructor
   for(Int_t i = 0; i < 2; ++i) {
@@ -94,8 +100,19 @@ fhTotRecoMult(0),
 fhCentrality(0),
 fhEqualizedMult(0),
 fhEqualizedMultSum(0),
-fhL2TriggersEfficiency(0),
-fhVBANDCounts(0)
+fNBinTotMult(100),
+fTotMultMax(30000),
+fNBinMult(100),
+fV0AMultMax(20000),
+fV0CMultMax(30000),
+fNBinOnlineCharge(100),
+fV0AOnlineChargeMax(20000),
+fV0COnlineChargeMax(30000),
+fNBinEquaMult(100),
+fEquaMultMax(50),
+fNBinSumsEqMult(100),
+fV0AEqMultMax(1000),
+fV0CEqMultMax(1000)
 {
   // Constructor
   for(Int_t i = 0; i < 2; ++i) {
@@ -202,7 +219,6 @@ void AliAnaVZEROPbPb::CreateHistosPerL2Trigger(){
        fhOnlineCharge= new TH2F*[fNClasses];
        fhCentrality= new TH1F*[fNClasses];
        fhV0vsSPDCentrality= new TH2F*[fNClasses];
-       fhL2TriggersEfficiency = new TH1F*[fNClasses];
        fhRecoMult= new TH2F*[fNClasses];
        fhTotRecoMult= new TH1F*[fNClasses];
        fhTriggerBits= new TH1F*[fNClasses];
@@ -212,16 +228,13 @@ void AliAnaVZEROPbPb::CreateHistosPerL2Trigger(){
        fhL2Triggers = CreateHisto1D("hL2Triggers","L2 Triggers",fNClasses,0,fNClasses);
        fOutputList->Add(fhL2Triggers);   
        
-       fhVBANDCounts = CreateHisto1D("hVBANDTrigger","VBAND Triggers counts",kNBinMult,0.,kMultMax,"VZERO charge");
-       fOutputList->Add(fhVBANDCounts);          
-
        TIter iter(fClassesNames);
        TObjString* name;
        Int_t iClass =0;
        while((name = (TObjString*) iter.Next())){
                fhL2Triggers->GetXaxis()->SetBinLabel(iClass+1,name->String().Data());
                
-               fhOnlineCharge[iClass] = CreateHisto2D(Form("hOnlineCharge_%s",name->String().Data()),Form("Online Charge for %s",name->String().Data()),100,0.,32000.,100,0.,32000,"V0A","V0C");
+               fhOnlineCharge[iClass] = CreateHisto2D(Form("hOnlineCharge_%s",name->String().Data()),Form("Online Charge for %s",name->String().Data()),fNBinOnlineCharge,0.,fV0AOnlineChargeMax,fNBinOnlineCharge,0.,fV0COnlineChargeMax,"V0A","V0C");
                fOutputList->Add(fhOnlineCharge[iClass]);         
 
                fhCentrality[iClass] = CreateHisto1D(Form("hV0Centrality_%s",name->String().Data()),Form("V0 centrality for %s",name->String().Data()),100,0.,100.);
@@ -230,10 +243,10 @@ void AliAnaVZEROPbPb::CreateHistosPerL2Trigger(){
                fhV0vsSPDCentrality[iClass] = CreateHisto2D(Form("hV0vsSPDCentrality_%s",name->String().Data()),Form("Centrality for %s",name->String().Data()),100,0.,100.,100,0.,100,"SPD Centrality (CL1)","V0 Centrality (V0M)");
                fOutputList->Add(fhV0vsSPDCentrality[iClass]);    
 
-               fhRecoMult[iClass] = CreateHisto2D(Form("hRecoMult_%s",name->String().Data()),Form("Reco Multiplicity for %s",name->String().Data()),100,0.,10000.,100,0.,20000,"V0A Mult","V0C Mult");
+               fhRecoMult[iClass] = CreateHisto2D(Form("hRecoMult_%s",name->String().Data()),Form("Reco Multiplicity for %s",name->String().Data()),fNBinMult,0.,fV0AMultMax,fNBinMult,0.,fV0CMultMax,"V0A Offline Mult","V0C Offline Mult");
                fOutputList->Add(fhRecoMult[iClass]);     
 
-               fhTotRecoMult[iClass] = CreateHisto1D(Form("hTotRecoMult_%s",name->String().Data()),Form("Total Reco Multiplicity for %s",name->String().Data()),kNBinMult,0.,kMultMax,"V0A + V0C Mult");
+               fhTotRecoMult[iClass] = CreateHisto1D(Form("hTotRecoMult_%s",name->String().Data()),Form("Total Reco Multiplicity for %s",name->String().Data()),fNBinTotMult,0.,fTotMultMax,"V0A + V0C Offline Mult");
                fOutputList->Add(fhTotRecoMult[iClass]);          
 
                fhTriggerBits[iClass] = CreateHisto1D(Form("hTriggerBits_%s",name->String().Data()),Form("Trigger Bits for %s",name->String().Data()),16,-0.5,15.5);
@@ -255,14 +268,12 @@ void AliAnaVZEROPbPb::CreateHistosPerL2Trigger(){
                fhTriggerBits[iClass]->GetXaxis()->SetBinLabel(16,"All True BG");
                fOutputList->Add(fhTriggerBits[iClass]);
        
-               fhEqualizedMult[iClass] = CreateHisto2D(Form("hEqualizedMult_%s",name->String().Data()),Form("Equalized Multiplicity for %s",name->String().Data()),64,-0.5,63.5,1000,0.,50,"PMT channel","Equalized Multiplicity");
+               fhEqualizedMult[iClass] = CreateHisto2D(Form("hEqualizedMult_%s",name->String().Data()),Form("Equalized Multiplicity for %s",name->String().Data()),64,-0.5,63.5,fNBinEquaMult,0.,fEquaMultMax,"PMT channel","Equalized Multiplicity");
                fOutputList->Add(fhEqualizedMult[iClass]);
        
-               fhEqualizedMultSum[iClass] = CreateHisto2D(Form("hEqualizedMultSum_%s",name->String().Data()),Form("Summed Equalized Multiplicity for %s",name->String().Data()),100,0.,500.,100,0.,1000,"V0A","V0C");
+               fhEqualizedMultSum[iClass] = CreateHisto2D(Form("hEqualizedMultSum_%s",name->String().Data()),Form("Summed Equalized Multiplicity for %s",name->String().Data()),fNBinSumsEqMult,0.,fV0AEqMultMax,fNBinSumsEqMult,0.,fV0CEqMultMax,"V0A","V0C");
                fOutputList->Add(fhEqualizedMultSum[iClass]);
 
-               fhL2TriggersEfficiency[iClass] = CreateHisto1D(Form("hL2TriggersEfficiency_%s",name->String().Data()),Form("Trigger %s Efficiency",name->String().Data()),kNBinMult,0.,kMultMax,"VZERO Multiplicity");
-               fOutputList->Add(fhL2TriggersEfficiency[iClass]);
                
                iClass++;
        }
@@ -342,34 +353,35 @@ void AliAnaVZEROPbPb::CreateQAHistos(){
   
 }
 //________________________________________________________________________
-Bool_t AliAnaVZEROPbPb::IsGoodEvent(){
-  Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB);
-  if (!isSelected) return kFALSE;
-  const AliESDVertex *primaryVtx = fESD->GetPrimaryVertex();
-  if (!primaryVtx) return kFALSE;
-  if (!primaryVtx->GetStatus()) return kFALSE;
-  Double_t tPrimaryVtxPosition[3];
-  primaryVtx->GetXYZ(tPrimaryVtxPosition);
-  if (TMath::Abs(tPrimaryVtxPosition[2]) > 10.0) return kFALSE;
-
-  AliCentrality *centrality = fESD->GetCentrality();
-  if (centrality->GetQuality()) return kFALSE;
-  
-  return kTRUE;
-}
-//________________________________________________________________________
 void AliAnaVZEROPbPb::FillPerL2TriggerHistos(){
    TString trigStr(fESD->GetFiredTriggerClasses());
   
-//  Bool_t isGoodEvt = IsGoodEvent();
        TIter iter(fClassesNames);
        TObjString* name;
        Int_t iClass =0;
-       if (trigStr.Contains("CPBI2-B"))  fhVBANDCounts->Fill(fEsdV0->GetMTotV0A()+fEsdV0->GetMTotV0C());
        
+   
+       TObjArray * tokens = trigStr.Tokenize(" ");
+    Int_t ntokens = tokens->GetEntriesFast();
+               
   while((name = (TObjString*) iter.Next())){
        
-       if (!trigStr.Contains(name->String().Data()) && iClass>0) continue;
+       Bool_t goodTrig = kFALSE;
+       if(iClass>0){
+       for (Int_t itoken = 0; itoken < ntokens; ++itoken) {
+                       if (!((((TObjString*)tokens->At(itoken))->String()).Contains("-B-"))) continue;
+                       if ((((TObjString*)tokens->At(itoken))->String()).BeginsWith(name->String().Data())) {
+                               goodTrig = kTRUE;
+                               break;
+                       }
+               }
+       } else goodTrig = kTRUE;
+       
+       if (!goodTrig) {
+               iClass++;
+               continue;
+       }
+//     if (!trigStr.Contains(name->String().Data())) continue;
        
        fhOnlineCharge[iClass]->Fill(fEsdV0->GetTriggerChargeA(),fEsdV0->GetTriggerChargeC());
        
@@ -378,7 +390,6 @@ void AliAnaVZEROPbPb::FillPerL2TriggerHistos(){
        fhRecoMult[iClass]->Fill(fEsdV0->GetMTotV0A(),fEsdV0->GetMTotV0C());
        fhTotRecoMult[iClass]->Fill(fEsdV0->GetMTotV0A()+fEsdV0->GetMTotV0C());
 
-
        for(int iTrig = 0; iTrig < 16; ++iTrig){
                if(fEsdV0->GetTriggerBits() & (1<<iTrig)) fhTriggerBits[iClass]->Fill(iTrig);   
        }
@@ -393,7 +404,7 @@ void AliAnaVZEROPbPb::FillPerL2TriggerHistos(){
        
        Float_t sumEqMult[2] = {0.,0.};
        for(int iCh = 0; iCh < 64; ++iCh){
-               if(fEsdV0->GetTime(iCh) < 1e-6) continue;
+               if(fEsdV0->GetTime(iCh) < -1024.+ 1e-6) continue;
                Int_t side = iCh / 32 ;
                sumEqMult[side] += fESD->GetVZEROEqMultiplicity(iCh);
                fhEqualizedMult[iClass]->Fill(iCh,fESD->GetVZEROEqMultiplicity(iCh));
@@ -402,6 +413,8 @@ void AliAnaVZEROPbPb::FillPerL2TriggerHistos(){
        
        iClass++;
   }
+       delete tokens;
+
 }
 //________________________________________________________________________
 void AliAnaVZEROPbPb::FillQAHistos(){
@@ -474,12 +487,35 @@ void AliAnaVZEROPbPb::Terminate(Option_t *)
     printf("ERROR: Output list not available\n");
     return;
   }
-       fhVBANDCounts= (TH1F*) fOutputList->At(1); // VBAND histo
-       
-       for(int i = 0; i < fNClasses; ++i){
-               fhTotRecoMult[i] = (TH1F*) fOutputList->At(6+ i*9); // Other defined trigger histo
-               fhL2TriggersEfficiency[i] = (TH1F*) fOutputList->At(10+ i*9); 
-               fhL2TriggersEfficiency[i]->Divide(fhTotRecoMult[i],fhVBANDCounts);
-       }
 
 }
+//________________________________________________________________________
+
+void AliAnaVZEROPbPb::SetOnlineChargeRange(Int_t nbins, Float_t maxA, Float_t maxC){
+       fNBinOnlineCharge = nbins;
+       fV0AOnlineChargeMax = maxA;
+       fV0COnlineChargeMax = maxC;
+}
+//________________________________________________________________________
+void AliAnaVZEROPbPb::SetTotalMultiplicityRange(Int_t nbins, Float_t max){
+       fNBinTotMult = nbins;
+       fTotMultMax = max;
+}
+//________________________________________________________________________
+void AliAnaVZEROPbPb::SetMultiplicityRange(Int_t nbins, Float_t maxA, Float_t maxC){
+       fNBinMult = nbins;
+       fV0AMultMax = maxA;
+       fV0CMultMax = maxC;
+}
+//________________________________________________________________________
+void AliAnaVZEROPbPb::SetEquaMultRange(Int_t nbins, Float_t max){
+       fNBinEquaMult = nbins;
+       fEquaMultMax = max;
+}
+//________________________________________________________________________
+void AliAnaVZEROPbPb::SetSumEquaMultRange(Int_t nbins, Float_t maxA, Float_t maxC){
+       fNBinSumsEqMult = nbins;
+       fV0AEqMultMax = maxA;
+       fV0CEqMultMax = maxC;
+}
+
index 6f739f9..697a1cc 100644 (file)
@@ -20,9 +20,12 @@ public:
 
   virtual void Init();
 
-  Bool_t IsGoodEvent();
-
   void SetClassesNames(const Char_t * names);
+  void SetOnlineChargeRange(Int_t nbins, Float_t maxA, Float_t macC);
+  void SetTotalMultiplicityRange(Int_t nbins, Float_t max);
+  void SetMultiplicityRange(Int_t nbins, Float_t maxA, Float_t maxC);
+  void SetSumEquaMultRange(Int_t nbins, Float_t maxA, Float_t maxC);
+  void SetEquaMultRange(Int_t nbins, Float_t max);
 
   void CreateQAHistos();
   void CreateHistosPerL2Trigger();
@@ -36,14 +39,11 @@ public:
                      Int_t nBinsY, Double_t yMin, Double_t yMax,
                      const char* xLabel = NULL, const char* yLabel = NULL);
   
-  static const Int_t kNBinMult;
-  static const Float_t kMultMax;
-
  private:
   AliESDEvent *fESD;    //! ESD object
   AliESDVZERO* fEsdV0;
   TList       *fOutputList; //! Output list
-  Int_t fNClasses;
+  Int_t fNClasses;   
   TObjArray *fClassesNames;
 
   TH2F *fNFlags; //!
@@ -79,22 +79,38 @@ public:
   TH2F *fhVtxXYBGC;       // XY vertex for beam-gas (C side) events
   TH1F *fhVtxZBGC;        // Z vertex for beam-gas (C side) events
 
-  TH1F *fhL2Triggers;
-  TH2F **fhOnlineCharge;
-  TH2F **fhRecoMult;
-  TH2F **fhV0vsSPDCentrality;
-  TH1F **fhTriggerBits;
-  TH1F **fhTotRecoMult;
-  TH1F **fhCentrality;
-  TH2F **fhEqualizedMult;
-  TH2F **fhEqualizedMultSum;
-  TH1F **fhL2TriggersEfficiency;
-  TH1F *fhVBANDCounts;
+  TH1F *fhL2Triggers;    //! Triggers counting histo
+  TH2F **fhOnlineCharge; //! Online Charge (send to EMCAL) histo
+  TH2F **fhRecoMult;     //! Reconstructed Multiplicity V0A % V0C
+  TH2F **fhV0vsSPDCentrality; //! Centrality V0 % SPD
+  TH1F **fhTriggerBits;  //! 16 trigger bits
+  TH1F **fhTotRecoMult;  //! Total Reconstructed Multiplicity V0A + V0C
+  TH1F **fhCentrality;   //! Centrality V0 
+  TH2F **fhEqualizedMult; //! Equalized Multiplicity per channel
+  TH2F **fhEqualizedMultSum; //! Equalized Multiplicity V0A % V0C
+
+  Int_t   fNBinTotMult; //! number of bin of histo fhTotRecoMult
+  Float_t fTotMultMax;  //! max of histo fhTotRecoMult
+
+  Int_t   fNBinMult;    //! number of bin of histo fhRecoMult
+  Float_t fV0AMultMax;  //! max VZERO-A of histo fhRecoMult
+  Float_t fV0CMultMax;  //! max VZERO-C of histo fhRecoMult
+  Int_t   fNBinOnlineCharge;   //! number of bin of histo fhOnlineCharge
+  Float_t fV0AOnlineChargeMax; //! max VZERO-A of histo fhOnlineCharge
+  Float_t fV0COnlineChargeMax; //! max VZERO-C of histo fhOnlineCharge
+
+  Int_t   fNBinEquaMult;     //! number of bin of histo fhEqualizedMult
+  Float_t fEquaMultMax;      //! max of histo fhEqualizedMult
+
+  Int_t   fNBinSumsEqMult;     //! number of bin of histo fhEqualizedMultSum
+  Float_t fV0AEqMultMax;       //! max VZERO-A of histo fhEqualizedMultSum
+  Float_t fV0CEqMultMax;       //! max VZERO-C of histo fhEqualizedMultSum
 
   AliAnaVZEROPbPb(const AliAnaVZEROPbPb&); // not implemented
   AliAnaVZEROPbPb& operator=(const AliAnaVZEROPbPb&); // not implemented
   
-  ClassDef(AliAnaVZEROPbPb, 1); // example of analysis
+  ClassDef(AliAnaVZEROPbPb, 2); 
 };
 
 #endif