]>
Commit | Line | Data |
---|---|---|
379592af | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2009, 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 | ||
27de2dfb | 16 | /* $Id$ */ |
17 | ||
379592af | 18 | //----------------------------------------------------------------------- |
19 | // Class for HF corrections as a function of many variables and step | |
20 | // Author : C. Zampolli, CERN | |
21 | // D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it | |
22 | // Base class for HF Unfolding - agrelli@uu.nl | |
23 | //----------------------------------------------------------------------- | |
24 | ||
25 | #include "TParticle.h" | |
26 | #include "TClonesArray.h" | |
27 | #include "AliAODMCParticle.h" | |
28 | #include "AliAODRecoDecayHF.h" | |
29 | #include "AliAODRecoDecayHF2Prong.h" | |
30 | #include "AliAODRecoDecayHF3Prong.h" | |
31 | #include "AliAODRecoDecayHF4Prong.h" | |
32 | #include "AliAODMCHeader.h" | |
33 | #include "AliAODEvent.h" | |
34 | #include "AliLog.h" | |
35 | #include "AliESDtrackCuts.h" | |
36 | #include "AliESDtrack.h" | |
37 | ||
38 | #include "AliCFVertexingHF.h" | |
39 | ||
40 | //___________________________________________________________ | |
41 | AliCFVertexingHF::AliCFVertexingHF() : | |
42 | fmcArray(0x0), | |
43 | fRecoCandidate(0), | |
44 | fmcPartCandidate(0x0), | |
45 | fNDaughters(0), | |
46 | fNVar(0), | |
47 | fzPrimVertex(0), | |
48 | fzMCVertex(0), | |
49 | fFillFromGenerated(0), | |
50 | fOriginDselection(0), | |
51 | fKeepDfromB(kFALSE), | |
52 | fKeepDfromBOnly(kFALSE), | |
53 | fmcLabel(0), | |
6e2e4f50 | 54 | fProngs(-1), |
b7af2639 | 55 | fLabelArray(0x0), |
56 | fCentValue(0.) | |
379592af | 57 | { |
f2703bd2 | 58 | // |
59 | // constructor | |
60 | // | |
61 | ||
6e2e4f50 | 62 | |
379592af | 63 | return; |
64 | } | |
65 | ||
66 | ||
67 | ||
68 | //_____________________________________________________ | |
69 | AliCFVertexingHF::AliCFVertexingHF(TClonesArray *mcArray, UShort_t originDselection) : | |
70 | fmcArray(mcArray), | |
71 | fRecoCandidate(0), | |
72 | fmcPartCandidate(0x0), | |
73 | fNDaughters(0), | |
74 | fNVar(0), | |
75 | fzPrimVertex(0), | |
76 | fzMCVertex(0), | |
77 | fFillFromGenerated(0), | |
78 | fOriginDselection(0), | |
79 | fKeepDfromB(kFALSE), | |
80 | fKeepDfromBOnly(kFALSE), | |
81 | fmcLabel(0), | |
6e2e4f50 | 82 | fProngs(-1), |
b7af2639 | 83 | fLabelArray(0x0), |
84 | fCentValue(0.) | |
379592af | 85 | { |
f2703bd2 | 86 | // |
87 | // constructor with mcArray | |
88 | // | |
89 | ||
90 | SetDselection(originDselection); | |
91 | return; | |
379592af | 92 | } |
93 | ||
379592af | 94 | //_______________________________________________________ |
95 | AliCFVertexingHF::~AliCFVertexingHF() | |
96 | { | |
f2703bd2 | 97 | // |
98 | // destructor | |
99 | // | |
379592af | 100 | |
f2703bd2 | 101 | if (fmcArray) fmcArray = 0x0; |
102 | if (fRecoCandidate) fRecoCandidate = 0x0; | |
103 | if (fmcPartCandidate) fmcPartCandidate = 0x0; | |
6e2e4f50 | 104 | if (fLabelArray){ |
b7af2639 | 105 | delete [] fLabelArray; |
106 | fLabelArray = 0x0; | |
6e2e4f50 | 107 | } |
f2703bd2 | 108 | } |
379592af | 109 | |
110 | //_____________________________________________________ | |
f2703bd2 | 111 | AliCFVertexingHF& AliCFVertexingHF::operator=(const AliCFVertexingHF& c) |
112 | { | |
113 | // | |
114 | // assigment operator | |
115 | // | |
116 | ||
379592af | 117 | if (this!= &c){ |
118 | TObject::operator=(c); | |
119 | fmcArray = c.fmcArray; | |
120 | fRecoCandidate = c.fRecoCandidate; | |
121 | fmcPartCandidate = c.fmcPartCandidate; | |
122 | fNDaughters = c.fNDaughters; | |
123 | fNVar = c.fNVar; | |
124 | fzPrimVertex = c.fzPrimVertex; | |
125 | fzMCVertex = c.fzMCVertex; | |
126 | fFillFromGenerated = c.fFillFromGenerated; | |
127 | fOriginDselection = c.fOriginDselection; | |
128 | fKeepDfromB = c.fKeepDfromB; | |
129 | fKeepDfromBOnly = c.fKeepDfromBOnly; | |
130 | fmcLabel = c.fmcLabel; | |
6e2e4f50 | 131 | fProngs=c.fProngs; |
b7af2639 | 132 | fCentValue=c.fCentValue; |
6e2e4f50 | 133 | if (fProngs > 0){ |
134 | fLabelArray = new Int_t[fProngs]; | |
135 | for(Int_t iP=0; iP<fProngs; iP++)fLabelArray[iP]=c.fLabelArray[iP]; | |
136 | } | |
379592af | 137 | } |
138 | ||
139 | return *this; | |
140 | } | |
141 | ||
142 | //____________________________________________________ | |
143 | AliCFVertexingHF::AliCFVertexingHF(const AliCFVertexingHF &c) : | |
144 | TObject(c), | |
145 | fmcArray(c.fmcArray), | |
146 | fRecoCandidate(c.fRecoCandidate), | |
147 | fmcPartCandidate(c.fmcPartCandidate), | |
148 | fNDaughters(c.fNDaughters), | |
149 | fNVar(c.fNVar), | |
150 | fzPrimVertex(c.fzPrimVertex), | |
151 | fzMCVertex(c.fzMCVertex), | |
152 | fFillFromGenerated(c.fFillFromGenerated), | |
153 | fOriginDselection (c.fOriginDselection), | |
154 | fKeepDfromB (c.fKeepDfromB), | |
155 | fKeepDfromBOnly (c.fKeepDfromBOnly), | |
156 | fmcLabel(c.fmcLabel), | |
6e2e4f50 | 157 | fProngs(c.fProngs), |
b7af2639 | 158 | fLabelArray(0x0), |
159 | fCentValue(c.fCentValue) | |
f2703bd2 | 160 | { |
161 | // | |
162 | //copy constructor | |
163 | // | |
6e2e4f50 | 164 | if (fProngs > 0){ |
165 | fLabelArray = new Int_t[fProngs]; | |
166 | if (c.fLabelArray) memcpy(fLabelArray,c.fLabelArray,fProngs*sizeof(Int_t)); | |
167 | } | |
379592af | 168 | } |
169 | ||
170 | //___________________________________________________________ | |
f2703bd2 | 171 | void AliCFVertexingHF::SetDselection(UShort_t originDselection) |
172 | { | |
173 | // setting the way the D0 will be selected | |
174 | // 0 --> only from c quarks | |
175 | // 1 --> only from b quarks | |
176 | // 2 --> from both c quarks and b quarks | |
177 | ||
178 | fOriginDselection = originDselection; | |
179 | ||
180 | if (fOriginDselection == 0) { | |
181 | fKeepDfromB = kFALSE; | |
182 | fKeepDfromBOnly = kFALSE; | |
183 | } | |
184 | ||
185 | if (fOriginDselection == 1) { | |
186 | fKeepDfromB = kTRUE; | |
187 | fKeepDfromBOnly = kTRUE; | |
188 | } | |
189 | ||
190 | if (fOriginDselection == 2) { | |
191 | fKeepDfromB = kTRUE; | |
192 | fKeepDfromBOnly = kFALSE; | |
193 | } | |
194 | ||
195 | return; | |
379592af | 196 | } |
197 | ||
198 | //______________________________________________________ | |
f2703bd2 | 199 | void AliCFVertexingHF::SetMCCandidateParam(Int_t label) |
200 | { | |
201 | // | |
202 | // setting the parameters (candidate and n. daughters) | |
203 | // | |
379592af | 204 | |
8a983038 | 205 | fmcPartCandidate = dynamic_cast <AliAODMCParticle*> (fmcArray->At(label)); |
206 | if (fmcPartCandidate){ | |
207 | fNDaughters = fmcPartCandidate->GetNDaughters(); | |
208 | } | |
209 | else { | |
210 | AliError(Form("Dynamic cast failed, fNdaughters will remain set to %d",fNDaughters)); | |
211 | } | |
f2703bd2 | 212 | return; |
379592af | 213 | } |
214 | ||
379592af | 215 | //____________________________________________________________ |
f2703bd2 | 216 | Int_t AliCFVertexingHF::MCcquarkCounting(AliAODMCParticle* mcPart) const |
217 | { | |
218 | // | |
219 | // counting the c-quarks | |
220 | // | |
221 | ||
222 | Int_t cquarks = 0; | |
8a983038 | 223 | if (mcPart) { |
224 | if (mcPart->GetPdgCode() == 4) cquarks++; | |
225 | if (mcPart->GetPdgCode() == -4) cquarks++; | |
226 | } | |
227 | else { | |
f2703bd2 | 228 | AliWarning("Particle not found in tree, skipping\n"); |
229 | return cquarks; | |
230 | } | |
231 | ||
232 | return cquarks; | |
379592af | 233 | } |
234 | ||
379592af | 235 | //________________________________________________________ |
f2703bd2 | 236 | Bool_t AliCFVertexingHF::CheckMCPartFamily(AliAODMCParticle */*mcPart*/, TClonesArray */*mcArray*/) const |
237 | { | |
238 | // | |
239 | //checking the family | |
240 | // | |
241 | ||
242 | Int_t pdgGranma = CheckOrigin(); | |
243 | if (pdgGranma == -9999){ | |
244 | AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only the prompt charm particles\n"); | |
f2703bd2 | 245 | return kFALSE; |
246 | } | |
247 | ||
248 | if (pdgGranma == -999){ | |
f036863c | 249 | AliDebug(2,"This particle come from a prompt charm particles but according to the settings of the task, we want only the ones coming from B\n"); |
f2703bd2 | 250 | return kFALSE; |
251 | } | |
252 | ||
253 | if (!CheckMCDaughters()) { | |
b7af2639 | 254 | AliDebug(3, "CheckMCDaughters false"); |
255 | return kFALSE; | |
f2703bd2 | 256 | } |
257 | if (!CheckMCChannelDecay()) { | |
6e2e4f50 | 258 | AliDebug(3,"CheckMCChannelDecay false"); |
f2703bd2 | 259 | return kFALSE; |
260 | } | |
261 | return kTRUE; | |
379592af | 262 | } |
263 | ||
264 | //_________________________________________________________________________________________________ | |
f2703bd2 | 265 | Int_t AliCFVertexingHF::CheckOrigin() const |
266 | { | |
267 | // | |
268 | // checking whether the mother of the particles come from a charm or a bottom quark | |
269 | // | |
270 | ||
271 | Int_t pdgGranma = 0; | |
272 | Int_t mother = 0; | |
273 | mother = fmcPartCandidate->GetMother(); | |
274 | Int_t istep = 0; | |
f036863c | 275 | Int_t abspdgGranma =0; |
f2703bd2 | 276 | while (mother >0 ){ |
277 | istep++; | |
278 | AliDebug(2,Form("mother at step %d = %d", istep, mother)); | |
279 | AliAODMCParticle* mcGranma = dynamic_cast<AliAODMCParticle*>(fmcArray->At(mother)); | |
8a983038 | 280 | if (mcGranma){ |
281 | pdgGranma = mcGranma->GetPdgCode(); | |
282 | AliDebug(2,Form("Pdg mother at step %d = %d", istep, pdgGranma)); | |
283 | abspdgGranma = TMath::Abs(pdgGranma); | |
284 | if ((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000)) { | |
285 | if (!fKeepDfromB) return -9999; //skip particle if come from a B meson. | |
286 | ||
287 | else{ | |
288 | break; | |
289 | } | |
f2703bd2 | 290 | } |
8a983038 | 291 | mother = mcGranma->GetMother(); |
292 | } | |
293 | else { | |
294 | AliError("Failed casting the mother particle!"); | |
295 | break; | |
f2703bd2 | 296 | } |
f2703bd2 | 297 | } |
f036863c | 298 | if (!((abspdgGranma > 500 && abspdgGranma < 600) || (abspdgGranma > 5000 && abspdgGranma < 6000))){ |
299 | if (fKeepDfromBOnly) return -999; | |
300 | } | |
379592af | 301 | return pdgGranma; |
379592af | 302 | } |
303 | ||
379592af | 304 | //___________________________________________ |
f2703bd2 | 305 | Bool_t AliCFVertexingHF::CheckMCDaughters()const |
306 | { | |
307 | // | |
308 | // checking the daughters | |
309 | // at MC level | |
379592af | 310 | |
f2703bd2 | 311 | AliAODMCParticle *mcPartDaughter; |
312 | Bool_t checkDaughters = kFALSE; | |
313 | ||
314 | Int_t label0 = fmcPartCandidate->GetDaughter(0); | |
315 | Int_t label1 = fmcPartCandidate->GetDaughter(1); | |
6e2e4f50 | 316 | AliDebug(3,Form("label0 = %d, label1 = %d",label0,label1)); |
f2703bd2 | 317 | if (label1==0 || label0 == 0){ |
6e2e4f50 | 318 | AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!")); |
f2703bd2 | 319 | return checkDaughters; |
320 | } | |
379592af | 321 | |
6e2e4f50 | 322 | if (fLabelArray == 0x0) { |
323 | return checkDaughters; | |
324 | } | |
325 | ||
f2703bd2 | 326 | for (Int_t iProng = 0; iProng<fProngs; iProng++){ |
6e2e4f50 | 327 | mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng])); |
f2703bd2 | 328 | if (!mcPartDaughter) { |
329 | AliWarning("At least one Daughter Particle not found in tree, skipping"); | |
330 | return checkDaughters; | |
331 | } | |
332 | } | |
333 | ||
334 | checkDaughters = kTRUE; | |
335 | return checkDaughters; | |
336 | } | |
379592af | 337 | |
338 | //______________________________________________________ | |
339 | Bool_t AliCFVertexingHF::FillMCContainer(Double_t *containerInputMC) | |
340 | { | |
f2703bd2 | 341 | // |
342 | // fill the container for Generator level selection | |
343 | // | |
379592af | 344 | |
f2703bd2 | 345 | Bool_t mcContainerFilled = kFALSE; |
346 | ||
347 | Double_t* vectorMC = new Double_t[fNVar]; | |
348 | for (Int_t iVar = 0; iVar<fNVar; iVar++) vectorMC[iVar]= 9999.; | |
349 | ||
350 | if (GetGeneratedValuesFromMCParticle(&vectorMC[0])){ | |
351 | for (Int_t iVar = 0; iVar<fNVar; iVar++){ | |
352 | containerInputMC[iVar] = vectorMC[iVar]; | |
353 | } | |
354 | mcContainerFilled = kTRUE; | |
355 | } | |
356 | delete [] vectorMC; | |
357 | vectorMC = 0x0; | |
358 | return mcContainerFilled; | |
379592af | 359 | } |
360 | ||
361 | //______________________________________________________ | |
f2703bd2 | 362 | Bool_t AliCFVertexingHF::FillRecoContainer(Double_t *containerInput) |
363 | { | |
364 | // | |
365 | // fill the container for Reconstrucred level selection | |
366 | // | |
367 | ||
368 | Bool_t recoContainerFilled = kFALSE; | |
369 | Double_t* vectorValues = new Double_t[fNVar]; | |
370 | Double_t* vectorReco = new Double_t[fNVar]; | |
f2703bd2 | 371 | for (Int_t iVar = 0; iVar<fNVar; iVar++) { |
b7af2639 | 372 | |
f2703bd2 | 373 | vectorValues[iVar]= 9999.; |
374 | vectorReco[iVar]=9999.; | |
375 | } | |
376 | ||
377 | if(fFillFromGenerated){ | |
378 | //filled with MC values | |
379 | if (GetGeneratedValuesFromMCParticle(&vectorValues[0])){ | |
380 | for (Int_t iVar = 0; iVar<fNVar; iVar++){ | |
381 | containerInput[iVar] = vectorValues[iVar]; | |
382 | } | |
383 | recoContainerFilled = kTRUE; | |
379592af | 384 | } |
385 | } | |
386 | else{ | |
f2703bd2 | 387 | //filled with Reco values |
379592af | 388 | |
389 | if (GetRecoValuesFromCandidate(&vectorReco[0])){ | |
390 | for (Int_t iVar = 0; iVar<fNVar; iVar++){ | |
b7af2639 | 391 | containerInput[iVar] = vectorReco[iVar]; |
379592af | 392 | } |
393 | recoContainerFilled = kTRUE; | |
394 | } | |
395 | } | |
f2703bd2 | 396 | |
397 | delete [] vectorValues; | |
398 | delete [] vectorReco; | |
399 | vectorValues = 0x0; | |
400 | vectorReco = 0x0; | |
401 | return recoContainerFilled; | |
379592af | 402 | } |
403 | ||
404 | //_____________________________________________________ | |
405 | Bool_t AliCFVertexingHF::MCAcceptanceStep() const | |
406 | { | |
f2703bd2 | 407 | // |
408 | // checking the MC acceptance step | |
409 | // | |
410 | ||
411 | Bool_t bMCAccStep = kFALSE; | |
412 | ||
413 | AliAODMCParticle *mcPartDaughter; | |
414 | Int_t label0 = fmcPartCandidate->GetDaughter(0); | |
415 | Int_t label1 = fmcPartCandidate->GetDaughter(1); | |
416 | if (label1==0 || label0 == 0){ | |
417 | AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!")); | |
418 | return bMCAccStep; | |
419 | } | |
420 | ||
6e2e4f50 | 421 | if (fLabelArray == 0x0) { |
422 | return bMCAccStep; | |
423 | } | |
424 | ||
f2703bd2 | 425 | for (Int_t iProng = 0; iProng<fProngs; iProng++){ |
6e2e4f50 | 426 | mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fLabelArray[iProng])); |
f2703bd2 | 427 | if (!mcPartDaughter) { |
428 | AliWarning("At least one Daughter Particle not found in tree, skipping"); | |
429 | return bMCAccStep; | |
430 | } | |
431 | Double_t eta = mcPartDaughter->Eta(); | |
432 | Double_t pt = mcPartDaughter->Pt(); | |
433 | ||
434 | //set values of eta and pt in the constructor. | |
435 | if (TMath::Abs(eta) > 0.9 || pt < 0.1){ | |
436 | AliDebug(3,"At least one daughter has eta>0.9 or pt < 0.1 \n"); | |
437 | return bMCAccStep; | |
438 | } | |
439 | } | |
440 | bMCAccStep = kTRUE; | |
441 | return bMCAccStep; | |
442 | ||
443 | } | |
f2703bd2 | 444 | //_____________________________________________________ |
379592af | 445 | Bool_t AliCFVertexingHF::MCRefitStep(AliAODEvent *aodEvent, AliESDtrackCuts *trackCuts) const |
446 | { | |
f2703bd2 | 447 | // |
448 | // check on the kTPCrefit and kITSrefit conditions of the daughters | |
449 | // | |
379592af | 450 | Bool_t bRefitStep = kFALSE; |
f2703bd2 | 451 | |
379592af | 452 | Int_t label0 = fmcPartCandidate->GetDaughter(0); |
453 | Int_t label1 = fmcPartCandidate->GetDaughter(1); | |
f2703bd2 | 454 | |
379592af | 455 | if (label1==0 || label0 == 0){ |
f2703bd2 | 456 | AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!")); |
457 | return bRefitStep; | |
379592af | 458 | } |
f2703bd2 | 459 | |
6e2e4f50 | 460 | if (fLabelArray == 0x0) { |
461 | return bRefitStep; | |
462 | } | |
f2703bd2 | 463 | |
379592af | 464 | Int_t foundDaughters = 0; |
6e2e4f50 | 465 | Int_t* temp = new Int_t[fProngs]; |
466 | for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){ | |
467 | temp[ilabel] = fLabelArray[ilabel]; | |
468 | } | |
469 | ||
379592af | 470 | if (trackCuts->GetRequireTPCRefit() || trackCuts->GetRequireITSRefit()){ |
f2703bd2 | 471 | |
379592af | 472 | for(Int_t iaod =0; iaod<aodEvent->GetNumberOfTracks(); iaod++){ |
473 | AliAODTrack *track = (AliAODTrack*)aodEvent->GetTrack(iaod); | |
6e2e4f50 | 474 | if(track->GetStatus()&AliESDtrack::kITSpureSA) continue; |
475 | Bool_t foundTrack = kFALSE; | |
476 | for (Int_t ilabel = 0; ilabel<fProngs; ilabel++){ | |
b7af2639 | 477 | AliDebug(3,Form("fLabelArray[%d] = %d, track->GetLabel() = %d",ilabel,fLabelArray[ilabel],TMath::Abs(track->GetLabel()))); |
478 | if (TMath::Abs(track->GetLabel()) == temp[ilabel]) { | |
479 | foundTrack = kTRUE; | |
480 | temp[ilabel] = 0; | |
481 | break; | |
482 | } | |
6e2e4f50 | 483 | } |
484 | if (foundTrack){ | |
b7af2639 | 485 | foundDaughters++; |
486 | AliDebug(4,Form("daughter %d \n",foundDaughters)); | |
487 | if(trackCuts->GetRequireTPCRefit()){ | |
488 | if(track->GetStatus()&AliESDtrack::kTPCrefit) { | |
489 | bRefitStep = kTRUE; | |
490 | } | |
379592af | 491 | else { |
492 | AliDebug(3, "Refit cut not passed , missing TPC refit\n"); | |
6e2e4f50 | 493 | delete [] temp; |
494 | temp = 0x0; | |
379592af | 495 | return kFALSE; |
496 | } | |
497 | } | |
498 | ||
499 | if (trackCuts->GetRequireITSRefit()) { | |
f2703bd2 | 500 | if(track->GetStatus()&AliESDtrack::kITSrefit){ |
379592af | 501 | bRefitStep = kTRUE; |
502 | } | |
503 | else { | |
504 | AliDebug(3, "Refit cut not passed , missing ITS refit\n"); | |
6e2e4f50 | 505 | delete [] temp; |
506 | temp = 0x0; | |
507 | return kFALSE; | |
379592af | 508 | } |
509 | } | |
510 | } | |
f2703bd2 | 511 | if (foundDaughters == fProngs){ |
379592af | 512 | break; |
f2703bd2 | 513 | } |
514 | } | |
6e2e4f50 | 515 | } |
516 | delete [] temp; | |
517 | temp = 0x0; | |
f2703bd2 | 518 | if (foundDaughters== fProngs) return bRefitStep; |
519 | else return kFALSE; | |
379592af | 520 | } |
521 | ||
522 | //____________________________________________________________________________ | |
523 | ||
524 | Bool_t AliCFVertexingHF::RecoStep() | |
379592af | 525 | { |
f2703bd2 | 526 | // |
527 | //check also vertex and ITS Refit and TPC Refit | |
528 | // | |
379592af | 529 | |
f2703bd2 | 530 | Bool_t bRecoStep = kFALSE; |
531 | Int_t mcLabel = GetMCLabel(); | |
532 | ||
533 | if (mcLabel == -1) { | |
534 | AliDebug(2,"No MC particle found"); | |
535 | return bRecoStep; | |
536 | } | |
537 | else{ | |
538 | fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel); | |
539 | if (!fmcPartCandidate){ | |
540 | AliWarning("Could not find associated MC in AOD MC tree"); | |
541 | return bRecoStep; | |
542 | } | |
543 | } | |
544 | ||
545 | Int_t pdgGranma = CheckOrigin(); | |
546 | ||
547 | if (pdgGranma == -9999){ | |
548 | AliDebug(2,"This particle come from a B decay channel but according to the settings of the task, we keep only prompt charm particles\n"); | |
549 | return bRecoStep; | |
550 | } | |
551 | ||
552 | if (pdgGranma == -999){ | |
553 | AliDebug(2,"This particle come from a prompt charm particle but according to the settings of the task, we want only the ones coming from B\n"); | |
554 | return bRecoStep; | |
555 | } | |
379592af | 556 | |
f2703bd2 | 557 | bRecoStep=kTRUE; |
558 | return bRecoStep; | |
379592af | 559 | } |
560 | //____________________________________________ | |
f2703bd2 | 561 | Double_t AliCFVertexingHF::GetEtaProng(Int_t iProng) const |
562 | { | |
563 | // | |
564 | // getting eta of the prong | |
565 | // | |
566 | ||
567 | if (fRecoCandidate){ | |
568 | Double_t etaProng = fRecoCandidate->EtaProng(iProng); | |
569 | return etaProng; | |
570 | } | |
571 | return 999999; | |
379592af | 572 | } |
573 | //______________________________________________________ | |
f2703bd2 | 574 | Double_t AliCFVertexingHF::GetPtProng(Int_t iProng) const |
575 | { | |
576 | // | |
577 | // getting pt of the prong | |
578 | // | |
379592af | 579 | |
f2703bd2 | 580 | if (fRecoCandidate){ |
581 | Double_t ptProng = fRecoCandidate->PtProng(iProng); | |
582 | return ptProng; | |
583 | } | |
584 | return 999999; | |
585 | ||
379592af | 586 | } |
587 | ||
588 | //____________________________________________________________________ | |
589 | ||
590 | Bool_t AliCFVertexingHF::RecoAcceptStep(AliESDtrackCuts *trackCuts) const | |
591 | { | |
f2703bd2 | 592 | // |
593 | // reco Acceptance step | |
594 | // | |
595 | ||
596 | Bool_t bRecoAccStep = kFALSE; | |
597 | ||
598 | Float_t etaCutMin, ptCutMin, etaCutMax, ptCutMax; | |
599 | trackCuts->GetEtaRange(etaCutMin, etaCutMax); | |
600 | trackCuts->GetPtRange(ptCutMin, ptCutMax); | |
601 | ||
602 | Float_t etaProng=0., ptProng=0.; | |
603 | ||
604 | for (Int_t iProng =0; iProng<fProngs; iProng++){ | |
605 | ||
606 | etaProng = GetEtaProng(iProng); | |
607 | ptProng = GetPtProng(iProng); | |
608 | ||
609 | Bool_t acceptanceProng = (etaProng>etaCutMin && etaProng<etaCutMax && ptProng>ptCutMin && ptProng<ptCutMax); | |
610 | if (!acceptanceProng) { | |
611 | AliDebug(2,"At least one reconstructed prong isn't in the acceptance\n"); | |
612 | return bRecoAccStep; | |
613 | } | |
614 | } | |
615 | ||
616 | bRecoAccStep=kTRUE; | |
617 | return bRecoAccStep; | |
379592af | 618 | } |
619 | //___________________________________________________________ | |
620 | ||
e11ae259 | 621 | Bool_t AliCFVertexingHF::FillUnfoldingMatrix(Double_t fill[4]) const |
f2703bd2 | 622 | { |
623 | // | |
624 | // filling the unfolding matrix | |
625 | // | |
626 | ||
f2703bd2 | 627 | if(fmcPartCandidate){ |
628 | ||
629 | fill[0] = GetPtCand(); | |
630 | fill[1] = GetYCand(); | |
631 | ||
632 | fill[2] = fmcPartCandidate->Pt(); | |
633 | fill[3] = fmcPartCandidate->Y(); | |
634 | ||
635 | return kTRUE; | |
636 | } | |
637 | ||
f2703bd2 | 638 | return kFALSE; |
379592af | 639 | } |
f2703bd2 | 640 | //___________________________________________________________ |
379592af | 641 | |
3ee5eb83 | 642 | Int_t AliCFVertexingHF::CheckReflexion(Char_t isSign) |
f2703bd2 | 643 | { |
644 | // | |
645 | // check for reflexion (particle/antiparticle) | |
646 | // | |
379592af | 647 | |
f2703bd2 | 648 | Int_t mcLabel = GetMCLabel(); |
649 | ||
650 | if (mcLabel == -1) { | |
651 | AliDebug(2,"No MC particle found"); | |
652 | return 0; | |
653 | } | |
654 | else{ | |
655 | fmcPartCandidate = (AliAODMCParticle*)fmcArray->At(mcLabel); | |
656 | if (!fmcPartCandidate){ | |
657 | AliWarning("Could not find associated MC in AOD MC tree"); | |
658 | return 0; | |
659 | } | |
660 | } | |
661 | ||
3ee5eb83 | 662 | if(fmcPartCandidate->GetPdgCode()>0) { |
663 | if (isSign == 1){ // I ask for antiparticle only | |
664 | AliDebug(2,"candidate is particle, I ask for antiparticle only"); | |
665 | return 0; | |
666 | } | |
667 | return 1; // particle | |
668 | } | |
669 | else if(fmcPartCandidate->GetPdgCode()<0) { | |
670 | if (isSign == 0){ // I ask for particle only | |
671 | AliDebug(2,"candidate is antiparticle, I ask for particle only"); | |
672 | return 0; | |
673 | } | |
674 | return 2; // antiparticle | |
675 | } | |
f2703bd2 | 676 | else return 0; // ....shouldn't be... |
3ee5eb83 | 677 | |
f2703bd2 | 678 | } |
6e2e4f50 | 679 | //___________________________________________________________ |
680 | ||
681 | Bool_t AliCFVertexingHF::SetLabelArray() | |
682 | { | |
683 | // | |
684 | // setting the label arrays | |
685 | // | |
686 | ||
687 | Bool_t bLabelArray = kFALSE; | |
688 | ||
689 | fLabelArray = new Int_t[fProngs]; | |
690 | ||
691 | AliAODMCParticle *mcPartDaughter; | |
692 | Int_t label0 = fmcPartCandidate->GetDaughter(0); | |
693 | Int_t label1 = fmcPartCandidate->GetDaughter(1); | |
694 | AliDebug(2,Form("label0 = %d, label1 = %d",label0,label1)); | |
695 | if (label1==0 || label0 == 0){ | |
f036863c | 696 | AliDebug(2, Form("The MC particle doesn't have correct daughters, skipping!!")); |
6e2e4f50 | 697 | delete [] fLabelArray; |
698 | fLabelArray = 0x0; | |
699 | return bLabelArray; | |
700 | } | |
701 | ||
702 | if (label1 - label0 == fProngs-1){ | |
703 | for (Int_t iProng = 0; iProng<fProngs; iProng++){ | |
704 | mcPartDaughter = dynamic_cast<AliAODMCParticle*>(fmcArray->At(label0+iProng)); | |
8a983038 | 705 | if (mcPartDaughter){ |
706 | fLabelArray[iProng] = mcPartDaughter->GetLabel(); | |
707 | } | |
708 | else{ | |
709 | AliError("Failed casting the daughter particle, returning a NULL label array"); | |
b7af2639 | 710 | //delete [] fLabelArray; |
711 | //fLabelArray = 0x0; | |
8a983038 | 712 | return bLabelArray; |
713 | } | |
6e2e4f50 | 714 | } |
715 | ||
716 | } | |
717 | // resonant decay channel | |
718 | else if (label1 - label0 == fProngs-2 && fProngs > 2){ | |
719 | Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0); | |
720 | Int_t foundDaughters = 0; | |
721 | for(Int_t iDau=0; iDau<fProngs-1; iDau++){ | |
722 | Int_t iLabelDau = labelFirstDau+iDau; | |
723 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDau)); | |
724 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); | |
725 | if(pdgCode==211 || pdgCode==321 || pdgCode==2212){ | |
8a983038 | 726 | if (part) { |
727 | fLabelArray[foundDaughters] = part->GetLabel(); | |
728 | foundDaughters++; | |
729 | } | |
730 | else{ | |
731 | AliError("Error while casting particle! returning a NULL array"); | |
b7af2639 | 732 | //delete [] fLabelArray; |
733 | //fLabelArray = 0x0; | |
8a983038 | 734 | return bLabelArray; |
735 | } | |
6e2e4f50 | 736 | } |
737 | else{ | |
738 | Int_t nDauRes=part->GetNDaughters(); | |
739 | if(nDauRes!=2) { | |
740 | delete [] fLabelArray; | |
741 | fLabelArray = 0x0; | |
742 | return bLabelArray; | |
743 | } | |
744 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
9e6f6c1a | 745 | for(Int_t iDauRes=0; iDauRes<nDauRes; iDauRes++){ |
6e2e4f50 | 746 | Int_t iLabelDauRes = labelFirstDauRes+iDauRes; |
747 | AliAODMCParticle* dauRes = dynamic_cast<AliAODMCParticle*>(fmcArray->At(iLabelDauRes)); | |
8a983038 | 748 | if (dauRes){ |
749 | fLabelArray[foundDaughters] = dauRes->GetLabel(); | |
750 | foundDaughters++; | |
751 | } | |
752 | else{ | |
753 | AliError("Error while casting resonant daughter! returning a NULL array"); | |
b7af2639 | 754 | //delete [] fLabelArray; |
755 | //fLabelArray = 0x0; | |
8a983038 | 756 | return bLabelArray; |
757 | } | |
6e2e4f50 | 758 | } |
759 | } | |
760 | } | |
761 | if (foundDaughters != fProngs){ | |
762 | delete [] fLabelArray; | |
763 | fLabelArray = 0x0; | |
764 | return bLabelArray; | |
765 | } | |
766 | } | |
767 | // wrong correspondance label <--> prongs | |
768 | else{ | |
769 | delete [] fLabelArray; | |
770 | fLabelArray = 0x0; | |
771 | return bLabelArray; | |
772 | } | |
773 | bLabelArray = kTRUE; | |
774 | return bLabelArray; | |
775 | } |