AliPhysics  fffcdf3 (fffcdf3)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  void SetConversionCuts(const TString cut);
102  void SetEventCuts(const TString cut);
103  void SetEventCuts(AliConvEventCuts *cuts) {fEventCuts=cuts; return;}
104 
106  void SetUseConstructGamma(Bool_t flag) {fUseConstructGamma=flag; return;}
107  void SetUseAODConversionPhoton(Bool_t b) {if(b){ cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}
108  else { cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;}
109  kUseAODConversionPhoton=b; return;}
110 
111  void SetCreateAODs(Bool_t k=kTRUE) {fCreateAOD=k; return;}
114  fRelabelAODs = kTRUE;
115  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
116  AliInfo(Form("Relabeling of AODs has automatically been switched ON!"));
117  return;}
118 
119  void RelabelAODs(Bool_t relabel=kTRUE) {fRelabelAODs=relabel; return;}
122  void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
123  void SetPeriodName(TString name) {fPeriodName = name;
124  AliInfo(Form("Set PeriodName to: %s",fPeriodName.Data()));
125  return;}
130  void SetUseMassToZero (Bool_t b) {if(b){ cout<<"enable set mass to zero for AliAODConversionPhoton"<<endl;}
131  else { cout<<"disable set mass to zero for AliAODConversionPhoton "<<endl;}
132  fUseMassToZero=b; return;}
133 
135  if(b) AliInfo("Enabled V0finding Efficiency");
136  return;}
137 
141  if(b) AliInfo("Producing additional impact parameter histograms");
142  return;}
143 
146 
147  Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax);
149  void FillRecMCHistosForV0FinderEffiESD( AliESDv0* currentV0);
150  void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack* ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF);
151  Bool_t CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked);
152  Bool_t CheckVectorForDoubleCount(vector<Int_t> &vec, Int_t tobechecked);
155 
159  iterator rend() const {return iterator(this, iterator::kBackwardDirection, -1);}
160 
161  protected:
162  // Reconstruct Gammas
164  AliKFConversionPhoton* ReconstructV0(AliESDv0* fCurrentV0,Int_t currentV0Index);
165  void FillAODOutput();
166  void FindDeltaAODBranchName();
168 
169  // Getter Functions
170  const AliExternalTrackParam* GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge);
171  const AliExternalTrackParam* GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,1);}
172  const AliExternalTrackParam* GetExternalTrackParamN(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,-1);}
173  AliKFParticle* GetPositiveKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
174  AliKFParticle* GetNegativeKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
175  AliKFParticle* GetPositiveKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
176  AliKFParticle* GetNegativeKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
177 
178  Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2]);
179  Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2]);
180  Double_t GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const;
181  Bool_t kAddv0sInESDFilter; // Add PCM v0s to AOD created in ESD filter
182  TBits *fPCMv0BitField; // Pointer to bitfield of PCM v0s
183  AliConversionPhotonCuts *fConversionCuts; // Pointer to the ConversionCut Selection
184  AliConvEventCuts *fEventCuts; // Pointer to the ConversionCut Selection
185  TClonesArray *fConversionGammas; // TClonesArray holding the reconstructed photons
186  Bool_t fUseImprovedVertex; // set flag to improve primary vertex estimation by adding photons
187  Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
188  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
189  Bool_t kUseAODConversionPhoton; // set flag to use AOD instead of KF output format for photons
190  Bool_t fCreateAOD; // set flag for AOD creation
191  TString fDeltaAODBranchName; // File where Gamma Conv AOD is located, if not in default AOD
192  TString fDeltaAODFilename; // set filename for delta/satellite aod
194  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
196  Int_t fNumberOfPrimaryTracks; // Number of Primary Tracks in AOD or ESD
197  Int_t fNumberOfTPCoutTracks; // Number of TPC Tracks with TPCout flag
199  Int_t fPtHardBin; // ptHard bin from file
200  Bool_t fUseMassToZero; // switch on setting the mass to 0 for AODConversionPhotons
201  Bool_t fProduceV0findingEffi; // enable histograms for V0finding efficiency
202  Bool_t fProduceImpactParamHistograms; // enable histograms of impact parameters
203  Float_t fCurrentInvMassPair; // Invariant mass of the pair
204  Int_t fImprovedPsiPair; // enables the calculation of PsiPair after the precise calculation of R and use of the proper function for propagation
205  TList *fHistograms; // list of histograms for V0 finding efficiency
206  TList *fImpactParamHistograms; // list of histograms of impact parameters
207  TH2F *fHistoMCGammaPtvsR; // histogram with all converted gammas vs Pt and R (eta < 0.9)
208  TH2F *fHistoMCGammaPtvsPhi; // histogram with all converted gammas vs Pt and Phi (eta < 0.9)
209  TH2F *fHistoMCGammaPtvsEta; // histogram with all converted gammas vs Pt and Eta
210  TH2F *fHistoMCGammaRvsPhi; // histogram with all converted gammas vs R and Phi (eta < 0.9)
211  TH2F *fHistoMCGammaRvsEta; // histogram with all converted gammas vs R and Eta
212  TH2F *fHistoMCGammaPhivsEta; // histogram with all converted gammas vs Phi and Eta
213  TH2F *fHistoRecMCGammaPtvsR; // histogram with all reconstructed converted gammas vs Pt and R (eta < 0.9)
214  TH2F *fHistoRecMCGammaPtvsPhi; // histogram with all reconstructed converted gammas vs Pt and Phi (eta < 0.9)
215  TH2F *fHistoRecMCGammaPtvsEta; // histogram with all reconstructed converted gammas vs Pt and Eta
216  TH2F *fHistoRecMCGammaRvsPhi; // histogram with all reconstructed converted gammas vs R and Phi (eta < 0.9)
217  TH2F *fHistoRecMCGammaRvsEta; // histogram with all reconstructed converted gammas vs R and Eta
218  TH2F *fHistoRecMCGammaPhivsEta; // histogram with all reconstructed converted gammas vs Phi and Eta
219  TH1F *fHistoRecMCGammaMultiPt; // histogram with all at least double counted photons vs Pt (eta < 0.9)
220  TH2F *fHistoRecMCGammaMultiPtvsEta; // histogram with all at least double counted photons vs Pt vs Eta
221  TH1F *fHistoRecMCGammaMultiR; // histogram with all at least double counted photons vs R (eta < 0.9)
222  TH1F *fHistoRecMCGammaMultiPhi; // histogram with all at least double counted photons vs Phi (eta < 0.9)
223  TH1F *fHistoPosTrackImpactParamZ; //impact parameter z of positive track of V0
235  TH2F *fHistoImpactParamZvsR; // conversion point z vs conversion radius
236  TH2F *fHistoImpactParamZvsR2; // after cuts
237  TH1F *fHistoPt;
238  TH1F *fHistoPt2; // Pt after Impact parameter and causality cuts
240  TH1F *fHistoDCAzPhoton2; // photon dca after impact parameter and causality cuts
241  TH1F *fHistoR; // conversion radius
242  TH1F *fHistoRrecalc; // recalculated conversion radius
243  TH1F *fHistoRviaAlpha; // conversion radius
244  TH1F *fHistoRviaAlphaRecalc; // recalculated conversion radius
245  TH1F *fHistoRdiff; // difference in R between conflict cluster and conversion radius
246  TH1F *fHistoImpactParameterStudy; // info about which cut rejected how many V0s
247  TTree *fImpactParamTree; // tree with y, pt and conversion radius
248 
249  vector<Int_t> fVectorFoundGammas; // vector with found MC labels of gammas
250  TString fCurrentFileName; // current file name
251  Bool_t fMCFileChecked; // vector with MC file names which are broken
252 
253  private:
254  AliV0ReaderV1(AliV0ReaderV1 &original);
256 
257  ClassDef(AliV0ReaderV1, 16)
258 
259 };
260 
261 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
262 #pragma GCC diagnostic pop
263 #endif
264 
266  if(fConversionCuts != NULL){
267  delete fConversionCuts;
268  fConversionCuts=NULL;
269  }
270  if(fConversionCuts == NULL){
271  fConversionCuts=new AliConversionPhotonCuts("V0ReaderCuts","V0ReaderCuts");
273  }
274 }
275 
276 inline void AliV0ReaderV1::SetEventCuts(const TString cut){
277  if(fEventCuts != NULL){
278  delete fEventCuts;
279  fEventCuts=NULL;
280  }
281  if(fEventCuts == NULL){
282  fEventCuts=new AliConvEventCuts("V0ReaderEventCuts","V0ReaderEventCuts");
284  }
285 }
286 
287 #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
AliV0ReaderV1 & operator=(const AliV0ReaderV1 &ref)
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