]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliV0ReaderV1.h
Merge remote-tracking branch 'origin/flatdev' into mergeFlat2Master
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliV0ReaderV1.h
1 #ifndef ALIV0READERV1_H
2 #define ALIV0READERV1_H
3
4 #include "AliAnalysisTaskSE.h"
5 #include "AliAODv0.h"
6 #include "AliESDv0.h"
7 #include "AliConversionPhotonCuts.h"
8 #include "AliConvEventCuts.h"
9 #include "AliExternalTrackParam.h"
10 #include "TObject.h"
11 #include "AliMCEvent.h"   // for CF
12 #include "AliESDEvent.h"
13 #include "AliKFParticle.h"
14 #include "TParticle.h"
15 #include <vector>
16 #include "AliESDpid.h"
17 #include "TF1.h"
18 #include "TRandom3.h"
19 #include "AliAnalysisManager.h"
20
21 class AliConversionPhotonBase;
22 class TRandom3;
23 class AliStack;
24 class TList;
25 class AliKFConversionPhoton;
26 class TString;
27 class TClonesArray;
28 class TH1F;
29 class TH2F;
30 class AliAODConversionPhoton;
31
32 using namespace std;
33
34 class AliV0ReaderV1 : public AliAnalysisTaskSE {
35
36         public:
37
38                 AliV0ReaderV1(const char *name="V0ReaderV1");
39                 virtual ~AliV0ReaderV1();                            //virtual destructor
40                 void UserCreateOutputObjects();
41                 virtual Bool_t Notify();
42                 virtual void UserExec(Option_t *option);
43                 virtual void Terminate(Option_t *);
44                 virtual void Init();
45
46                 Bool_t ProcessEvent(AliVEvent *inputEvent,AliMCEvent *mcEvent=NULL);
47                 Bool_t IsEventSelected(){return fEventIsSelected;}
48
49                 // Return Reconstructed Gammas
50                 TClonesArray *GetReconstructedGammas(){return fConversionGammas;}
51                 Int_t GetNReconstructedGammas(){if(fConversionGammas){return fConversionGammas->GetEntriesFast();}else{return 0;}}
52                 
53                 AliConversionPhotonCuts *GetConversionCuts(){return fConversionCuts;}
54                 AliConvEventCuts *GetEventCuts(){return fEventCuts;}
55                 TList *GetCutHistograms(){if(fConversionCuts){return fConversionCuts->GetCutHistograms();}return NULL;}
56                 TList *GetEventCutHistograms(){if(fEventCuts){return fEventCuts->GetCutHistograms();}return NULL;}
57                 // Set Options
58
59                 void CountTracks();
60                 void SetConversionCuts(const TString cut);
61                 void SetConversionCuts(AliConversionPhotonCuts *cuts){fConversionCuts=cuts;}
62                 void SetEventCuts(const TString cut);
63                 void SetEventCuts(AliConvEventCuts *cuts){fEventCuts=cuts;}
64
65                 void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
66                 void SetUseConstructGamma(Bool_t flag){fUseConstructGamma=flag;}
67                 void SetUseAODConversionPhoton(Bool_t b){if(b){cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}else{cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;};kUseAODConversionPhoton=b;}
68                 void SetCreateAODs(Bool_t k=kTRUE){fCreateAOD=k;}
69                 void SetDeltaAODFilename(TString s){fDeltaAODFilename=s;}
70                 void SetDeltaAODBranchName(TString string) { fDeltaAODBranchName = string;AliInfo(Form("Set DeltaAOD BranchName to: %s",fDeltaAODBranchName.Data()));}
71                 void RelabelAODs(Bool_t relabel=kTRUE){fRelabelAODs=relabel;}
72                 Bool_t AreAODsRelabeled(){return fRelabelAODs;}
73                 void RelabelAODPhotonCandidates(AliAODConversionPhoton *PhotonCandidate);
74                 TString GetPeriodName(){return fPeriodName;}
75                 Int_t GetNumberOfPrimaryTracks(){return fNumberOfPrimaryTracks;}
76         
77         protected:
78                 // Reconstruct Gammas
79                 Bool_t ProcessESDV0s();
80                 AliKFConversionPhoton *ReconstructV0(AliESDv0* fCurrentV0,Int_t currentV0Index);
81                 void FillAODOutput();
82                 void FindDeltaAODBranchName();
83                 Bool_t GetAODConversionGammas();
84
85                 // Getter Functions
86
87                 const AliExternalTrackParam *GetExternalTrackParam(AliESDv0 *fCurrentV0,Int_t &tracklabel,Int_t charge);
88                 const AliExternalTrackParam *GetExternalTrackParamP(AliESDv0 *fCurrentV0,Int_t &tracklabel){return GetExternalTrackParam(fCurrentV0,tracklabel,1);};
89                 const AliExternalTrackParam *GetExternalTrackParamN(AliESDv0 *fCurrentV0,Int_t &tracklabel){return GetExternalTrackParam(fCurrentV0,tracklabel,-1);};
90                 AliKFParticle *GetPositiveKFParticle(AliAODv0 *fCurrentV0,Int_t fTrackLabel[2]);
91                 AliKFParticle *GetNegativeKFParticle(AliAODv0 *fCurrentV0,Int_t fTrackLabel[2]);
92                 AliKFParticle *GetPositiveKFParticle(AliESDv0 *fCurrentV0,Int_t fTrackLabel[2]);
93                 AliKFParticle *GetNegativeKFParticle(AliESDv0 *fCurrentV0,Int_t fTrackLabel[2]);
94
95                 Bool_t GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3],Double_t dca[2]);
96                 Bool_t GetHelixCenter(const AliExternalTrackParam *track,Double_t center[2]);
97                 Double_t GetPsiPair(const AliESDv0* v0, const AliExternalTrackParam *positiveparam,const AliExternalTrackParam *negativeparam) const;
98
99                 AliConversionPhotonCuts *fConversionCuts;                       // Pointer to the ConversionCut Selection
100                 AliConvEventCuts        *fEventCuts;                            // Pointer to the ConversionCut Selection
101                 TClonesArray            *fConversionGammas;             // TClonesArray holding the reconstructed photons
102                 Bool_t                          fUseImprovedVertex;             // set flag to improve primary vertex estimation by adding photons
103                 Bool_t                          fUseOwnXYZCalculation;          //flag that determines if we use our own calculation of xyz (markus)
104                 Bool_t                          fUseConstructGamma;             //flag that determines if we use ConstructGamma method from AliKF
105                 Bool_t                          kUseAODConversionPhoton;        // set flag to use AOD instead of KF output format for photons
106                 Bool_t                          fCreateAOD;                             // set flag for AOD creation
107                 TString                 fDeltaAODBranchName;            // File where Gamma Conv AOD is located, if not in default AOD
108                 TString                         fDeltaAODFilename;                      // set filename for delta/satellite aod
109                 Bool_t                          fRelabelAODs;                           //
110                 Bool_t                          fEventIsSelected;
111                 Int_t                           fNumberOfPrimaryTracks;         // Number of Primary Tracks in AOD or ESD
112                 TString                         fPeriodName;
113                 
114         private:
115                 AliV0ReaderV1(AliV0ReaderV1 &original);
116                 AliV0ReaderV1 &operator=(const AliV0ReaderV1 &ref);
117
118
119     ClassDef(AliV0ReaderV1, 4)
120 };
121
122 inline void AliV0ReaderV1::SetConversionCuts(const TString cut){
123     if(fConversionCuts != NULL){
124         delete fConversionCuts;
125                 fConversionCuts=NULL;
126     }
127     if(fConversionCuts == NULL){
128                 fConversionCuts=new AliConversionPhotonCuts("V0ReaderCuts","V0ReaderCuts");
129                 fConversionCuts->InitializeCutsFromCutString(cut.Data());
130     }
131 }
132
133 inline void AliV0ReaderV1::SetEventCuts(const TString cut){
134     if(fEventCuts != NULL){
135         delete fEventCuts;
136                 fEventCuts=NULL;
137     }
138     if(fEventCuts == NULL){
139                 fEventCuts=new AliConvEventCuts("V0ReaderEventCuts","V0ReaderEventCuts");
140                 fEventCuts->InitializeCutsFromCutString(cut.Data());
141     }
142 }
143
144 #endif