]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
AliAODEvent::GetHeader() returns AliVHeader
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / AliSpectraBothEventCuts.cxx
index 10703f849368fe158a904f81b06894b9111f7b91..87b75e534009b1a1683c79089947f9cdb67bd808 100644 (file)
@@ -36,6 +36,8 @@
 #include "AliAnalysisDataContainer.h"
 #include "AliSpectraBothEventCuts.h"
 #include "AliSpectraBothTrackCuts.h"
+#include "AliAnalysisUtils.h"
+#include "AliPPVsMultUtils.h"  
 //#include "AliSpectraBothHistoManager.h"
 #include <iostream>
 
@@ -45,23 +47,28 @@ ClassImp(AliSpectraBothEventCuts)
 
 AliSpectraBothEventCuts::AliSpectraBothEventCuts(const char *name) : TNamed(name, "AOD Event Cuts"), fAOD(0),fAODEvent(AliSpectraBothTrackCuts::kAODobject), fTrackBits(0),fIsMC(0),fCentEstimator(""), fUseCentPatchAOD049(0), fUseSDDPatchforLHC11a(kDoNotCheckforSDD),fTriggerSettings(AliVEvent::kMB),fTrackCuts(0),
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0),fMaxChi2perNDFforVertex(0),
+fMinRun(0),fMaxRun(0),fetarangeofmultiplicitycut(0.0),fUseAliPPVsMultUtils(false),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVector(0)
-,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0)
+,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0),fHistoRunNumbers(0),
+fHistoCentrality(0),fHistoMultiplicty(0),fAnalysisUtils(0),fAliPPVsMultUtils(0)
+
 {
-  // Constructor
-  fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
-  fHistoVtxBefSel = new TH1F("fHistoVtxBefSel", "Vtx distr before event selection",300,-15,15);
-  fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection",300,-15,15);
-  fHistoVtxAftSelwithoutZvertexCut=new TH1F("fHistoVtxAftSelwithoutZvertexcut", "Vtx distr after event selection without Z vertex cut",300,-15,15);
-  fHistoVtxalltriggerEventswithMCz=new TH1F("fHistoVtxalltriggerEventswithMCz", "generated z vertex position",300,-15,15);
-  fHistoVtxAftSelwithoutZvertexCutusingMCz=new TH1F("fHistoVtxAftSelwithoutZvertexCutusingMCz", "Vtx distr after event selection without Z vertex cut using MC z",300,-15,15);
-  fHistoEtaBefSel = new TH1F("fHistoEtaBefSel", "Eta distr before event selection",500,-2,2);
-  fHistoEtaAftSel = new TH1F("fHistoEtaAftSel", "Eta distr after event selection",500,-2,2);
-  fHistoNChAftSel = new TH1F("fHistoNChAftSel", "NCh distr after event selection",2000,-0.5,1999.5);
+  // Constructori
+ // Bool_t oldStatus = TH1::AddDirectoryStatus();
+  //TH1::AddDirectory(kFALSE); 
+ // fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
+ // fHistoVtxBefSel = new TH1F("fHistoVtxBefSel", "Vtx distr before event selection",300,-15,15);
+//  fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection",300,-15,15);
+//  fHistoVtxAftSelwithoutZvertexCut=new TH1F("fHistoVtxAftSelwithoutZvertexcut", "Vtx distr after event selection without Z vertex cut",300,-15,15);
+//  fHistoVtxalltriggerEventswithMCz=new TH1F("fHistoVtxalltriggerEventswithMCz", "generated z vertex position",300,-15,15);
+//  fHistoVtxAftSelwithoutZvertexCutusingMCz=new TH1F("fHistoVtxAftSelwithoutZvertexCutusingMCz", "Vtx distr after event selection without Z vertex cut using MC z",300,-15,15);
+//  fHistoEtaBefSel = new TH1F("fHistoEtaBefSel", "Eta distr before event selection",500,-2,2);
+//  fHistoEtaAftSel = new TH1F("fHistoEtaAftSel", "Eta distr after event selection",500,-2,2);
+ // fHistoNChAftSel = new TH1F("fHistoNChAftSel", "NCh distr after event selection",2000,-0.5,1999.5);
   //fHistoQVectorPos = new TH1F("fHistoQVectorPos", "QVectorPos distribution",100,0,10);
   //fHistoQVectorNeg = new TH1F("fHistoQVectorNeg", "QVectorNeg distribution",100,0,10);
-  fHistoQVector = new TH1F("fHistoQVector", "QVector with VZERO distribution",100,0,10);
-  fHistoEP = new TH1F("fHistoEP", "EP with VZERO distribution",100,-10,10);
// fHistoQVector = new TH1F("fHistoQVector", "QVector with VZERO distribution",100,0,10);
// fHistoEP = new TH1F("fHistoEP", "EP with VZERO distribution",100,-10,10);
   fCentralityCutMin = 0.0;      // default value of centrality cut minimum, 0 ~ no cut
   fCentralityCutMax = 10000.0;  // default value of centrality cut maximum,  ~ no cut
   // fQVectorPosCutMin=0.0;
@@ -77,27 +84,116 @@ fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEta
   fTrackBits=1;
   fCentEstimator="V0M";
   fMaxChi2perNDFforVertex=-1;
+ // TH1::AddDirectory(oldStatus);      
 }
