Adding addtional histograms for z vertex QA and option to turn on/off checking the...
authormchojnac <mchojnac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Mar 2013 10:50:35 +0000 (10:50 +0000)
committermchojnac <mchojnac@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 26 Mar 2013 10:50:35 +0000 (10:50 +0000)
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraBoth.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliAnalysisTaskSpectraBoth.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothEventCuts.h
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.cxx
PWGLF/SPECTRA/PiKaPr/TestAOD/AliSpectraBothTrackCuts.h

index 72e65c5..acf9433 100644 (file)
@@ -44,6 +44,7 @@
 #include "AliPIDResponse.h"\r
 #include "AliStack.h"\r
 #include "AliSpectraBothPID.h"\r
+#include "AliGenEventHeader.h" \r
 #include <TMCProcess.h>\r
 \r
 #include <iostream>\r
@@ -116,12 +117,28 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
        TClonesArray *arrayMC = 0;\r
        Int_t npar=0;\r
        AliStack* stack=0x0;\r
-  \r
+        Double_t mcZ=-100;\r
+\r
        if (fIsMC)\r
        {\r
-         \r
+               TArrayF mcVertex(3);\r
+               mcVertex[0]=9999.; mcVertex[1]=9999.; mcVertex[2]=9999.;\r
+               AliMCEvent* mcEvent=(AliMCEvent*)MCEvent();\r
+               AliHeader* header = mcEvent->Header();\r
+               if (!header) \r
+               {\r
+                       AliDebug(AliLog::kError, "Header not available");\r
+                       return;\r
+               }\r
+       \r
+               AliGenEventHeader* genHeader = header->GenEventHeader();\r
+               if(genHeader)\r
+               {\r
+                       genHeader->PrimaryVertex(mcVertex);\r
+                       mcZ=mcVertex[2];\r
+               }\r
                  if(ifAODEvent==AliSpectraBothTrackCuts::kAODobject)\r
-                 {     \r
+                 {\r
                          arrayMC = (TClonesArray*) fAOD->GetList()->FindObject(AliAODMCParticle::StdBranchName());\r
                          if (!arrayMC) \r
                          {\r
@@ -135,8 +152,7 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                                  //if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax()){//charged hadron are filled inside the eta acceptance\r
                                  //Printf("%f     %f-%f",partMC->Eta(),fTrackCuts->GetEtaMin(),fTrackCuts->GetEtaMax());\r
                                  if(partMC->Eta() > fTrackCuts->GetEtaMin() && partMC->Eta() < fTrackCuts->GetEtaMax())\r
-                                               fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());\r
-                                 \r
+                                               fHistMan->GetPtHistogram(kHistPtGen)->Fill(partMC->Pt(),partMC->IsPhysicalPrimary());                                                                    \r
                                  //rapidity cut\r
                                  if(partMC->Y() > fTrackCuts->GetYMax()|| partMC->Y() < fTrackCuts->GetYMin() ) \r
                                        continue;       \r
@@ -152,8 +168,8 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                          }\r
                  }\r
                  if(ifAODEvent==AliSpectraBothTrackCuts::kESDobject)\r
-                 {     \r
-                       AliMCEvent* mcEvent  = (AliMCEvent*) MCEvent();\r
+                 {\r
+                       //AliMCEvent* mcEvent  = (AliMCEvent*) MCEvent();\r
                        //Printf("MC particles: %d", mcEvent->GetNumberOfTracks());             \r
                        if (!mcEvent) \r
                        {\r
@@ -189,9 +205,8 @@ void AliAnalysisTaskSpectraBoth::UserExec(Option_t *)
                          }\r
                  }\r
        }\r
-  \r
        if(!fdotheMCLoopAfterEventCuts)\r
-               if(!fEventCuts->IsSelected(fAOD,fTrackCuts))return;//event selection\r
+               if(!fEventCuts->IsSelected(fAOD,fTrackCuts,fIsMC,mcZ))return;//event selection\r
 \r
        //main loop on tracks\r
        Int_t ntracks=0;\r
index c19e544..5100e0b 100644 (file)
@@ -20,6 +20,8 @@ class AliSpectraBothTrackCuts;
 class AliSpectraBothEventCuts;\r
 class AliSpectraBothPID;\r
 class AliESDtrackCuts;\r
+class AliGenEventHeader;\r
+\r
 #include "AliSpectraBothHistoManager.h"\r
 #include "AliAnalysisTaskSE.h"\r
 #include "AliESDtrackCuts.h"\r
index 0017950..2b92657 100644 (file)
@@ -46,13 +46,15 @@ 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),
 fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),fHistoNChAftSel(0),fHistoQVector(0)
