]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/AliAnalysisTaskGammaConversion.h
changes from gsi svn
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliAnalysisTaskGammaConversion.h
1 #ifndef ALIANALYSISTASKGAMMACONVERSION_H
2 #define ALIANALYSISTASKGAMMACONVERSION_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 ////////////////////////////////////////////////
8 //--------------------------------------------- 
9 // Class used to do analysis on conversion pairs
10 //---------------------------------------------
11 ////////////////////////////////////////////////
12
13 #include "AliAnalysisTaskSE.h"
14 #include <vector>
15 #include "AliV0Reader.h"
16 #include "AliGammaConversionBGHandler.h"
17 #include "TRandom3.h"
18 #include "TF1.h"
19 #include "AliMultiplicity.h"
20 //#include "AliCFManager.h"  // for CF
21 //#include "AliCFContainer.h"   // for CF
22 #include "AliAODConversionMother.h"
23
24
25 class AliAODPWG4Particle;
26 class AliAODConversionPhoton;
27 class AliAODConversionMother;
28 class AliKFConversionPhoton;
29 class AliKFConversionMother;
30 class TNtuple;
31 class AliGammaConversionHistograms;
32 class AliESDv0;
33 class AliV0;
34 class AliKFParticle;
35 class AliKFVertex;
36 class AliESDInputHandler;
37 class AliESDEvent;
38 class AliAODEvent;
39 class AliMCEvent;
40 class TList;
41 class AliStack;
42 class AliESDtrackCuts;
43 class AliTriggerAnalysis;
44 class AliCFManager; // for CF
45 class AliCFContainer; // for CF
46 class TRandom3;
47 class TF1;
48
49 class AliAnalysisTaskGammaConversion : public AliAnalysisTaskSE
50 {
51         
52  public:
53   typedef enum { kProcSD, kProcDD, kProcND, kProcUnknown, kNProcs } ProcType_t; 
54   AliAnalysisTaskGammaConversion();
55   AliAnalysisTaskGammaConversion(const char* name);
56   virtual ~AliAnalysisTaskGammaConversion() ;// virtual destructor
57                 
58   // Implementation of interface methods
59   virtual void UserCreateOutputObjects();
60   virtual void Init();
61   virtual void LocalInit() {Init();}
62   virtual void UserExec(Option_t *option);
63   virtual void Terminate(Option_t *option);
64   //virtual void ConnectInputData(Option_t * option);
65   void CheckMesonProcessTypeEventQuality(Int_t evtQ);
66   Int_t GetProcessType(const AliMCEvent * mcEvt) ;
67   void ProcessMCData();
68   void ProcessV0sNoCut();
69   void ProcessV0s();
70   void ProcessGammasForNeutralMesonAnalysis();
71   void ProcessGammasForOmegaMesonAnalysis();
72   //  void ProcessConvPHOSGammasForNeutralMesonAnalysis();
73 //  void RecalculateV0ForGamma();
74   // for CF
75   void SetCFManager(AliCFManager * const io) {fCFManager = io;};
76   AliCFManager *GetCFManager() const {return fCFManager;}
77                 
78                 
79   // AOD
80   TString GetAODBranchName() const {return  fAODBranchName;}
81   void SetAODBranchName(TString name)  {fAODBranchName = name ;}        
82   void SetForceAOD(Bool_t forceAOD ) { fKFForceAOD = forceAOD; }
83   void FillAODWithConversionGammas();
84   void AddGammaToAOD(AliKFConversionPhoton * kfParticle);
85  // void AddPionToAOD(AliKFConversionMother * kfParticle);
86  // void AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2);
87   void TagDaughter(Int_t gammaIndex);
88
89   // end AOD
90                 
91   static Bool_t IsGoodImpPar(const AliESDtrack *const track);
92         
93   // for GammaJetAnalysis
94   void ProcessGammasForGammaJetAnalysis();
95   void CreateListOfChargedParticles();
96   Double_t GetMinimumDistanceToCharge(Int_t indexHighestPtGamma);
97   void CalculateJetCone(Int_t gammaIndex);
98   Int_t GetIndexHighestPtGamma();
99   void SetESDtrackCuts();
100   // end of Gamma Jet
101                 
102   void SetMinPtForGammaJet(Double_t minPtForGammaJet){fMinPtForGammaJet=minPtForGammaJet;}
103   void SetMinIsoConeSize(Double_t minIsoConeSize){fMinIsoConeSize=minIsoConeSize;}
104   void SetMinPtIsoCone(Double_t minPtIsoCone){fMinPtIsoCone=minPtIsoCone;}
105   void SetMinPtGamChargedCorr(Double_t minPtGamChargedCorr){fMinPtGamChargedCorr=minPtGamChargedCorr;}
106   void SetMinPtJetCone(Double_t minPtJetCone){fMinPtJetCone=minPtJetCone;}
107
108   void SetLowPtMapping(Double_t lowPtMapping){fLowPtMapping=lowPtMapping;}
109   void SetHighPtMapping(Double_t highPtMapping){fHighPtMapping=highPtMapping;}
110
111                 
112   void SetHistograms(AliGammaConversionHistograms *const histograms){fHistograms=histograms;}
113   void SetTriggerCINT1B(Bool_t flag){fTriggerCINT1B=flag;}
114   void SetDoMCTruth(Bool_t flag){fDoMCTruth=flag;}
115   void SetDoNeutralMeson(Bool_t flag){fDoNeutralMeson=flag;}
116   void SetDoOmegaMeson(Bool_t flag){fDoOmegaMeson=flag;}
117   void SetDoNeutralMesonV0MCCheck(Bool_t flag){fDoNeutralMesonV0MCCheck=flag;}
118   void SetDoJet(Bool_t flag){fDoJet=flag;}
119   void SetDoChic(Bool_t flag){fDoChic=flag;}
120   void SetRecalculateV0ForGamma(Bool_t flag){fRecalculateV0ForGamma=flag;}              
121
122   void SetElectronMass(Double_t electronMass){fElectronMass = electronMass;}
123   void SetGammaMass(Double_t gammaMass){fGammaMass = gammaMass;}
124   void SetGammaWidth(Double_t gammaWidth){fGammaWidth = gammaWidth;}
125   void SetPi0Mass(Double_t pi0Mass){fPi0Mass = pi0Mass;}
126   void SetPi0Width(Double_t pi0Width){fPi0Width = pi0Width;}
127   void SetEtaMass(Double_t etaMass){fEtaMass = etaMass;}
128   void SetEtaWidth(Double_t etaWidth){fEtaWidth = etaWidth;}
129   void SetMinOpeningAngleGhostCut(Double_t ghostCut){fMinOpeningAngleGhostCut = ghostCut;}
130   void SetV0Reader(AliV0Reader* const reader){fV0Reader=reader; fV0Reader->SetESDtrackCuts(fEsdTrackCuts);}
131   void SetCalculateBackground(Bool_t bg){fCalculateBackground=bg;}
132   void CalculateBackground();
133   void SetWriteNtuple(Bool_t writeNtuple){fWriteNtuple = writeNtuple;}
134   void FillNtuple();
135   Double_t GetMCOpeningAngle(const TParticle* const daughter0,const TParticle* const daughter1) const;
136   void CheckV0Efficiency();
137   void SetDeltaAODFileName(TString fn) { fKFDeltaAODFileName = fn; };
138   void SetCreateAOD(Bool_t doAod) { fKFCreateAOD = doAod; };
139   TString GetDeltaAODFileName() const { return fKFDeltaAODFileName; };
140   //////////////////Chi_c Analysis////////////////////////////
141   void GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight);   
142   double GetSigmaToVertex(const AliESDtrack* t);
143   void ElectronBackground(TString hBg, TClonesArray e);
144   void FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos);
145   void FillElectronInvMass(TString histoName, TClonesArray const negativeElectron, TClonesArray const positiveElectron);
146   void FillGammaElectronInvMass(TString histoMass,TString histoDiff, TClonesArray const fKFGammas, TClonesArray const tlVeNeg,TClonesArray const tlVePos);
147   void CleanWithAngleCuts(TClonesArray const negativeElectrons, TClonesArray const positiveElectrons, TClonesArray const gammas);
148   TClonesArray GetTLorentzVector(TClonesArray* esdTrack);       
149   void ProcessGammaElectronsForChicAnalysis();
150   ///////////////////////////////////////////////////////////////
151
152   void SetDoCF(Bool_t flag){fDoCF = flag;}
153
154   void SetUseChargedTracksMultiplicityForBG(Bool_t flag){fUseTrackMultiplicityForBG = flag;}            
155
156   void SetMoveParticleAccordingToVertex(Bool_t flag){fMoveParticleAccordingToVertex = flag;}
157
158   void MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex);
159
160   void SetApplyChi2Cut(Bool_t flag){fApplyChi2Cut = flag;}
161
162   void SetDoRotation(Bool_t flag){fDoRotation = flag;}
163
164   void SetPMDegreesBG(Int_t deg){fNDegreesPMBackground=deg;}
165
166   void SetNumberOfRotationsBG(Int_t nRot){fNRandomEventsForBG=nRot;}
167
168   void RotateKFParticle(AliKFParticle * kfParticle,Double_t angle);
169
170   void SetCheckBGProbability(Bool_t flag){fCheckBGProbability = flag;}
171
172   void SetRemovePileUp(Bool_t removePileUp) { fRemovePileUp = removePileUp; }
173
174   void SetSelectV0AND(Bool_t selectV0AND) { fSelectV0AND = selectV0AND; }
175   void SetUseMultiplicity(Int_t useMultiplicity) {fUseMultiplicity=useMultiplicity;}
176   void SetUseMultiplicityBin(Int_t useMultiplicityBin) {fUseMultiplicityBin=useMultiplicityBin;}
177   void SetUseHBTMultiplicity(Int_t useHBTMultiplicity) {fUseHBTMultiplicity=useHBTMultiplicity;}
178   void SetUseHBTMultiplicityBin(Int_t useHBTMultiplicityBin) {fUseHBTMultiplicityBin=useHBTMultiplicityBin;}
179
180   Int_t CalculateMultiplicityBin();
181   void SetUseCentrality(Int_t useCentrality) {fUseCentrality=useCentrality;}
182   void SetUseCentralityBin(Int_t useCentralityBin) {fUseCentralityBin=useCentralityBin;}
183
184
185
186
187  private:
188   AliAnalysisTaskGammaConversion(const AliAnalysisTaskGammaConversion&); // Not implemented
189   AliAnalysisTaskGammaConversion& operator=(const AliAnalysisTaskGammaConversion&); // Not implemented
190   
191                 
192   // for CF
193   enum{
194     kStepGenerated = 0,
195     kStepReconstructable = 1, 
196     kStepGetOnFly = 2,
197     kStepLikeSign = 3,
198     kStepTPCRefit = 4,
199     kStepKinks = 5,
200     kStepdEdxElectronSelection = 6,
201     kStepdEdxPpionRejection = 7,
202     kStepNContributors = 8,
203     kStepTPCPID = 9,
204     kStepR = 10,
205     kStepLine = 11,
206     kStepZ = 12,
207     kStepMinClsTPC = 13,
208     kStepSinglePt = 14,
209     kStepNDF = 15,
210     kStepChi2 = 16,
211     kStepEta = 17,
212     kStepPt = 18,
213     kStepTrueGamma = 19
214   };
215   
216   AliV0Reader* fV0Reader; // The V0 reader object 
217                 
218   AliStack * fStack; // pointer to the MC particle stack
219   AliMCEventHandler *fMCTruth; // for CF   pointer to MCTruth
220   AliMCEvent *fGCMCEvent;  // for CF    pointer to the MC Event
221   AliESDEvent* fESDEvent; //pointer to the ESDEvent
222   TList * fOutputContainer; // Histogram container
223   AliCFManager *fCFManager;  // for CF
224   //  AliCFContainer *container;   // for CF
225
226                 
227                 
228   AliGammaConversionHistograms *fHistograms; // Pointer to the histogram handling class
229   Bool_t fTriggerCINT1B; //Flag to select trigger CINT1B
230   Bool_t fDoMCTruth; // Flag to switch on/off MC truth 
231   Bool_t fDoNeutralMeson; // flag
232   Bool_t fDoOmegaMeson; // flag
233   Bool_t fDoJet; // flag
234   Bool_t fDoChic; // flag
235   Bool_t fRecalculateV0ForGamma;//flag
236                 
237   TClonesArray * fKFReconstructedGammasTClone; //! transient
238   TClonesArray * fKFReconstructedPi0sTClone; //! transient
239   TClonesArray * fKFRecalculatedGammasTClone; //! transient
240   TClonesArray * fCurrentEventPosElectronTClone; //! transient
241   TClonesArray * fCurrentEventNegElectronTClone; //! transient
242   TClonesArray * fKFReconstructedGammasCutTClone; //! transient
243   TClonesArray * fPreviousEventTLVNegElectronTClone; //! transient
244   TClonesArray * fPreviousEventTLVPosElectronTClone; //! transient
245                 
246   //  vector<AliKFParticle> fKFReconstructedGammas; // vector containing all reconstructed gammas
247                 
248   //  AliESDpid * fESDpid; // esd pid
249
250
251   ///////Chi_c Analysis///////////////////////////
252   //  vector<AliESDtrack*> fCurrentEventPosElectron;       // comment here
253   //  vector<AliESDtrack*> fCurrentEventNegElectron;       // comment here
254   //  vector<AliKFParticle> fKFReconstructedGammasCut;     // comment here
255   //  vector<TLorentzVector> fPreviousEventTLVNegElectron; // comment here
256   //  vector<TLorentzVector> fPreviousEventTLVPosElectron; // comment here
257   //////////////////////////////////////////////////    
258                 
259   //mass defines
260   Double_t fElectronMass; //electron mass
261   Double_t fGammaMass;    //gamma mass
262   Double_t fPi0Mass;      //pi0mass
263   Double_t fEtaMass;      //eta mass
264                 
265   // width defines
266   Double_t fGammaWidth; //gamma width cut
267   Double_t fPi0Width;   // pi0 width cut
268   Double_t fEtaWidth;   // eta width cut
269                 
270   Double_t fMinOpeningAngleGhostCut; // minimum angle cut
271                 
272   AliESDtrackCuts* fEsdTrackCuts;           // Object containing the parameters of the esd track cuts
273                 
274   Bool_t fCalculateBackground; //flag to set backgrount calculation on/off
275   Bool_t fWriteNtuple;         // flag to set if writing to ntuple on/off
276   TNtuple *fGammaNtuple;       // Ntuple for gamma values
277   TNtuple *fNeutralMesonNtuple;// NTuple for mesons
278                 
279   Int_t fTotalNumberOfAddedNtupleEntries; // number of added ntuple entries
280                 
281   TClonesArray* fChargedParticles;  //! transient
282   vector<Int_t> fChargedParticlesId;  //! transient
283                 
284   Double_t fGammaPtHighest;  //! transient
285   Double_t fMinPtForGammaJet;  //! transient
286   Double_t fMinIsoConeSize; //! transient
287   Double_t fMinPtIsoCone; //! transient
288   Double_t fMinPtGamChargedCorr; //! transient
289   Double_t fMinPtJetCone; //! transient
290   Int_t    fLeadingChargedIndex; //! transient
291   Double_t fLowPtMapping; //! transient
292   Double_t fHighPtMapping; //! transient
293   Bool_t fDoCF; //! transient
294                 
295   TClonesArray * fAODGamma; //TClonesArray for gammas to put in AOD
296   //TClonesArray * fAODPi0; //TTClonesArray for Pi0s to put in AOD
297   //TClonesArray * fAODOmega; //TTClonesArray for omegas to put in AOD
298   TString fAODBranchName; // New AOD branch name
299   Bool_t fKFCreateAOD; //Create the AOD tclones? (regardless if storing or not)
300   
301   Bool_t fKFForceAOD;  //Set the Analysis Manager FillAOD variable to true every event
302   TString fKFDeltaAODFileName; //! File name for delta AOD (if any)
303   Bool_t fDoNeutralMesonV0MCCheck; //flag
304   Bool_t fUseTrackMultiplicityForBG; //flag
305   Bool_t fMoveParticleAccordingToVertex; //flag
306   Bool_t fApplyChi2Cut; //flag
307   Int_t fNRandomEventsForBG; //number of random events to use in rotation method
308   Int_t fNDegreesPMBackground; // number of degree window to rotate particles for rotation method
309   Bool_t fDoRotation; //flag
310   Bool_t fCheckBGProbability; //flag
311 //  vector<Int_t>fKFReconstructedGammasV0Index; // index of the reconstructed v0s
312   Bool_t fRemovePileUp;                 // Remove Pile Up
313   Bool_t fSelectV0AND;                 // Select V0AND
314   AliTriggerAnalysis *fTriggerAnalysis; //! Trigger Analysis for Normalisation
315   Int_t fMultiplicity;
316   Int_t fUseMultiplicity;
317   Int_t fUseMultiplicityBin;
318   Int_t fUseHBTMultiplicity;
319   Int_t fUseHBTMultiplicityBin;
320   Int_t fUseCentrality;
321   Int_t fUseCentralityBin;
322   TRandom3 fRandom;
323   ClassDef(AliAnalysisTaskGammaConversion, 20); // Analysis task for gamma conversions
324 };
325
326 #endif //ALIANALYSISTASKGAMMA_H