+//______________________________________________________
+
+AliSpectraBothEventCuts::~AliSpectraBothEventCuts()
+{
+       if(fHistoCuts)
+               delete fHistoCuts;
+       if(fHistoVtxBefSel)
+               delete fHistoVtxBefSel;
+       if(fHistoVtxAftSel)
+               delete fHistoVtxAftSel;
+       if(fHistoVtxAftSelwithoutZvertexCut)
+               delete fHistoVtxAftSelwithoutZvertexCut;
+       if(fHistoVtxalltriggerEventswithMCz)
+               delete fHistoVtxalltriggerEventswithMCz;
+       if(fHistoVtxAftSelwithoutZvertexCutusingMCz)
+               delete fHistoVtxAftSelwithoutZvertexCutusingMCz;
+       if(fHistoEtaBefSel)
+               delete fHistoEtaBefSel;
+       if(fHistoEtaAftSel)
+               delete fHistoEtaAftSel ;
+       if(fHistoNChAftSel)
+               delete fHistoNChAftSel;
+       if(fHistoQVector)
+               delete fHistoQVector;
+       if(fHistoEP)
+               delete fHistoEP;
+       if(fHistoRunNumbers)
+               delete fHistoRunNumbers;
+       if(fHistoCentrality)
+               delete fHistoCentrality;
+       if(fHistoMultiplicty)
+               delete fHistoMultiplicty;
+       if(fAnalysisUtils)
+               delete fAnalysisUtils;
+       if(fAliPPVsMultUtils)
+               delete fAliPPVsMultUtils;
+
+}
+//______________________________________________________
+void AliSpectraBothEventCuts::InitHisto()
+{
+       Bool_t oldStatus = TH1::AddDirectoryStatus();
+       TH1::AddDirectory(kFALSE);
+       if(!fHistoCuts) 
+               fHistoCuts = new TH1I("fEventCuts", "Event Cuts", kNVtxCuts, -0.5, kNVtxCuts - 0.5);
+       if(!fHistoVtxBefSel )
+               fHistoVtxBefSel = new TH1F("fHistoVtxBefSel", "Vtx distr before event selection",300,-15,15);
+       if(!fHistoVtxAftSel)
+               fHistoVtxAftSel = new TH1F("fHistoVtxAftSel", "Vtx distr after event selection",300,-15,15);
+       if(!fHistoVtxAftSelwithoutZvertexCut)
+               fHistoVtxAftSelwithoutZvertexCut=new TH1F("fHistoVtxAftSelwithoutZvertexcut", "Vtx distr after event selection without Z vertex cut",300,-15,15);
+       if(!fHistoVtxalltriggerEventswithMCz)
+               fHistoVtxalltriggerEventswithMCz=new TH1F("fHistoVtxalltriggerEventswithMCz", "generated z vertex position",300,-15,15);
+       if(!fHistoVtxAftSelwithoutZvertexCutusingMCz)
+               fHistoVtxAftSelwithoutZvertexCutusingMCz=new TH1F("fHistoVtxAftSelwithoutZvertexCutusingMCz", "Vtx distr after event selection without Z vertex cut using MC z",300,-15,15);
+       if(!fHistoEtaBefSel)
+               fHistoEtaBefSel = new TH1F("fHistoEtaBefSel", "Eta distr before event selection",500,-2,2);
+       if(!fHistoEtaAftSel)
+               fHistoEtaAftSel = new TH1F("fHistoEtaAftSel", "Eta distr after event selection",500,-2,2);
+       if(!fHistoNChAftSel)
+               fHistoNChAftSel = new TH1F("fHistoNChAftSel", "NCh distr after event selection",2000,-0.5,1999.5);
+  //fHistoQVectorPos = new TH1F("fHistoQVectorPos", "QVectorPos distribution",100,0,10);
+  //fHistoQVectorNeg = new TH1F("fHistoQVectorNeg", "QVectorNeg distribution",100,0,10);
+       if(!fHistoQVector)
+               fHistoQVector = new TH1F("fHistoQVector", "QVector with VZERO distribution",100,0,10);
+       if(!fHistoEP)
+               fHistoEP = new TH1F("fHistoEP", "EP with VZERO distribution",100,-10,10);
+       if(!fHistoRunNumbers)
+       {
+               if(fMaxRun>fMinRun&&fMinRun>=0)
+                       fHistoRunNumbers=new TH1F("fHistoRunNumbers","Run numbers",fMaxRun-fMinRun+1,fMinRun-0.5,fMaxRun+0.5);
+               else
+                       fHistoRunNumbers=new TH1F("fHistoRunNumbers","Run numbers",1001,120000-.5,121000+0.5);
+
+       }
+       if(!fHistoCentrality)
+               fHistoCentrality = new TH2F("fHistoCentrality", "centrality",2,0,2,100,0.0,100);
+
+       if(!fHistoMultiplicty)
+               fHistoMultiplicty= new TH2F("fHistoMultiplicty", "multiplicty estimator",2,0,2,155,-4.5,150.5);
 
+       TH1::AddDirectory(oldStatus);           
+}
 //______________________________________________________
-Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts* trackcuts,Bool_t isMC,Double_t mcZ)
+Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts* trackcuts,Bool_t isMC,Double_t mcZ,TH1F* managerhisteventcuts)
 {
   // Returns true if Event Cuts are selected and applied
   fAOD = aod;
   fTrackCuts = trackcuts;
   fHistoCuts->Fill(kProcessedEvents);
-
+  if(managerhisteventcuts)
+       managerhisteventcuts->Fill(0);
+  fHistoRunNumbers->Fill(aod->GetRunNumber());
   Bool_t IsPhysSel = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerSettings);//FIXME we can add the trigger mask here
-  if(!IsPhysSel)return IsPhysSel;
-
+  if(!IsPhysSel)
+       return IsPhysSel;
+  if(fAnalysisUtils) // we check for pile-up
+                IsPhysSel = (!fAnalysisUtils->IsPileUpEvent(fAOD));
+  if(!IsPhysSel)
+       return IsPhysSel;
+       
   if(isMC)     
        fHistoVtxalltriggerEventswithMCz->Fill(mcZ);
-
    //loop on tracks, before event selection, filling QA histos
- AliESDEvent* esdevent=0x0;
 AliESDEvent* esdevent=0x0;
   AliAODEvent* aodevent=0x0;
   Bool_t isSDD=kFALSE;
