]>
Commit | Line | Data |
---|---|---|
48a61f36 | 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 | |
4 | ||
b3b66a56 | 5 | #include <TAxis.h> |
6 | #include <TCanvas.h> | |
7 | #include <TChain.h> | |
8 | #include <TFormula.h> | |
9 | #include <TH1.h> | |
10 | #include <TH2.h> | |
11 | #include <TH3.h> | |
12 | #include <THn.h> | |
13 | #include <TProfile2D.h> | |
14 | #include <TROOT.h> | |
15 | #include <TTree.h> | |
16 | #include "AliAnalysisUtils.h" | |
48a61f36 | 17 | #include "AliAODEvent.h" |
18 | #include "AliAODInputHandler.h" | |
19 | #include "AliAnalysisManager.h" | |
20 | #include "AliAnalysisTask.h" | |
21 | #include "AliCentrality.h" | |
22 | #include "AliDhcTask.h" | |
23 | #include "AliESDEvent.h" | |
24 | #include "AliESDInputHandler.h" | |
beb13b6c | 25 | #include "AliESDMuonTrack.h" |
b3b66a56 | 26 | #include "AliESDtrackCuts.h" |
8433ff41 | 27 | #include "AliPool.h" |
48a61f36 | 28 | #include "AliVParticle.h" |
29 | ||
c64cb1f6 | 30 | using std::cout; |
31 | using std::endl; | |
32 | ||
48a61f36 | 33 | ClassImp(AliDhcTask) |
34 | ||
beb13b6c | 35 | |
36 | //________________________________________________________________________ | |
37 | AliDhcTask::AliDhcTask() | |
38 | : AliAnalysisTaskSE(), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), | |
39 | fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), | |
d7149d30 | 40 | fPtTACrit(kTRUE), fAllTAHists(kFALSE), fMixInEtaT(kFALSE), |
b3b66a56 | 41 | fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), fOmitFirstEv(kTRUE), |
98880cdf | 42 | fDoFillSame(kFALSE), fDoMassCut(kFALSE), fClassName(), |
beb13b6c | 43 | fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), |
44 | fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), | |
45 | fHPtTrgNorm1S(0x0), fHPtTrgNorm1M(0x0), fHPtTrgNorm2S(0x0), fHPtTrgNorm2M(0x0), | |
98880cdf | 46 | fHCent(0x0), fHZvtx(0x0), fNbins(0), fHSs(0x0), fHMs(0x0), fHPts(0x0), fHSMass(0x0), fHMMass(0x0), |
d7149d30 | 47 | fHQAT(0x0), fHQAA(0x0), fHPtCentT(0x0), fHPtCentA(0x0), |
380fb711 | 48 | fIndex(0x0), |
beb13b6c | 49 | fCentrality(99), fZVertex(99), fEsdTPCOnly(0), fPoolMgr(0), |
50 | fCentMethod("V0M"), fNBdeta(20), fNBdphi(36), | |
51 | fBPtT(0x0), fBPtA(0x0), fBCent(0x0), fBZvtx(0x0), | |
52 | fMixBCent(0x0), fMixBZvtx(0x0), | |
b3b66a56 | 53 | fHEffT(0x0), fHEffA(0x0), fUtils(0x0) |
beb13b6c | 54 | { |
55 | ||
56 | } | |
57 | ||
48a61f36 | 58 | //________________________________________________________________________ |
eee08176 | 59 | AliDhcTask::AliDhcTask(const char *name, Bool_t def) |
42036329 | 60 | : AliAnalysisTaskSE(name), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), |
beb13b6c | 61 | fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), |
d7149d30 | 62 | fPtTACrit(kTRUE), fAllTAHists(kFALSE), fMixInEtaT(kFALSE), |
b3b66a56 | 63 | fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), fOmitFirstEv(kTRUE), |
98880cdf | 64 | fDoFillSame(kFALSE), fDoMassCut(kFALSE), fClassName(), |
beb13b6c | 65 | fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), |
66 | fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), | |
67 | fHPtTrgNorm1S(0x0), fHPtTrgNorm1M(0x0), fHPtTrgNorm2S(0x0), fHPtTrgNorm2M(0x0), | |
98880cdf | 68 | fHCent(0x0), fHZvtx(0x0), fNbins(0), fHSs(0x0), fHMs(0x0), fHPts(0x0), fHSMass(0x0), fHMMass(0x0), |
d7149d30 | 69 | fHQAT(0x0), fHQAA(0x0), fHPtCentT(0x0), fHPtCentA(0x0), |
380fb711 | 70 | fIndex(0x0), |
8a9d3e12 | 71 | fCentrality(99), fZVertex(99), fEsdTPCOnly(0), fPoolMgr(0), |
d688e049 | 72 | fCentMethod("V0M"), fNBdeta(20), fNBdphi(36), |
73 | fBPtT(0x0), fBPtA(0x0), fBCent(0x0), fBZvtx(0x0), | |
beb13b6c | 74 | fMixBCent(0x0), fMixBZvtx(0x0), |
b3b66a56 | 75 | fHEffT(0x0), fHEffA(0x0), fUtils(0x0) |
48a61f36 | 76 | { |
77 | // Constructor | |
78 | ||
79 | // Define input and output slots here | |
80 | // Input slot #0 works with a TChain | |
81 | DefineInput(0, TChain::Class()); | |
82 | // Output slot #0 id reserved by the base class for AOD | |
83 | // Output slot #1 writes into a TH1 container | |
84 | DefineOutput(1, TList::Class()); | |
85 | ||
48a61f36 | 86 | fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,SPDVertex.,TPCVertex.,Tracks " |
87 | "AOD:header,tracks,vertices,"; | |
d688e049 | 88 | |
eee08176 | 89 | if (def) { |
90 | Double_t ptt[4] = {0.25, 1.0, 2.0, 15.0}; | |
91 | fBPtT = new TAxis(3,ptt); | |
92 | Double_t pta[4] = {0.25, 1.0, 2.0, 15.0}; | |
93 | fBPtA = new TAxis(3,pta); | |
94 | Double_t cent[2] = {-100.0, 100.0}; | |
95 | fBCent = new TAxis(1,cent); | |
96 | Double_t zvtx[2] = {-10, 10}; | |
97 | fBZvtx = new TAxis(1,zvtx); | |
98 | Double_t centmix[2] = {-100.0, 100.0}; | |
99 | fMixBCent = new TAxis(1,centmix); | |
100 | Double_t zvtxmix[9] = {-10,-6,-4,-2,0,2,4,6,10}; | |
101 | fMixBZvtx = new TAxis(8,zvtxmix); | |
102 | } | |
48a61f36 | 103 | } |
104 | ||
105 | //________________________________________________________________________ | |
106 | void AliDhcTask::UserCreateOutputObjects() | |
107 | { | |
108 | // Create histograms | |
109 | // Called once (per slave on PROOF!) | |
d7149d30 | 110 | PrintDhcSettings(); |
48a61f36 | 111 | |
48a61f36 | 112 | fOutputList = new TList(); |
113 | fOutputList->SetOwner(1); | |
114 | ||
b3b66a56 | 115 | fUtils = new AliAnalysisUtils(); |
48a61f36 | 116 | |
8433ff41 | 117 | BookHistos(); |
118 | InitEventMixer(); | |
48a61f36 | 119 | PostData(1, fOutputList); |
120 | } | |
121 | ||
d7149d30 | 122 | //________________________________________________________________________ |
123 | void AliDhcTask::PrintDhcSettings() | |
124 | { | |
125 | AliInfo(Form("Dhc Task %s settings",fName.Data())); | |
126 | AliInfo(Form(" centrality estimator %s", fCentMethod.Data())); | |
127 | AliInfo(Form(" using tracks named %s", fTracksName.Data())); | |
128 | AliInfo(Form(" efficiency correct triggers? %d", fHEffT!=0)); | |
129 | AliInfo(Form(" efficiency correct associates? %d", fHEffA!=0)); | |
130 | AliInfo(Form(" fill muons? %d", fFillMuons)); | |
131 | AliInfo(Form(" use pTT > pTA criterion? %d", fPtTACrit)); | |
132 | AliInfo(Form(" create all pTT, pTA hists? %d", fAllTAHists)); | |
133 | AliInfo(Form(" Mix in eta_T bins instead of z_vertex? %d", fMixInEtaT)); | |
134 | AliInfo(Form(" trigger eta range %f .. %f", fEtaTLo, fEtaTHi)); | |
135 | AliInfo(Form(" associate eta range %f .. %f", fEtaALo, fEtaAHi)); | |
98880cdf | 136 | AliInfo(Form(" fill same event in any case? %d", fDoFillSame)); |
b3b66a56 | 137 | AliInfo(Form(" do invariant mass cut? %d", fDoMassCut)); |
138 | AliInfo(Form(" omit first event? %d\n", fOmitFirstEv)); | |
d7149d30 | 139 | } |
140 | ||
48a61f36 | 141 | //________________________________________________________________________ |
142 | void AliDhcTask::BookHistos() | |
143 | { | |
8433ff41 | 144 | // Book histograms. |
145 | ||
d688e049 | 146 | if (fVerbosity > 1) { |
8a9d3e12 | 147 | AliInfo(Form("Number of pt(t) bins: %d", fBPtT->GetNbins())); |
148 | for (Int_t i=1; i<=fBPtT->GetNbins(); i++) { | |
149 | AliInfo(Form("pt(t) bin %d, %f to %f", i, fBPtT->GetBinLowEdge(i), fBPtT->GetBinUpEdge(i))); | |
150 | } | |
d688e049 | 151 | AliInfo(Form("Number of pt(a) bins: %d", fBPtA->GetNbins())); |
152 | for (Int_t i=1; i<=fBPtA->GetNbins(); i++) { | |
153 | AliInfo(Form("pt(a) bin %d, %f to %f", i, fBPtA->GetBinLowEdge(i), fBPtA->GetBinUpEdge(i))); | |
154 | } | |
155 | } | |
48a61f36 | 156 | |
d688e049 | 157 | Int_t nPtAssc=fBPtA->GetNbins(); |
158 | Int_t nPtTrig=fBPtT->GetNbins(); | |
159 | Int_t nCent=fBCent->GetNbins(); | |
160 | Int_t nZvtx=fBZvtx->GetNbins(); | |
161 | Double_t ptt[nPtTrig+1]; | |
162 | ptt[0] = fBPtT->GetBinLowEdge(1); | |
163 | for (Int_t i=1; i<=nPtTrig; i++) { | |
164 | ptt[i] = fBPtT->GetBinUpEdge(i); | |
165 | } | |
166 | Double_t pta[nPtAssc+1]; | |
167 | pta[0] = fBPtA->GetBinLowEdge(1); | |
168 | for (Int_t i=1; i<=nPtAssc; i++) { | |
169 | pta[i] = fBPtA->GetBinUpEdge(i); | |
170 | } | |
171 | Double_t cent[nCent+1]; | |
172 | cent[0] = fBCent->GetBinLowEdge(1); | |
173 | for (Int_t i=1; i<=nCent; i++) { | |
174 | cent[i] = fBCent->GetBinUpEdge(i); | |
175 | } | |
176 | Double_t zvtx[nZvtx+1]; | |
177 | zvtx[0] = fBZvtx->GetBinLowEdge(1); | |
178 | for (Int_t i=1; i<=nZvtx; i++) { | |
179 | zvtx[i] = fBZvtx->GetBinUpEdge(i); | |
180 | } | |
380fb711 | 181 | |
8a9d3e12 | 182 | fHEvt = new TH2F("fHEvt", "Event-level variables; Zvtx; Cent", nZvtx, zvtx, nCent, cent); |
8433ff41 | 183 | fOutputList->Add(fHEvt); |
380fb711 | 184 | fHTrk = new TH2F("fHTrk", "Track-level variables", |
185 | 100, 0, TMath::TwoPi(), 100, -fEtaMax, +fEtaMax); | |
8433ff41 | 186 | fOutputList->Add(fHTrk); |
187 | ||
8433ff41 | 188 | fHPtAss = new TH1F("fHPtAss","PtAssoc;P_{T} (GeV/c) [GeV/c]",nPtAssc,pta); |
189 | fOutputList->Add(fHPtAss); | |
190 | fHPtTrg = new TH1F("fHPtTrg","PtTrig;P_{T} (GeV/c) [GeV/c]",nPtTrig,ptt); | |
191 | fOutputList->Add(fHPtTrg); | |
beb13b6c | 192 | fHPtTrgEvt = new TH1F("fHPtTrgEvt","PtTrig;P_{T} (GeV/c) [GeV/c]",nPtTrig,ptt); |
193 | fHPtTrgNorm1S = new TH3F("fHPtTrgNorm1S","PtTrig;P_{T} (GeV/c) [GeV/c];centrality;z_{vtx}",nPtTrig,ptt,nCent,cent,nZvtx,zvtx); | |
194 | fOutputList->Add(fHPtTrgNorm1S); | |
195 | fHPtTrgNorm1M = (TH3*) fHPtTrgNorm1S->Clone("fHPtTrgNorm1M"); | |
196 | fOutputList->Add(fHPtTrgNorm1M); | |
197 | fHPtTrgNorm2S = (TH3*) fHPtTrgNorm1S->Clone("fHPtTrgNorm2S"); | |
198 | fOutputList->Add(fHPtTrgNorm2S); | |
199 | fHPtTrgNorm2M = (TH3*) fHPtTrgNorm1S->Clone("fHPtTrgNorm2M"); | |
200 | fOutputList->Add(fHPtTrgNorm2M); | |
380fb711 | 201 | |
8433ff41 | 202 | fHCent = new TH1F("fHCent","Cent;bins",nCent,cent); |
203 | fOutputList->Add(fHCent); | |
204 | fHZvtx = new TH1F("fHZvtx","Zvertex;bins",nZvtx,zvtx); | |
205 | fOutputList->Add(fHZvtx); | |
380fb711 | 206 | |
207 | fHQAT = new TH3F("fHQAT","QA trigger;p_{T} (GeV/c);#eta;#phi", | |
208 | 100,0.0,10.0, | |
209 | 40,fEtaTLo,fEtaTHi, | |
210 | 36,0.0,TMath::TwoPi()); | |
211 | fOutputList->Add(fHQAT); | |
212 | ||
213 | fHQAA = new TH3F("fHQAA","QA associated;p_{T} (GeV/c);#eta;#phi", | |
214 | 100,0.0,10.0, | |
215 | 40,fEtaALo,fEtaAHi, | |
216 | 36,0.0,TMath::TwoPi()); | |
217 | fOutputList->Add(fHQAA); | |
8433ff41 | 218 | |
d7149d30 | 219 | fHPtCentT = new TH2F("fHPtCentT",Form("trigger particles;p_{T} (GeV/c);centrality (%s)",fCentMethod.Data()), |
220 | 100,0.0,10.0, | |
221 | 100,cent[0],cent[nCent]); | |
222 | fOutputList->Add(fHPtCentT); | |
223 | fHPtCentA = new TH2F("fHPtCentA",Form("associated particles;p_{T} (GeV/c);centrality (%s)",fCentMethod.Data()), | |
224 | 100,0.0,10.0, | |
225 | 100,cent[0],cent[nCent]); | |
226 | fOutputList->Add(fHPtCentA); | |
227 | ||
98880cdf | 228 | fNbins = nPtTrig*nPtAssc*nCent*nZvtx; |
229 | fHSs = new TH2*[fNbins]; | |
230 | fHMs = new TH2*[fNbins]; | |
231 | fHPts = new TH1*[fNbins]; | |
232 | fHSMass = new TH1*[fNbins]; | |
233 | fHMMass = new TH1*[fNbins]; | |
234 | ||
8433ff41 | 235 | fIndex = new TFormula("GlobIndex","(t-1)*[0]*[1]*[2]+(z-1)*[0]*[1]+(x-1)*[0]+(y-1)+0*[4]"); |
236 | fIndex->SetParameters(nPtTrig,nPtAssc,nZvtx,nCent); | |
237 | fIndex->SetParNames("NTrigBins","NAssocBins", "NZvertexBins", "NCentBins"); | |
eee08176 | 238 | fOutputList->Add(fIndex); |
380fb711 | 239 | |
8433ff41 | 240 | Int_t count = 0; |
241 | for (Int_t c=1; c<=nCent; ++c) { | |
242 | for (Int_t z=1; z<=nZvtx; ++z) { | |
243 | for (Int_t t=1; t<=nPtTrig; ++t) { | |
380fb711 | 244 | for (Int_t a=1; a<=nPtAssc; ++a) { |
98880cdf | 245 | fHSs[count] = 0; |
246 | fHMs[count] = 0; | |
247 | fHPts[count] = 0; | |
248 | fHSMass[count] = 0; | |
249 | fHMMass[count] = 0; | |
e47b8f11 | 250 | if ((a>t)&&!fAllTAHists) { |
380fb711 | 251 | ++count; |
252 | continue; | |
253 | } | |
98880cdf | 254 | if (z==1 && t==1 && a==1) { |
255 | TString title(Form("cen=%d (%.1f to %.1f)", | |
256 | c, fBCent->GetBinLowEdge(c), fBCent->GetBinUpEdge(c))); | |
257 | fHSMass[count] = new TH1F(Form("hSMass%d",count), Form("Mass Same Event %s;m (GeV)",title.Data()), 10000, 0,10); | |
258 | fOutputList->Add(fHSMass[count]); | |
259 | fHMMass[count] = new TH1F(Form("hMMass%d",count), Form("Mass Mixed Event %s;m (GeV)",title.Data()), 10000, 0,10); | |
260 | fOutputList->Add(fHMMass[count]); | |
261 | } | |
8a9d3e12 | 262 | if (t==1 && a==1) { |
263 | TString title(Form("cen=%d (%.1f to %.1f), zVtx=%d (%.1f to %.1f)", | |
380fb711 | 264 | c, fBCent->GetBinLowEdge(c), fBCent->GetBinUpEdge(c), |
8a9d3e12 | 265 | z, fBZvtx->GetBinLowEdge(z), fBZvtx->GetBinUpEdge(z))); |
266 | fHPts[count] = new TH1F(Form("hPt%d",count), Form("Ptdist %s;p_{T} (GeV/c)",title.Data()), 200,0,20); | |
267 | fOutputList->Add(fHPts[count]); | |
268 | } | |
380fb711 | 269 | TString title(Form("cen=%d (%.1f to %.1f), zVtx=%d (%.1f to %.1f), trig=%d (%.1f to %.1f), assoc=%d (%.1f to %.1f)", |
270 | c, fBCent->GetBinLowEdge(c), fBCent->GetBinUpEdge(c), | |
8a9d3e12 | 271 | z, fBZvtx->GetBinLowEdge(z), fBZvtx->GetBinUpEdge(z), |
380fb711 | 272 | t, fBPtT->GetBinLowEdge(t), fBPtT->GetBinUpEdge(t), |
8a9d3e12 | 273 | a, fBPtA->GetBinLowEdge(a), fBPtA->GetBinUpEdge(a))); |
380fb711 | 274 | fHSs[count] = new TH2F(Form("hS%d",count), Form("Signal %s;#Delta #varphi;#Delta #eta",title.Data()), |
275 | fNBdphi,-0.5*TMath::Pi(),1.5*TMath::Pi(),fNBdeta,-2*fEtaMax,2*fEtaMax); | |
276 | fHMs[count] = new TH2F(Form("hM%d",count), Form("Mixed %s;#Delta #varphi;#Delta #eta",title.Data()), | |
277 | fNBdphi,-0.5*TMath::Pi(),1.5*TMath::Pi(),fNBdeta,-2*fEtaMax,2*fEtaMax); | |
278 | fOutputList->Add(fHSs[count]); | |
279 | fOutputList->Add(fHMs[count]); | |
8a9d3e12 | 280 | Int_t tcount = (Int_t)fIndex->Eval(t,a,z,c); |
380fb711 | 281 | if (fVerbosity>5) |
282 | cout << count << " " << tcount << ": " << title << endl; | |
8a9d3e12 | 283 | if (count != tcount) |
284 | AliFatal(Form("Index mismatch: %d %d", count, tcount)); | |
380fb711 | 285 | ++count; |
286 | } | |
8433ff41 | 287 | } |
288 | } | |
289 | } | |
48a61f36 | 290 | } |
291 | ||
beb13b6c | 292 | //________________________________________________________________________ |
b422cf0d | 293 | void AliDhcTask::SetAnaMode(Int_t iAna) |
beb13b6c | 294 | { |
295 | if (iAna==kHH) { | |
296 | SetFillMuons(kFALSE); | |
297 | fEtaTLo = -1.0; | |
298 | fEtaTHi = 1.0; | |
299 | fEtaALo = -1.0; | |
300 | fEtaAHi = 1.0; | |
301 | } else if (iAna==kMuH) { | |
302 | SetFillMuons(kTRUE); | |
303 | fEtaTLo = -5.0; | |
380fb711 | 304 | fEtaTHi = -1.0; |
beb13b6c | 305 | fEtaALo = -1.0; |
306 | fEtaAHi = 1.0; | |
307 | } else if (iAna==kHMu) { | |
308 | SetFillMuons(kTRUE); | |
309 | fEtaTLo = -1.0; | |
310 | fEtaTHi = 1.0; | |
311 | fEtaALo = -5.0; | |
380fb711 | 312 | fEtaAHi = -1.0; |
beb13b6c | 313 | } else if (iAna==kMuMu) { |
314 | SetFillMuons(kTRUE); | |
315 | fEtaTLo = -5.0; | |
380fb711 | 316 | fEtaTHi = -1.0; |
beb13b6c | 317 | fEtaALo = -5.0; |
380fb711 | 318 | fEtaAHi = -1.0; |
beb13b6c | 319 | } else if (iAna==kPSide) { |
320 | SetFillMuons(kFALSE); | |
321 | fEtaTLo = -1.0; | |
322 | fEtaTHi = -0.465; | |
323 | fEtaALo = -1.0; | |
324 | fEtaAHi = -0.465; | |
325 | } else if (iAna==kASide) { | |
326 | SetFillMuons(kFALSE); | |
327 | fEtaTLo = -0.465; | |
328 | fEtaTHi = 1.0; | |
329 | fEtaALo = -0.465; | |
330 | fEtaAHi = 1.0; | |
331 | } else { | |
332 | AliInfo(Form("Unrecognized analysis option: %d", iAna)); | |
333 | } | |
334 | } | |
335 | ||
48a61f36 | 336 | //________________________________________________________________________ |
337 | void AliDhcTask::InitEventMixer() | |
338 | { | |
339 | // The effective pool size in events is set by trackDepth, so more | |
340 | // low-mult events are required to maintain the threshold than | |
341 | // high-mult events. Centrality pools are indep. of data histogram | |
342 | // binning, no need to match. | |
343 | ||
48a61f36 | 344 | // Centrality pools |
d688e049 | 345 | Int_t nCentBins=fMixBCent->GetNbins(); |
346 | Double_t centBins[nCentBins+1]; | |
347 | centBins[0] = fMixBCent->GetBinLowEdge(1); | |
348 | for (Int_t i=1; i<=nCentBins; i++) { | |
349 | centBins[i] = fMixBCent->GetBinUpEdge(i); | |
350 | } | |
48a61f36 | 351 | |
352 | // Z-vertex pools | |
d688e049 | 353 | Int_t nZvtxBins=fMixBZvtx->GetNbins(); |
354 | Double_t zvtxbin[nZvtxBins+1]; | |
355 | zvtxbin[0] = fMixBZvtx->GetBinLowEdge(1); | |
356 | for (Int_t i=1; i<=nZvtxBins; i++) { | |
357 | zvtxbin[i] = fMixBZvtx->GetBinUpEdge(i); | |
358 | } | |
8433ff41 | 359 | |
360 | fPoolMgr = new AliEvtPoolManager(); | |
d688e049 | 361 | fPoolMgr->SetTargetTrackDepth(fTrackDepth); |
8433ff41 | 362 | if (fVerbosity>4) |
363 | fPoolMgr->SetDebug(1); | |
d688e049 | 364 | fPoolMgr->InitEventPools(fPoolSize, nCentBins, centBins, nZvtxBins, zvtxbin); |
48a61f36 | 365 | } |
366 | ||
367 | //________________________________________________________________________ | |
368 | void AliDhcTask::UserExec(Option_t *) | |
369 | { | |
370 | // Main loop, called for each event. | |
48a61f36 | 371 | |
372 | LoadBranches(); | |
373 | ||
b3b66a56 | 374 | if (fOmitFirstEv) { |
375 | if (fUtils->IsFirstEventInChunk(InputEvent())) | |
376 | return; | |
377 | } | |
378 | ||
48a61f36 | 379 | // Get event pointers, check for signs of life |
b3b66a56 | 380 | Int_t dType = -1; // Will be set to kESD or kAOD. |
48a61f36 | 381 | fESD = dynamic_cast<AliESDEvent*>(InputEvent()); |
382 | fAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
383 | if (fESD) | |
384 | dType = kESD; | |
385 | else if (fAOD) | |
386 | dType = kAOD; | |
387 | else { | |
388 | AliError("Neither fESD nor fAOD available"); | |
389 | return; | |
390 | } | |
391 | ||
5a6df06d | 392 | if (fClassName.Length()>0) { |
393 | TString cls; | |
394 | if (fESD) | |
395 | cls = fESD->GetFiredTriggerClasses(); | |
396 | else | |
397 | cls = fAOD->GetFiredTriggerClasses(); | |
398 | if (!cls.Contains(fClassName)) | |
399 | return; | |
400 | } | |
401 | ||
d688e049 | 402 | Bool_t mcgen = 0; |
403 | if (fTracksName.Contains("Gen")) | |
404 | mcgen = 1; | |
405 | ||
48a61f36 | 406 | // Centrality, vertex, other event variables... |
d688e049 | 407 | if (mcgen) { |
408 | fZVertex = 0; | |
409 | TList *list = InputEvent()->GetList(); | |
beb13b6c | 410 | TClonesArray *tcaTracks = 0; |
411 | if (list) | |
412 | tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
d688e049 | 413 | if (tcaTracks) |
414 | fCentrality = tcaTracks->GetEntries(); | |
415 | } else { | |
416 | if (dType == kESD) { | |
b3b66a56 | 417 | const AliESDVertex* vertex = fESD->GetPrimaryVertex(); |
418 | fZVertex = vertex->GetZ(); | |
419 | if (!VertexOk()) { | |
d688e049 | 420 | if (fVerbosity > 1) |
421 | AliInfo(Form("Event REJECTED (ESD vertex not OK). z = %.1f", fZVertex)); | |
422 | return; | |
423 | } | |
d688e049 | 424 | if(fESD->GetCentrality()) { |
425 | fCentrality = | |
426 | fESD->GetCentrality()->GetCentralityPercentile(fCentMethod); | |
427 | } | |
eee08176 | 428 | } else if (dType == kAOD) { |
d688e049 | 429 | const AliAODVertex* vertex = fAOD->GetPrimaryVertex(); |
430 | fZVertex = vertex->GetZ(); | |
b3b66a56 | 431 | if (!VertexOk()) { |
d688e049 | 432 | if (fVerbosity > 1) |
433 | Info("Exec()", "Event REJECTED (AOD vertex not OK). z = %.1f", fZVertex); | |
434 | return; | |
435 | } | |
436 | const AliCentrality *aodCent = fAOD->GetHeader()->GetCentralityP(); | |
437 | if (aodCent) { | |
438 | fCentrality = aodCent->GetCentralityPercentile(fCentMethod); | |
439 | } | |
48a61f36 | 440 | } |
441 | } | |
d688e049 | 442 | |
eee08176 | 443 | // Fill event histogram |
48a61f36 | 444 | fHEvt->Fill(fZVertex, fCentrality); |
d688e049 | 445 | if (fCentrality > fBCent->GetXmax() || fCentrality < fBCent->GetXmin()) { |
9370528f | 446 | if (fVerbosity > 1) |
447 | AliInfo(Form("Event REJECTED (centrality out of range). fCentrality = %.1f", fCentrality)); | |
48a61f36 | 448 | return; |
449 | } | |
450 | ||
b3b66a56 | 451 | // Get pool containing tracks from other events like this one |
452 | AliEvtPool* pool = fPoolMgr->GetEventPool(fCentrality, fZVertex); | |
453 | if (!pool) { | |
454 | AliWarning(Form("No pool found. Centrality %f, ZVertex %f", | |
455 | fCentrality, fZVertex)); | |
456 | return; | |
457 | } | |
458 | ||
48a61f36 | 459 | // Get array of selected tracks |
b3b66a56 | 460 | MiniEvent* sTracks = new MiniEvent(0); // deleted by pool mgr. |
48a61f36 | 461 | if (dType == kESD) { |
f6701c6e | 462 | GetESDTracks(sTracks); |
eee08176 | 463 | } else if (dType == kAOD) { |
f6701c6e | 464 | GetAODTracks(sTracks); |
48a61f36 | 465 | } |
466 | ||
b3b66a56 | 467 | if (sTracks->size()==0) { |
468 | AliWarning(Form("Track array empty")); | |
469 | delete sTracks; | |
48a61f36 | 470 | return; |
471 | } | |
472 | ||
473 | if (!pool->IsReady()) { | |
474 | pool->UpdatePool(sTracks); | |
eee08176 | 475 | if (fDoFillSame) { // fill same event right away if requested |
476 | Correlate(*sTracks, *sTracks, kSameEvt); | |
477 | } | |
48a61f36 | 478 | return; |
479 | } | |
480 | ||
481 | if (pool->IsFirstReady()) { | |
482 | // recover events missed before the pool is ready | |
483 | Int_t nEvs = pool->GetCurrentNEvents(); | |
484 | if (nEvs>1) { | |
485 | for (Int_t i=0; i<nEvs; ++i) { | |
486 | MiniEvent* evI = pool->GetEvent(i); | |
487 | for (Int_t j=0; j<nEvs; ++j) { | |
488 | MiniEvent* evJ = pool->GetEvent(j); | |
eee08176 | 489 | if ((i==j) && !fDoFillSame) { |
490 | Correlate(*evI, *evJ, kSameEvt); | |
48a61f36 | 491 | } else { |
d688e049 | 492 | Correlate(*evI, *evJ, kDiffEvt); |
48a61f36 | 493 | } |
494 | } | |
495 | } | |
496 | } | |
497 | } else { /* standard case: same event, then mix*/ | |
498 | Correlate(*sTracks, *sTracks, kSameEvt); | |
499 | Int_t nMix = pool->GetCurrentNEvents(); | |
500 | for (Int_t jMix=0; jMix<nMix; ++jMix) { | |
501 | MiniEvent* bgTracks = pool->GetEvent(jMix); | |
d688e049 | 502 | Correlate(*sTracks, *bgTracks, kDiffEvt); |
48a61f36 | 503 | } |
504 | } | |
505 | ||
48a61f36 | 506 | pool->UpdatePool(sTracks); |
507 | PostData(1, fOutputList); | |
48a61f36 | 508 | } |
509 | ||
510 | //________________________________________________________________________ | |
f6701c6e | 511 | void AliDhcTask::GetESDTracks(MiniEvent* miniEvt) |
48a61f36 | 512 | { |
513 | // Loop twice: 1. Count sel. tracks. 2. Fill vector. | |
514 | ||
d688e049 | 515 | if (fTracksName.IsNull()) { |
516 | const AliESDVertex *vtxSPD = fESD->GetPrimaryVertexSPD(); | |
517 | if (!vtxSPD) | |
518 | return; | |
519 | ||
520 | Int_t nTrax = fESD->GetNumberOfTracks(); | |
521 | if (fVerbosity > 2) | |
522 | AliInfo(Form("%d tracks in event",nTrax)); | |
523 | ||
524 | // Loop 1. | |
525 | Int_t nSelTrax = 0; | |
526 | TObjArray arr(nTrax); | |
527 | arr.SetOwner(1); | |
528 | ||
b3b66a56 | 529 | if (!fEsdTPCOnly) { |
530 | fEsdTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); | |
531 | //fEsdTPCOnly->SetMinNClustersTPC(70); | |
532 | fEsdTPCOnly->SetMinNCrossedRowsTPC(70); | |
533 | fEsdTPCOnly->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8); | |
534 | } | |
535 | ||
d688e049 | 536 | for (Int_t i = 0; i < nTrax; ++i) { |
537 | AliESDtrack* esdtrack = fESD->GetTrack(i); | |
538 | if (!esdtrack) { | |
539 | AliError(Form("Couldn't get ESD track %d\n", i)); | |
540 | continue; | |
541 | } | |
8a9d3e12 | 542 | Bool_t trkOK = fEsdTPCOnly->AcceptTrack(esdtrack); |
d688e049 | 543 | if (!trkOK) |
544 | continue; | |
545 | Double_t pt = esdtrack->Pt(); | |
546 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
547 | if (!ptOK) | |
548 | continue; | |
549 | Double_t eta = esdtrack->Eta(); | |
550 | if (TMath::Abs(eta) > fEtaMax) | |
551 | continue; | |
552 | ||
553 | // create a tpc only track | |
554 | AliESDtrack *newtrack = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID()); | |
555 | if(!newtrack) | |
556 | continue; | |
557 | if (newtrack->Pt()<=0) { | |
558 | delete newtrack; | |
559 | continue; | |
560 | } | |
8433ff41 | 561 | |
d688e049 | 562 | AliExternalTrackParam exParam; |
563 | Bool_t relate = newtrack->RelateToVertexTPC(vtxSPD,fESD->GetMagneticField(),kVeryBig,&exParam); | |
564 | if (!relate) { | |
565 | delete newtrack; | |
566 | continue; | |
567 | } | |
8433ff41 | 568 | |
d688e049 | 569 | // set the constraint parameters to the track |
570 | newtrack->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance()); | |
8433ff41 | 571 | |
d688e049 | 572 | pt = newtrack->Pt(); |
573 | ptOK = pt >= fPtMin && pt < fPtMax; | |
574 | if (!ptOK) { | |
575 | delete newtrack; | |
576 | continue; | |
577 | } | |
578 | eta = esdtrack->Eta(); | |
579 | if (TMath::Abs(eta) > fEtaMax) { | |
580 | delete newtrack; | |
581 | continue; | |
582 | } | |
583 | arr.Add(newtrack); | |
584 | nSelTrax++; | |
8433ff41 | 585 | } |
beb13b6c | 586 | |
587 | for(Int_t itrack = 0; itrack < nSelTrax; itrack++) { | |
588 | AliVTrack *esdtrack = static_cast<AliESDtrack*>(arr.At(itrack)); | |
589 | if(!esdtrack) { | |
590 | AliError(Form("ERROR: Could not retrieve esdtrack %d",itrack)); | |
591 | continue; | |
592 | } | |
593 | Double_t pt = esdtrack->Pt(); | |
594 | Double_t eta = esdtrack->Eta(); | |
595 | Double_t phi = esdtrack->Phi(); | |
596 | Int_t sign = esdtrack->Charge() > 0 ? 1 : -1; | |
597 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
598 | } | |
b673a083 | 599 | } else { |
600 | TList *list = InputEvent()->GetList(); | |
601 | TClonesArray *tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
f018e7c8 | 602 | |
b673a083 | 603 | if(!tcaTracks){ |
604 | AliError("Ptr to tcaTracks zero"); | |
605 | return; | |
606 | } | |
f018e7c8 | 607 | |
b673a083 | 608 | const Int_t ntracks = tcaTracks->GetEntries(); |
609 | if (miniEvt) | |
610 | miniEvt->reserve(ntracks); | |
611 | else { | |
612 | AliError("Ptr to miniEvt zero"); | |
613 | return; | |
614 | } | |
48a61f36 | 615 | |
b673a083 | 616 | for (Int_t itrack = 0; itrack < ntracks; itrack++) { |
617 | AliVTrack *vtrack = static_cast<AliVTrack*>(tcaTracks->At(itrack)); | |
618 | if (!vtrack) { | |
619 | AliError(Form("ERROR: Could not retrieve track %d",itrack)); | |
620 | continue; | |
621 | } | |
622 | Double_t pt = vtrack->Pt(); | |
623 | Double_t eta = vtrack->Eta(); | |
624 | Double_t phi = vtrack->Phi(); | |
625 | Int_t sign = vtrack->Charge() > 0 ? 1 : -1; | |
626 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
48a61f36 | 627 | } |
48a61f36 | 628 | } |
beb13b6c | 629 | |
630 | if (fFillMuons) { | |
beb13b6c | 631 | // count good muons |
632 | Int_t nGoodMuons = 0; | |
633 | for (Int_t iMu = 0; iMu<fESD->GetNumberOfMuonTracks(); iMu++) { | |
634 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iMu); | |
b673a083 | 635 | if (muonTrack) { |
beb13b6c | 636 | if (IsGoodMUONtrack(*muonTrack)) nGoodMuons++; |
637 | } | |
638 | } | |
639 | miniEvt->reserve(miniEvt->size()+nGoodMuons); | |
640 | // fill them into the mini event | |
641 | for (Int_t iMu = 0; iMu<fESD->GetNumberOfMuonTracks(); iMu++) { | |
642 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iMu); | |
b673a083 | 643 | if (muonTrack) { |
644 | if (!IsGoodMUONtrack(*muonTrack)) | |
645 | continue; | |
646 | Double_t ptMu = muonTrack->Pt(); | |
647 | Double_t etaMu = muonTrack->Eta(); | |
648 | Double_t phiMu = muonTrack->Phi(); | |
b422cf0d | 649 | Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; |
beb13b6c | 650 | miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); |
651 | } | |
652 | } | |
653 | } | |
48a61f36 | 654 | } |
655 | ||
656 | //________________________________________________________________________ | |
f6701c6e | 657 | void AliDhcTask::GetAODTracks(MiniEvent* miniEvt) |
48a61f36 | 658 | { |
659 | // Loop twice: 1. Count sel. tracks. 2. Fill vector. | |
660 | ||
b673a083 | 661 | if (fTracksName.IsNull()) { |
662 | Int_t nTrax = fAOD->GetNumberOfTracks(); | |
663 | Int_t nSelTrax = 0; | |
48a61f36 | 664 | |
b673a083 | 665 | if (fVerbosity > 2) |
666 | AliInfo(Form("%d tracks in event",nTrax)); | |
48a61f36 | 667 | |
b673a083 | 668 | // Loop 1. |
669 | for (Int_t i = 0; i < nTrax; ++i) { | |
670 | AliAODTrack* aodtrack = fAOD->GetTrack(i); | |
671 | if (!aodtrack) { | |
672 | AliError(Form("Couldn't get AOD track %d\n", i)); | |
673 | continue; | |
674 | } | |
675 | // See $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C | |
676 | UInt_t tpcOnly = 1 << 7; | |
677 | Bool_t trkOK = aodtrack->TestFilterBit(tpcOnly); | |
678 | if (!trkOK) | |
679 | continue; | |
680 | Double_t pt = aodtrack->Pt(); | |
681 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
682 | if (!ptOK) | |
683 | continue; | |
684 | Double_t eta = aodtrack->Eta(); | |
685 | if (TMath::Abs(eta) > fEtaMax) | |
686 | continue; | |
687 | nSelTrax++; | |
48a61f36 | 688 | } |
48a61f36 | 689 | |
b673a083 | 690 | if (miniEvt) |
691 | miniEvt->reserve(nSelTrax); | |
692 | else { | |
693 | AliError("!miniEvt"); | |
694 | return; | |
48a61f36 | 695 | } |
b673a083 | 696 | |
697 | // Loop 2. | |
698 | for (Int_t i = 0; i < nTrax; ++i) { | |
699 | AliAODTrack* aodtrack = fAOD->GetTrack(i); | |
700 | if (!aodtrack) { | |
701 | AliError(Form("Couldn't get AOD track %d\n", i)); | |
702 | continue; | |
703 | } | |
48a61f36 | 704 | |
b673a083 | 705 | // See $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C |
706 | UInt_t tpcOnly = 1 << 7; | |
707 | Bool_t trkOK = aodtrack->TestFilterBit(tpcOnly); | |
708 | if (!trkOK) | |
709 | continue; | |
710 | Double_t pt = aodtrack->Pt(); | |
711 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
712 | if (!ptOK) | |
713 | continue; | |
714 | Double_t eta = aodtrack->Eta(); | |
715 | if (TMath::Abs(eta) > fEtaMax) | |
716 | continue; | |
717 | ||
718 | Double_t phi = aodtrack->Phi(); | |
719 | Int_t sign = aodtrack->Charge() > 0 ? 1 : -1; | |
720 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
721 | } | |
722 | } else { | |
723 | TList *list = InputEvent()->GetList(); | |
724 | TClonesArray *tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
725 | ||
726 | if (!tcaTracks){ | |
727 | AliError("Ptr to tcaTracks zero"); | |
728 | return; | |
729 | } | |
730 | ||
731 | const Int_t ntracks = tcaTracks->GetEntries(); | |
732 | if (miniEvt) | |
733 | miniEvt->reserve(ntracks); | |
734 | else { | |
735 | AliError("Ptr to miniEvt zero"); | |
736 | return; | |
737 | } | |
738 | ||
739 | for (Int_t itrack = 0; itrack < ntracks; itrack++) { | |
740 | AliVTrack *vtrack = static_cast<AliVTrack*>(tcaTracks->At(itrack)); | |
741 | if (!vtrack) { | |
742 | AliError(Form("ERROR: Could not retrieve vtrack %d",itrack)); | |
743 | continue; | |
744 | } | |
745 | Double_t pt = vtrack->Pt(); | |
746 | Double_t eta = vtrack->Eta(); | |
747 | Double_t phi = vtrack->Phi(); | |
748 | Int_t sign = vtrack->Charge() > 0 ? 1 : -1; | |
749 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
750 | } | |
751 | } | |
48a61f36 | 752 | |
b673a083 | 753 | if (fFillMuons) { |
754 | // count good muons | |
755 | Int_t nGoodMuons = 0; | |
756 | for (Int_t iMu = 0; iMu<fAOD->GetNumberOfTracks(); iMu++) { | |
757 | AliAODTrack* muonTrack = fAOD->GetTrack(iMu); | |
758 | if(muonTrack) { | |
759 | if (IsGoodMUONtrack(*muonTrack)) | |
760 | nGoodMuons++; | |
761 | } | |
762 | } | |
763 | miniEvt->reserve(miniEvt->size()+nGoodMuons); | |
764 | // fill them into the mini event | |
765 | for (Int_t iMu = 0; iMu<fAOD->GetNumberOfTracks(); iMu++) { | |
766 | AliAODTrack* muonTrack = fAOD->GetTrack(iMu); | |
767 | if (muonTrack) { | |
768 | if (!IsGoodMUONtrack(*muonTrack)) | |
769 | continue; | |
770 | Double_t ptMu = muonTrack->Pt(); | |
771 | Double_t etaMu = muonTrack->Eta(); | |
772 | Double_t phiMu = muonTrack->Phi(); | |
b422cf0d | 773 | Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; |
b673a083 | 774 | miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); |
775 | } | |
776 | } | |
48a61f36 | 777 | } |
48a61f36 | 778 | } |
779 | ||
780 | //________________________________________________________________________ | |
781 | Double_t AliDhcTask::DeltaPhi(Double_t phia, Double_t phib, | |
782 | Double_t rangeMin, Double_t rangeMax) const | |
783 | { | |
784 | Double_t dphi = -999; | |
785 | Double_t pi = TMath::Pi(); | |
786 | ||
787 | if (phia < 0) phia += 2*pi; | |
788 | else if (phia > 2*pi) phia -= 2*pi; | |
789 | if (phib < 0) phib += 2*pi; | |
790 | else if (phib > 2*pi) phib -= 2*pi; | |
791 | dphi = phib - phia; | |
792 | if (dphi < rangeMin) dphi += 2*pi; | |
793 | else if (dphi > rangeMax) dphi -= 2*pi; | |
794 | ||
795 | return dphi; | |
796 | } | |
797 | ||
798 | //________________________________________________________________________ | |
d688e049 | 799 | Int_t AliDhcTask::Correlate(const MiniEvent &evt1, const MiniEvent &evt2, Int_t pairing) |
48a61f36 | 800 | { |
801 | // Triggered angular correlations. If pairing is kSameEvt, particles | |
802 | // within evt1 are correlated. If kDiffEvt, correlate triggers from | |
803 | // evt1 with partners from evt2. | |
8433ff41 | 804 | |
805 | Int_t cbin = fHCent->FindBin(fCentrality); | |
806 | if (fHCent->IsBinOverflow(cbin) || | |
807 | fHCent->IsBinUnderflow(cbin)) | |
808 | return 0; | |
809 | ||
810 | Int_t zbin = fHZvtx->FindBin(fZVertex); | |
811 | if (fHZvtx->IsBinOverflow(zbin) || | |
812 | fHZvtx->IsBinUnderflow(zbin)) | |
813 | return 0; | |
814 | ||
48a61f36 | 815 | Int_t iMax = evt1.size(); |
816 | Int_t jMax = evt2.size(); | |
817 | ||
8433ff41 | 818 | TH2 **hist = fHMs; |
819 | if (pairing == kSameEvt) { | |
820 | hist = fHSs; | |
b673a083 | 821 | fHCent->Fill(fCentrality); |
822 | fHZvtx->Fill(fZVertex); | |
8433ff41 | 823 | } |
824 | ||
825 | Int_t nZvtx = fHZvtx->GetNbinsX(); | |
826 | Int_t nPtTrig = fHPtTrg->GetNbinsX(); | |
827 | Int_t nPtAssc = fHPtAss->GetNbinsX(); | |
828 | ||
829 | Int_t globIndex = (cbin-1)*nZvtx*nPtTrig*nPtAssc+(zbin-1)*nPtTrig*nPtAssc; | |
98880cdf | 830 | Int_t ptindex = (Int_t)fIndex->Eval(1,1,zbin,cbin); |
831 | Int_t mindex = (Int_t)fIndex->Eval(1,1,1,cbin); | |
48a61f36 | 832 | |
8a9d3e12 | 833 | |
beb13b6c | 834 | fHPtTrgEvt->Reset(); |
383b3bca | 835 | for (Int_t i=0; i<iMax; ++i) { |
836 | const AliMiniTrack &a(evt1.at(i)); | |
837 | Float_t pta = a.Pt(); | |
beb13b6c | 838 | fHPtTrgEvt->Fill(pta); |
383b3bca | 839 | if (pairing == kSameEvt) { |
8a9d3e12 | 840 | fHPts[ptindex]->Fill(pta); |
d688e049 | 841 | } |
842 | } | |
73a051c1 | 843 | |
beb13b6c | 844 | Bool_t bCountTrg; // only count the trigger if an associated particle is found |
48a61f36 | 845 | |
beb13b6c | 846 | for (Int_t i=0; i<iMax; ++i) { |
48a61f36 | 847 | // Trigger particles |
8433ff41 | 848 | const AliMiniTrack &a(evt1.at(i)); |
849 | ||
850 | Float_t pta = a.Pt(); | |
beb13b6c | 851 | Float_t etaa = a.Eta(); |
7e990b20 | 852 | Float_t phia = a.Phi(); |
380fb711 | 853 | |
854 | // brief intermezzo in the trigger particle loop: do associated particle QA here in order to avoid double counting | |
855 | if (pairing == kSameEvt) { | |
856 | if (etaa>fEtaALo && etaa<fEtaAHi) { | |
857 | Int_t bbin = fHPtAss->FindBin(pta); | |
858 | if (!(fHPtAss->IsBinOverflow(bbin) || fHPtAss->IsBinUnderflow(bbin))) { | |
859 | fHQAA->Fill(pta,etaa,phia); // fill every associated particle once | |
d7149d30 | 860 | fHPtCentA->Fill(pta,fCentrality); |
380fb711 | 861 | } |
862 | } | |
863 | } | |
864 | ||
865 | // back to triggers | |
8433ff41 | 866 | Int_t abin = fHPtTrg->FindBin(pta); |
beb13b6c | 867 | if (fHPtTrg->IsBinOverflow(abin) || fHPtTrg->IsBinUnderflow(abin)) |
868 | continue; | |
869 | ||
870 | if (etaa<fEtaTLo || etaa>fEtaTHi) | |
8433ff41 | 871 | continue; |
48a61f36 | 872 | |
beb13b6c | 873 | // efficiency weighting |
beb13b6c | 874 | Double_t effWtT = 1.0; |
875 | if (fHEffT) { | |
876 | // trigger particle | |
7e990b20 | 877 | const Int_t nEffDimT = fHEffT->GetNdimensions(); |
878 | Int_t effBinT[nEffDimT]; | |
879 | effBinT[0] = fHEffT->GetAxis(0)->FindBin(etaa); | |
880 | effBinT[1] = fHEffT->GetAxis(1)->FindBin(pta); | |
881 | effBinT[2] = fHEffT->GetAxis(2)->FindBin(fCentrality); | |
882 | effBinT[3] = fHEffT->GetAxis(3)->FindBin(fZVertex); | |
883 | if (nEffDimT>4) { | |
884 | effBinT[4] = fHEffT->GetAxis(4)->FindBin(phia); | |
885 | } | |
886 | effWtT = fHEffT->GetBinContent(effBinT); | |
beb13b6c | 887 | } |
888 | ||
48a61f36 | 889 | if (pairing == kSameEvt) { |
7e990b20 | 890 | fHTrk->Fill(phia,etaa); |
380fb711 | 891 | fHQAT->Fill(pta,etaa,phia); |
d7149d30 | 892 | fHPtCentT->Fill(pta,fCentrality); |
380fb711 | 893 | fHPtTrg->Fill(pta); |
beb13b6c | 894 | fHPtTrgNorm1S->Fill(pta,fCentrality,fZVertex,effWtT); |
895 | } else { | |
896 | fHPtTrgNorm1M->Fill(pta,fCentrality,fZVertex,effWtT); | |
48a61f36 | 897 | } |
beb13b6c | 898 | bCountTrg = kFALSE; |
48a61f36 | 899 | |
8433ff41 | 900 | for (Int_t j=0; j<jMax; ++j) { |
48a61f36 | 901 | // Associated particles |
902 | if (pairing == kSameEvt && i==j) | |
beb13b6c | 903 | continue; |
48a61f36 | 904 | |
8433ff41 | 905 | const AliMiniTrack &b(evt2.at(j)); |
48a61f36 | 906 | |
48a61f36 | 907 | Float_t ptb = b.Pt(); |
beb13b6c | 908 | Float_t etab = b.Eta(); |
7e990b20 | 909 | Float_t phib = b.Phi(); |
380fb711 | 910 | if (fPtTACrit&&(pta < ptb)) { |
b422cf0d | 911 | continue; |
912 | } | |
48a61f36 | 913 | |
73a051c1 | 914 | Int_t bbin = fHPtAss->FindBin(ptb); |
beb13b6c | 915 | if (fHPtAss->IsBinOverflow(bbin) || fHPtAss->IsBinUnderflow(bbin)) |
916 | continue; | |
917 | ||
918 | if (etab<fEtaALo || etab>fEtaAHi) | |
919 | continue; | |
8433ff41 | 920 | |
7e990b20 | 921 | Float_t dphi = DeltaPhi(phia, phib); |
beb13b6c | 922 | Float_t deta = etaa - etab; |
98880cdf | 923 | Float_t mass = 2*pta*ptb*(TMath::CosH(deta)-TMath::Cos(dphi)); |
924 | Int_t q2 = a.Sign() + b.Sign(); | |
925 | if ((q2==0) && fDoMassCut) { | |
926 | if (mass>3.0 && mass<3.2) | |
927 | continue; | |
928 | if (mass>9.2&&mass<9.8) | |
929 | continue; | |
930 | } | |
48a61f36 | 931 | |
8433ff41 | 932 | Int_t index = globIndex+(abin-1)*nPtAssc+(bbin-1); |
8a9d3e12 | 933 | Double_t weight = 1.0; |
beb13b6c | 934 | // number of trigger weight event-by-event (CMS method) |
935 | if (fDoWeights) { | |
936 | Double_t nTrgs = fHPtTrgEvt->GetBinContent(abin); | |
937 | if (nTrgs==0.0) { | |
938 | AliError(Form("Trying to work with number of triggers weight = %f",nTrgs)); | |
939 | return 0; | |
940 | } | |
941 | weight *= 1./nTrgs; | |
942 | } | |
8a9d3e12 | 943 | |
beb13b6c | 944 | // efficiency weighting |
945 | if (fHEffT) { | |
946 | // trigger particle | |
947 | weight *= effWtT; | |
73a051c1 | 948 | } |
98880cdf | 949 | |
beb13b6c | 950 | if (fHEffA) { |
951 | // associated particle | |
7e990b20 | 952 | const Int_t nEffDimA = fHEffA->GetNdimensions(); |
953 | Int_t effBinA[nEffDimA]; | |
954 | effBinA[0] = fHEffA->GetAxis(0)->FindBin(etab); | |
955 | effBinA[1] = fHEffA->GetAxis(1)->FindBin(ptb); | |
956 | effBinA[2] = fHEffA->GetAxis(2)->FindBin(fCentrality); | |
957 | effBinA[3] = fHEffA->GetAxis(3)->FindBin(fZVertex); | |
958 | if (nEffDimA>4) { | |
959 | effBinA[4] = fHEffA->GetAxis(4)->FindBin(phib); | |
960 | } | |
961 | weight *= fHEffA->GetBinContent(effBinA); | |
beb13b6c | 962 | } |
98880cdf | 963 | |
380fb711 | 964 | if (hist[index]) { // check if this histogram exists, relevant in the fPtTACrit==kFALSE case |
965 | hist[index]->Fill(dphi,deta,weight); | |
966 | bCountTrg = kTRUE; | |
967 | if (pairing == kSameEvt) { | |
968 | fHPtAss->Fill(ptb); // fill every associated particle every time it is used | |
98880cdf | 969 | if (q2==0) |
970 | fHSMass[mindex]->Fill(mass); | |
971 | } else { | |
972 | if (q2==0) | |
973 | fHMMass[mindex]->Fill(mass); | |
380fb711 | 974 | } |
beb13b6c | 975 | } |
976 | } | |
977 | if (bCountTrg) { | |
978 | if (pairing == kSameEvt) { | |
979 | fHPtTrgNorm2S->Fill(pta,fCentrality,fZVertex,effWtT); | |
980 | } else { | |
981 | fHPtTrgNorm2M->Fill(pta,fCentrality,fZVertex,effWtT); | |
8433ff41 | 982 | } |
48a61f36 | 983 | } |
984 | } | |
985 | ||
beb13b6c | 986 | return 1; |
48a61f36 | 987 | } |
988 | ||
989 | //________________________________________________________________________ | |
990 | void AliDhcTask::Terminate(Option_t *) | |
991 | { | |
992 | // Draw result to the screen | |
993 | // Called once at the end of the query | |
48a61f36 | 994 | } |
995 | ||
996 | //________________________________________________________________________ | |
b3b66a56 | 997 | Bool_t AliDhcTask::VertexOk() const |
48a61f36 | 998 | { |
999 | // Modified from AliAnalyseLeadingTrackUE::VertexSelection() | |
1000 | ||
1001 | Int_t nContributors = 0; | |
1002 | Double_t zVertex = 999; | |
1003 | TString name(""); | |
b3b66a56 | 1004 | |
1005 | Int_t runno = InputEvent()->GetRunNumber(); | |
1006 | if (runno>=176326 && runno<=197692) { // year 12 and 13 | |
1007 | if (!fUtils->IsVertexSelected2013pA(InputEvent())) | |
1008 | return 0; | |
1009 | } | |
1010 | ||
1011 | if (fESD) { | |
1012 | const AliESDVertex* vtx = fESD->GetPrimaryVertex(); | |
48a61f36 | 1013 | if (!vtx) |
1014 | return 0; | |
1015 | nContributors = vtx->GetNContributors(); | |
1016 | zVertex = vtx->GetZ(); | |
1017 | name = vtx->GetName(); | |
b3b66a56 | 1018 | } else { |
1019 | if (fAOD->GetNumberOfVertices() < 1) | |
48a61f36 | 1020 | return 0; |
b3b66a56 | 1021 | const AliAODVertex* vtx = fAOD->GetPrimaryVertex(); |
48a61f36 | 1022 | nContributors = vtx->GetNContributors(); |
1023 | zVertex = vtx->GetZ(); | |
1024 | name = vtx->GetName(); | |
1025 | } | |
1026 | ||
1027 | // Reject if TPC-only vertex | |
8433ff41 | 1028 | if (name.CompareTo("TPCVertex")==0) |
48a61f36 | 1029 | return kFALSE; |
1030 | ||
1031 | // Check # contributors and range... | |
1032 | if( nContributors < 1 || TMath::Abs(zVertex) > fZVtxMax ) { | |
1033 | return kFALSE; | |
1034 | } | |
1035 | ||
1036 | return kTRUE; | |
1037 | } | |
beb13b6c | 1038 | |
1039 | //________________________________________________________________________ | |
1040 | Bool_t AliDhcTask::IsGoodMUONtrack(AliESDMuonTrack &track) | |
1041 | { | |
b673a083 | 1042 | // Applying track cuts for MUON tracks |
1043 | ||
1044 | if (!track.ContainTrackerData()) | |
1045 | return kFALSE; | |
1046 | if (!track.ContainTriggerData()) | |
1047 | return kFALSE; | |
1048 | Double_t thetaTrackAbsEnd = TMath::ATan(track.GetRAtAbsorberEnd()/505.) * TMath::RadToDeg(); | |
1049 | if ((thetaTrackAbsEnd < 2.) || (thetaTrackAbsEnd > 10.)) | |
1050 | return kFALSE; | |
1051 | Double_t eta = track.Eta(); | |
1052 | if ((eta < -4.) || (eta > -2.5)) | |
1053 | return kFALSE; | |
1054 | if (track.GetMatchTrigger() < 0.5) | |
1055 | return kFALSE; | |
1056 | return kTRUE; | |
1057 | } | |
1058 | ||
1059 | //________________________________________________________________________ | |
1060 | Bool_t AliDhcTask::IsGoodMUONtrack(AliAODTrack &track) | |
1061 | { | |
1062 | // Applying track cuts for MUON tracks | |
1063 | ||
1064 | if (!track.IsMuonTrack()) | |
1065 | return kFALSE; | |
1066 | Double_t dThetaAbs = TMath::ATan(track.GetRAtAbsorberEnd()/505.)* TMath::RadToDeg(); | |
1067 | if ((dThetaAbs<2.) || (dThetaAbs>10.)) | |
1068 | return kFALSE; | |
1069 | Double_t dEta = track.Eta(); | |
3d3e51db | 1070 | if ((dEta<-4.) || (dEta>-2.5)) |
b673a083 | 1071 | return kFALSE; |
1072 | if (track.GetMatchTrigger()<0.5) | |
1073 | return kFALSE; | |
1074 | return kTRUE; | |
1075 | } | |
1076 | ||
1077 | //________________________________________________________________________ | |
1078 | AliDhcTask::~AliDhcTask() | |
1079 | { | |
1080 | //Destructor | |
1081 | if (fPoolMgr) | |
1082 | delete fPoolMgr; | |
beb13b6c | 1083 | } |