AliPhysics  3b4a69f (3b4a69f)
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 CalculateSphericity();
101  void CalculateSphericityMCTrue(AliVEvent *inputEvent);
102  void CalculatePtMaxSector();
103 
104  void SetConversionCuts(const TString cut);
106  void SetEventCuts(const TString cut);
107  void SetEventCuts(AliConvEventCuts *cuts) {fEventCuts=cuts; return;}
108 
110  void SetUseConstructGamma(Bool_t flag) {fUseConstructGamma=flag; return;}
111  void SetUseAODConversionPhoton(Bool_t b) {if(b){ cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}
112  else { cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;}
113  kUseAODConversionPhoton=b; return;}
114 
115  void SetCreateAODs(Bool_t k=kTRUE) {fCreateAOD=k; return;}
118  fRelabelAODs = kTRUE;
119  AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));
120  AliInfo(Form("Relabeling of AODs has automatically been switched ON!"));
121  return;}
122 
123  void RelabelAODs(Bool_t relabel=kTRUE) {fRelabelAODs=relabel; return;}
126  void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
127  void SetPeriodName(TString name) {fPeriodName = name;
128  AliInfo(Form("Set PeriodName to: %s",fPeriodName.Data()));
129  return;}
140  void SetCalcSphericity(Bool_t set) {fCalcSphericity=set; return;}
141  void SetCalcSector(Bool_t set) {fCalcSector=set; return;}
144  void SetUseMassToZero (Bool_t b) {if(b){ cout<<"enable set mass to zero for AliAODConversionPhoton"<<endl;}
145  else { cout<<"disable set mass to zero for AliAODConversionPhoton "<<endl;}
146  fUseMassToZero=b; return;}
147 
149  if(b) AliInfo("Enabled V0finding Efficiency");
150  return;}
151 
155  if(b) AliInfo("Producing additional impact parameter histograms");
156  return;}
157 
160 
161  Bool_t ParticleIsConvertedPhoton(AliMCEvent *mcEvent, TParticle *particle, Double_t etaMax, Double_t rMax, Double_t zMax);
163  void FillRecMCHistosForV0FinderEffiESD( AliESDv0* currentV0);
164  void FillImpactParamHistograms(AliVTrack *ptrack, AliVTrack* ntrack, AliESDv0 *fCurrentV0, AliKFConversionPhoton *fCurrentMotherKF);
165  Bool_t CheckVectorOnly(vector<Int_t> &vec, Int_t tobechecked);
166  Bool_t CheckVectorForDoubleCount(vector<Int_t> &vec, Int_t tobechecked);
169 
170 
174  iterator rend() const {return iterator(this, iterator::kBackwardDirection, -1);}
175 
176  protected:
177  // Reconstruct Gammas
179  AliKFConversionPhoton* ReconstructV0(AliESDv0* fCurrentV0,Int_t currentV0Index);
180  void FillAODOutput();
181  void FindDeltaAODBranchName();
183 
184  // Getter Functions
185  const AliExternalTrackParam* GetExternalTrackParam(AliESDv0 *fCurrentV0, Int_t &tracklabel, Int_t charge);
186  const AliExternalTrackParam* GetExternalTrackParamP(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,1);}
187  const AliExternalTrackParam* GetExternalTrackParamN(AliESDv0 *fCurrentV0, Int_t &tracklabel) {return GetExternalTrackParam(fCurrentV0,tracklabel,-1);}
188  AliKFParticle* GetPositiveKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
189  AliKFParticle* GetNegativeKFParticle(AliAODv0 *fCurrentV0, Int_t fTrackLabel[2]);
190  AliKFParticle* GetPositiveKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
191  AliKFParticle* GetNegativeKFParticle(AliESDv0 *fCurrentV0, Int_t fTrackLabel[2]);
192 
193  Bool_t GetConversionPoint(const AliExternalTrackParam *pparam, const AliExternalTrackParam *nparam, Double_t convpos[3], Double_t dca[2]);
194  Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t center[2]);
195  Double_t GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam, const AliExternalTrackParam *negativeparam, const Double_t convpos[3]) const;
196  Bool_t kAddv0sInESDFilter; // Add PCM v0s to AOD created in ESD filter
197  TBits *fPCMv0BitField; // Pointer to bitfield of PCM v0s
198  AliConversionPhotonCuts *fConversionCuts; // Pointer to the ConversionCut Selection
199  AliConvEventCuts *fEventCuts; // Pointer to the EventCut Selection
200  TClonesArray *fConversionGammas; // TClonesArray holding the reconstructed photons
201  Bool_t fUseImprovedVertex; // set flag to improve primary vertex estimation by adding photons
202  Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
203  Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
204  Bool_t kUseAODConversionPhoton; // set flag to use AOD instead of KF output format for photons
205  Bool_t fCreateAOD; // set flag for AOD creation
206  TString fDeltaAODBranchName; // File where Gamma Conv AOD is located, if not in default AOD
207  TString fDeltaAODFilename; // set filename for delta/satellite aod
209  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
211  Int_t fNumberOfPrimaryTracks; // Number of Primary Tracks in AOD or ESD
212  Int_t fNumberOfTPCoutTracks; // Number of TPC Tracks with TPCout flag
213  Bool_t fCalcSphericity; // enable sphericity calculation
214  Bool_t fCalcSector; // enable sector of ptmax particle calculation
215  Double_t fSphericity; // Sphericity of the event
216  Double_t fSphericityAxisMainPhi; // Phi of the main sphericity axis
217  Double_t fSphericityAxisSecondaryPhi; // Phi of the secondary sphericity axis
218  Bool_t fInEMCalAcceptance; // Flag for the sphericity axis in the EMCal acceptance
219  Int_t fNumberOfRecTracks; // Number of reconstructed tracks used in sphericity calculation
220  Double_t fSphericityTrue; // True sphericity of the event
221  Int_t fNumberOfTruePrimaryTracks; // True number of primary tracks used in sphericity calculation
222  Int_t fPtMaxSector; // Sector of the detector with the maximum pt particle
224  Int_t fPtHardBin; // ptHard bin from file
225  Bool_t fUseMassToZero; // switch on setting the mass to 0 for AODConversionPhotons
226  Bool_t fProduceV0findingEffi; // enable histograms for V0finding efficiency
227  Bool_t fProduceImpactParamHistograms; // enable histograms of impact parameters
228  Float_t fCurrentInvMassPair; // Invariant mass of the pair
229  Int_t fImprovedPsiPair; // enables the calculation of PsiPair after the precise calculation of R and use of the proper function for propagation
230  TList *fHistograms; // list of histograms for V0 finding efficiency
231  TList *fImpactParamHistograms; // list of histograms of impact parameters
232  TH2F *fHistoMCGammaPtvsR; // histogram with all converted gammas vs Pt and R (eta < 0.9)
233  TH2F *fHistoMCGammaPtvsPhi; // histogram with all converted gammas vs Pt and Phi (eta < 0.9)
234  TH2F *fHistoMCGammaPtvsEta; // histogram with all converted gammas vs Pt and Eta
235  TH2F *fHistoMCGammaRvsPhi; // histogram with all converted gammas vs R and Phi (eta < 0.9)
236  TH2F *fHistoMCGammaRvsEta; // histogram with all converted gammas vs R and Eta
237  TH2F *fHistoMCGammaPhivsEta; // histogram with all converted gammas vs Phi and Eta
238  TH2F *fHistoRecMCGammaPtvsR; // histogram with all reconstructed converted gammas vs Pt and R (eta < 0.9)
239  TH2F *fHistoRecMCGammaPtvsPhi; // histogram with all reconstructed converted gammas vs Pt and Phi (eta < 0.9)
240  TH2F *fHistoRecMCGammaPtvsEta; // histogram with all reconstructed converted gammas vs Pt and Eta
241  TH2F *fHistoRecMCGammaRvsPhi; // histogram with all reconstructed converted gammas vs R and Phi (eta < 0.9)
242  TH2F *fHistoRecMCGammaRvsEta; // histogram with all reconstructed converted gammas vs R and Eta
243  TH2F *fHistoRecMCGammaPhivsEta; // histogram with all reconstructed converted gammas vs Phi and Eta
244  TH1F *fHistoRecMCGammaMultiPt; // histogram with all at least double counted photons vs Pt (eta < 0.9)
245  TH2F *fHistoRecMCGammaMultiPtvsEta; // histogram with all at least double counted photons vs Pt vs Eta
246  TH1F *fHistoRecMCGammaMultiR; // histogram with all at least double counted photons vs R (eta < 0.9)
247  TH1F *fHistoRecMCGammaMultiPhi; // histogram with all at least double counted photons vs Phi (eta < 0.9)
248  TH1F *fHistoPosTrackImpactParamZ; //impact parameter z of positive track of V0
260  TH2F *fHistoImpactParamZvsR; // conversion point z vs conversion radius
261  TH2F *fHistoImpactParamZvsR2; // after cuts
262  TH1F *fHistoPt;
263  TH1F *fHistoPt2; // Pt after Impact parameter and causality cuts
265  TH1F *fHistoDCAzPhoton2; // photon dca after impact parameter and causality cuts
266  TH1F *fHistoR; // conversion radius
267  TH1F *fHistoRrecalc; // recalculated conversion radius
268  TH1F *fHistoRviaAlpha; // conversion radius
269  TH1F *fHistoRviaAlphaRecalc; // recalculated conversion radius
270  TH1F *fHistoRdiff; // difference in R between conflict cluster and conversion radius
271  TH1F *fHistoImpactParameterStudy; // info about which cut rejected how many V0s
272  TTree *fImpactParamTree; // tree with y, pt and conversion radius
273 
274  vector<Int_t> fVectorFoundGammas; // vector with found MC labels of gammas
275  TString fCurrentFileName; // current file name
276  Bool_t fMCFileChecked; // vector with MC file names which are broken
277 
278  private:
279  AliV0ReaderV1(AliV0ReaderV1 &original);
281 
282 
283  ClassDef(AliV0ReaderV1, 21)
284 
285 };
286 
287 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
288 #pragma GCC diagnostic pop
289 #endif
290 
292  if(fConversionCuts != NULL){
293  delete fConversionCuts;
294  fConversionCuts=NULL;
295  }
296  if(fConversionCuts == NULL){
297  fConversionCuts = new AliConversionPhotonCuts("V0ReaderCuts","V0ReaderCuts");
299  }
300 }
301 
302 inline void AliV0ReaderV1::SetEventCuts(const TString cut){
303  if(fEventCuts != NULL){
304  delete fEventCuts;
305  fEventCuts=NULL;
306  }
307  if(fEventCuts == NULL){
308  fEventCuts = new AliConvEventCuts("V0ReaderEventCuts","V0ReaderEventCuts");
310  }
311 }
312 
313 #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
Bool_t fCalcSector
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)
Double_t fSphericityTrue
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)
void CalculateSphericityMCTrue(AliVEvent *inputEvent)
Double_t GetSphericityTrue()
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*()
Bool_t fCalcSphericity
TString GetCurrentFileName()
Definition: AliV0ReaderV1.h:95
TString GetPeriodName()
TH1F * fHistoPosTrackImpactParamY
void CalculateSphericity()
TH1F * fHistoDCAzPhoton
TList * GetCutHistograms()
Definition: AliV0ReaderV1.h:91
Bool_t IsSphericityAxisInEMCalAcceptance()
virtual void Init()
void SetCalcSphericity(Bool_t set)
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
Double_t fSphericityAxisMainPhi
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
Int_t GetNumberOfRecTracks()
Bool_t GetProduceV0FindingEfficiency()
Bool_t kUseAODConversionPhoton
TList * fHistograms
Bool_t GetProduceImpactParamHistograms()
iterator begin() const
Int_t fNumberOfTPCoutTracks
void SetCalcSector(Bool_t set)
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()
Double_t GetPhiMainSphericityAxis()
Double_t GetPhiSecondarySphericityAxis()
Bool_t ProcessEvent(AliVEvent *inputEvent, AliMCEvent *mcEvent=NULL)
float Float_t
Definition: External.C:68
Double_t fSphericity
void SetEventCuts(AliConvEventCuts *cuts)
Int_t fNumberOfRecTracks
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
void CalculatePtMaxSector()
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
Double_t fSphericityAxisSecondaryPhi
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
Int_t GetNumberOfTruePrimaryTracks()
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 fInEMCalAcceptance
Double_t GetSphericity()
Int_t GetPtMaxSector()
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
Int_t fNumberOfTruePrimaryTracks
TH2F * fHistoRecMCGammaMultiPtvsEta