AliPhysics  d497547 (d497547)
 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 using namespace std;
33 
35 
36  public:
37 
38  class iterator : public std::iterator<std::bidirectional_iterator_tag, AliConversionPhotonBase> {
39  public:
40  enum Direction_t {
41  kForwardDirection = 0,
42  kBackwardDirection = 1
43  };
44  iterator(const AliV0ReaderV1 *reader, Direction_t dir, int position);
45  iterator(const iterator &other);
46  iterator &operator=(const iterator &other);
47  virtual ~iterator() {}
48 
49  bool operator!=(iterator &other) const;
50  iterator operator++(int);
51  iterator &operator++();
52  iterator operator--(int);
53  iterator &operator--();
54  AliConversionPhotonBase *operator*();
55 
56  private:
60  };
61 
62  AliV0ReaderV1(const char *name="V0ReaderV1");
63  virtual ~AliV0ReaderV1(); //virtual destructor
64 
65  void UserCreateOutputObjects();
66  virtual Bool_t Notify();
67  virtual void UserExec(Option_t *option);
68  virtual void Terminate(Option_t *);
69  virtual void Init();
70 
71  Bool_t ProcessEvent (AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL);
72  Bool_t IsEventSelected() {return fEventIsSelected;}
73 
74  // Return Reconstructed Gammas
75  TClonesArray* GetReconstructedGammas() const {return fConversionGammas;}
76  Int_t GetNReconstructedGammas() const {if(fConversionGammas){return fConversionGammas->GetEntriesFast();} else{ return 0;}}
77  AliConversionPhotonBase *operator[](int index) const;
78 
79  AliConversionPhotonCuts* GetConversionCuts() {return fConversionCuts;}
80  AliConvEventCuts* GetEventCuts() {return fEventCuts;}
81  TList* GetCutHistograms() {if(fConversionCuts) {return fConversionCuts->GetCutHistograms();}
82  return NULL;}
83  TList* GetEventCutHistograms() {if(fEventCuts) {return fEventCuts->GetCutHistograms();}
84  return NULL;}
85  TString GetCurrentFileName() {return fCurrentFileName;}
86  // Set Options
87  void SetAddv0sInESDFilter(Bool_t addv0s) {kAddv0sInESDFilter = addv0s;}
88  void CountTracks();
89  void CountTPCoutTracks();
90  void SetConversionCuts(const TString cut);
91  void SetConversionCuts(AliConversionPhotonCuts *cuts) {fConversionCuts=cuts; return;}
92  void SetEventCuts(const TString cut);
93  void SetEventCuts(AliConvEventCuts *cuts) {fEventCuts=cuts; return;}
94 
95  void SetUseOwnXYZCalculation(Bool_t flag) {fUseOwnXYZCalculation=flag; return;}
96  void SetUseConstructGamma(Bool_t flag) {fUseConstructGamma=flag; return;}
97  void SetUseAODConversionPhoton(Bool_t b) {if(b){ cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}
98  else { cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;}
99  kUseAODConversionPhoton=b; return;}
100 
101  void SetCreateAODs(Bool_t k=kTRUE) {fCreateAOD=k; return;}
102  void SetDeltaAODFilename(TString s) {fDeltaAODFilename=s; return;}
103  void SetDeltaAODBranchName(TString string) {fDeltaAODBranchName = string;
104  fRelabelAODs = kTRUE;
105  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
106  AliInfo(Form("Relabeling of AODs has automatically been switched ON!"));
107  return;}
108 
109  void RelabelAODs(Bool_t relabel=kTRUE) {fRelabelAODs=relabel; return;}
110  Bool_t AreAODsRelabeled() {return fRelabelAODs;}
111  Int_t IsReaderPerformingRelabeling() {return fPreviousV0ReaderPerformsAODRelabeling;}
112  void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
113  void SetPeriodName(TString name) {fPeriodName = name;
114  AliInfo(Form("Set PeriodName to: %s",fPeriodName.Data()));
115  return;}
116  TString GetPeriodName() {return fPeriodName;}
117  Int_t GetPtHardFromFile() {return fPtHardBin;}
118  Int_t GetNumberOfPrimaryTracks() {return fNumberOfPrimaryTracks;}
119  Int_t GetNumberOfTPCoutTracks() {return fNumberOfTPCoutTracks;}
120  void SetUseMassToZero (Bool_t b) {if(b){ cout<<"enable set mass to zero for AliAODConversionPhoton"<<endl;}
121  else { cout<<"disable set mass to zero for AliAODConversionPhoton "<<endl;}
122  fUseMassToZero=b; return;}
123 
124  void SetProduceV0FindingEfficiency(Bool_t b) {fProduceV0findingEffi = b;
125  if(b) AliInfo("Enabled V0finding Efficiency");
126  return;}
127 
128  Bool_t GetProduceV0FindingEfficiency() {return fProduceV0findingEffi;}
129  TList* GetV0FindingEfficiencyHistograms() {return fHistograms;}
130  void SetProduceImpactParamHistograms(Bool_t b) {fProduceImpactParamHistograms = b;
131  if(b) AliInfo("Producing additional impact parameter histograms");
132  return;}
133 
134  Bool_t GetProduceImpactParamHistograms() {return fProduceImpactParamHistograms;}
135  TList* GetImpactParamHistograms() {return fImpactParamHistograms;}
136 
137  Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax);
138  void CreatePureMCHistosForV0FinderEffiESD();
139  void FillRecMCHistosForV0FinderEffiESD( AliESDv0* currentV0);
140  void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack* ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF);
141  Bool_t CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked);
142  Bool_t CheckVectorForDoubleCount(vector<Int_t> &vec, Int_t tobechecked);
143  void SetImprovedPsiPair(Int_t p) {fImprovedPsiPair=p;return;}
144  Int_t GetImprovedPsiPair() {return fImprovedPsiPair;}
145 
146  iterator begin() const {return iterator(this, iterator::kForwardDirection, 0);}
147  iterator end() const {return iterator(this, iterator::kForwardDirection, GetNReconstructedGammas());}
148  iterator rbegin() const {return iterator(this, iterator::kBackwardDirection, GetNReconstructedGammas() -1); }
149  iterator rend() const {return iterator(this, iterator::kBackwardDirection, -1);}
150 
151  protected:
152  // Reconstruct Gammas
153  Bool_t ProcessESDV0s();
154  AliKFConversionPhoton* ReconstructV0(AliESDv0* fCurrentV0,Int_t currentV0Index);
155  void FillAODOutput();
156  void FindDeltaAODBranchName();
157  Bool_t GetAODConversionGammas();
158 
159  // Getter Functions
160  const AliExternalTrackParam* GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge);
161  const AliExternalTrackParam* GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,1);}
162  const AliExternalTrackParam* GetExternalTrackParamN(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,-1);}
163  AliKFParticle* GetPositiveKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
164  AliKFParticle* GetNegativeKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
165  AliKFParticle* GetPositiveKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
166  AliKFParticle* GetNegativeKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
167 
168  Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2]);
169  Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2]);
170  Double_t GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const;
171  Bool_t kAddv0sInESDFilter; // Add PCM v0s to AOD created in ESD filter
172  TBits *fPCMv0BitField; // Pointer to bitfield of PCM v0s
173  AliConversionPhotonCuts *fConversionCuts; // Pointer to the ConversionCut Selection
174  AliConvEventCuts *fEventCuts; // Pointer to the ConversionCut Selection
175  TClonesArray *fConversionGammas; // TClonesArray holding the reconstructed photons
176  Bool_t fUseImprovedVertex; // set flag to improve primary vertex estimation by adding photons
177  Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
178  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
179  Bool_t kUseAODConversionPhoton; // set flag to use AOD instead of KF output format for photons
180  Bool_t fCreateAOD; // set flag for AOD creation
181  TString fDeltaAODBranchName; // File where Gamma Conv AOD is located, if not in default AOD
182  TString fDeltaAODFilename; // set filename for delta/satellite aod
184  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
186  Int_t fNumberOfPrimaryTracks; // Number of Primary Tracks in AOD or ESD
187  Int_t fNumberOfTPCoutTracks; // Number of TPC Tracks with TPCout flag
189  Int_t fPtHardBin; // ptHard bin from file
190  Bool_t fUseMassToZero; // switch on setting the mass to 0 for AODConversionPhotons
191  Bool_t fProduceV0findingEffi; // enable histograms for V0finding efficiency
192  Bool_t fProduceImpactParamHistograms; // enable histograms of impact parameters
193  Float_t fCurrentInvMassPair; // Invariant mass of the pair
194  Int_t fImprovedPsiPair; // enables the calculation of PsiPair after the precise calculation of R and use of the proper function for propagation
195  TList *fHistograms; // list of histograms for V0 finding efficiency
196  TList *fImpactParamHistograms; // list of histograms of impact parameters
197  TH2F *fHistoMCGammaPtvsR; // histogram with all converted gammas vs Pt and R (eta < 0.9)
198  TH2F *fHistoMCGammaPtvsPhi; // histogram with all converted gammas vs Pt and Phi (eta < 0.9)
199  TH2F *fHistoMCGammaPtvsEta; // histogram with all converted gammas vs Pt and Eta
200  TH2F *fHistoMCGammaRvsPhi; // histogram with all converted gammas vs R and Phi (eta < 0.9)
201  TH2F *fHistoMCGammaRvsEta; // histogram with all converted gammas vs R and Eta
202  TH2F *fHistoMCGammaPhivsEta; // histogram with all converted gammas vs Phi and Eta
203  TH2F *fHistoRecMCGammaPtvsR; // histogram with all reconstructed converted gammas vs Pt and R (eta < 0.9)
204  TH2F *fHistoRecMCGammaPtvsPhi; // histogram with all reconstructed converted gammas vs Pt and Phi (eta < 0.9)
205  TH2F *fHistoRecMCGammaPtvsEta; // histogram with all reconstructed converted gammas vs Pt and Eta
206  TH2F *fHistoRecMCGammaRvsPhi; // histogram with all reconstructed converted gammas vs R and Phi (eta < 0.9)
207  TH2F *fHistoRecMCGammaRvsEta; // histogram with all reconstructed converted gammas vs R and Eta
208  TH2F *fHistoRecMCGammaPhivsEta; // histogram with all reconstructed converted gammas vs Phi and Eta
209  TH1F *fHistoRecMCGammaMultiPt; // histogram with all at least double counted photons vs Pt (eta < 0.9)
210  TH2F *fHistoRecMCGammaMultiPtvsEta; // histogram with all at least double counted photons vs Pt vs Eta
211  TH1F *fHistoRecMCGammaMultiR; // histogram with all at least double counted photons vs R (eta < 0.9)
212  TH1F *fHistoRecMCGammaMultiPhi; // histogram with all at least double counted photons vs Phi (eta < 0.9)
213  TH1F *fHistoPosTrackImpactParamZ; //impact parameter z of positive track of V0
225  TH2F *fHistoImpactParamZvsR; // conversion point z vs conversion radius
226  TH2F *fHistoImpactParamZvsR2; // after cuts
227  TH1F *fHistoPt;
228  TH1F *fHistoPt2; // Pt after Impact parameter and causality cuts
230  TH1F *fHistoDCAzPhoton2; // photon dca after impact parameter and causality cuts
231  TH1F *fHistoR; // conversion radius
232  TH1F *fHistoRrecalc; // recalculated conversion radius
233  TH1F *fHistoRviaAlpha; // conversion radius
234  TH1F *fHistoRviaAlphaRecalc; // recalculated conversion radius
235  TH1F *fHistoRdiff; // difference in R between conflict cluster and conversion radius
236  TH1F *fHistoImpactParameterStudy; // info about which cut rejected how many V0s
237  TTree *fImpactParamTree; // tree with y, pt and conversion radius
238 
239  vector<Int_t> fVectorFoundGammas; // vector with found MC labels of gammas
240  TString fCurrentFileName; // current file name
241  Bool_t fMCFileChecked; // vector with MC file names which are broken
242 
243  private:
244  AliV0ReaderV1(AliV0ReaderV1 &original);
245  AliV0ReaderV1 &operator=(const AliV0ReaderV1 &ref);
246 
247  ClassDef(AliV0ReaderV1, 16)
248 
249 };
250 
252  if(fConversionCuts != NULL){
253  delete fConversionCuts;
254  fConversionCuts=NULL;
255  }
256  if(fConversionCuts == NULL){
257  fConversionCuts=new AliConversionPhotonCuts("V0ReaderCuts","V0ReaderCuts");
258  fConversionCuts->InitializeCutsFromCutString(cut.Data());
259  }
260 }
261 
262 inline void AliV0ReaderV1::SetEventCuts(const TString cut){
263  if(fEventCuts != NULL){
264  delete fEventCuts;
265  fEventCuts=NULL;
266  }
267  if(fEventCuts == NULL){
268  fEventCuts=new AliConvEventCuts("V0ReaderEventCuts","V0ReaderEventCuts");
269  fEventCuts->InitializeCutsFromCutString(cut.Data());
270  }
271 }
272 
273 #endif
Int_t IsReaderPerformingRelabeling()
Int_t charge
Direction_t fDirection
Iterator in forward direction.
Definition: AliV0ReaderV1.h:59
void SetCreateAODs(Bool_t k=kTRUE)
TH1F * fHistoNegTrackImpactParamZ
TH2F * fHistoPosTrackImpactParamZvsPt
double Double_t
Definition: External.C:58
Bool_t fUseConstructGamma
TH2F * fHistoRecMCGammaPhivsEta
Bool_t fMCFileChecked
Definition: External.C:236
Int_t GetNReconstructedGammas() const
Definition: AliV0ReaderV1.h:76
void SetConversionCuts(const TString cut)
TH2F * fHistoImpactParamZvsR
TH1F * fHistoPosTrackImpactParamX
TH1F * fHistoRviaAlphaRecalc
Bool_t AreAODsRelabeled()
const AliV0ReaderV1 * fkData
V0 reader used to iterate over.
Definition: AliV0ReaderV1.h:57
Bool_t IsEventSelected()
Definition: AliV0ReaderV1.h:72
TString fDeltaAODFilename
TH1F * fHistoRecMCGammaMultiPhi
Int_t fNumberOfPrimaryTracks
Int_t GetNumberOfPrimaryTracks()
Float_t fCurrentInvMassPair
TH2F * fHistoRecMCGammaPtvsR
TList * GetEventCutHistograms()
Definition: AliV0ReaderV1.h:83
void SetUseOwnXYZCalculation(Bool_t flag)
Definition: AliV0ReaderV1.h:95
TString GetCurrentFileName()
Definition: AliV0ReaderV1.h:85
TString GetPeriodName()
TH1F * fHistoPosTrackImpactParamY
TH1F * fHistoDCAzPhoton
TList * GetCutHistograms()
Definition: AliV0ReaderV1.h:81
void SetProduceV0FindingEfficiency(Bool_t b)
TH1F * fHistoDCAzPhoton2
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)
Definition: AliV0ReaderV1.h:91
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:58
AliConversionPhotonCuts * fConversionCuts
int Int_t
Definition: External.C:63
iterator end() const
TH1F * fHistoRrecalc
TH1F * fHistoPosTrackImpactParamZ
Bool_t fProduceImpactParamHistograms
float Float_t
Definition: External.C:68
void SetEventCuts(AliConvEventCuts *cuts)
Definition: AliV0ReaderV1.h:93
Int_t GetNumberOfTPCoutTracks()
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:79
TH1F * fHistoRecMCGammaMultiR
TString fCurrentFileName
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TH1F * fHistoRviaAlpha
void SetUseAODConversionPhoton(Bool_t b)
Definition: AliV0ReaderV1.h:97
TH1F * fHistoImpactParameterStudy
TH2F * fHistoNegTrackImpactParamZvsPt
TString fPeriodName
TBits * fPCMv0BitField
Bool_t fUseImprovedVertex
void SetUseConstructGamma(Bool_t flag)
Definition: AliV0ReaderV1.h:96
TH2F * fHistoRecMCGammaPtvsPhi
TString fDeltaAODBranchName
TH2F * fHistoPosTrackImpactParamXvsPt
TH1F * fHistoNegTrackImpactParamY
TH2F * fHistoMCGammaRvsEta
Int_t fPreviousV0ReaderPerformsAODRelabeling
TList * GetImpactParamHistograms()
vector< Int_t > fVectorFoundGammas
Bool_t fUseOwnXYZCalculation
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:75
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
TH1F * fHistoRecMCGammaMultiPt
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:80
TList * fImpactParamHistograms
const char Option_t
Definition: External.C:48
TClonesArray * fConversionGammas
Bool_t fRelabelAODs
const AliExternalTrackParam * GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel)
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:87
Bool_t fUseMassToZero
TTree * fImpactParamTree
void SetPeriodName(TString name)
void SetUseMassToZero(Bool_t b)
void SetEventCuts(const TString cut)
TH2F * fHistoMCGammaPtvsEta
void RelabelAODs(Bool_t relabel=kTRUE)
TH2F * fHistoImpactParamZvsR2
iterator rend() const
Bool_t kAddv0sInESDFilter
TH2F * fHistoRecMCGammaRvsEta
TList * GetV0FindingEfficiencyHistograms()
TDirectoryFile * dir
TH2F * fHistoRecMCGammaMultiPtvsEta