-,fHistoEP(0),fHistoVtxAftSelwithoutZveretxCut(0)
+,fHistoEP(0),fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(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);
-  fHistoVtxAftSelwithoutZveretxCut=new TH1F("fHistoVtxAftSelwithoutZveretx cut", "Vtx distr after event selection without Z veretx cut",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);
@@ -78,14 +80,19 @@ fHistoCuts(0),fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEta
 }
 
 //______________________________________________________
-Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts     *trackcuts)
+Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts* trackcuts,Bool_t isMC,Double_t mcZ)
 {
   // Returns true if Event Cuts are selected and applied
   fAOD = aod;
   fTrackCuts = trackcuts;
   fHistoCuts->Fill(kProcessedEvents);
+
   Bool_t IsPhysSel = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & fTriggerSettings);//FIXME we can add the trigger mask here
   if(!IsPhysSel)return IsPhysSel;
+
+  if(isMC)     
+       fHistoVtxalltriggerEventswithMCz->Fill(mcZ);
+
    //loop on tracks, before event selection, filling QA histos
  AliESDEvent* esdevent=0x0;
   AliAODEvent* aodevent=0x0;
@@ -138,9 +145,11 @@ Bool_t AliSpectraBothEventCuts::IsSelected(AliVEvent * aod,AliSpectraBothTrackCu
 
     fIsSelected=CheckQVectorCut(); // QVector is calculated only if the centrality and vertex are correct (performance)
   }
