]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/DPhi/FourierDecomposition/AliDhcTask.h
Add possibility to use AliMuonTrackCuts. Improve event cut on muon in event.
[u/mrichter/AliRoot.git] / PWGCF / Correlations / DPhi / FourierDecomposition / AliDhcTask.h
1 // Dihadron correlations task - simple task to read ESD or AOD input,
2 // calculate same- and mixed-event correlations, and fill THnSparse
3 // output. -A. Adare, Apr 2011, updated Mar 2012
4
5 #ifndef AliDhcTask_cxx
6 #define AliDhcTask_cxx
7
8 #include "AliAnalysisTaskSE.h"
9 #include "AliPool.h"
10 #include "PWG/muon/AliMuonTrackCuts.h"
11
12 class TFormula;
13 class TH1;
14 class TH2;
15 class TH3;
16 class THn;
17 class TAxis;
18 class TObjArray;
19 class TObject;
20 class TProfile2D;
21 class AliAODEvent;
22 class AliAODTrack;
23 class AliAnalysisUtils;
24 class AliESDEvent;
25 class AliESDMuonTrack;
26 class AliESDtrackCuts;
27 class AliEvtPoolManager;
28
29 class AliDhcTask : public AliAnalysisTaskSE {
30  public:
31   AliDhcTask();
32   AliDhcTask(const char *name, Bool_t def=kFALSE);
33   virtual ~AliDhcTask();
34   
35   void         SetAllTAHists(Bool_t b)                { fAllTAHists = b;          }
36   void         SetAnaMode(Int_t iAna);
37   void         SetCentBins(TAxis *bins)               { fBCent=bins;              }
38   void         SetCentMethod(const char *name)        { fCentMethod = name;       }
39   void         SetCentMixBins(TAxis *bins)            { fMixBCent=bins;           }
40   void         SetCheckVertex(Bool_t b)               { fCheckVertex = b;         }
41   void         SetClassName(const char *n)            { fClassName = n;           }
42   void         SetDEtaDPhiBins(Int_t nbe, Int_t nbp)  { fNBdeta=nbe; fNBdphi=nbp; }
43   void         SetDoFillSame(Bool_t b)                { fDoFillSame = b;          }
44   void         SetDoMassCut(Bool_t b)                 { fDoMassCut = b;           }
45   void         SetDoWeights(Bool_t b)                 { fDoWeights = b;           }
46   void         SetEtaMax(Double_t eta)                { fEtaMax = eta;            }
47   void         SetEtaTRange(Double_t eL, Double_t eH) { fEtaTLo=eL; fEtaTHi=eH;   }
48   void         SetEtaARange(Double_t eL, Double_t eH) { fEtaALo=eL; fEtaAHi=eH;   }
49   void         SetFillMuons(Bool_t b)                 { fFillMuons = b;           }
50   void         SetHEffA(THnF *h)                      { fHEffA=h;                 }
51   void         SetHEffT(THnF *h)                      { fHEffT=h;                 }
52   void         SetMixInEtaT(Bool_t b)                 { fMixInEtaT = b;           }
53   void         SetMuonUtils(Bool_t b = kTRUE,
54                             UInt_t mask = AliMuonTrackCuts::kMuEta | AliMuonTrackCuts::kMuThetaAbs | AliMuonTrackCuts::kMuPdca | AliMuonTrackCuts::kMuMatchApt ) {
55     fUseMuonUtils = b;
56     fMuonCutMask = mask;
57   }
58   void         SetOmitFirstEv(Bool_t b)               { fOmitFirstEv = b;         }
59   void         SetPoolSize(Int_t p)                   { fPoolSize = p;            }
60   void         SetPtABins(TAxis *bins)                { fBPtA=bins;               }
61   void         SetPtRange(Double_t min, Double_t max) { fPtMin=min; fPtMax=max;   }
62   void         SetPtTACrit(Bool_t b)                  { fPtTACrit = b;            }
63   void         SetPtTBins(TAxis *bins)                { fBPtT=bins;               }
64   void         SetRequireMuon(Bool_t b, Double_t l=0.5, Double_t h=4.0) {
65     fRequireMuon = b;
66     fReqPtLo = l;
67     fReqPtHi = h;
68   }
69   void         SetTrackDepth(Int_t t)                 { fTrackDepth = t;          }
70   void         SetTracksName(const char *n)           { fTracksName = n;          }
71   void         SetTriggerMatch(Bool_t b)              { fTriggerMatch = b;        }
72   void         SetVerbosity(Int_t v)                  { fVerbosity = v;           }
73   void         SetZVtxBins(TAxis *bins)               { fBZvtx=bins;              }
74   void         SetZVtxMixBins(TAxis *bins)            { fMixBZvtx=bins;           }
75   void         SetZvtx(Double_t zvtx)                 { fZVtxMax = zvtx;          }
76   void         PrintDhcSettings();
77
78   enum eAnaMode       {kHH=1, kMuH, kHMu, kMuMu, kPSide, kASide};
79
80  protected:
81   enum ePairingScheme {kSameEvt, kDiffEvt};
82   enum eDataType      {kESD, kAOD};
83
84   void         BookHistos();
85   void         InitEventMixer();
86   void         GetESDTracks(MiniEvent*);
87   void         GetAODTracks(MiniEvent*);
88   Bool_t       VertexOk() const;
89   Bool_t       HasMuonESD();
90   Bool_t       HasMuonAOD();
91   Bool_t       IsGoodMUONtrack(AliESDMuonTrack &track);
92   Bool_t       IsGoodMUONtrack(AliAODTrack &track);
93   Bool_t       IsTrigger(Double_t eta, Double_t pt);
94   Bool_t       IsAssociated(Double_t eta, Double_t pt);
95   Double_t     DeltaPhi(Double_t phia, Double_t phib,
96                         Double_t rangeMin = -TMath::Pi()/2, 
97                         Double_t rangeMax = 3*TMath::Pi()/2) const;
98   Int_t        Correlate(const MiniEvent &arr1, const MiniEvent &arr2, Int_t pairing = kSameEvt);
99   void         UserCreateOutputObjects();
100   void         UserExec(Option_t *option);
101   void         Terminate(Option_t *);
102
103  private:
104   Int_t              fVerbosity;       //  0 = silence
105   Double_t           fEtaMax;          //  Max |eta| cut for standard ESD or AOD analysis
106   Double_t           fZVtxMax;         //  Max |z| cut (cm)
107   Double_t           fPtMin;           //  Min pt cut
108   Double_t           fPtMax;           //  Max pt cut
109   Int_t              fTrackDepth;      //  #tracks to fill pool
110   Int_t              fPoolSize;        //  Maximum number of events
111   TString            fTracksName;      //  name of track collection
112   Bool_t             fDoWeights;       //  if true weight with 1/N per event
113   Bool_t             fFillMuons;       //  fill the muon tracks into the mini event
114   Bool_t             fRequireMuon;     //  only run on events with a muon track
115   Double_t           fReqPtLo;         //  require a muon above this pt
116   Double_t           fReqPtHi;         //  and below this pt
117   Bool_t             fPtTACrit;        //  use the pTT > pTA criterion?
118   Bool_t             fAllTAHists;      //  create all pTT,pTA combination hists, even t<a?
119   Bool_t             fMixInEtaT;       //  mix in bins of eta_T instead of z_vertex
120   Bool_t             fUseMuonUtils;    //  use muon cuts from PWG/muon/AliMuonTrackCuts ?
121   UInt_t             fMuonCutMask;     //  muon cut mask for above
122   AliMuonTrackCuts  *fMuonTrackCuts;   //  muon track cut object
123   Double_t           fEtaTLo;          //  Min eta for triggers
124   Double_t           fEtaTHi;          //  Max eta for triggers
125   Double_t           fEtaALo;          //  Min eta for associated
126   Double_t           fEtaAHi;          //  Max eta for associated
127   Bool_t             fOmitFirstEv;     //  if true skip first event in chunk
128   Bool_t             fDoFillSame;      //  If true fill same event immediately (not waiting for pool)
129   Bool_t             fDoMassCut;       //  If true cut on invariant mass
130   Bool_t             fCheckVertex;     //  switch to flase for MC generator-level analysis
131   TString            fClassName;       //  If not null only process events with given class
132   TString            fCentMethod;      //  centrality selection method
133   Int_t              fNBdeta;          //  no. deta bins
134   Int_t              fNBdphi;          //  no. dphi bins
135   Bool_t             fTriggerMatch;    //  muon trigger match
136   TAxis             *fBPtT;            //  ptt binning
137   TAxis             *fBPtA;            //  pta binning
138   TAxis             *fBCent;           //  centrality binning
139   TAxis             *fBZvtx;           //  zvtx binning
140   TAxis             *fMixBCent;        //  centrality binning for mixing
141   TAxis             *fMixBZvtx;        //  zvtx binning for mixing
142   THnF              *fHEffT;           //  efficiency for trigger particles
143   THnF              *fHEffA;           //  efficiency for associate particles
144   AliESDEvent       *fESD;             //! ESD object
145   AliAODEvent       *fAOD;             //! AOD object
146   TList             *fOutputList;      //! Output list
147   TH2               *fHEvt;            //! Cent vs vtx.
148   TH2               *fHEvtWTr;         //! Cent vs vtx. for events with at least one track
149   TH2               *fHTrk;            //! Phi vs Eta
150   TH2               *fHPoolReady;      //! Check how many Jobs start mixing
151   TH1               *fHPtAss;          //! Pt ass
152   TH1               *fHPtTrg;          //! Pt trg
153   TH1               *fHPtTrgEvt;       //! Pt trg per event for weighting
154   TH3               *fHPtTrgNorm1S;    //! Pt trg same events in cent. and zvtx bins, method 1
155   TH3               *fHPtTrgNorm1M;    //! Pt trg mixed events in cent. and zvtx bins, method 1
156   TH3               *fHPtTrgNorm2S;    //! Pt trg same events in cent. and zvtx bins, method 2
157   TH3               *fHPtTrgNorm2M;    //! Pt trg mixed events in cent. and zvtx bins, method 2
158   TH1               *fHCent;           //! Centrality
159   TH1               *fHZvtx;           //! Zvertex
160   Int_t              fNbins;           //! Number of histogram bins
161   TH2              **fHSs;             //! Same-evt correlations
162   TH2              **fHMs;             //! Diff-evt correlations
163   TH1              **fHPts;            //! Pt distributions
164   TH1              **fHSMass;          //! Mass distributions same
165   TH1              **fHMMass;          //! Mass distributions mixed
166   TH3               *fHQATp;           //! positive trigger particle distribution for QA
167   TH3               *fHQAAp;           //! associated particle distribution for QA
168   TH3               *fHQATpCorr;       //! correction applied trigger distribution
169   TH3               *fHQAApCorr;       //! correction applied associated distribution
170   TH3               *fHQATm;           //! the same for negative particles
171   TH3               *fHQAAm;           //!
172   TH3               *fHQATmCorr;       //!
173   TH3               *fHQAAmCorr;       //!
174   TH2               *fHPtCentT;        //! trigger pT vs centrality
175   TH2               *fHPtCentA;        //! associated pT vs centrality
176   TFormula          *fIndex;           //! index for histograms
177   Double_t           fCentrality;      //! centrality of current event
178   Double_t           fZVertex;         //! z vertex of current event
179   AliESDtrackCuts   *fEsdTPCOnly;      //! track cuts
180   AliEvtPoolManager *fPoolMgr;         //! event mixer
181   AliAnalysisUtils  *fUtils;           //! analysis utils
182
183   AliDhcTask(const AliDhcTask&);            // not implemented
184   AliDhcTask &operator=(const AliDhcTask&); // not implemented
185
186   ClassDef(AliDhcTask, 9)
187 };
188
189 #endif