]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/AliV0ReaderV1.h
Cluster histograms: fill with clusters with more than 1 cell, change return by contin...
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0ReaderV1.h
1 #ifndef ALIV0READERV1_H
2 #define ALIV0READERV1_H
3
4 #include "AliAnalysisTaskSE.h"
5 #include "TClonesArray.h"
6 #include "AliKFParticle.h"
7 #include "AliAODv0.h"
8 #include "AliESDv0.h"
9 #include "AliAODEvent.h"
10 #include "AliESDEvent.h"
11 #include "AliKFConversionPhoton.h"
12 #include "AliConversionPhotonBase.h"
13 #include "AliConversionAODBGHandlerRP.h"
14 #include "TVector.h"
15 #include "AliKFVertex.h"
16 #include "AliAODTrack.h"
17 #include "AliESDtrack.h"
18 #include "AliVTrack.h"
19 #include "AliStack.h"
20 #include "AliEventplane.h"
21
22 #include "TH1.h"
23 #include "TH2.h"
24
25 class AliAODConversionPhoton;
26
27 using namespace std;
28
29 class AliV0ReaderV1 : public AliAnalysisTaskSE {
30         
31  public: 
32         
33   AliV0ReaderV1(const char *name="V0ReaderV1");
34   virtual ~AliV0ReaderV1();                            //virtual destructor
35   void UserCreateOutputObjects();
36
37   virtual void   UserExec(Option_t *option);
38   virtual void Terminate(Option_t *);
39
40   // Reconstruct Gammas
41   void ProcessV0();
42
43   Bool_t CheckV0Status();
44
45   void ProcessMC(AliKFConversionPhoton*);
46   void ProcessMCGammasForEfficiency();
47
48   void SetIsHeavyIon(Bool_t heavyion){fIsHeavyIon=heavyion;if(!fIsHeavyIon){fNCentralityBins=1;}}
49
50   // Return Reconstructed Gammas
51   TClonesArray *GetReconstructedGammas(){return fConversionGammas;}
52   Int_t GetNReconstructedGammas(){if(fConversionGammas){return fConversionGammas->GetEntriesFast();}else{return 0;}}
53
54   // Process Gamma Candidates
55
56   Bool_t IsGammaCandidate(AliConversionPhotonBase *fPhotonCandidate);
57   Bool_t IsMCConversionGammaInAcceptance(TParticle *particle);
58
59   void PrintCuts();
60
61   Bool_t CentralitySelection();
62   Bool_t VertexZCut();
63   Double_t GetCentrality();
64   Bool_t SetEventPlane();
65   AliEventplane *GetEventPlane();
66   AliVTrack *GetTrack(Int_t label);
67
68   // Getter Functions
69
70   const AliExternalTrackParam *GetExternalTrackParam(Int_t charge);
71   const AliExternalTrackParam *GetExternalTrackParamP(){return GetExternalTrackParam(1);};
72   const AliExternalTrackParam *GetExternalTrackParamN(){return GetExternalTrackParam(-1);};
73
74
75   Bool_t GetConversionPoint(const AliExternalTrackParam *pparam,const AliExternalTrackParam *nparam,Double_t convpos[3]);
76   Bool_t GetHelixCenter(const AliExternalTrackParam *track, Double_t b,Int_t charge, Double_t center[2]);
77
78   Double_t GetMagneticField() const{if(fESDEvent){return fESDEvent->GetMagneticField();}if(fAODEvent){return fAODEvent->GetMagneticField();}return 0;}
79
80
81   const AliVertex *GetPrimaryVertex();
82
83   AliKFParticle *GetPositiveKFParticle(AliAODv0 *fCurrentV0,Int_t fTrackLabel[2]);
84   AliKFParticle *GetNegativeKFParticle(AliAODv0 *fCurrentV0,Int_t fTrackLabel[2]);
85   AliKFParticle *GetPositiveKFParticle(AliESDv0 *fCurrentV0,Int_t fTrackLabel[2]);
86   AliKFParticle *GetNegativeKFParticle(AliESDv0 *fCurrentV0,Int_t fTrackLabel[2]);
87
88   Int_t GetNumberOfContributorsVtx();
89
90   // Cut Functions
91
92   Bool_t EventIsSelected(){return fEventIsSelected;}
93   Bool_t TrackCuts(AliConversionPhotonBase *fPhotonCandidate);
94   Bool_t AcceptanceCuts(AliConversionPhotonBase *fPhotonCandidate);
95   Bool_t AcceptanceCut(TParticle *particle, TParticle * ePos,TParticle* eNeg);
96   Bool_t dEdxCuts(AliConversionPhotonBase *fPhotonCandidate);
97   Bool_t ArmenterosQtCut(AliConversionPhotonBase *fPhotonCandidate);
98   Bool_t AsymmetryCut(AliConversionPhotonBase *fPhotonCandidate);
99   Bool_t PIDProbabilityCut(AliConversionPhotonBase *fPhotonCandidate);
100   Bool_t EventCuts();
101
102   // Set Mass Zero for Gammas
103   void SetGammaMassZero(){fCurrentMotherKFCandidate->E()=fCurrentMotherKFCandidate->GetP();}
104
105
106   // Set Output
107
108   void SetUseAODConversionPhoton(Bool_t b){if(b){cout<<"Setting Outputformat to AliAODConversionPhoton "<<endl;}else{cout<<"Setting Outputformat to AliKFConversionPhoton "<<endl;};kUseAODConversionPhoton=b;}
109
110   void SetCreateAODs(Bool_t k){fCreateAOD=k;}
111   void SetDeltaAODFilename(TString s){fDeltaAODFilename=s;}
112
113
114
115
116   // Set Cuts
117
118   void SetMaxVertexZ(Double_t maxVertexZ){fMaxVertexZ=maxVertexZ;}
119
120   void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}
121
122    void SetOnFlyFlag(Bool_t flag){fUseOnFlyV0Finder = flag;}
123
124   void SetMaxRCut(Double_t maxR){fMaxR=maxR;}
125   void SetMinRCut(Double_t minR){fMinR=minR;}
126
127   void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}
128
129   void SetEtaCutMin(Double_t etaCutMin){fEtaCutMin=etaCutMin;}
130
131   void SetPtCut(Double_t ptCut){fPtCut=ptCut;}
132         
133   void SetSinglePtCut(Double_t singleptCut){fSinglePtCut=singleptCut;}
134         
135   void SetMaxZCut(Double_t maxZ){fMaxZ=maxZ;}
136         
137   void SetMinClsTPCCut(Double_t minClsTPC){fMinClsTPC=minClsTPC;}
138
139   void SetMinClsTPCCutToF(Double_t minClsTPCToF){fMinClsTPCToF=minClsTPCToF;}
140         
141   void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}
142   void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}
143         
144   void SetLineCutZRSlopeMin(Double_t LineCutZRSlopeMin){fLineCutZRSlopeMin=LineCutZRSlopeMin;}
145   void SetLineCutZValueMin(Double_t LineCutZValueMin){fLineCutZValueMin=LineCutZValueMin;}
146                 
147   void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}
148
149   void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}
150         
151   void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}
152         
153   void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}
154
155   void SetPIDnSigmaAboveElectronLine(Double_t nSigmaAbove){fPIDnSigmaAboveElectronLine=nSigmaAbove;}
156   void SetTofPIDnSigmaAboveElectronLine(Double_t nTofSigmaAbove){fTofPIDnSigmaAboveElectronLine=nTofSigmaAbove;} // RRnewTOF
157         
158   void SetPIDnSigmaBelowElectronLine(Double_t nSigmaBelow){fPIDnSigmaBelowElectronLine=nSigmaBelow;}
159   void SetTofPIDnSigmaBelowElectronLine(Double_t nTofSigmaBelow){fTofPIDnSigmaBelowElectronLine=nTofSigmaBelow;} // RRnewTOF
160         
161   /*
162    * Sets the PIDnSigmaAbovePion cut value for the tracks.
163    */
164   void SetPIDnSigmaAbovePionLine(Double_t nSigmaAbovePion){fPIDnSigmaAbovePionLine=nSigmaAbovePion;}
165
166   /*
167    * Sets the PIDnSigmaAbovePion cut value for the tracks.
168    */
169   void SetPIDnSigmaAbovePionLineHighPt(Double_t nSigmaAbovePionHighPt){fPIDnSigmaAbovePionLineHighPt=nSigmaAbovePionHighPt;}
170
171   /*
172    * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
173    */
174   void SetPIDMinPnSigmaAbovePionLine(Double_t MinPnSigmaAbovePion){fPIDMinPnSigmaAbovePionLine=MinPnSigmaAbovePion;}
175
176  /*
177    * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
178    */
179   void SetPIDMaxPnSigmaAbovePionLine(Double_t MaxPnSigmaAbovePion){fPIDMaxPnSigmaAbovePionLine=MaxPnSigmaAbovePion;}
180
181   /*
182    * Sets the SigmaMassCut value.
183    */
184   void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}
185         
186   void SetTRDEfficiency(Double_t eff){if(eff<=1&&eff>=0){fPIDTRDEfficiency=eff;}}
187   void SetDoTRDPID(Bool_t doTRD){fDoTRDPID=doTRD;}
188
189   void SetDodEdxSigmaCut( Bool_t dodEdxSigmaCut){fDodEdxSigmaCut=dodEdxSigmaCut;}
190   void SetDoTOFsigmaCut( Bool_t doTOFsigmaCut){fDoTOFsigmaCut=doTOFsigmaCut;} //RRnewTOF
191   void SetDoPhotonAsymmetryCut( Bool_t doPhotonAsymmetryCut){fDoPhotonAsymmetryCut=doPhotonAsymmetryCut;}
192
193   void SetMinPPhotonAsymmetryCut(Double_t minPPhotonAsymmetryCut){fMinPPhotonAsymmetryCut=minPPhotonAsymmetryCut;}
194   void SetMinPhotonAsymmetry(Double_t minPhotonAsymmetry){fMinPhotonAsymmetry=minPhotonAsymmetry;}
195   /*
196    * Sets the flag to enable/disable the cut dedx N sigma for Kaon Rejection at low p 
197    */
198   void SetDoKaonRejectionLowP( Bool_t doKaonRejectionLowP){fDoKaonRejectionLowP=doKaonRejectionLowP;}
199   /*
200    * Sets the flag to enable/disable the cut dedx N sigma for Proton Rejection at low p 
201    */
202   void SetDoProtonRejectionLowP( Bool_t doProtonRejectionLowP){fDoProtonRejectionLowP=doProtonRejectionLowP;}
203
204   /*
205    * Sets the flag to enable/disable the cut dedx N sigma for Pion Rejection at low p 
206    */
207   void SetDoPionRejectionLowP( Bool_t doPionRejectionLowP){fDoPionRejectionLowP=doPionRejectionLowP;}
208
209   /*
210    * Sets the PIDMinPnSigmaAroundKaon cut value for the tracks.
211    */
212   void SetPIDnSigmaAtLowPAroundKaonLine(Double_t nSigmaAtLowPAroundKaon){fPIDnSigmaAtLowPAroundKaonLine =nSigmaAtLowPAroundKaon;}
213
214   /*
215    * Sets the PIDMinPnSigmaAroundProton cut value for the tracks.
216    */
217   void SetPIDnSigmaAtLowPAroundProtonLine(Double_t nSigmaAtLowPAroundProton){fPIDnSigmaAtLowPAroundProtonLine =nSigmaAtLowPAroundProton;}
218
219   /*
220    * Sets the PIDMinPnSigmaAroundPion cut value for the tracks.
221    */
222   void SetPIDnSigmaAtLowPAroundPionLine(Double_t nSigmaAtLowPAroundPion){fPIDnSigmaAtLowPAroundPionLine =nSigmaAtLowPAroundPion;}
223
224   /*
225    * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
226    */
227   void SetPIDMinPKaonRejectionLowP(Double_t PIDMinPKaonRejectionLowP ){fPIDMinPKaonRejectionLowP=PIDMinPKaonRejectionLowP;}
228
229   /*
230    * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
231    */
232   void SetPIDMinPProtonRejectionLowP(Double_t PIDMinPProtonRejectionLowP ){fPIDMinPProtonRejectionLowP=PIDMinPProtonRejectionLowP;}
233   /*
234    * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
235    */
236   void SetPIDMinPPionRejectionLowP(Double_t PIDMinPPionRejectionLowP ){fPIDMinPPionRejectionLowP=PIDMinPPionRejectionLowP;}
237
238   /*
239    *Set if we want to use Gamma Selection based on Qt from Armenteros
240    */
241   void SetDoQtGammaSelection(Bool_t doQtGammaSelection){fDoQtGammaSelection=doQtGammaSelection;}
242   void SetDoHighPtQtGammaSelection(Bool_t doHighPtQtGammaSelection){fDoHighPtQtGammaSelection=doHighPtQtGammaSelection;} // RRnew
243
244   void SetQtMax(Double_t qtMax){fQtMax=qtMax;}
245   void SetHighPtQtMax(Double_t qtMaxHighPt){fHighPtQtMax=qtMaxHighPt;} // RRnew
246   void SetPtBorderForQt(Double_t ptBorderForQt){fPtBorderForQt=ptBorderForQt;} // RRnew
247
248   void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
249
250   void SetUseConstructGamma(Bool_t flag){fUseConstructGamma=flag;}
251
252 protected:
253     TClonesArray *fConversionGammas;
254     AliESDEvent *fESDEvent;
255     AliAODEvent *fAODEvent;
256     AliStack *fMCStack;
257     TList *fOutputList;
258     AliKFConversionPhoton *fCurrentMotherKFCandidate;
259     AliKFParticle *fCurrentPositiveKFParticle;
260     AliKFParticle *fCurrentNegativeKFParticle;
261     Int_t *fCurrentTrackLabels;
262     Int_t fCurrentV0Index;
263     Int_t fNCentralityBins;
264     Int_t fCentralityBin;
265     Bool_t fEventIsSelected;
266     AliConversionAODBGHandlerRP *fBGHandler;
267     Double_t fVertexZ;
268     Double_t fCentrality;
269     Double_t fEPAngle;
270
271 private:
272     //Event Cuts
273     Double_t fMaxVertexZ; // max z vertex cut
274   //cuts
275   Double_t fMaxR; //r cut
276   Double_t fMinR; //r cut
277   Double_t fEtaCut; //eta cut
278   Double_t fEtaCutMin; //eta cut
279   Double_t fPtCut; // pt cut
280   Double_t fSinglePtCut; // pt cut for electron/positron
281   Double_t fMaxZ; //z cut
282   Double_t fMinClsTPC; // minimum clusters in the TPC
283   Double_t fMinClsTPCToF; // minimum clusters to findable clusters
284   Double_t fLineCutZRSlope; //linecut
285   Double_t fLineCutZValue; //linecut
286   Double_t fLineCutZRSlopeMin; //linecut
287   Double_t fLineCutZValueMin; //linecut
288   Double_t fChi2CutConversion; //chi2cut
289   Double_t fPIDProbabilityCutNegativeParticle;
290   Double_t fPIDProbabilityCutPositiveParticle;
291   Bool_t   fDodEdxSigmaCut; // flag to use the dEdxCut based on sigmas
292   Bool_t   fDoTOFsigmaCut; // flag to use TOF pid cut RRnewTOF
293   Double_t fPIDTRDEfficiency;
294   Bool_t fDoTRDPID;
295   Double_t fPIDnSigmaAboveElectronLine; // sigma cut
296   Double_t fPIDnSigmaBelowElectronLine; // sigma cut
297   Double_t fTofPIDnSigmaAboveElectronLine; // sigma cut RRnewTOF
298   Double_t fTofPIDnSigmaBelowElectronLine; // sigma cut RRnewTOF 
299   Double_t fPIDnSigmaAbovePionLine;     // sigma cut
300   Double_t fPIDnSigmaAbovePionLineHighPt;     // sigma cut
301   Double_t fPIDMinPnSigmaAbovePionLine; // sigma cut
302   Double_t fPIDMaxPnSigmaAbovePionLine; // sigma cut
303   Double_t fDoKaonRejectionLowP;   // Kaon rejection at low p
304   Double_t fDoProtonRejectionLowP; // Proton rejection at low p
305   Double_t fDoPionRejectionLowP;   // Pion rejection at low p
306   Double_t fPIDnSigmaAtLowPAroundKaonLine; // sigma cut
307   Double_t fPIDnSigmaAtLowPAroundProtonLine; // sigma cut
308   Double_t fPIDnSigmaAtLowPAroundPionLine; // sigma cut
309   Double_t fPIDMinPKaonRejectionLowP; // Momentum limit to apply kaon rejection
310   Double_t fPIDMinPProtonRejectionLowP; // Momentum limit to apply proton rejection
311   Double_t fPIDMinPPionRejectionLowP; // Momentum limit to apply proton rejection
312   Bool_t   fDoQtGammaSelection; // Select gammas using qtMax
313   Bool_t   fDoHighPtQtGammaSelection; // RRnew Select gammas using qtMax for high pT
314   Double_t fQtMax; // Maximum Qt from Armenteros to select Gammas
315   Double_t fHighPtQtMax; // RRnew Maximum Qt for High pT from Armenteros to select Gammas
316   Double_t fPtBorderForQt; // RRnew 
317   Double_t fXVertexCut; //vertex cut
318   Double_t fYVertexCut; //vertex cut
319   Double_t fZVertexCut; // vertexcut
320         
321   Double_t fNSigmaMass; //nsigma cut
322         
323   Bool_t fUseImprovedVertex; //flag
324
325   Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
326
327   Bool_t fUseConstructGamma; //flag that determines if we use ConstructGamma method from AliKF
328
329   Bool_t fUseEtaMinCut; //flag
330
331   Bool_t fUseOnFlyV0Finder; //flag
332
333   Bool_t   fDoPhotonAsymmetryCut; // flag to use the PhotonAsymetryCut
334   Double_t fMinPPhotonAsymmetryCut;
335   Double_t fMinPhotonAsymmetry;
336
337   Bool_t kUseAODConversionPhoton;
338
339   Bool_t fIsHeavyIon;
340   Bool_t fCreateAOD;
341   TString fDeltaAODFilename;
342
343
344
345   // Histograms
346   
347   TH1F *hV0CurrentFinder;
348   TH2F *hV0AllArmenteros;
349   TH1F *hV0Good;
350   TH2F *hV0GoodArmenteros;
351
352   TH1F *hV0CutLikeSign;
353   TH1F *hV0CutRefit;
354   TH1F *hV0CutKinks;
355   TH1F *hV0CutMinNclsTPCToF;
356
357   TH1F *hV0CutNContributors;
358   TH1F *hV0CutVertexZ;
359
360   TH1F *hV0CutdEdxElectron;
361   TH1F *hV0CutdEdxPion;
362   TH1F *hV0CutdEdxKaonLowP;
363   TH1F *hV0CutdEdxProtonLowP;
364   TH1F *hV0CutdEdxPionLowP;
365   TH1F *hV0CutdEdxTOFElectron;
366   TH1F * hV0CutdEdxTRD;
367
368   TH1F *hV0CutQt;
369
370   TH1F *hV0CutR;
371   TH1F *hV0CutMinR;
372   TH1F *hV0CutLine;
373   TH1F *hV0CutZ;
374   TH1F *hV0CutEta;
375   TH1F *hV0CutSinglePt;
376   TH1F *hV0CutPt;
377   TH1F *hV0CutNDF;
378   TH1F *hV0CutChi2;
379
380   TH1F *hV0CutPIDProb;
381   TH1F* hV0CutAsymmetry;
382
383   TH2F *hMCPtResolution;
384   TH1F **hGammaPt;
385   TH1F **hMCPtRECOTRUE;
386   TH1F **hMCPtTRUE;
387   TH2F *hMCPtResolutionPhi;
388   TH2F *hMCRResolutionvsR;
389   TH2F *hMCZResolutionvsZ;
390   TH1F *hGammaPhi;
391   TH2F *hGammadEdxbefore;
392   TH2F *hGammadEdxafter;
393   TH2F *hGammaConversionMapXY;
394   TH2F *hGammaConversionMapZR;
395
396   // Event
397
398   TH1F *hV0EventCuts;
399   TH1F *hNEvents;
400   TH1F *hCentrality;
401   TH1F *hVertexZ;
402
403
404   ClassDef(AliV0ReaderV1,1)
405 };
406
407
408 #endif
409
410
411
412
413