-  if(fIsSelected)
+  if(fIsSelected&&vertex)
  {
-      fHistoVtxAftSelwithoutZveretxCut->Fill(vertex->GetZ());
+      fHistoVtxAftSelwithoutZvertexCut->Fill(vertex->GetZ());
+      if(isMC)
+          fHistoVtxAftSelwithoutZvertexCutusingMCz->Fill(mcZ); 
      if (vertex->GetZ() > fVertexCutMin && vertex->GetZ() < fVertexCutMax)
      {
                fHistoCuts->Fill(kAcceptedEvents);
index 6fd3663..4747f33 100644 (file)
@@ -30,7 +30,7 @@ enum {kDoNotCheckforSDD=0,kwithSDD,kwithoutSDD};
 fIsSelected(0), fCentralityCutMin(0), fCentralityCutMax(0), fQVectorCutMin(0), fQVectorCutMax(0), fVertexCutMin(0), 
 fVertexCutMax(0), fMultiplicityCutMin(0), fMultiplicityCutMax(0), fMaxChi2perNDFforVertex(0),fHistoCuts(0),
 fHistoVtxBefSel(0),fHistoVtxAftSel(0),fHistoEtaBefSel(0),fHistoEtaAftSel(0),
-fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZveretxCut(0)
+fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZvertexCut(0),fHistoVtxalltriggerEventswithMCz(0),fHistoVtxAftSelwithoutZvertexCutusingMCz(0)
 {}
   AliSpectraBothEventCuts(const char *name);
   virtual  ~AliSpectraBothEventCuts() {}
@@ -51,7 +51,7 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZveretxCu
 
 
   // Methods
-  Bool_t IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts     *trackcuts);
+  Bool_t IsSelected(AliVEvent * aod,AliSpectraBothTrackCuts     *trackcuts, Bool_t isMC=kFALSE, Double_t mcZ=-100.0);
   Bool_t CheckVtx();
   Bool_t CheckCentralityCut();
   Bool_t CheckMultiplicityCut();
@@ -71,7 +71,10 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZveretxCu
   TH1I * GetHistoCuts()         {  return fHistoCuts; }
   TH1F * GetHistoVtxBefSel()         {  return fHistoVtxBefSel; }
   TH1F * GetHistoVtxAftSel()         {  return fHistoVtxAftSel; }
-  TH1F * GetHistoVtxAftSelwithoutZveretxCut()         {  return fHistoVtxAftSelwithoutZveretxCut; }
+  TH1F * GetHistoVtxAftSelwithoutZvertexCut()         {  return fHistoVtxAftSelwithoutZvertexCut; }
+  TH1F * GetHistoVtxGenerated()         {  return fHistoVtxalltriggerEventswithMCz; }
+  TH1F * GetHistoVtxAftSelwithoutZvertexCutusingMCz()         {  return fHistoVtxAftSelwithoutZvertexCutusingMCz; }
+
   TH1F * GetHistoEtaBefSel()         {  return fHistoEtaBefSel; }
   TH1F * GetHistoEtaAftSel()         {  return fHistoEtaAftSel; }
   TH1F * GetHistoNChAftSel()         {  return fHistoNChAftSel; }
@@ -138,13 +141,15 @@ fHistoNChAftSel(0),fHistoQVector(0),fHistoEP(0), fHistoVtxAftSelwithoutZveretxCu
   //TH1F            *fHistoQVectorNeg;        // QVectorNeg
   TH1F            *fHistoQVector;        // QVector
   TH1F            *fHistoEP;        // EP
-  TH1F                   *fHistoVtxAftSelwithoutZveretxCut;        // Vtx distr after event selection but without z vertex cut
-         
+  TH1F                   *fHistoVtxAftSelwithoutZvertexCut;        // Vtx distr after event selection but without z vertex cut
+  TH1F                   *fHistoVtxalltriggerEventswithMCz;        // MC z vertex ditribution of generated events
+  TH1F                   *fHistoVtxAftSelwithoutZvertexCutusingMCz;        // Vtx distr after event selection but without z vertex cut
+
 
   AliSpectraBothEventCuts(const AliSpectraBothEventCuts&);
   AliSpectraBothEventCuts& operator=(const AliSpectraBothEventCuts&);
   
-  ClassDef(AliSpectraBothEventCuts, 6);
+  ClassDef(AliSpectraBothEventCuts, 7);
   
 };
 #endif
index ba13240..2a332e3 100644 (file)
@@ -59,7 +59,7 @@ ClassImp(AliSpectraBothTrackCuts)
 
 
 AliSpectraBothTrackCuts::AliSpectraBothTrackCuts(const char *name) : TNamed(name, "AOD Track Cuts"), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0), fDCACut(0), fPCut(0), fPtCut(0), fYCutMax(0),fYCutMin(0),