-     TString nameoftrack(fAOD->ClassName());  
+  TString nameoftrack(fAOD->ClassName());  
     if(!nameoftrack.CompareTo("AliESDEvent"))
     {
                fAODEvent=AliSpectraBothTrackCuts::kESDobject;
@@ -130,55 +226,75 @@ Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCu
      if(fUseSDDPatchforLHC11a==kwithoutSDD&&isSDD==kTRUE)
                return false;
 
-
     fHistoCuts->Fill(kPhysSelEvents);
+   if(managerhisteventcuts)
+       managerhisteventcuts->Fill(1);
 
 
 
 
    const AliVVertex * vertex = fAOD->GetPrimaryVertex();//FIXME vertex is recreated    
 
-  if(vertex)fHistoVtxBefSel->Fill(vertex->GetZ());
+  if(vertex)
+       fHistoVtxBefSel->Fill(vertex->GetZ());
   fIsSelected =kFALSE;
-  if(CheckVtx() && CheckCentralityCut() && CheckMultiplicityCut() && CheckVtxChi2perNDF())
-   { //selection on vertex and Centrality
+  if(CheckVtx())
+   { //selection on vertex
 
-    fIsSelected=CheckQVectorCut(); // QVector is calculated only if the centrality and vertex are correct (performance)
+    fIsSelected=kTRUE;
   }
   if(fIsSelected&&vertex)
- {
-      fHistoVtxAftSelwithoutZvertexCut->Fill(vertex->GetZ());
-      if(isMC)
-          fHistoVtxAftSelwithoutZvertexCutusingMCz->Fill(mcZ); 
-     if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
-     {
-               fHistoCuts->Fill(kAcceptedEvents);
+  {
+       fHistoVtxAftSelwithoutZvertexCut->Fill(vertex->GetZ());
+       if(isMC)
+               fHistoVtxAftSelwithoutZvertexCutusingMCz->Fill(mcZ);    
+       if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
+       {
                fIsSelected=kTRUE;
                fHistoVtxAftSel->Fill(vertex->GetZ());
-     }
-    else       
-    {
+       }
+       else    
+       {
                fIsSelected=kFALSE;
-    }  
+       }       
   }
+  if(fIsSelected)
+  {
+       if( CheckCentralityCut() && CheckMultiplicityCut() && CheckQVectorCut())
+               fIsSelected=kTRUE;
+       else
+               fIsSelected=kFALSE;     
+  }    
+
+
+
   Int_t Nch=0;
-  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) {
-    AliVTrack* track =dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
+  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++) 
+  {
+        AliVTrack* track =dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
    /* if(fAODEvent==AliSpectraBothTrackCuts::kESDobject)
                track=dynamic_cast<AliVTrack*>(esdevent->GetTrack(iTracks));
      else if (fAODEvent==AliSpectraBothTrackCuts::kAODobject)
                track=dynamic_cast<AliVTrack*>(aodevent->GetTrack(iTracks));
      else return false;*/
      
-    if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
-    fHistoEtaBefSel->Fill(track->Eta());
-    if(fIsSelected){
-      fHistoEtaAftSel->Fill(track->Eta());
-      Nch++;
-    }
+        if (!fTrackCuts->IsSelected(track,kFALSE)) 
+               continue;
+       fHistoEtaBefSel->Fill(track->Eta());
+        if(fIsSelected)
+       {
+               fHistoEtaAftSel->Fill(track->Eta());
+               Nch++;
+       }
   }
-  //Printf("NCHARGED_EvSel : %d",Nch);
-  if(fIsSelected)fHistoNChAftSel->Fill(Nch);
+  if(fIsSelected)
+  {    
+       fHistoNChAftSel->Fill(Nch);
+       fHistoCuts->Fill(kAcceptedEvents);
+       if(managerhisteventcuts)
+               managerhisteventcuts->Fill(2);
+
+  }    
   return fIsSelected;
 }
 
@@ -214,7 +330,10 @@ Bool_t AliSpectraBothEventCuts::CheckVtx()
    // {
     //  return kTRUE;
    // }
-  fHistoCuts->Fill(kVtxRange);
+   if(!CheckVtxChi2perNDF())     
+       return kFALSE;
+               
+ fHistoCuts->Fill(kGoodVtx);
   //return kFALSE;
    return kTRUE;
 }
@@ -223,12 +342,28 @@ Bool_t AliSpectraBothEventCuts::CheckVtx()
 Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
 {
   // Check centrality cut
-  if ( fCentralityCutMax<0.0  &&  fCentralityCutMin<0.0 )  return kTRUE;   
-  Double_t cent=0;
-  if(!fUseCentPatchAOD049)cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentEstimator.Data());
-  else cent=ApplyCentralityPatchAOD049();
-  
-  if ( (cent <= fCentralityCutMax)  &&  (cent >= fCentralityCutMin) )  return kTRUE;   
+ if ( fCentralityCutMax<0.0  &&  fCentralityCutMin<0.0 )  
+       return kTRUE;
+  Double_t cent=0;     
+  if(fUseAliPPVsMultUtils)
+  {
+       if(!fAliPPVsMultUtils)
+               fAliPPVsMultUtils=new AliPPVsMultUtils();
+       cent=fAliPPVsMultUtils->GetMultiplicityPercentile(fAOD,fCentEstimator.Data());
+  }    
+  else
+  {
+       if(!fUseCentPatchAOD049)
+               cent=fAOD->GetCentrality()->GetCentralityPercentile(fCentEstimator.Data());
+       else 
+               cent=ApplyCentralityPatchAOD049();
+  }    
+  fHistoCentrality->Fill(0.5,cent);    
+  if ( (cent < fCentralityCutMax)  &&  (cent >= fCentralityCutMin) )  
+  {
+        fHistoCentrality->Fill(1.5,cent);      
+       return kTRUE;
+  }       
   fHistoCuts->Fill(kVtxCentral);
 
   return kFALSE;
