AliPhysics  88b7ad0 (88b7ad0)
AliV0ReaderV1.h
Go to the documentation of this file.
1 #ifndef ALIV0READERV1_H
2 #define ALIV0READERV1_H
3 
4 #include "AliAnalysisTaskSE.h"
5 #include "AliAODv0.h"
6 #include "AliESDv0.h"
8 #include "AliConvEventCuts.h"
9 #include "AliExternalTrackParam.h"
10 #include "TObject.h"
11 #include "AliMCEvent.h"
12 #include "AliESDEvent.h"
13 #include "AliKFParticle.h"
14 #include "TParticle.h"
15 #include <iterator>
16 #include <vector>
17 #include "AliESDpid.h"
18 #include "TF1.h"
19 #include "TRandom3.h"
20 #include "AliAnalysisManager.h"
21 
23 class TRandom3;
24 class TList;
26 class TString;
27 class TClonesArray;
28 class TH1F;
29 class TH2F;
31 
32 #if (__GNUC__ >= 3) && !defined(__INTEL_COMPILER)
33 // gcc warns in level Weffc++ about non-virtual destructor
34 // in std::iterator. It is a false positive, therefore Weffc++
35 // needs to be disabled for AliV0ReaderV1
36 #pragma GCC system_header
37 #endif
38 
39 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
40 #pragma GCC diagnostic push
41 #pragma GCC diagnostic ignored "-Weffc++"
42 #endif
43 
45 
46  public:
47 
48  class iterator : public std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase> {
49  public:
50  enum Direction_t {
53  };
54  iterator(const AliV0ReaderV1 *reader, Direction_t dir, int position);
55  iterator(const iterator &other);
56  iterator &operator=(const iterator &other);
57  virtual ~iterator() {}
58 
59  bool operator!=(iterator &other) const;
60  iterator operator++(int);
62  iterator operator--(int);
65 
66  private:
70  };
71 
72  AliV0ReaderV1(const char *name="V0ReaderV1");
73  virtual ~AliV0ReaderV1(); //virtual destructor
74 
76  virtual Bool_t Notify();
77  virtual void UserExec(Option_t *option);
78  virtual void Terminate(Option_t *);
79  virtual void Init();
80 
81  Bool_t ProcessEvent (AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL);
83 
84  // Return Reconstructed Gammas
85  TClonesArray* GetReconstructedGammas() const {return fConversionGammas;}
86  Int_t GetNReconstructedGammas() const {if(fConversionGammas){return fConversionGammas->GetEntriesFast();} else{ return 0;}}
87  AliConversionPhotonBase *operator[](int index) const;
88 
92  return NULL;}
94  return NULL;}
96  // Set Options
98  void CountTracks();
99  void CountTPCoutTracks();
100 
101  void SetConversionCuts(const TString cut);
103  void SetEventCuts(const TString cut);
104  void SetEventCuts(AliConvEventCuts *cuts) {fEventCuts=cuts; return;}
105 
107  void SetUseConstructGamma(Bool_t flag) {fUseConstructGamma=flag; return;}
108  void SetUseAODConversionPhoton(Bool_t b) {if(b){ cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}
109  else { cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;}
110  kUseAODConversionPhoton=b; return;}
111 
112  void SetCreateAODs(Bool_t k=kTRUE) {fCreateAOD=k; return;}
115  fRelabelAODs = kTRUE;
116  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
117  AliInfo(Form("Relabeling of AODs has automatically been switched ON!"));
118  return;}
119 
120  void RelabelAODs(Bool_t relabel=kTRUE) {fRelabelAODs=relabel; return;}
123  void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
124  void SetPeriodName(TString name) {fPeriodName = name;
125  AliInfo(Form("Set PeriodName to: %s",fPeriodName.Data()));
126  return;}
131  void SetUseMassToZero (Bool_t b) {if(b){ cout<<"enable set mass to zero for AliAODConversionPhoton"<<endl;}
132  else { cout<<"disable set mass to zero for AliAODConversionPhoton "<<endl;}
133  fUseMassToZero=b; return;}
134 
136  if(b) AliInfo("Enabled V0finding Efficiency");
137  return;}
138 
142  if(b) AliInfo("Producing additional impact parameter histograms");
143  return;}
144 
147 
148  Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax);
150  void FillRecMCHistosForV0FinderEffiESD( AliESDv0* currentV0);
151  void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack* ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF);
152  Bool_t CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked);
153  Bool_t CheckVectorForDoubleCount(vector<Int_t> &vec, Int_t tobechecked);
156 
157 
161  iterator rend() const {return iterator(this, iterator::kBackwardDirection, -1);}
162 
163  protected:
164  // Reconstruct Gammas
166  AliKFConversionPhoton* ReconstructV0(AliESDv0* fCurrentV0,Int_t currentV0Index);
167  void FillAODOutput();
168  void FindDeltaAODBranchName();
170 
171  // Getter Functions
172  const AliExternalTrackParam* GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge);
173  const AliExternalTrackParam* GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,1);}
174  const AliExternalTrackParam* GetExternalTrackParamN(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,-1);}
175  AliKFParticle* GetPositiveKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
176  AliKFParticle* GetNegativeKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
177  AliKFParticle* GetPositiveKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
178  AliKFParticle* GetNegativeKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
179 
180  Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2]);
181  Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2]);
182  Double_t GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const;
183  Bool_t kAddv0sInESDFilter; // Add PCM v0s to AOD created in ESD filter
184  TBits *fPCMv0BitField; // Pointer to bitfield of PCM v0s
185  AliConversionPhotonCuts *fConversionCuts; // Pointer to the ConversionCut Selection
186  AliConvEventCuts *fEventCuts; // Pointer to the EventCut Selection
187  TClonesArray *fConversionGammas; // TClonesArray holding the reconstructed photons
188  Bool_t fUseImprovedVertex; // set flag to improve primary vertex estimation by adding photons
189  Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
190  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
191  Bool_t kUseAODConversionPhoton; // set flag to use AOD instead of KF output format for photons
192  Bool_t fCreateAOD; // set flag for AOD creation
193  TString fDeltaAODBranchName; // File where Gamma Conv AOD is located, if not in default AOD
194  TString fDeltaAODFilename; // set filename for delta/satellite aod
196  Int_t fPreviousV0ReaderPerformsAODRelabeling; // 0->not set, meaning V0Reader has not yet determined if it should do AODRelabeling, 1-> V0Reader perfomrs relabeling, 2-> previous V0Reader in list perfomrs relabeling
198  Int_t fNumberOfPrimaryTracks; // Number of Primary Tracks in AOD or ESD
199  Int_t fNumberOfTPCoutTracks; // Number of TPC Tracks with TPCout flag
201  Int_t fPtHardBin; // ptHard bin from file
202  Bool_t fUseMassToZero; // switch on setting the mass to 0 for AODConversionPhotons
203  Bool_t fProduceV0findingEffi; // enable histograms for V0finding efficiency
204  Bool_t fProduceImpactParamHistograms; // enable histograms of impact parameters
205  Float_t fCurrentInvMassPair; // Invariant mass of the pair
206  Int_t fImprovedPsiPair; // enables the calculation of PsiPair after the precise calculation of R and use of the proper function for propagation
207  TList *fHistograms; // list of histograms for V0 finding efficiency
208  TList *fImpactParamHistograms; // list of histograms of impact parameters
209  TH2F *fHistoMCGammaPtvsR; // histogram with all converted gammas vs Pt and R (eta < 0.9)
210  TH2F *fHistoMCGammaPtvsPhi; // histogram with all converted gammas vs Pt and Phi (eta < 0.9)
211  TH2F *fHistoMCGammaPtvsEta; // histogram with all converted gammas vs Pt and Eta
212  TH2F *fHistoMCGammaRvsPhi; // histogram with all converted gammas vs R and Phi (eta < 0.9)
213  TH2F *fHistoMCGammaRvsEta; // histogram with all converted gammas vs R and Eta
214  TH2F *fHistoMCGammaPhivsEta; // histogram with all converted gammas vs Phi and Eta
215  TH2F *fHistoRecMCGammaPtvsR; // histogram with all reconstructed converted gammas vs Pt and R (eta < 0.9)
216  TH2F *fHistoRecMCGammaPtvsPhi; // histogram with all reconstructed converted gammas vs Pt and Phi (eta < 0.9)
217  TH2F *fHistoRecMCGammaPtvsEta; // histogram with all reconstructed converted gammas vs Pt and Eta
218  TH2F *fHistoRecMCGammaRvsPhi; // histogram with all reconstructed converted gammas vs R and Phi (eta < 0.9)
219  TH2F *fHistoRecMCGammaRvsEta; // histogram with all reconstructed converted gammas vs R and Eta
220  TH2F *fHistoRecMCGammaPhivsEta; // histogram with all reconstructed converted gammas vs Phi and Eta
221  TH1F *fHistoRecMCGammaMultiPt; // histogram with all at least double counted photons vs Pt (eta < 0.9)
222  TH2F *fHistoRecMCGammaMultiPtvsEta; // histogram with all at least double counted photons vs Pt vs Eta
223  TH1F *fHistoRecMCGammaMultiR; // histogram with all at least double counted photons vs R (eta < 0.9)
224  TH1F *fHistoRecMCGammaMultiPhi; // histogram with all at least double counted photons vs Phi (eta < 0.9)
225  TH1F *fHistoPosTrackImpactParamZ; //impact parameter z of positive track of V0
237  TH2F *fHistoImpactParamZvsR; // conversion point z vs conversion radius
238  TH2F *fHistoImpactParamZvsR2; // after cuts
239  TH1F *fHistoPt;
240  TH1F *fHistoPt2; // Pt after Impact parameter and causality cuts
242  TH1F *fHistoDCAzPhoton2; // photon dca after impact parameter and causality cuts
243  TH1F *fHistoR; // conversion radius
244  TH1F *fHistoRrecalc; // recalculated conversion radius
245  TH1F *fHistoRviaAlpha; // conversion radius
246  TH1F *fHistoRviaAlphaRecalc; // recalculated conversion radius
247  TH1F *fHistoRdiff; // difference in R between conflict cluster and conversion radius
248  TH1F *fHistoImpactParameterStudy; // info about which cut rejected how many V0s
249  TTree *fImpactParamTree; // tree with y, pt and conversion radius
250 
251  vector<Int_t> fVectorFoundGammas; // vector with found MC labels of gammas
252  TString fCurrentFileName; // current file name
253  Bool_t fMCFileChecked; // vector with MC file names which are broken
254 
255  private:
256  AliV0ReaderV1(AliV0ReaderV1 &original);
258 
259  ClassDef(AliV0ReaderV1, 16)
260 
261 };
262 
263 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
264 #pragma GCC diagnostic pop
265 #endif
266 
268  if(fConversionCuts != NULL){
269  delete fConversionCuts;
270  fConversionCuts=NULL;
271  }
272  if(fConversionCuts == NULL){
273  fConversionCuts = new AliConversionPhotonCuts("V0ReaderCuts","V0ReaderCuts");
275  }
276 }
277 
278 inline void AliV0ReaderV1::SetEventCuts(const TString cut){
279  if(fEventCuts != NULL){
280  delete fEventCuts;
281  fEventCuts=NULL;
282  }
283  if(fEventCuts == NULL){
284  fEventCuts = new AliConvEventCuts("V0ReaderEventCuts","V0ReaderEventCuts");
286  }
287 }
288 
289 #endif
Int_t IsReaderPerformingRelabeling()
Int_t charge
Direction_t fDirection
Iterator in forward direction.
Definition: AliV0ReaderV1.h:69
void FillAODOutput()
void SetCreateAODs(Bool_t k=kTRUE)
TH1F * fHistoNegTrackImpactParamZ
TH2F * fHistoPosTrackImpactParamZvsPt
double Double_t
Definition: External.C:58
Bool_t fUseConstructGamma
TH2F * fHistoRecMCGammaPhivsEta
Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax)
Bool_t fMCFileChecked
Definition: External.C:236
Int_t GetNReconstructedGammas() const
Definition: AliV0ReaderV1.h:86
void FindDeltaAODBranchName()
void SetConversionCuts(const TString cut)
Bool_t CheckVectorForDoubleCount(vector< Int_t > &vec, Int_t tobechecked)
TH2F * fHistoImpactParamZvsR
TH1F * fHistoPosTrackImpactParamX
TList * GetCutHistograms()
TH1F * fHistoRviaAlphaRecalc
Bool_t AreAODsRelabeled()
const AliV0ReaderV1 * fkData
V0 reader used to iterate over.
Definition: AliV0ReaderV1.h:67
Bool_t IsEventSelected()
Definition: AliV0ReaderV1.h:82
TString fDeltaAODFilename
void CreatePureMCHistosForV0FinderEffiESD()
TH1F * fHistoRecMCGammaMultiPhi
Int_t fNumberOfPrimaryTracks
Int_t GetNumberOfPrimaryTracks()
Float_t fCurrentInvMassPair
TH2F * fHistoRecMCGammaPtvsR
TList * GetEventCutHistograms()
Definition: AliV0ReaderV1.h:93
void SetUseOwnXYZCalculation(Bool_t flag)
AliConversionPhotonBase * operator*()
TString GetCurrentFileName()
Definition: AliV0ReaderV1.h:95
TString GetPeriodName()
TH1F * fHistoPosTrackImpactParamY
TH1F * fHistoDCAzPhoton
TList * GetCutHistograms()
Definition: AliV0ReaderV1.h:91
virtual void Init()
Double_t GetPsiPair(const AliESDv0 *v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const
void FillRecMCHistosForV0FinderEffiESD(AliESDv0 *currentV0)
void SetProduceV0FindingEfficiency(Bool_t b)
TH1F * fHistoDCAzPhoton2
Bool_t CheckVectorOnly(vector< Int_t > &vec, Int_t tobechecked)
TH1F * fHistoNegTrackImpactParamX
TH2F * fHistoMCGammaPhivsEta
AliConvEventCuts * fEventCuts
void SetImprovedPsiPair(Int_t p)
const AliExternalTrackParam * GetExternalTrackParamN(AliESDv0 *fCurrentV0, Int_t &tracklabel)
Int_t GetImprovedPsiPair()
TH2F * fHistoNegTrackImpactParamXvsPt
void SetConversionCuts(AliConversionPhotonCuts *cuts)
TH2F * fHistoRecMCGammaPtvsEta
Bool_t GetProduceV0FindingEfficiency()
Bool_t kUseAODConversionPhoton
TList * fHistograms
Bool_t GetProduceImpactParamHistograms()
iterator begin() const
Int_t fNumberOfTPCoutTracks
iterator rbegin() const
int fCurrentIndex
Index of the current element.
Definition: AliV0ReaderV1.h:68
AliConversionPhotonCuts * fConversionCuts
int Int_t
Definition: External.C:63
iterator end() const
TH1F * fHistoRrecalc
TH1F * fHistoPosTrackImpactParamZ
Bool_t fProduceImpactParamHistograms
virtual ~AliV0ReaderV1()
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
float Float_t
Definition: External.C:68
void SetEventCuts(AliConvEventCuts *cuts)
Int_t GetNumberOfTPCoutTracks()
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
TH1F * fHistoRecMCGammaMultiR
iterator(const AliV0ReaderV1 *reader, Direction_t dir, int position)
Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2])
void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate)
TString fCurrentFileName
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TH1F * fHistoRviaAlpha
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
void SetUseAODConversionPhoton(Bool_t b)
TH1F * fHistoImpactParameterStudy
TH2F * fHistoNegTrackImpactParamZvsPt
void CountTPCoutTracks()
AliV0ReaderV1(const char *name="V0ReaderV1")
TString fPeriodName
TBits * fPCMv0BitField
Bool_t fUseImprovedVertex
virtual Bool_t Notify()
void SetUseConstructGamma(Bool_t flag)
TH2F * fHistoRecMCGammaPtvsPhi
iterator & operator=(const iterator &other)
TString fDeltaAODBranchName
TH2F * fHistoPosTrackImpactParamXvsPt
TH1F * fHistoNegTrackImpactParamY
TH2F * fHistoMCGammaRvsEta
Int_t fPreviousV0ReaderPerformsAODRelabeling
Bool_t InitializeCutsFromCutString(const TString analysisCutSelection)
virtual void Terminate(Option_t *)
const AliExternalTrackParam * GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge)
TList * GetImpactParamHistograms()
AliKFConversionPhoton * ReconstructV0(AliESDv0 *fCurrentV0, Int_t currentV0Index)
AliKFParticle * GetPositiveKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2])
vector< Int_t > fVectorFoundGammas
Bool_t fUseOwnXYZCalculation
bool operator!=(iterator &other) const
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
Bool_t fEventIsSelected
Int_t fImprovedPsiPair
Int_t GetPtHardFromFile()
void SetProduceImpactParamHistograms(Bool_t b)
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TH2F * fHistoPosTrackImpactParamYvsPt
TH1F * fHistoRdiff
TH2F * fHistoRecMCGammaRvsPhi
Bool_t fProduceV0findingEffi
TH2F * fHistoNegTrackImpactParamYvsPt
void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack *ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF)
TH1F * fHistoRecMCGammaMultiPt
AliConversionPhotonBase * operator[](int index) const
Array index operator.
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
TList * fImpactParamHistograms
const char Option_t
Definition: External.C:48
TClonesArray * fConversionGammas
Bool_t fRelabelAODs
const AliExternalTrackParam * GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel)
Bool_t ProcessESDV0s()
void SetDeltaAODFilename(TString s)
TH2F * fHistoMCGammaRvsPhi
void SetDeltaAODBranchName(TString string)
TH2F * fHistoMCGammaPtvsPhi
bool Bool_t
Definition: External.C:53
TH2F * fHistoMCGammaPtvsR
void SetAddv0sInESDFilter(Bool_t addv0s)
Definition: AliV0ReaderV1.h:97
Bool_t fUseMassToZero
TTree * fImpactParamTree
Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2])
void SetPeriodName(TString name)
void SetUseMassToZero(Bool_t b)
Bool_t GetAODConversionGammas()
AliKFParticle * GetNegativeKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2])
void SetEventCuts(const TString cut)
void UserCreateOutputObjects()
TH2F * fHistoMCGammaPtvsEta
virtual void UserExec(Option_t *option)
void RelabelAODs(Bool_t relabel=kTRUE)
TH2F * fHistoImpactParamZvsR2
iterator rend() const
Bool_t kAddv0sInESDFilter
TH2F * fHistoRecMCGammaRvsEta
TList * GetV0FindingEfficiencyHistograms()
TDirectoryFile * dir
TH2F * fHistoRecMCGammaMultiPtvsEta