]>
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 | ||
5 | #include "TCanvas.h" | |
6 | #include "TChain.h" | |
8433ff41 | 7 | #include "TFormula.h" |
48a61f36 | 8 | #include "TH1.h" |
9 | #include "TH2.h" | |
beb13b6c | 10 | #include "TH3.h" |
d688e049 | 11 | #include "TAxis.h" |
8433ff41 | 12 | #include "TProfile2D.h" |
48a61f36 | 13 | #include "TROOT.h" |
14 | #include "TTree.h" | |
48a61f36 | 15 | #include "AliAODEvent.h" |
16 | #include "AliAODInputHandler.h" | |
17 | #include "AliAnalysisManager.h" | |
18 | #include "AliAnalysisTask.h" | |
19 | #include "AliCentrality.h" | |
20 | #include "AliDhcTask.h" | |
21 | #include "AliESDEvent.h" | |
22 | #include "AliESDInputHandler.h" | |
23 | #include "AliESDtrackCuts.h" | |
beb13b6c | 24 | #include "AliESDMuonTrack.h" |
8433ff41 | 25 | #include "AliPool.h" |
48a61f36 | 26 | #include "AliVParticle.h" |
27 | ||
c64cb1f6 | 28 | using std::cout; |
29 | using std::endl; | |
30 | ||
48a61f36 | 31 | ClassImp(AliDhcTask) |
32 | ||
beb13b6c | 33 | |
34 | //________________________________________________________________________ | |
35 | AliDhcTask::AliDhcTask() | |
36 | : AliAnalysisTaskSE(), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), | |
37 | fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), | |
d7149d30 | 38 | fPtTACrit(kTRUE), fAllTAHists(kFALSE), fMixInEtaT(kFALSE), |
beb13b6c | 39 | fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), |
98880cdf | 40 | fDoFillSame(kFALSE), fDoMassCut(kFALSE), fClassName(), |
beb13b6c | 41 | fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), |
42 | fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), | |
43 | fHPtTrgNorm1S(0x0), fHPtTrgNorm1M(0x0), fHPtTrgNorm2S(0x0), fHPtTrgNorm2M(0x0), | |
98880cdf | 44 | fHCent(0x0), fHZvtx(0x0), fNbins(0), fHSs(0x0), fHMs(0x0), fHPts(0x0), fHSMass(0x0), fHMMass(0x0), |
d7149d30 | 45 | fHQAT(0x0), fHQAA(0x0), fHPtCentT(0x0), fHPtCentA(0x0), |
380fb711 | 46 | fIndex(0x0), |
beb13b6c | 47 | fCentrality(99), fZVertex(99), fEsdTPCOnly(0), fPoolMgr(0), |
48 | fCentMethod("V0M"), fNBdeta(20), fNBdphi(36), | |
49 | fBPtT(0x0), fBPtA(0x0), fBCent(0x0), fBZvtx(0x0), | |
50 | fMixBCent(0x0), fMixBZvtx(0x0), | |
51 | fHEffT(0x0), fHEffA(0x0) | |
52 | { | |
53 | ||
54 | } | |
55 | ||
48a61f36 | 56 | //________________________________________________________________________ |
eee08176 | 57 | AliDhcTask::AliDhcTask(const char *name, Bool_t def) |
42036329 | 58 | : AliAnalysisTaskSE(name), fVerbosity(0), fEtaMax(1), fZVtxMax(10), fPtMin(0.25), fPtMax(15), |
beb13b6c | 59 | fTrackDepth(1000), fPoolSize(200), fTracksName(), fDoWeights(kFALSE), fFillMuons(kFALSE), |
d7149d30 | 60 | fPtTACrit(kTRUE), fAllTAHists(kFALSE), fMixInEtaT(kFALSE), |
beb13b6c | 61 | fEtaTLo(-1.0), fEtaTHi(1.0), fEtaALo(-1.0), fEtaAHi(1.0), |
98880cdf | 62 | fDoFillSame(kFALSE), fDoMassCut(kFALSE), fClassName(), |
beb13b6c | 63 | fESD(0x0), fAOD(0x0), fOutputList(0x0), fHEvt(0x0), fHTrk(0x0), |
64 | fHPtAss(0x0), fHPtTrg(0x0), fHPtTrgEvt(0x0), | |
65 | fHPtTrgNorm1S(0x0), fHPtTrgNorm1M(0x0), fHPtTrgNorm2S(0x0), fHPtTrgNorm2M(0x0), | |
98880cdf | 66 | fHCent(0x0), fHZvtx(0x0), fNbins(0), fHSs(0x0), fHMs(0x0), fHPts(0x0), fHSMass(0x0), fHMMass(0x0), |
d7149d30 | 67 | fHQAT(0x0), fHQAA(0x0), fHPtCentT(0x0), fHPtCentA(0x0), |
380fb711 | 68 | fIndex(0x0), |
8a9d3e12 | 69 | fCentrality(99), fZVertex(99), fEsdTPCOnly(0), fPoolMgr(0), |
d688e049 | 70 | fCentMethod("V0M"), fNBdeta(20), fNBdphi(36), |
71 | fBPtT(0x0), fBPtA(0x0), fBCent(0x0), fBZvtx(0x0), | |
beb13b6c | 72 | fMixBCent(0x0), fMixBZvtx(0x0), |
73 | fHEffT(0x0), fHEffA(0x0) | |
48a61f36 | 74 | { |
75 | // Constructor | |
76 | ||
77 | // Define input and output slots here | |
78 | // Input slot #0 works with a TChain | |
79 | DefineInput(0, TChain::Class()); | |
80 | // Output slot #0 id reserved by the base class for AOD | |
81 | // Output slot #1 writes into a TH1 container | |
82 | DefineOutput(1, TList::Class()); | |
83 | ||
48a61f36 | 84 | fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,SPDVertex.,TPCVertex.,Tracks " |
85 | "AOD:header,tracks,vertices,"; | |
d688e049 | 86 | |
eee08176 | 87 | if (def) { |
88 | Double_t ptt[4] = {0.25, 1.0, 2.0, 15.0}; | |
89 | fBPtT = new TAxis(3,ptt); | |
90 | Double_t pta[4] = {0.25, 1.0, 2.0, 15.0}; | |
91 | fBPtA = new TAxis(3,pta); | |
92 | Double_t cent[2] = {-100.0, 100.0}; | |
93 | fBCent = new TAxis(1,cent); | |
94 | Double_t zvtx[2] = {-10, 10}; | |
95 | fBZvtx = new TAxis(1,zvtx); | |
96 | Double_t centmix[2] = {-100.0, 100.0}; | |
97 | fMixBCent = new TAxis(1,centmix); | |
98 | Double_t zvtxmix[9] = {-10,-6,-4,-2,0,2,4,6,10}; | |
99 | fMixBZvtx = new TAxis(8,zvtxmix); | |
100 | } | |
48a61f36 | 101 | } |
102 | ||
103 | //________________________________________________________________________ | |
104 | void AliDhcTask::UserCreateOutputObjects() | |
105 | { | |
106 | // Create histograms | |
107 | // Called once (per slave on PROOF!) | |
d7149d30 | 108 | PrintDhcSettings(); |
48a61f36 | 109 | |
48a61f36 | 110 | fOutputList = new TList(); |
111 | fOutputList->SetOwner(1); | |
112 | ||
8a9d3e12 | 113 | fEsdTPCOnly = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); |
114 | //fEsdTPCOnly->SetMinNClustersTPC(70); | |
115 | fEsdTPCOnly->SetMinNCrossedRowsTPC(70); | |
116 | fEsdTPCOnly->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8); | |
48a61f36 | 117 | |
8433ff41 | 118 | BookHistos(); |
119 | InitEventMixer(); | |
48a61f36 | 120 | PostData(1, fOutputList); |
121 | } | |
122 | ||
d7149d30 | 123 | //________________________________________________________________________ |
124 | void AliDhcTask::PrintDhcSettings() | |
125 | { | |
126 | AliInfo(Form("Dhc Task %s settings",fName.Data())); | |
127 | AliInfo(Form(" centrality estimator %s", fCentMethod.Data())); | |
128 | AliInfo(Form(" using tracks named %s", fTracksName.Data())); | |
129 | AliInfo(Form(" efficiency correct triggers? %d", fHEffT!=0)); | |
130 | AliInfo(Form(" efficiency correct associates? %d", fHEffA!=0)); | |
131 | AliInfo(Form(" fill muons? %d", fFillMuons)); | |
132 | AliInfo(Form(" use pTT > pTA criterion? %d", fPtTACrit)); | |
133 | AliInfo(Form(" create all pTT, pTA hists? %d", fAllTAHists)); | |
134 | AliInfo(Form(" Mix in eta_T bins instead of z_vertex? %d", fMixInEtaT)); | |
135 | AliInfo(Form(" trigger eta range %f .. %f", fEtaTLo, fEtaTHi)); | |
136 | AliInfo(Form(" associate eta range %f .. %f", fEtaALo, fEtaAHi)); | |
98880cdf | 137 | AliInfo(Form(" fill same event in any case? %d", fDoFillSame)); |
138 | AliInfo(Form(" do invariant mass cut? %d\n", fDoMassCut)); | |
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 | static int iEvent = -1; ++iEvent; |
372 | ||
373 | if (fVerbosity>2) { | |
5a6df06d | 374 | if (iEvent % 100 == 0) |
48a61f36 | 375 | cout << iEvent << endl; |
376 | } | |
377 | ||
378 | Int_t dType = -1; // Will be set to kESD or kAOD. | |
f6701c6e | 379 | MiniEvent* sTracks = new MiniEvent(0); // deleted by pool mgr. |
48a61f36 | 380 | |
381 | LoadBranches(); | |
382 | ||
383 | // Get event pointers, check for signs of life | |
384 | fESD = dynamic_cast<AliESDEvent*>(InputEvent()); | |
385 | fAOD = dynamic_cast<AliAODEvent*>(InputEvent()); | |
386 | if (fESD) | |
387 | dType = kESD; | |
388 | else if (fAOD) | |
389 | dType = kAOD; | |
390 | else { | |
391 | AliError("Neither fESD nor fAOD available"); | |
392 | return; | |
393 | } | |
394 | ||
5a6df06d | 395 | if (fClassName.Length()>0) { |
396 | TString cls; | |
397 | if (fESD) | |
398 | cls = fESD->GetFiredTriggerClasses(); | |
399 | else | |
400 | cls = fAOD->GetFiredTriggerClasses(); | |
401 | if (!cls.Contains(fClassName)) | |
402 | return; | |
403 | } | |
404 | ||
d688e049 | 405 | Bool_t mcgen = 0; |
406 | if (fTracksName.Contains("Gen")) | |
407 | mcgen = 1; | |
408 | ||
48a61f36 | 409 | // Centrality, vertex, other event variables... |
d688e049 | 410 | if (mcgen) { |
411 | fZVertex = 0; | |
412 | TList *list = InputEvent()->GetList(); | |
beb13b6c | 413 | TClonesArray *tcaTracks = 0; |
414 | if (list) | |
415 | tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
d688e049 | 416 | if (tcaTracks) |
417 | fCentrality = tcaTracks->GetEntries(); | |
418 | } else { | |
419 | if (dType == kESD) { | |
420 | if (!VertexOk(fESD)) { | |
421 | if (fVerbosity > 1) | |
422 | AliInfo(Form("Event REJECTED (ESD vertex not OK). z = %.1f", fZVertex)); | |
423 | return; | |
424 | } | |
425 | const AliESDVertex* vertex = fESD->GetPrimaryVertex(); | |
426 | fZVertex = vertex->GetZ(); | |
427 | if(fESD->GetCentrality()) { | |
428 | fCentrality = | |
429 | fESD->GetCentrality()->GetCentralityPercentile(fCentMethod); | |
430 | } | |
eee08176 | 431 | } else if (dType == kAOD) { |
d688e049 | 432 | const AliAODVertex* vertex = fAOD->GetPrimaryVertex(); |
433 | fZVertex = vertex->GetZ(); | |
434 | if (!VertexOk(fAOD)) { | |
435 | if (fVerbosity > 1) | |
436 | Info("Exec()", "Event REJECTED (AOD vertex not OK). z = %.1f", fZVertex); | |
437 | return; | |
438 | } | |
439 | const AliCentrality *aodCent = fAOD->GetHeader()->GetCentralityP(); | |
440 | if (aodCent) { | |
441 | fCentrality = aodCent->GetCentralityPercentile(fCentMethod); | |
442 | } | |
48a61f36 | 443 | } |
444 | } | |
d688e049 | 445 | |
eee08176 | 446 | // Fill event histogram |
48a61f36 | 447 | fHEvt->Fill(fZVertex, fCentrality); |
d688e049 | 448 | if (fCentrality > fBCent->GetXmax() || fCentrality < fBCent->GetXmin()) { |
9370528f | 449 | if (fVerbosity > 1) |
450 | AliInfo(Form("Event REJECTED (centrality out of range). fCentrality = %.1f", fCentrality)); | |
48a61f36 | 451 | return; |
452 | } | |
453 | ||
454 | // Get array of selected tracks | |
455 | if (dType == kESD) { | |
f6701c6e | 456 | GetESDTracks(sTracks); |
eee08176 | 457 | } else if (dType == kAOD) { |
f6701c6e | 458 | GetAODTracks(sTracks); |
48a61f36 | 459 | } |
460 | ||
461 | // Get pool containing tracks from other events like this one | |
8433ff41 | 462 | AliEvtPool* pool = fPoolMgr->GetEventPool(fCentrality, fZVertex); |
48a61f36 | 463 | if (!pool) { |
c71ff6f4 | 464 | AliWarning(Form("No pool found. Centrality %f, ZVertex %f", |
465 | fCentrality, fZVertex)); | |
48a61f36 | 466 | return; |
467 | } | |
468 | ||
469 | if (!pool->IsReady()) { | |
470 | pool->UpdatePool(sTracks); | |
eee08176 | 471 | if (fDoFillSame) { // fill same event right away if requested |
472 | Correlate(*sTracks, *sTracks, kSameEvt); | |
473 | } | |
48a61f36 | 474 | return; |
475 | } | |
476 | ||
477 | if (pool->IsFirstReady()) { | |
478 | // recover events missed before the pool is ready | |
479 | Int_t nEvs = pool->GetCurrentNEvents(); | |
480 | if (nEvs>1) { | |
481 | for (Int_t i=0; i<nEvs; ++i) { | |
482 | MiniEvent* evI = pool->GetEvent(i); | |
483 | for (Int_t j=0; j<nEvs; ++j) { | |
484 | MiniEvent* evJ = pool->GetEvent(j); | |
eee08176 | 485 | if ((i==j) && !fDoFillSame) { |
486 | Correlate(*evI, *evJ, kSameEvt); | |
48a61f36 | 487 | } else { |
d688e049 | 488 | Correlate(*evI, *evJ, kDiffEvt); |
48a61f36 | 489 | } |
490 | } | |
491 | } | |
492 | } | |
493 | } else { /* standard case: same event, then mix*/ | |
494 | Correlate(*sTracks, *sTracks, kSameEvt); | |
495 | Int_t nMix = pool->GetCurrentNEvents(); | |
496 | for (Int_t jMix=0; jMix<nMix; ++jMix) { | |
497 | MiniEvent* bgTracks = pool->GetEvent(jMix); | |
d688e049 | 498 | Correlate(*sTracks, *bgTracks, kDiffEvt); |
48a61f36 | 499 | } |
500 | } | |
501 | ||
48a61f36 | 502 | pool->UpdatePool(sTracks); |
503 | PostData(1, fOutputList); | |
48a61f36 | 504 | } |
505 | ||
506 | //________________________________________________________________________ | |
f6701c6e | 507 | void AliDhcTask::GetESDTracks(MiniEvent* miniEvt) |
48a61f36 | 508 | { |
509 | // Loop twice: 1. Count sel. tracks. 2. Fill vector. | |
510 | ||
d688e049 | 511 | if (fTracksName.IsNull()) { |
512 | const AliESDVertex *vtxSPD = fESD->GetPrimaryVertexSPD(); | |
513 | if (!vtxSPD) | |
514 | return; | |
515 | ||
516 | Int_t nTrax = fESD->GetNumberOfTracks(); | |
517 | if (fVerbosity > 2) | |
518 | AliInfo(Form("%d tracks in event",nTrax)); | |
519 | ||
520 | // Loop 1. | |
521 | Int_t nSelTrax = 0; | |
522 | TObjArray arr(nTrax); | |
523 | arr.SetOwner(1); | |
524 | ||
525 | for (Int_t i = 0; i < nTrax; ++i) { | |
526 | AliESDtrack* esdtrack = fESD->GetTrack(i); | |
527 | if (!esdtrack) { | |
528 | AliError(Form("Couldn't get ESD track %d\n", i)); | |
529 | continue; | |
530 | } | |
8a9d3e12 | 531 | Bool_t trkOK = fEsdTPCOnly->AcceptTrack(esdtrack); |
d688e049 | 532 | if (!trkOK) |
533 | continue; | |
534 | Double_t pt = esdtrack->Pt(); | |
535 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
536 | if (!ptOK) | |
537 | continue; | |
538 | Double_t eta = esdtrack->Eta(); | |
539 | if (TMath::Abs(eta) > fEtaMax) | |
540 | continue; | |
541 | ||
542 | // create a tpc only track | |
543 | AliESDtrack *newtrack = AliESDtrackCuts::GetTPCOnlyTrack(fESD,esdtrack->GetID()); | |
544 | if(!newtrack) | |
545 | continue; | |
546 | if (newtrack->Pt()<=0) { | |
547 | delete newtrack; | |
548 | continue; | |
549 | } | |
8433ff41 | 550 | |
d688e049 | 551 | AliExternalTrackParam exParam; |
552 | Bool_t relate = newtrack->RelateToVertexTPC(vtxSPD,fESD->GetMagneticField(),kVeryBig,&exParam); | |
553 | if (!relate) { | |
554 | delete newtrack; | |
555 | continue; | |
556 | } | |
8433ff41 | 557 | |
d688e049 | 558 | // set the constraint parameters to the track |
559 | newtrack->Set(exParam.GetX(),exParam.GetAlpha(),exParam.GetParameter(),exParam.GetCovariance()); | |
8433ff41 | 560 | |
d688e049 | 561 | pt = newtrack->Pt(); |
562 | ptOK = pt >= fPtMin && pt < fPtMax; | |
563 | if (!ptOK) { | |
564 | delete newtrack; | |
565 | continue; | |
566 | } | |
567 | eta = esdtrack->Eta(); | |
568 | if (TMath::Abs(eta) > fEtaMax) { | |
569 | delete newtrack; | |
570 | continue; | |
571 | } | |
572 | arr.Add(newtrack); | |
573 | nSelTrax++; | |
8433ff41 | 574 | } |
beb13b6c | 575 | |
576 | for(Int_t itrack = 0; itrack < nSelTrax; itrack++) { | |
577 | AliVTrack *esdtrack = static_cast<AliESDtrack*>(arr.At(itrack)); | |
578 | if(!esdtrack) { | |
579 | AliError(Form("ERROR: Could not retrieve esdtrack %d",itrack)); | |
580 | continue; | |
581 | } | |
582 | Double_t pt = esdtrack->Pt(); | |
583 | Double_t eta = esdtrack->Eta(); | |
584 | Double_t phi = esdtrack->Phi(); | |
585 | Int_t sign = esdtrack->Charge() > 0 ? 1 : -1; | |
586 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
587 | } | |
b673a083 | 588 | } else { |
589 | TList *list = InputEvent()->GetList(); | |
590 | TClonesArray *tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
f018e7c8 | 591 | |
b673a083 | 592 | if(!tcaTracks){ |
593 | AliError("Ptr to tcaTracks zero"); | |
594 | return; | |
595 | } | |
f018e7c8 | 596 | |
b673a083 | 597 | const Int_t ntracks = tcaTracks->GetEntries(); |
598 | if (miniEvt) | |
599 | miniEvt->reserve(ntracks); | |
600 | else { | |
601 | AliError("Ptr to miniEvt zero"); | |
602 | return; | |
603 | } | |
48a61f36 | 604 | |
b673a083 | 605 | for (Int_t itrack = 0; itrack < ntracks; itrack++) { |
606 | AliVTrack *vtrack = static_cast<AliVTrack*>(tcaTracks->At(itrack)); | |
607 | if (!vtrack) { | |
608 | AliError(Form("ERROR: Could not retrieve track %d",itrack)); | |
609 | continue; | |
610 | } | |
611 | Double_t pt = vtrack->Pt(); | |
612 | Double_t eta = vtrack->Eta(); | |
613 | Double_t phi = vtrack->Phi(); | |
614 | Int_t sign = vtrack->Charge() > 0 ? 1 : -1; | |
615 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
48a61f36 | 616 | } |
48a61f36 | 617 | } |
beb13b6c | 618 | |
619 | if (fFillMuons) { | |
beb13b6c | 620 | // count good muons |
621 | Int_t nGoodMuons = 0; | |
622 | for (Int_t iMu = 0; iMu<fESD->GetNumberOfMuonTracks(); iMu++) { | |
623 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iMu); | |
b673a083 | 624 | if (muonTrack) { |
beb13b6c | 625 | if (IsGoodMUONtrack(*muonTrack)) nGoodMuons++; |
626 | } | |
627 | } | |
628 | miniEvt->reserve(miniEvt->size()+nGoodMuons); | |
629 | // fill them into the mini event | |
630 | for (Int_t iMu = 0; iMu<fESD->GetNumberOfMuonTracks(); iMu++) { | |
631 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iMu); | |
b673a083 | 632 | if (muonTrack) { |
633 | if (!IsGoodMUONtrack(*muonTrack)) | |
634 | continue; | |
635 | Double_t ptMu = muonTrack->Pt(); | |
636 | Double_t etaMu = muonTrack->Eta(); | |
637 | Double_t phiMu = muonTrack->Phi(); | |
b422cf0d | 638 | Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; |
beb13b6c | 639 | miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); |
640 | } | |
641 | } | |
642 | } | |
48a61f36 | 643 | } |
644 | ||
645 | //________________________________________________________________________ | |
f6701c6e | 646 | void AliDhcTask::GetAODTracks(MiniEvent* miniEvt) |
48a61f36 | 647 | { |
648 | // Loop twice: 1. Count sel. tracks. 2. Fill vector. | |
649 | ||
b673a083 | 650 | if (fTracksName.IsNull()) { |
651 | Int_t nTrax = fAOD->GetNumberOfTracks(); | |
652 | Int_t nSelTrax = 0; | |
48a61f36 | 653 | |
b673a083 | 654 | if (fVerbosity > 2) |
655 | AliInfo(Form("%d tracks in event",nTrax)); | |
48a61f36 | 656 | |
b673a083 | 657 | // Loop 1. |
658 | for (Int_t i = 0; i < nTrax; ++i) { | |
659 | AliAODTrack* aodtrack = fAOD->GetTrack(i); | |
660 | if (!aodtrack) { | |
661 | AliError(Form("Couldn't get AOD track %d\n", i)); | |
662 | continue; | |
663 | } | |
664 | // See $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C | |
665 | UInt_t tpcOnly = 1 << 7; | |
666 | Bool_t trkOK = aodtrack->TestFilterBit(tpcOnly); | |
667 | if (!trkOK) | |
668 | continue; | |
669 | Double_t pt = aodtrack->Pt(); | |
670 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
671 | if (!ptOK) | |
672 | continue; | |
673 | Double_t eta = aodtrack->Eta(); | |
674 | if (TMath::Abs(eta) > fEtaMax) | |
675 | continue; | |
676 | nSelTrax++; | |
48a61f36 | 677 | } |
48a61f36 | 678 | |
b673a083 | 679 | if (miniEvt) |
680 | miniEvt->reserve(nSelTrax); | |
681 | else { | |
682 | AliError("!miniEvt"); | |
683 | return; | |
48a61f36 | 684 | } |
b673a083 | 685 | |
686 | // Loop 2. | |
687 | for (Int_t i = 0; i < nTrax; ++i) { | |
688 | AliAODTrack* aodtrack = fAOD->GetTrack(i); | |
689 | if (!aodtrack) { | |
690 | AliError(Form("Couldn't get AOD track %d\n", i)); | |
691 | continue; | |
692 | } | |
48a61f36 | 693 | |
b673a083 | 694 | // See $ALICE_ROOT/ANALYSIS/macros/AddTaskESDFilter.C |
695 | UInt_t tpcOnly = 1 << 7; | |
696 | Bool_t trkOK = aodtrack->TestFilterBit(tpcOnly); | |
697 | if (!trkOK) | |
698 | continue; | |
699 | Double_t pt = aodtrack->Pt(); | |
700 | Bool_t ptOK = pt >= fPtMin && pt < fPtMax; | |
701 | if (!ptOK) | |
702 | continue; | |
703 | Double_t eta = aodtrack->Eta(); | |
704 | if (TMath::Abs(eta) > fEtaMax) | |
705 | continue; | |
706 | ||
707 | Double_t phi = aodtrack->Phi(); | |
708 | Int_t sign = aodtrack->Charge() > 0 ? 1 : -1; | |
709 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
710 | } | |
711 | } else { | |
712 | TList *list = InputEvent()->GetList(); | |
713 | TClonesArray *tcaTracks = dynamic_cast<TClonesArray*>(list->FindObject(fTracksName)); | |
714 | ||
715 | if (!tcaTracks){ | |
716 | AliError("Ptr to tcaTracks zero"); | |
717 | return; | |
718 | } | |
719 | ||
720 | const Int_t ntracks = tcaTracks->GetEntries(); | |
721 | if (miniEvt) | |
722 | miniEvt->reserve(ntracks); | |
723 | else { | |
724 | AliError("Ptr to miniEvt zero"); | |
725 | return; | |
726 | } | |
727 | ||
728 | for (Int_t itrack = 0; itrack < ntracks; itrack++) { | |
729 | AliVTrack *vtrack = static_cast<AliVTrack*>(tcaTracks->At(itrack)); | |
730 | if (!vtrack) { | |
731 | AliError(Form("ERROR: Could not retrieve vtrack %d",itrack)); | |
732 | continue; | |
733 | } | |
734 | Double_t pt = vtrack->Pt(); | |
735 | Double_t eta = vtrack->Eta(); | |
736 | Double_t phi = vtrack->Phi(); | |
737 | Int_t sign = vtrack->Charge() > 0 ? 1 : -1; | |
738 | miniEvt->push_back(AliMiniTrack(pt, eta, phi, sign)); | |
739 | } | |
740 | } | |
48a61f36 | 741 | |
b673a083 | 742 | if (fFillMuons) { |
743 | // count good muons | |
744 | Int_t nGoodMuons = 0; | |
745 | for (Int_t iMu = 0; iMu<fAOD->GetNumberOfTracks(); iMu++) { | |
746 | AliAODTrack* muonTrack = fAOD->GetTrack(iMu); | |
747 | if(muonTrack) { | |
748 | if (IsGoodMUONtrack(*muonTrack)) | |
749 | nGoodMuons++; | |
750 | } | |
751 | } | |
752 | miniEvt->reserve(miniEvt->size()+nGoodMuons); | |
753 | // fill them into the mini event | |
754 | for (Int_t iMu = 0; iMu<fAOD->GetNumberOfTracks(); iMu++) { | |
755 | AliAODTrack* muonTrack = fAOD->GetTrack(iMu); | |
756 | if (muonTrack) { | |
757 | if (!IsGoodMUONtrack(*muonTrack)) | |
758 | continue; | |
759 | Double_t ptMu = muonTrack->Pt(); | |
760 | Double_t etaMu = muonTrack->Eta(); | |
761 | Double_t phiMu = muonTrack->Phi(); | |
b422cf0d | 762 | Int_t signMu = muonTrack->Charge() > 0 ? 1 : -1; |
b673a083 | 763 | miniEvt->push_back(AliMiniTrack(ptMu, etaMu, phiMu, signMu)); |
764 | } | |
765 | } | |
48a61f36 | 766 | } |
48a61f36 | 767 | } |
768 | ||
769 | //________________________________________________________________________ | |
770 | Double_t AliDhcTask::DeltaPhi(Double_t phia, Double_t phib, | |
771 | Double_t rangeMin, Double_t rangeMax) const | |
772 | { | |
773 | Double_t dphi = -999; | |
774 | Double_t pi = TMath::Pi(); | |
775 | ||
776 | if (phia < 0) phia += 2*pi; | |
777 | else if (phia > 2*pi) phia -= 2*pi; | |
778 | if (phib < 0) phib += 2*pi; | |
779 | else if (phib > 2*pi) phib -= 2*pi; | |
780 | dphi = phib - phia; | |
781 | if (dphi < rangeMin) dphi += 2*pi; | |
782 | else if (dphi > rangeMax) dphi -= 2*pi; | |
783 | ||
784 | return dphi; | |
785 | } | |
786 | ||
787 | //________________________________________________________________________ | |
d688e049 | 788 | Int_t AliDhcTask::Correlate(const MiniEvent &evt1, const MiniEvent &evt2, Int_t pairing) |
48a61f36 | 789 | { |
790 | // Triggered angular correlations. If pairing is kSameEvt, particles | |
791 | // within evt1 are correlated. If kDiffEvt, correlate triggers from | |
792 | // evt1 with partners from evt2. | |
8433ff41 | 793 | |
794 | Int_t cbin = fHCent->FindBin(fCentrality); | |
795 | if (fHCent->IsBinOverflow(cbin) || | |
796 | fHCent->IsBinUnderflow(cbin)) | |
797 | return 0; | |
798 | ||
799 | Int_t zbin = fHZvtx->FindBin(fZVertex); | |
800 | if (fHZvtx->IsBinOverflow(zbin) || | |
801 | fHZvtx->IsBinUnderflow(zbin)) | |
802 | return 0; | |
803 | ||
48a61f36 | 804 | Int_t iMax = evt1.size(); |
805 | Int_t jMax = evt2.size(); | |
806 | ||
8433ff41 | 807 | TH2 **hist = fHMs; |
808 | if (pairing == kSameEvt) { | |
809 | hist = fHSs; | |
b673a083 | 810 | fHCent->Fill(fCentrality); |
811 | fHZvtx->Fill(fZVertex); | |
8433ff41 | 812 | } |
813 | ||
814 | Int_t nZvtx = fHZvtx->GetNbinsX(); | |
815 | Int_t nPtTrig = fHPtTrg->GetNbinsX(); | |
816 | Int_t nPtAssc = fHPtAss->GetNbinsX(); | |
817 | ||
818 | Int_t globIndex = (cbin-1)*nZvtx*nPtTrig*nPtAssc+(zbin-1)*nPtTrig*nPtAssc; | |
98880cdf | 819 | Int_t ptindex = (Int_t)fIndex->Eval(1,1,zbin,cbin); |
820 | Int_t mindex = (Int_t)fIndex->Eval(1,1,1,cbin); | |
48a61f36 | 821 | |
8a9d3e12 | 822 | |
beb13b6c | 823 | fHPtTrgEvt->Reset(); |
383b3bca | 824 | for (Int_t i=0; i<iMax; ++i) { |
825 | const AliMiniTrack &a(evt1.at(i)); | |
826 | Float_t pta = a.Pt(); | |
beb13b6c | 827 | fHPtTrgEvt->Fill(pta); |
383b3bca | 828 | if (pairing == kSameEvt) { |
8a9d3e12 | 829 | fHPts[ptindex]->Fill(pta); |
d688e049 | 830 | } |
831 | } | |
73a051c1 | 832 | |
beb13b6c | 833 | Bool_t bCountTrg; // only count the trigger if an associated particle is found |
48a61f36 | 834 | |
beb13b6c | 835 | for (Int_t i=0; i<iMax; ++i) { |
48a61f36 | 836 | // Trigger particles |
8433ff41 | 837 | const AliMiniTrack &a(evt1.at(i)); |
838 | ||
839 | Float_t pta = a.Pt(); | |
beb13b6c | 840 | Float_t etaa = a.Eta(); |
7e990b20 | 841 | Float_t phia = a.Phi(); |
380fb711 | 842 | |
843 | // brief intermezzo in the trigger particle loop: do associated particle QA here in order to avoid double counting | |
844 | if (pairing == kSameEvt) { | |
845 | if (etaa>fEtaALo && etaa<fEtaAHi) { | |
846 | Int_t bbin = fHPtAss->FindBin(pta); | |
847 | if (!(fHPtAss->IsBinOverflow(bbin) || fHPtAss->IsBinUnderflow(bbin))) { | |
848 | fHQAA->Fill(pta,etaa,phia); // fill every associated particle once | |
d7149d30 | 849 | fHPtCentA->Fill(pta,fCentrality); |
380fb711 | 850 | } |
851 | } | |
852 | } | |
853 | ||
854 | // back to triggers | |
8433ff41 | 855 | Int_t abin = fHPtTrg->FindBin(pta); |
beb13b6c | 856 | if (fHPtTrg->IsBinOverflow(abin) || fHPtTrg->IsBinUnderflow(abin)) |
857 | continue; | |
858 | ||
859 | if (etaa<fEtaTLo || etaa>fEtaTHi) | |
8433ff41 | 860 | continue; |
48a61f36 | 861 | |
beb13b6c | 862 | // efficiency weighting |
beb13b6c | 863 | Double_t effWtT = 1.0; |
864 | if (fHEffT) { | |
865 | // trigger particle | |
7e990b20 | 866 | const Int_t nEffDimT = fHEffT->GetNdimensions(); |
867 | Int_t effBinT[nEffDimT]; | |
868 | effBinT[0] = fHEffT->GetAxis(0)->FindBin(etaa); | |
869 | effBinT[1] = fHEffT->GetAxis(1)->FindBin(pta); | |
870 | effBinT[2] = fHEffT->GetAxis(2)->FindBin(fCentrality); | |
871 | effBinT[3] = fHEffT->GetAxis(3)->FindBin(fZVertex); | |
872 | if (nEffDimT>4) { | |
873 | effBinT[4] = fHEffT->GetAxis(4)->FindBin(phia); | |
874 | } | |
875 | effWtT = fHEffT->GetBinContent(effBinT); | |
beb13b6c | 876 | } |
877 | ||
48a61f36 | 878 | if (pairing == kSameEvt) { |
7e990b20 | 879 | fHTrk->Fill(phia,etaa); |
380fb711 | 880 | fHQAT->Fill(pta,etaa,phia); |
d7149d30 | 881 | fHPtCentT->Fill(pta,fCentrality); |
380fb711 | 882 | fHPtTrg->Fill(pta); |
beb13b6c | 883 | fHPtTrgNorm1S->Fill(pta,fCentrality,fZVertex,effWtT); |
884 | } else { | |
885 | fHPtTrgNorm1M->Fill(pta,fCentrality,fZVertex,effWtT); | |
48a61f36 | 886 | } |
beb13b6c | 887 | bCountTrg = kFALSE; |
48a61f36 | 888 | |
8433ff41 | 889 | for (Int_t j=0; j<jMax; ++j) { |
48a61f36 | 890 | // Associated particles |
891 | if (pairing == kSameEvt && i==j) | |
beb13b6c | 892 | continue; |
48a61f36 | 893 | |
8433ff41 | 894 | const AliMiniTrack &b(evt2.at(j)); |
48a61f36 | 895 | |
48a61f36 | 896 | Float_t ptb = b.Pt(); |
beb13b6c | 897 | Float_t etab = b.Eta(); |
7e990b20 | 898 | Float_t phib = b.Phi(); |
380fb711 | 899 | if (fPtTACrit&&(pta < ptb)) { |
b422cf0d | 900 | continue; |
901 | } | |
48a61f36 | 902 | |
73a051c1 | 903 | Int_t bbin = fHPtAss->FindBin(ptb); |
beb13b6c | 904 | if (fHPtAss->IsBinOverflow(bbin) || fHPtAss->IsBinUnderflow(bbin)) |
905 | continue; | |
906 | ||
907 | if (etab<fEtaALo || etab>fEtaAHi) | |
908 | continue; | |
8433ff41 | 909 | |
7e990b20 | 910 | Float_t dphi = DeltaPhi(phia, phib); |
beb13b6c | 911 | Float_t deta = etaa - etab; |
98880cdf | 912 | Float_t mass = 2*pta*ptb*(TMath::CosH(deta)-TMath::Cos(dphi)); |
913 | Int_t q2 = a.Sign() + b.Sign(); | |
914 | if ((q2==0) && fDoMassCut) { | |
915 | if (mass>3.0 && mass<3.2) | |
916 | continue; | |
917 | if (mass>9.2&&mass<9.8) | |
918 | continue; | |
919 | } | |
48a61f36 | 920 | |
8433ff41 | 921 | Int_t index = globIndex+(abin-1)*nPtAssc+(bbin-1); |
8a9d3e12 | 922 | Double_t weight = 1.0; |
beb13b6c | 923 | // number of trigger weight event-by-event (CMS method) |
924 | if (fDoWeights) { | |
925 | Double_t nTrgs = fHPtTrgEvt->GetBinContent(abin); | |
926 | if (nTrgs==0.0) { | |
927 | AliError(Form("Trying to work with number of triggers weight = %f",nTrgs)); | |
928 | return 0; | |
929 | } | |
930 | weight *= 1./nTrgs; | |
931 | } | |
8a9d3e12 | 932 | |
beb13b6c | 933 | // efficiency weighting |
934 | if (fHEffT) { | |
935 | // trigger particle | |
936 | weight *= effWtT; | |
73a051c1 | 937 | } |
98880cdf | 938 | |
beb13b6c | 939 | if (fHEffA) { |
940 | // associated particle | |
7e990b20 | 941 | const Int_t nEffDimA = fHEffA->GetNdimensions(); |
942 | Int_t effBinA[nEffDimA]; | |
943 | effBinA[0] = fHEffA->GetAxis(0)->FindBin(etab); | |
944 | effBinA[1] = fHEffA->GetAxis(1)->FindBin(ptb); | |
945 | effBinA[2] = fHEffA->GetAxis(2)->FindBin(fCentrality); | |
946 | effBinA[3] = fHEffA->GetAxis(3)->FindBin(fZVertex); | |
947 | if (nEffDimA>4) { | |
948 | effBinA[4] = fHEffA->GetAxis(4)->FindBin(phib); | |
949 | } | |
950 | weight *= fHEffA->GetBinContent(effBinA); | |
beb13b6c | 951 | } |
98880cdf | 952 | |
380fb711 | 953 | if (hist[index]) { // check if this histogram exists, relevant in the fPtTACrit==kFALSE case |
954 | hist[index]->Fill(dphi,deta,weight); | |
955 | bCountTrg = kTRUE; | |
956 | if (pairing == kSameEvt) { | |
957 | fHPtAss->Fill(ptb); // fill every associated particle every time it is used | |
98880cdf | 958 | if (q2==0) |
959 | fHSMass[mindex]->Fill(mass); | |
960 | } else { | |
961 | if (q2==0) | |
962 | fHMMass[mindex]->Fill(mass); | |
380fb711 | 963 | } |
beb13b6c | 964 | } |
965 | } | |
966 | if (bCountTrg) { | |
967 | if (pairing == kSameEvt) { | |
968 | fHPtTrgNorm2S->Fill(pta,fCentrality,fZVertex,effWtT); | |
969 | } else { | |
970 | fHPtTrgNorm2M->Fill(pta,fCentrality,fZVertex,effWtT); | |
8433ff41 | 971 | } |
48a61f36 | 972 | } |
973 | } | |
974 | ||
beb13b6c | 975 | return 1; |
48a61f36 | 976 | } |
977 | ||
978 | //________________________________________________________________________ | |
979 | void AliDhcTask::Terminate(Option_t *) | |
980 | { | |
981 | // Draw result to the screen | |
982 | // Called once at the end of the query | |
48a61f36 | 983 | } |
984 | ||
985 | //________________________________________________________________________ | |
986 | Bool_t AliDhcTask::VertexOk(TObject* obj) const | |
987 | { | |
988 | // Modified from AliAnalyseLeadingTrackUE::VertexSelection() | |
989 | ||
990 | Int_t nContributors = 0; | |
991 | Double_t zVertex = 999; | |
992 | TString name(""); | |
993 | ||
994 | if (obj->InheritsFrom("AliESDEvent")) { | |
995 | AliESDEvent* esdevt = (AliESDEvent*) obj; | |
996 | const AliESDVertex* vtx = esdevt->GetPrimaryVertex(); | |
997 | if (!vtx) | |
998 | return 0; | |
999 | nContributors = vtx->GetNContributors(); | |
1000 | zVertex = vtx->GetZ(); | |
1001 | name = vtx->GetName(); | |
1002 | } | |
1003 | else if (obj->InheritsFrom("AliAODEvent")) { | |
1004 | AliAODEvent* aodevt = (AliAODEvent*) obj; | |
1005 | if (aodevt->GetNumberOfVertices() < 1) | |
1006 | return 0; | |
1007 | const AliAODVertex* vtx = aodevt->GetPrimaryVertex(); | |
1008 | nContributors = vtx->GetNContributors(); | |
1009 | zVertex = vtx->GetZ(); | |
1010 | name = vtx->GetName(); | |
1011 | } | |
1012 | ||
1013 | // Reject if TPC-only vertex | |
8433ff41 | 1014 | if (name.CompareTo("TPCVertex")==0) |
48a61f36 | 1015 | return kFALSE; |
1016 | ||
1017 | // Check # contributors and range... | |
1018 | if( nContributors < 1 || TMath::Abs(zVertex) > fZVtxMax ) { | |
1019 | return kFALSE; | |
1020 | } | |
1021 | ||
1022 | return kTRUE; | |
1023 | } | |
beb13b6c | 1024 | |
1025 | //________________________________________________________________________ | |
1026 | Bool_t AliDhcTask::IsGoodMUONtrack(AliESDMuonTrack &track) | |
1027 | { | |
b673a083 | 1028 | // Applying track cuts for MUON tracks |
1029 | ||
1030 | if (!track.ContainTrackerData()) | |
1031 | return kFALSE; | |
1032 | if (!track.ContainTriggerData()) | |
1033 | return kFALSE; | |
1034 | Double_t thetaTrackAbsEnd = TMath::ATan(track.GetRAtAbsorberEnd()/505.) * TMath::RadToDeg(); | |
1035 | if ((thetaTrackAbsEnd < 2.) || (thetaTrackAbsEnd > 10.)) | |
1036 | return kFALSE; | |
1037 | Double_t eta = track.Eta(); | |
1038 | if ((eta < -4.) || (eta > -2.5)) | |
1039 | return kFALSE; | |
1040 | if (track.GetMatchTrigger() < 0.5) | |
1041 | return kFALSE; | |
1042 | return kTRUE; | |
1043 | } | |
1044 | ||
1045 | //________________________________________________________________________ | |
1046 | Bool_t AliDhcTask::IsGoodMUONtrack(AliAODTrack &track) | |
1047 | { | |
1048 | // Applying track cuts for MUON tracks | |
1049 | ||
1050 | if (!track.IsMuonTrack()) | |
1051 | return kFALSE; | |
1052 | Double_t dThetaAbs = TMath::ATan(track.GetRAtAbsorberEnd()/505.)* TMath::RadToDeg(); | |
1053 | if ((dThetaAbs<2.) || (dThetaAbs>10.)) | |
1054 | return kFALSE; | |
1055 | Double_t dEta = track.Eta(); | |
3d3e51db | 1056 | if ((dEta<-4.) || (dEta>-2.5)) |
b673a083 | 1057 | return kFALSE; |
1058 | if (track.GetMatchTrigger()<0.5) | |
1059 | return kFALSE; | |
1060 | return kTRUE; | |
1061 | } | |
1062 | ||
1063 | //________________________________________________________________________ | |
1064 | AliDhcTask::~AliDhcTask() | |
1065 | { | |
1066 | //Destructor | |
1067 | if (fPoolMgr) | |
1068 | delete fPoolMgr; | |
beb13b6c | 1069 | } |