@@ -238,19 +373,39 @@ Bool_t AliSpectraBothEventCuts::CheckCentralityCut()
 Bool_t AliSpectraBothEventCuts::CheckMultiplicityCut()
 {
   // Check multiplicity cut
-if(fMultiplicityCutMin<0.0 && fMultiplicityCutMax<0.0)
-       return kTRUE;
-  Int_t Ncharged=0;
-  for (Int_t iTracks = 0; iTracks < fAOD->GetNumberOfTracks(); iTracks++){
-    AliVTrack* track = dynamic_cast<AliVTrack*>(fAOD->GetTrack(iTracks));
+       if(fMultiplicityCutMin<0 && fMultiplicityCutMax<0)
+               return kTRUE;
+       Int_t Ncharged=-1;
+       if(fAODEvent==AliSpectraBothTrackCuts::kESDobject)
+       {       
+                 AliESDEvent* esdevent=dynamic_cast<AliESDEvent*>(fAOD);
+                AliESDtrackCuts::MultEstTrackType estType = esdevent->GetPrimaryVertexTracks()->GetStatus() ? AliESDtrackCuts::kTrackletsITSTPC : AliESDtrackCuts::kTracklets;
+               Ncharged=AliESDtrackCuts::GetReferenceMultiplicity(esdevent,estType,fetarangeofmultiplicitycut);
+       }
+       else if(fAODEvent==AliSpectraBothTrackCuts::kAODobject)
+       {
+               AliAODEvent* aodevent=0x0;
+               aodevent=dynamic_cast<AliAODEvent*>(fAOD);
+                AliAODHeader * header = dynamic_cast<AliAODHeader*>(aodevent->GetHeader());
+                if(!header) AliFatal("Not a standard AOD");
+
+               if(TMath::Abs(0.8-fetarangeofmultiplicitycut)<0.1)
+                       Ncharged=header->GetRefMultiplicityComb08();
+               else if (TMath::Abs(0.5-fetarangeofmultiplicitycut)<0.1)
+                       Ncharged=header->GetRefMultiplicityComb05();
+               else 
+                       Ncharged=-1;
+       }
+       else
+               return kFALSE;   
 
-    if (!fTrackCuts->IsSelected(track,kFALSE)) continue;
-       
-    Ncharged++;
-  }
-  //Printf("NCHARGED_cut : %d",Ncharged);
-  if(Ncharged>fMultiplicityCutMin && Ncharged<fMultiplicityCutMax)return kTRUE;
-  
+   fHistoMultiplicty->Fill(0.5,Ncharged);
+   if(Ncharged>=fMultiplicityCutMin && Ncharged<fMultiplicityCutMax&& Ncharged>0)
+   { 
+       fHistoMultiplicty->Fill(1.5,Ncharged);
+       return kTRUE;
+   }
+  fHistoCuts->Fill(kVtxCentral);
   return kFALSE;
 }
 