-  fPtCutTOFMatching(0),fAODtrack(kotherobject), fHashitinSPD1(0),
+  fPtCutTOFMatching(0),fAODtrack(kotherobject), fHashitinSPD1(0),fusedadditionalcuts(kTRUE),
 fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),fTrack(0),fCuts(0)
   
 {
@@ -175,6 +175,8 @@ Bool_t AliSpectraBothTrackCuts::CheckTrackCuts()
 {
   // Check additional track Cuts
   Bool_t PassTrackCuts=kTRUE;
+  if(!fusedadditionalcuts)
+       return PassTrackCuts;
   AliAODTrack* aodtrack=0;
   AliESDtrack* esdtrack=0;
   if(fAODtrack==kESDobject)
index 02c9764..1d435c1 100644 (file)
@@ -31,7 +31,8 @@ class AliSpectraBothTrackCuts : public TNamed
   enum { kTrkBit = 0, kTrkCuts, kTrkEta, kTrkDCA, kTrkP, kTrkPt,kTrkPtTOF,kTOFMatching,kTrTOFout,kTrTIME,kTrTOFpid,kAccepted,kNTrkCuts};
   enum {kAODobject=0,kESDobject,kotherobject};
   
- AliSpectraBothTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0),fDCACut(0) ,fPCut(0), fPtCut(0),fYCutMax(0),fYCutMin(0), fPtCutTOFMatching(0),fAODtrack(0), fHashitinSPD1(0),fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),fTrack(0),fCuts(0) {}
+ AliSpectraBothTrackCuts() : TNamed(), fIsSelected(0), fTrackBits(0), fMinTPCcls(0), fEtaCutMin(0), fEtaCutMax(0),fDCACut(0) ,fPCut(0), fPtCut(0),fYCutMax(0),fYCutMin(0), fPtCutTOFMatching(0),fAODtrack(0), fHashitinSPD1(0),fusedadditionalcuts(kTRUE),
+fHistoCuts(0), fHistoNSelectedPos(0), fHistoNSelectedNeg(0), fHistoNMatchedPos(0), fHistoNMatchedNeg(0), fHistoEtaPhiHighPt(0), fHistoNclustersITS(0),fTrack(0),fCuts(0) {}
   
   AliSpectraBothTrackCuts(const char *name);
   virtual  ~AliSpectraBothTrackCuts() {} // To be implemented
@@ -66,6 +67,7 @@ class AliSpectraBothTrackCuts : public TNamed
    void SetTrackBits(UInt_t TrackBits) {fTrackBits=TrackBits;}
    void SetMinTPCcls(UInt_t MinTPCcls) {fMinTPCcls=MinTPCcls;}
    void SetHashitinSPD1 (Bool_t value) {fHashitinSPD1=value;}  
+   void SetUsedAdditionalCuts (Bool_t value) {fusedadditionalcuts=value;}      
    Float_t GetEtaMin()       const    { return fEtaCutMin; }
    Float_t GetEtaMax()       const    { return fEtaCutMax; }
    Float_t GetYMax()         const    { return fYCutMax; }
@@ -92,14 +94,17 @@ class AliSpectraBothTrackCuts : public TNamed
    Float_t          fYCutMin;           // Minimum value of Y
    Float_t          fPtCutTOFMatching;           // TOF Matching
    Int_t            fAODtrack; // 0 ESD track connected , 1 AOD track conected , else nothing
-   Bool_t          fHashitinSPD1; // Check if SPD1 has a hit                   
+   Bool_t          fHashitinSPD1; // Check if SPD1 has a hit   
+   Bool_t          fusedadditionalcuts;          //If set to true the TPCrefit, ITSrefit, SPDany and Ncluster cut is check             
    TH1I             *fHistoCuts;       // Cuts statistics
    TH1F             *fHistoNSelectedPos;       // Selected positive tracks
    TH1F             *fHistoNSelectedNeg;       // Selected negative tracks
    TH1F             *fHistoNMatchedPos;       // Matched positive tracks
    TH1F             *fHistoNMatchedNeg;       // Matched negative tracks
    TH2F             *fHistoEtaPhiHighPt;       // EtaPhi distr at high pt (>1.5 GeV/c)
-   TH1F            *fHistoNclustersITS;      // Number of clusters in ITS              
+   TH1F            *fHistoNclustersITS;      // Number of clusters in ITS 
+                
+               
    AliVTrack      *fTrack;           //! Track pointer
    AliESDtrackCuts *fCuts;      //! cuts  
    static const char * kBinLabel[]; // labels of stat histo
@@ -108,7 +113,7 @@ class AliSpectraBothTrackCuts : public TNamed
    AliSpectraBothTrackCuts(const AliSpectraBothTrackCuts&);
    AliSpectraBothTrackCuts& operator=(const AliSpectraBothTrackCuts&);
    
-   ClassDef(AliSpectraBothTrackCuts, 4);
+   ClassDef(AliSpectraBothTrackCuts, 5);
 };
 #endif