]>
Commit | Line | Data |
---|---|---|
259c3296 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | /************************************************************************** | |
16 | * * | |
17 | * QA class of Heavy Flavor quark and fragmeted/decayed particles * | |
dbe3abbe | 18 | * -Check kinematics of Heavy Quarks/hadrons, and decayed leptons * |
19 | * pT, rapidity * | |
20 | * decay lepton kinematics w/wo acceptance * | |
21 | * heavy hadron decay length, electron pT fraction carried from decay * | |
22 | * -Check yield of Heavy Quarks/hadrons * | |
23 | * Number of produced heavy quark * | |
24 | * Number of produced hadron of given pdg code * | |
25 | * * | |
259c3296 | 26 | * * |
27 | * Authors: * | |
28 | * MinJung Kweon <minjung@physi.uni-heidelberg.de> * | |
29 | * * | |
30 | **************************************************************************/ | |
31 | ||
32 | ||
33 | #include <iostream> | |
34 | #include <TH2F.h> | |
35 | #include <TCanvas.h> | |
36 | #include <TFile.h> | |
37 | #include <TH1F.h> | |
38 | #include <TH2F.h> | |
39 | #include <TCut.h> | |
40 | #include <TRandom.h> | |
41 | #include <TDatabasePDG.h> | |
42 | #include <TROOT.h> | |
43 | #include <TParticle.h> | |
44 | ||
45 | #include <AliLog.h> | |
46 | #include <AliESDEvent.h> | |
47 | #include <AliESDtrack.h> | |
48 | #include <AliESDInputHandler.h> | |
49 | #include <AliESDVertex.h> | |
50 | #include <AliStack.h> | |
51 | ||
52 | #include "AliHFEmcQA.h" | |
53 | ||
54 | const Int_t AliHFEmcQA::fgkGluon=21; | |
55 | const Int_t AliHFEmcQA::fgkMaxGener=10; | |
dbe3abbe | 56 | const Int_t AliHFEmcQA::fgkMaxIter=100; |
57 | const Int_t AliHFEmcQA::fgkqType = 7; // number of species waiting for QA done | |
259c3296 | 58 | |
59 | ClassImp(AliHFEmcQA) | |
60 | ||
61 | //_______________________________________________________________________________________________ | |
62 | AliHFEmcQA::AliHFEmcQA() : | |
dbe3abbe | 63 | fStack(0x0) |
259c3296 | 64 | ,fNparents(0) |
65 | { | |
66 | // Default constructor | |
67 | ||
259c3296 | 68 | } |
69 | ||
70 | //_______________________________________________________________________________________________ | |
71 | AliHFEmcQA::AliHFEmcQA(const AliHFEmcQA&p): | |
72 | TObject(p) | |
259c3296 | 73 | ,fStack(0x0) |
74 | ,fNparents(p.fNparents) | |
75 | { | |
76 | // Copy constructor | |
77 | } | |
78 | ||
79 | //_______________________________________________________________________________________________ | |
80 | AliHFEmcQA& | |
81 | AliHFEmcQA::operator=(const AliHFEmcQA &) | |
82 | { | |
83 | // Assignment operator | |
84 | ||
85 | AliInfo("Not yet implemented."); | |
86 | return *this; | |
87 | } | |
88 | ||
89 | //_______________________________________________________________________________________________ | |
90 | AliHFEmcQA::~AliHFEmcQA() | |
91 | { | |
92 | // Destructor | |
93 | ||
94 | AliInfo("Analysis Done."); | |
95 | } | |
96 | ||
97 | //_______________________________________________________________________________________________ | |
dc306130 | 98 | void AliHFEmcQA::PostAnalyze() |
259c3296 | 99 | { |
100 | } | |
101 | ||
102 | //__________________________________________ | |
dbe3abbe | 103 | void AliHFEmcQA::CreateHistograms(const Int_t kquark, Int_t icut, TString hnopt) |
259c3296 | 104 | { |
105 | // create histograms | |
106 | ||
dbe3abbe | 107 | if (kquark != kCharm && kquark != kBeauty) { |
259c3296 | 108 | AliDebug(1, "This task is only for heavy quark QA, return\n"); |
109 | return; | |
110 | } | |
dbe3abbe | 111 | Int_t iq = kquark - kCharm; |
259c3296 | 112 | |
113 | TString kqTypeLabel[fgkqType]; | |
dbe3abbe | 114 | if (kquark == kCharm){ |
115 | kqTypeLabel[kQuark]="c"; | |
116 | kqTypeLabel[kantiQuark]="cbar"; | |
117 | kqTypeLabel[kHadron]="cHadron"; | |
118 | kqTypeLabel[keHadron]="ceHadron"; | |
119 | kqTypeLabel[kDeHadron]="nullHadron"; | |
120 | kqTypeLabel[kElectron]="ce"; | |
121 | kqTypeLabel[kElectron2nd]="nulle"; | |
122 | } else if (kquark == kBeauty){ | |
123 | kqTypeLabel[kQuark]="b"; | |
124 | kqTypeLabel[kantiQuark]="bbar"; | |
125 | kqTypeLabel[kHadron]="bHadron"; | |
126 | kqTypeLabel[keHadron]="beHadron"; | |
127 | kqTypeLabel[kDeHadron]="bDeHadron"; | |
128 | kqTypeLabel[kElectron]="be"; | |
129 | kqTypeLabel[kElectron2nd]="bce"; | |
259c3296 | 130 | } |
131 | ||
132 | ||
133 | TString hname; | |
134 | for (Int_t iqType = 0; iqType < fgkqType; iqType++ ){ | |
dbe3abbe | 135 | if (iqType < keHadron && icut > 0) continue; // don't duplicate histogram for quark and hadron |
259c3296 | 136 | hname = hnopt+"PdgCode_"+kqTypeLabel[iqType]; |
dbe3abbe | 137 | fHist[iq][iqType][icut].fPdgCode = new TH1F(hname,hname,20001,-10000.5,10000.5); |
259c3296 | 138 | hname = hnopt+"Pt_"+kqTypeLabel[iqType]; |
78ea5ef4 | 139 | fHist[iq][iqType][icut].fPt = new TH1F(hname,hname+";p_{T} (GeV/c)",250,0,50); |
259c3296 | 140 | hname = hnopt+"Y_"+kqTypeLabel[iqType]; |
dbe3abbe | 141 | fHist[iq][iqType][icut].fY = new TH1F(hname,hname,150,-7.5,7.5); |
259c3296 | 142 | hname = hnopt+"Eta_"+kqTypeLabel[iqType]; |
dbe3abbe | 143 | fHist[iq][iqType][icut].fEta = new TH1F(hname,hname,150,-7.5,7.5); |
259c3296 | 144 | } |
145 | ||
dbe3abbe | 146 | if (icut == 0){ |
147 | hname = hnopt+"Nq_"+kqTypeLabel[kQuark]; | |
148 | fHistComm[iq][icut].fNq = new TH1F(hname,hname,10,-0.5,9.5); | |
149 | hname = hnopt+"ProcessID_"+kqTypeLabel[kQuark]; | |
150 | fHistComm[iq][icut].fProcessID = new TH1F(hname,hname,21,-10.5,10.5); | |
151 | } | |
152 | hname = hnopt+"ePtRatio_"+kqTypeLabel[kQuark]; | |
153 | fHistComm[iq][icut].fePtRatio = new TH2F(hname,hname+";p_{T} (GeV/c);momentum fraction",100,0,30,100,0,1); | |
154 | hname = hnopt+"DePtRatio_"+kqTypeLabel[kQuark]; | |
155 | fHistComm[iq][icut].fDePtRatio = new TH2F(hname,hname+";p_{T} (GeV/c);momentum fraction",100,0,30,100,0,1); | |
156 | hname = hnopt+"eDistance_"+kqTypeLabel[kQuark]; | |
157 | fHistComm[iq][icut].feDistance= new TH2F(hname,hname+";p_{T} (GeV/c);distance (cm)",100,0,30,200,0,2); | |
158 | hname = hnopt+"DeDistance_"+kqTypeLabel[kQuark]; | |
159 | fHistComm[iq][icut].fDeDistance= new TH2F(hname,hname+";p_{T} (GeV/c);distance (cm)",100,0,30,200,0,2); | |
259c3296 | 160 | |
161 | } | |
162 | ||
163 | //__________________________________________ | |
164 | void AliHFEmcQA::Init() | |
165 | { | |
166 | // called at begining every event | |
167 | ||
168 | for (Int_t i=0; i<2; i++){ | |
169 | fIsHeavy[i] = 0; | |
170 | } | |
171 | ||
172 | fNparents = 7; | |
173 | ||
174 | fParentSelect[0][0] = 411; | |
175 | fParentSelect[0][1] = 421; | |
176 | fParentSelect[0][2] = 431; | |
177 | fParentSelect[0][3] = 4122; | |
178 | fParentSelect[0][4] = 4132; | |
179 | fParentSelect[0][5] = 4232; | |
180 | fParentSelect[0][6] = 4332; | |
181 | ||
182 | fParentSelect[1][0] = 511; | |
183 | fParentSelect[1][1] = 521; | |
184 | fParentSelect[1][2] = 531; | |
185 | fParentSelect[1][3] = 5122; | |
186 | fParentSelect[1][4] = 5132; | |
187 | fParentSelect[1][5] = 5232; | |
188 | fParentSelect[1][6] = 5332; | |
189 | ||
190 | } | |
191 | ||
192 | //__________________________________________ | |
722347d8 | 193 | void AliHFEmcQA::GetQuarkKine(TParticle *part, Int_t iTrack, const Int_t kquark) |
259c3296 | 194 | { |
195 | // get heavy quark kinematics | |
196 | ||
dbe3abbe | 197 | if (kquark != kCharm && kquark != kBeauty) { |
259c3296 | 198 | AliDebug(1, "This task is only for heavy quark QA, return\n"); |
199 | return; | |
200 | } | |
dbe3abbe | 201 | Int_t iq = kquark - kCharm; |
259c3296 | 202 | |
259c3296 | 203 | if (iTrack < 0) { |
204 | AliDebug(1, "Stack label is negative, return\n"); | |
205 | return; | |
206 | } | |
207 | ||
722347d8 | 208 | //TParticle *part = fStack->Particle(iTrack); |
259c3296 | 209 | Int_t partPdgcode = TMath::Abs(part->GetPdgCode()); |
210 | ||
211 | // select heavy hadron or not fragmented heavy quark | |
212 | if ( int(partPdgcode/100.)==kquark || int(partPdgcode/1000.)==kquark || (partPdgcode==kquark && (part->GetNDaughters()==0 && iTrack>5)) ){ | |
213 | ||
214 | TParticle *partMother; | |
215 | Int_t iLabel; | |
216 | ||
217 | if (partPdgcode == kquark){ // in case of not fragmented heavy quark | |
218 | partMother = part; | |
219 | iLabel = iTrack; | |
220 | } else{ // in case of heavy hadron, start to search for mother heavy parton | |
221 | iLabel = part->GetFirstMother(); | |
222 | if (iLabel>-1) { partMother = fStack->Particle(iLabel); } | |
223 | else { | |
224 | AliDebug(1, "Stack label is negative, return\n"); | |
225 | return; | |
226 | } | |
227 | } | |
228 | ||
229 | // heavy parton selection as a mother of heavy hadron | |
230 | // if the heavy particle comes from string which is denoted as particle status 12|12|12...12|11,[PYTHIA p.60] | |
231 | // in this case, the mother of heavy particle can be one of the fragmented parton of the string | |
232 | // should I make a condition that partMother should be quark or diquark? -> not necessary | |
233 | if ( abs(partMother->GetPdgCode()) == kquark || (partMother->GetStatusCode() == 11) ){ | |
234 | //if ( abs(partMother->GetPdgCode()) == kquark || (partMother->GetStatusCode() == 11 || partMother->GetStatusCode() == 12) ){ | |
235 | ||
236 | if ( abs(partMother->GetPdgCode()) != kquark ){ | |
237 | // search fragmented partons in the same string | |
dbe3abbe | 238 | Bool_t isSameString = kTRUE; |
259c3296 | 239 | for (Int_t i=1; i<fgkMaxIter; i++){ |
240 | iLabel = iLabel - 1; | |
241 | if (iLabel>-1) { partMother = fStack->Particle(iLabel); } | |
242 | else { | |
243 | AliDebug(1, "Stack label is negative, return\n"); | |
244 | return; | |
245 | } | |
246 | if ( abs(partMother->GetPdgCode()) == kquark ) break; | |
dbe3abbe | 247 | if ( partMother->GetStatusCode() != 12 ) isSameString = kFALSE; |
248 | if (!isSameString) return; | |
259c3296 | 249 | } |
250 | } | |
251 | AliDebug(1, "Can not find heavy parton of this heavy hadron in the string, return\n"); | |
252 | if (abs(partMother->GetPdgCode()) != kquark) return; | |
253 | ||
254 | if (fIsHeavy[iq] >= 50) return; | |
255 | fHeavyQuark[fIsHeavy[iq]] = partMother; | |
256 | fIsHeavy[iq]++; | |
257 | ||
258 | // fill kinematics for heavy parton | |
259 | if (partMother->GetPdgCode() > 0) { // quark | |
dbe3abbe | 260 | fHist[iq][kQuark][0].fPdgCode->Fill(partMother->GetPdgCode()); |
261 | fHist[iq][kQuark][0].fPt->Fill(partMother->Pt()); | |
262 | fHist[iq][kQuark][0].fY->Fill(GetRapidity(partMother)); | |
263 | fHist[iq][kQuark][0].fEta->Fill(partMother->Eta()); | |
259c3296 | 264 | } else{ // antiquark |
dbe3abbe | 265 | fHist[iq][kantiQuark][0].fPdgCode->Fill(partMother->GetPdgCode()); |
266 | fHist[iq][kantiQuark][0].fPt->Fill(partMother->Pt()); | |
267 | fHist[iq][kantiQuark][0].fY->Fill(GetRapidity(partMother)); | |
268 | fHist[iq][kantiQuark][0].fEta->Fill(partMother->Eta()); | |
259c3296 | 269 | } |
270 | ||
271 | } // end of heavy parton slection loop | |
272 | ||
273 | } // end of heavy hadron or quark selection | |
274 | ||
275 | } | |
276 | ||
277 | //__________________________________________ | |
278 | void AliHFEmcQA::EndOfEventAna(const Int_t kquark) | |
279 | { | |
280 | // end of event analysis | |
281 | ||
dbe3abbe | 282 | if (kquark != kCharm && kquark != kBeauty) { |
259c3296 | 283 | AliDebug(1, "This task is only for heavy quark QA, return\n"); |
284 | return; | |
285 | } | |
dbe3abbe | 286 | Int_t iq = kquark - kCharm; |
259c3296 | 287 | |
288 | ||
289 | // # of heavy quark per event | |
290 | AliDebug(1,Form("Number of heavy quark in this event = %d \n",fIsHeavy[iq])); | |
dbe3abbe | 291 | fHistComm[iq][0].fNq->Fill(fIsHeavy[iq]); |
259c3296 | 292 | |
293 | Int_t motherID[fgkMaxGener]; | |
294 | Int_t motherType[fgkMaxGener]; | |
295 | Int_t motherLabel[fgkMaxGener]; | |
296 | Int_t ancestorPdg[fgkMaxGener]; | |
297 | Int_t ancestorLabel[fgkMaxGener]; | |
298 | ||
299 | for (Int_t i = 0; i < fgkMaxGener; i++){ // initialization | |
300 | motherID[i] = 0; | |
301 | motherType[i] = 0; | |
302 | motherLabel[i] = 0; | |
303 | ancestorPdg[i] = 0; | |
304 | ancestorLabel[i] = 0; | |
305 | } | |
306 | ||
307 | // check history of found heavy quarks | |
308 | for (Int_t i = 0; i < fIsHeavy[iq]; i++){ | |
309 | ||
310 | ancestorLabel[0] = i; | |
311 | ancestorPdg[0] = fHeavyQuark[i]->GetPdgCode(); | |
312 | ancestorLabel[1] = fHeavyQuark[i]->GetFirstMother(); | |
313 | ||
314 | AliDebug(1,Form("pdg code= %d\n",ancestorPdg[0])); | |
315 | AliDebug(1,Form("ancestor label= %d\n",ancestorLabel[1])); | |
316 | ||
317 | Int_t ig = 1; | |
318 | while (ancestorLabel[ig] != -1){ | |
319 | // in case there is mother, get mother's pdg code and grandmother's label | |
320 | IdentifyMother(ancestorLabel[ig], ancestorPdg[ig], ancestorLabel[ig+1]); | |
321 | // if mother is still heavy, find again mother's ancestor | |
322 | if (ancestorPdg[ig-1] == ancestorPdg[ig]) { | |
323 | ig++; | |
324 | continue; // if it is from same heavy | |
325 | } | |
326 | // if the heavy's mother is not heavy, check the mother's label to know if it comes from inital or final parton shower | |
327 | if (IsFromInitialShower(ancestorLabel[ig],motherID[i],motherType[i],motherLabel[i])) break; | |
328 | if (IsFromFinalParton(ancestorLabel[ig],motherID[i],motherType[i],motherLabel[i])) break; | |
329 | // if it is not the above case, something is strange | |
dbe3abbe | 330 | ReportStrangeness(motherID[i],motherType[i],motherLabel[i]); |
259c3296 | 331 | break; |
332 | } | |
333 | if (ancestorLabel[ig] == -1){ // from hard scattering | |
334 | HardScattering(kquark, motherID[i],motherType[i], motherLabel[i]); | |
335 | } | |
336 | ||
337 | } // end of found heavy quark loop | |
338 | ||
339 | ||
340 | // check process type | |
341 | Int_t processID = 0; | |
342 | for (Int_t i = 0; i < fIsHeavy[iq]; i++){ | |
343 | AliDebug(1,Form("Mother ID= %d type= %d label= %d\n",motherID[i],motherType[i],motherLabel[i])); | |
344 | } | |
345 | ||
346 | ||
347 | Int_t nheavypair = Int_t(fIsHeavy[iq]/2.); | |
348 | for (Int_t ipair = 0; ipair < nheavypair; ipair++){ | |
349 | ||
350 | Int_t id1 = ipair*2; | |
351 | Int_t id2 = ipair*2 + 1; | |
352 | ||
353 | if (motherType[id1] == 2 && motherType[id2] == 2){ | |
dbe3abbe | 354 | if (motherLabel[id1] == motherLabel[id2]) processID = kGluonSplitting; // gluon spliting |
259c3296 | 355 | else processID = -9; |
356 | } | |
357 | else if (motherType[id1] == -1 && motherType[id2] == -1) { | |
358 | if (motherLabel[id1] == -1 && motherLabel[id2] == -1) { | |
dbe3abbe | 359 | if (motherID[id1] == fgkGluon) processID = kPairCreationFromg; // gluon fusion |
360 | else processID = kPairCreationFromq; // q-qbar pair creation | |
259c3296 | 361 | } |
362 | else processID = -8; | |
363 | } | |
364 | else if (motherType[id1] == -1 || motherType[id2] == -1) { | |
365 | if ((motherLabel[id1] == -1 || motherLabel[id2] == -1) && (motherLabel[id1]*motherLabel[id2] == -2 || motherLabel[id1]*motherLabel[id2] == -3)) { | |
dbe3abbe | 366 | if(motherID[id1]*motherID[id2] == kquark*fgkGluon) processID = kFlavourExitation; // flavour exitation |
367 | else processID = kLightQuarkShower; | |
259c3296 | 368 | } |
369 | else processID = -7; | |
370 | } | |
371 | else if (motherType[id1] == -2 || motherType[id2] == -2) { | |
dbe3abbe | 372 | if (motherLabel[id1] == motherLabel[id2]) processID = kInitialPartonShower; // initial parton shower |
259c3296 | 373 | else processID = -6; |
374 | ||
375 | } | |
376 | else processID = -5; | |
377 | ||
378 | if (nheavypair >1) AliDebug(1,Form("Multi pair found : process ID = %d\n",processID)); | |
dbe3abbe | 379 | else fHistComm[iq][0].fProcessID->Fill(processID); |
259c3296 | 380 | AliDebug(1,Form("Process ID = %d\n",processID)); |
381 | } // end of # heavy quark pair loop | |
382 | ||
383 | } | |
384 | ||
385 | //__________________________________________ | |
722347d8 | 386 | void AliHFEmcQA::GetHadronKine(TParticle* mcpart, const Int_t kquark) |
dbe3abbe | 387 | { |
388 | // decay electron kinematics | |
389 | ||
390 | if (kquark != kCharm && kquark != kBeauty) { | |
391 | AliDebug(1, "This task is only for heavy quark QA, return\n"); | |
392 | return; | |
393 | } | |
394 | Int_t iq = kquark - kCharm; | |
395 | ||
722347d8 | 396 | //TParticle* mcpart = fStack->Particle(iTrack); |
dbe3abbe | 397 | |
398 | Int_t iLabel = mcpart->GetFirstMother(); | |
399 | if (iLabel<0){ | |
400 | AliDebug(1, "Stack label is negative, return\n"); | |
401 | return; | |
402 | } | |
403 | ||
404 | TParticle *partCopy = mcpart; | |
405 | Int_t pdgcode = mcpart->GetPdgCode(); | |
406 | Int_t pdgcodeCopy = pdgcode; | |
407 | ||
408 | // if the mother is charmed hadron | |
75d81601 | 409 | Bool_t isDirectCharm = kFALSE; |
dbe3abbe | 410 | if ( int(abs(pdgcode)/100.) == kCharm || int(abs(pdgcode)/1000.) == kCharm ) { |
411 | ||
412 | // iterate until you find B hadron as a mother or become top ancester | |
413 | for (Int_t i=1; i<fgkMaxIter; i++){ | |
414 | ||
415 | Int_t jLabel = mcpart->GetFirstMother(); | |
416 | if (jLabel == -1){ | |
75d81601 | 417 | isDirectCharm = kTRUE; |
dbe3abbe | 418 | break; // if there is no ancester |
419 | } | |
420 | if (jLabel < 0){ // safety protection | |
421 | AliDebug(1, "Stack label is negative, return\n"); | |
422 | return; | |
423 | } | |
424 | // if there is an ancester | |
425 | TParticle* mother = fStack->Particle(jLabel); | |
426 | Int_t motherPDG = mother->GetPdgCode(); | |
427 | ||
428 | for (Int_t j=0; j<fNparents; j++){ | |
429 | if (abs(motherPDG)==fParentSelect[1][j]) return; // return if this hadron is originated from b | |
430 | } | |
431 | ||
432 | mcpart = mother; | |
433 | } // end of iteration | |
434 | } // end of if | |
75d81601 | 435 | if((isDirectCharm == kTRUE && kquark == kCharm) || kquark == kBeauty) { |
dbe3abbe | 436 | for (Int_t i=0; i<fNparents; i++){ |
437 | if (abs(pdgcodeCopy)==fParentSelect[iq][i]){ | |
438 | ||
439 | // fill hadron kinematics | |
440 | fHist[iq][kHadron][0].fPdgCode->Fill(pdgcodeCopy); | |
441 | fHist[iq][kHadron][0].fPt->Fill(partCopy->Pt()); | |
442 | fHist[iq][kHadron][0].fY->Fill(GetRapidity(partCopy)); | |
443 | fHist[iq][kHadron][0].fEta->Fill(partCopy->Eta()); | |
444 | ||
445 | } | |
446 | } | |
447 | } // end of if | |
448 | } | |
449 | ||
450 | //__________________________________________ | |
722347d8 | 451 | void AliHFEmcQA::GetDecayedKine(TParticle* mcpart, const Int_t kquark, Int_t kdecayed, Int_t icut) |
259c3296 | 452 | { |
453 | // decay electron kinematics | |
454 | ||
dbe3abbe | 455 | if (kquark != kCharm && kquark != kBeauty) { |
259c3296 | 456 | AliDebug(1, "This task is only for heavy quark QA, return\n"); |
457 | return; | |
458 | } | |
dbe3abbe | 459 | Int_t iq = kquark - kCharm; |
259c3296 | 460 | |
722347d8 | 461 | /* |
259c3296 | 462 | if (iTrack < 0) { |
463 | AliDebug(1, "Stack label is negative, return\n"); | |
464 | return; | |
465 | } | |
722347d8 | 466 | */ |
259c3296 | 467 | |
722347d8 | 468 | //TParticle* mcpart = fStack->Particle(iTrack); |
259c3296 | 469 | |
470 | if ( abs(mcpart->GetPdgCode()) != kdecayed ) return; | |
259c3296 | 471 | |
472 | Int_t iLabel = mcpart->GetFirstMother(); | |
473 | if (iLabel<0){ | |
474 | AliDebug(1, "Stack label is negative, return\n"); | |
475 | return; | |
476 | } | |
477 | ||
478 | TParticle *partMother = fStack->Particle(iLabel); | |
dbe3abbe | 479 | TParticle *partMotherCopy = partMother; |
259c3296 | 480 | Int_t maPdgcode = partMother->GetPdgCode(); |
dbe3abbe | 481 | Int_t maPdgcodeCopy = maPdgcode; |
259c3296 | 482 | |
483 | // get electron production vertex | |
484 | TLorentzVector ePoint; | |
485 | mcpart->ProductionVertex(ePoint); | |
486 | ||
259c3296 | 487 | // if the mother is charmed hadron |
dbe3abbe | 488 | Bool_t isMotherDirectCharm = kFALSE; |
489 | if ( int(abs(maPdgcode)/100.) == kCharm || int(abs(maPdgcode)/1000.) == kCharm ) { | |
259c3296 | 490 | |
491 | // iterate until you find B hadron as a mother or become top ancester | |
492 | for (Int_t i=1; i<fgkMaxIter; i++){ | |
493 | ||
494 | Int_t jLabel = partMother->GetFirstMother(); | |
495 | if (jLabel == -1){ | |
dbe3abbe | 496 | isMotherDirectCharm = kTRUE; |
259c3296 | 497 | break; // if there is no ancester |
498 | } | |
499 | if (jLabel < 0){ // safety protection | |
500 | AliDebug(1, "Stack label is negative, return\n"); | |
501 | return; | |
502 | } | |
503 | ||
504 | // if there is an ancester | |
505 | TParticle* grandMa = fStack->Particle(jLabel); | |
506 | Int_t grandMaPDG = grandMa->GetPdgCode(); | |
507 | ||
fc0de2a0 | 508 | for (Int_t j=0; j<fNparents; j++){ |
509 | if (abs(grandMaPDG)==fParentSelect[1][j]){ | |
259c3296 | 510 | |
dbe3abbe | 511 | if (kquark == kCharm) return; |
259c3296 | 512 | // fill electron kinematics |
dbe3abbe | 513 | fHist[iq][kElectron2nd][icut].fPdgCode->Fill(mcpart->GetPdgCode()); |
514 | fHist[iq][kElectron2nd][icut].fPt->Fill(mcpart->Pt()); | |
515 | fHist[iq][kElectron2nd][icut].fY->Fill(GetRapidity(mcpart)); | |
516 | fHist[iq][kElectron2nd][icut].fEta->Fill(mcpart->Eta()); | |
259c3296 | 517 | |
518 | // fill mother hadron kinematics | |
dbe3abbe | 519 | fHist[iq][kDeHadron][icut].fPdgCode->Fill(grandMaPDG); |
520 | fHist[iq][kDeHadron][icut].fPt->Fill(grandMa->Pt()); | |
521 | fHist[iq][kDeHadron][icut].fY->Fill(GetRapidity(grandMa)); | |
522 | fHist[iq][kDeHadron][icut].fEta->Fill(grandMa->Eta()); | |
259c3296 | 523 | |
524 | // ratio between pT of electron and pT of mother B hadron | |
dbe3abbe | 525 | if(grandMa->Pt()) fHistComm[iq][icut].fDePtRatio->Fill(grandMa->Pt(),mcpart->Pt()/grandMa->Pt()); |
259c3296 | 526 | |
527 | // distance between electron production point and mother hadron production point | |
528 | TLorentzVector debPoint; | |
529 | grandMa->ProductionVertex(debPoint); | |
530 | TLorentzVector dedistance = ePoint - debPoint; | |
dbe3abbe | 531 | fHistComm[iq][icut].fDeDistance->Fill(grandMa->Pt(),dedistance.P()); |
259c3296 | 532 | return; |
533 | } | |
dc306130 | 534 | } |
259c3296 | 535 | |
536 | partMother = grandMa; | |
537 | } // end of iteration | |
538 | } // end of if | |
dbe3abbe | 539 | if((isMotherDirectCharm == kTRUE && kquark == kCharm) || kquark == kBeauty) { |
259c3296 | 540 | for (Int_t i=0; i<fNparents; i++){ |
541 | if (abs(maPdgcodeCopy)==fParentSelect[iq][i]){ | |
542 | ||
543 | // fill electron kinematics | |
dbe3abbe | 544 | fHist[iq][kElectron][icut].fPdgCode->Fill(mcpart->GetPdgCode()); |
545 | fHist[iq][kElectron][icut].fPt->Fill(mcpart->Pt()); | |
546 | fHist[iq][kElectron][icut].fY->Fill(GetRapidity(mcpart)); | |
547 | fHist[iq][kElectron][icut].fEta->Fill(mcpart->Eta()); | |
259c3296 | 548 | |
549 | // fill mother hadron kinematics | |
dbe3abbe | 550 | fHist[iq][keHadron][icut].fPdgCode->Fill(maPdgcodeCopy); |
551 | fHist[iq][keHadron][icut].fPt->Fill(partMotherCopy->Pt()); | |
552 | fHist[iq][keHadron][icut].fY->Fill(GetRapidity(partMotherCopy)); | |
553 | fHist[iq][keHadron][icut].fEta->Fill(partMotherCopy->Eta()); | |
259c3296 | 554 | |
555 | // ratio between pT of electron and pT of mother B hadron | |
dbe3abbe | 556 | if(partMotherCopy->Pt()) fHistComm[iq][icut].fePtRatio->Fill(partMotherCopy->Pt(),mcpart->Pt()/partMotherCopy->Pt()); |
259c3296 | 557 | |
558 | // distance between electron production point and mother hadron production point | |
559 | TLorentzVector ebPoint; | |
560 | partMotherCopy->ProductionVertex(ebPoint); | |
561 | TLorentzVector edistance = ePoint - ebPoint; | |
dbe3abbe | 562 | fHistComm[iq][icut].feDistance->Fill(partMotherCopy->Pt(),edistance.P()); |
259c3296 | 563 | } |
564 | } | |
565 | } // end of if | |
566 | } | |
567 | ||
568 | ||
569 | //__________________________________________ | |
75d81601 | 570 | void AliHFEmcQA::IdentifyMother(Int_t motherlabel, Int_t &motherpdg, Int_t &grandmotherlabel) |
259c3296 | 571 | { |
dbe3abbe | 572 | // find mother pdg code and label |
573 | ||
75d81601 | 574 | if (motherlabel < 0) { |
259c3296 | 575 | AliDebug(1, "Stack label is negative, return\n"); |
576 | return; | |
577 | } | |
75d81601 | 578 | TParticle *heavysMother = fStack->Particle(motherlabel); |
579 | motherpdg = heavysMother->GetPdgCode(); | |
580 | grandmotherlabel = heavysMother->GetFirstMother(); | |
581 | AliDebug(1,Form("ancestor pdg code= %d\n",motherpdg)); | |
259c3296 | 582 | } |
583 | ||
584 | //__________________________________________ | |
259c3296 | 585 | void AliHFEmcQA::HardScattering(const Int_t kquark, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel) |
586 | { | |
dbe3abbe | 587 | // mothertype -1 means this heavy quark coming from hard vertex |
588 | ||
259c3296 | 589 | TParticle *afterinitialrad1 = fStack->Particle(4); |
590 | TParticle *afterinitialrad2 = fStack->Particle(5); | |
591 | ||
592 | motherlabel = -1; | |
593 | ||
594 | if (abs(afterinitialrad1->GetPdgCode()) == fgkGluon && abs(afterinitialrad2->GetPdgCode()) == fgkGluon){ | |
595 | AliDebug(1,"heavy from gluon gluon pair creation!\n"); | |
596 | mothertype = -1; | |
597 | motherID = fgkGluon; | |
598 | } | |
599 | else if (abs(afterinitialrad1->GetPdgCode()) == kquark || abs(afterinitialrad2->GetPdgCode()) == kquark){ // one from Q and the other from g | |
600 | AliDebug(1,"heavy from flavor exitation!\n"); | |
601 | mothertype = -1; | |
602 | motherID = kquark; | |
603 | } | |
604 | else if (abs(afterinitialrad1->GetPdgCode()) == abs(afterinitialrad2->GetPdgCode())){ | |
605 | AliDebug(1,"heavy from q-qbar pair creation!\n"); | |
606 | mothertype = -1; | |
607 | motherID = 1; | |
608 | } | |
609 | else { | |
610 | AliDebug(1,"something strange!\n"); | |
611 | mothertype = -999; | |
612 | motherlabel = -999; | |
613 | motherID = -999; | |
614 | } | |
615 | } | |
616 | ||
617 | //__________________________________________ | |
259c3296 | 618 | Bool_t AliHFEmcQA::IsFromInitialShower(Int_t inputmotherlabel, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel) |
619 | { | |
dbe3abbe | 620 | // mothertype -2 means this heavy quark coming from initial state |
621 | ||
259c3296 | 622 | if (inputmotherlabel==2 || inputmotherlabel==3){ // mother exist before initial state radiation |
623 | TParticle *heavysMother = fStack->Particle(inputmotherlabel); | |
624 | motherID = heavysMother->GetPdgCode(); | |
625 | mothertype = -2; // there is mother before initial state radiation | |
626 | motherlabel = inputmotherlabel; | |
627 | AliDebug(1,"initial parton shower! \n"); | |
628 | ||
629 | return kTRUE; | |
630 | } | |
631 | ||
632 | return kFALSE; | |
633 | } | |
634 | ||
635 | //__________________________________________ | |
259c3296 | 636 | Bool_t AliHFEmcQA::IsFromFinalParton(Int_t inputmotherlabel, Int_t &motherID, Int_t &mothertype, Int_t &motherlabel) |
637 | { | |
dbe3abbe | 638 | // mothertype 2 means this heavy quark coming from final state |
639 | ||
259c3296 | 640 | if (inputmotherlabel > 5){ // mother exist after hard scattering |
641 | TParticle *heavysMother = fStack->Particle(inputmotherlabel); | |
642 | motherID = heavysMother->GetPdgCode(); | |
643 | mothertype = 2; // | |
644 | motherlabel = inputmotherlabel; | |
645 | AliDebug(1,Form("heavy quark from %d after hard scattering! \n",motherID)); | |
646 | ||
647 | return kTRUE; | |
648 | } | |
649 | return kFALSE; | |
650 | } | |
651 | ||
652 | //__________________________________________ | |
dbe3abbe | 653 | void AliHFEmcQA::ReportStrangeness(Int_t &motherID, Int_t &mothertype, Int_t &motherlabel) |
259c3296 | 654 | { |
dbe3abbe | 655 | // mark strange behavior |
656 | ||
259c3296 | 657 | mothertype = -888; |
658 | motherlabel = -888; | |
659 | motherID = -888; | |
660 | AliDebug(1,"something strange!\n"); | |
661 | } | |
662 | ||
663 | //__________________________________________ | |
dc306130 | 664 | Float_t AliHFEmcQA::GetRapidity(TParticle *part) |
259c3296 | 665 | { |
dbe3abbe | 666 | // return rapidity |
667 | ||
259c3296 | 668 | Float_t rapidity; |
669 | if(part->Energy() - part->Pz() == 0 || part->Energy() + part->Pz() == 0) rapidity=-999; | |
670 | else rapidity = 0.5*(TMath::Log((part->Energy()+part->Pz()) / (part->Energy()-part->Pz()))); | |
671 | return rapidity; | |
672 | } |