@@ -318,13 +473,16 @@ void AliSpectraBothEventCuts::PrintCuts()
 {
   // print info about event cuts
   cout << "Event Stats" << endl;
-  cout << " > Number of accepted events: " << fHistoCuts->GetBinContent(kAcceptedEvents + 1) << endl;
-  cout << " > Number of processed events: " << fHistoCuts->GetBinContent(kProcessedEvents + 1) << endl;
-  cout << " > Number of PhysSel events: " << fHistoCuts->GetBinContent(kPhysSelEvents + 1) << endl;
-  cout << " > Vertex out of range: " << fHistoCuts->GetBinContent(kVtxRange + 1) << endl;
-  cout << " > Events cut by centrality: " << fHistoCuts->GetBinContent(kVtxCentral + 1) << endl;
-  cout << " > Events without vertex: " << fHistoCuts->GetBinContent(kVtxNoEvent + 1) << endl;
-  cout << " > QVector cut: " << fHistoCuts->GetBinContent(kQVector + 1) << endl;
+  if(fHistoCuts)
+  {            
+        cout << " > Number of accepted events: " << fHistoCuts->GetBinContent(kAcceptedEvents + 1) << endl;
+        cout << " > Number of processed events: " << fHistoCuts->GetBinContent(kProcessedEvents + 1) << endl;
+        cout << " > Number of PhysSel events: " << fHistoCuts->GetBinContent(kPhysSelEvents + 1) << endl;
+        cout << " > With good veretx: " << fHistoCuts->GetBinContent(kGoodVtx + 1) << endl;
+        cout << " > Events cut by centrality: " << fHistoCuts->GetBinContent(kVtxCentral + 1) << endl;
+        cout << " > Events without vertex: " << fHistoCuts->GetBinContent(kVtxNoEvent + 1) << endl;
+         cout << " > QVector cut: " << fHistoCuts->GetBinContent(kQVector + 1) << endl;
+  }    
   cout << " > Track type used for the QVector calculation: " << fTrackBits << endl;
   // cout << " > QPosRange: [" << fQVectorPosCutMin <<"," <<fQVectorPosCutMax<<"]"<< endl;
   // cout << " > QNegRange: [" << fQVectorNegCutMin <<"," <<fQVectorNegCutMax<<"]"<< endl;
@@ -436,6 +594,12 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
   // TList collections_histoQVectorNeg;
   TList collections_histoQVector;
   TList collections_histoEP;
+  TList collections_histoVtxAftSelwithoutZvertexCut;
+  TList collections_histoVtxalltriggerEventswithMCz;
+  TList collections_histoVtxAftSelwithoutZvertexCutusingMCz;                   
+  TList collections_histoRunNumbers;
+  TList collections_histoCentrality;                   
+  TList collections_histoMultiplicty;
 
   Int_t count = 0;
 
@@ -464,6 +628,24 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
     collections_histoQVector.Add(histo_histoQVector);
     TH1F * histo_histoEP = entry->GetHistoEP();      
     collections_histoEP.Add(histo_histoEP);
+    TH1F* histo_histoVtxAftSelwithoutZvertexCut=entry->GetHistoVtxAftSelwithoutZvertexCut();
+    collections_histoVtxAftSelwithoutZvertexCut.Add(histo_histoVtxAftSelwithoutZvertexCut);
+    TH1F* histo_histoVtxalltriggerEventswithMCz=entry->GetHistoVtxGenerated();
+    collections_histoVtxalltriggerEventswithMCz.Add(histo_histoVtxalltriggerEventswithMCz);
+    
+   TH1F* histo_histoVtxAftSelwithoutZvertexCutusingMCz=entry->GetHistoVtxAftSelwithoutZvertexCutusingMCz();
+    collections_histoVtxAftSelwithoutZvertexCutusingMCz.Add(histo_histoVtxAftSelwithoutZvertexCutusingMCz);    
+    
+    TH1F* histo_histoRunNumbers=entry->GetHistoRunNumbers();
+    collections_histoRunNumbers.Add(histo_histoRunNumbers);
+   TH2F* histo_histoCentrality=entry->GetHistoCentrality();
+  collections_histoCentrality.Add(histo_histoCentrality);              
+
+TH2F* histo_histoMultiplicty=entry->GetHistoMultiplicty();
+  collections_histoMultiplicty.Add(histo_histoMultiplicty);
+
+
     count++;
   }
   
@@ -477,10 +659,25 @@ Long64_t AliSpectraBothEventCuts::Merge(TCollection* list)
   // fHistoQVectorNeg->Merge(&collections_histoQVectorNeg);
   fHistoQVector->Merge(&collections_histoQVector);
   fHistoEP->Merge(&collections_histoEP);
-  
+
+  fHistoVtxAftSelwithoutZvertexCut->Merge(&collections_histoVtxAftSelwithoutZvertexCut);
+  fHistoVtxalltriggerEventswithMCz->Merge(&collections_histoVtxalltriggerEventswithMCz);
+  fHistoVtxAftSelwithoutZvertexCutusingMCz->Merge(&collections_histoVtxAftSelwithoutZvertexCutusingMCz);
+  fHistoRunNumbers->Merge(&collections_histoRunNumbers);
+  fHistoCentrality->Merge(&collections_histoCentrality);
+  fHistoMultiplicty->Merge(&collections_histoMultiplicty);
+
 
   delete iter;
 
   return count+1;
 }
-
+//__________________________________________________________________________________________________________
+void AliSpectraBothEventCuts::SetRunNumberRange(Int_t min, Int_t max)
+{
+       if(max>min&&min>=0)
+       {
+                fMinRun=min;                    
+                fMaxRun=max;
+       }
+}