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