]>
Commit | Line | Data |
---|---|---|
043062fe | 1 | /************************************************************************** |
2 | * Copyright(c) 2007-2011, 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 | ||
7b45817b | 16 | /* $Id$ */ |
043062fe | 17 | |
18 | /////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Class to compute variables for correction framework // | |
21 | // for 3-body decays of D mesons (D+, Ds, Lc) // | |
22 | // in bins of cut variables // | |
23 | // Origin: Francesco Prino (prino@to.infn.it) // | |
24 | // Renu Bala (bala@to.infn.it) // | |
25 | // // | |
26 | /////////////////////////////////////////////////////////////////// | |
27 | ||
28 | #include "AliAODMCParticle.h" | |
29 | #include "AliAODEvent.h" | |
30 | #include "TClonesArray.h" | |
31 | #include "AliCFVertexingHF.h" | |
32 | #include "AliESDtrack.h" | |
33 | #include "TDatabasePDG.h" | |
34 | ||
35 | #include "AliCFVertexingHF3Prong.h" | |
36 | #include "AliCFContainer.h" | |
37 | ||
38 | ClassImp(AliCFVertexingHF3Prong) | |
39 | ||
40 | ||
41 | //_________________________________________ | |
42 | AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(Int_t decay): | |
43 | AliCFVertexingHF(), | |
44 | fDecay(decay) | |
45 | { | |
46 | // | |
47 | SetNProngs(3); | |
2bf2e62b | 48 | |
49 | fPtAccCut=new Float_t[fProngs]; | |
50 | fEtaAccCut=new Float_t[fProngs]; | |
51 | for(Int_t iP=0; iP<fProngs; iP++){ | |
52 | fPtAccCut[iP]=0.1; | |
53 | fEtaAccCut[iP]=0.9; | |
54 | } | |
55 | ||
043062fe | 56 | } |
57 | //_________________________________________ | |
58 | AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(TClonesArray *mcArray, UShort_t originDselection, Int_t decay): | |
59 | AliCFVertexingHF(mcArray, originDselection), | |
60 | fDecay(decay) | |
61 | ||
62 | { | |
63 | // | |
64 | SetNProngs(3); | |
2bf2e62b | 65 | fPtAccCut=new Float_t[fProngs]; |
66 | fEtaAccCut=new Float_t[fProngs]; | |
67 | for(Int_t iP=0; iP<fProngs; iP++){ | |
68 | fPtAccCut[iP]=0.1; | |
69 | fEtaAccCut[iP]=0.9; | |
70 | } | |
043062fe | 71 | } |
72 | ||
73 | ||
74 | //_____________________________________ | |
75 | AliCFVertexingHF3Prong& AliCFVertexingHF3Prong::operator=(const AliCFVertexingHF3Prong& c){ | |
76 | // | |
77 | if (this != &c) { | |
78 | ||
79 | AliCFVertexingHF::operator=(c); | |
80 | ||
81 | } | |
82 | return *this; | |
83 | } | |
84 | ||
85 | //__________________________________________ | |
86 | Bool_t AliCFVertexingHF3Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand){ | |
87 | // Checks if candidate is signal and D meson is present in MC array | |
88 | ||
89 | Bool_t bSignAssoc = kFALSE; | |
90 | fRecoCandidate = recoCand; | |
91 | ||
92 | if (!fRecoCandidate) { | |
93 | AliError("fRecoCandidate not found, problem in assignement\n"); | |
94 | return bSignAssoc; | |
95 | } | |
96 | ||
97 | Int_t pdgCand = -1; | |
98 | Int_t pdgDaughter[3]={-1,-1,-1}; | |
99 | if(fDecay==kDplustoKpipi){ | |
100 | pdgCand=411; | |
101 | pdgDaughter[0]=321; | |
102 | pdgDaughter[1]=211; | |
103 | pdgDaughter[2]=211; | |
104 | }else if(fDecay==kDstoKKpi){ | |
105 | pdgCand=431; | |
106 | pdgDaughter[0]=321; | |
107 | pdgDaughter[1]=321; | |
108 | pdgDaughter[2]=211; | |
109 | }else if(fDecay==kLctopKpi){ | |
110 | AliError("LambdaC not yet implemented"); | |
111 | return bSignAssoc; | |
112 | }else{ | |
113 | AliError("WRONG DECAY SETTING"); | |
114 | return bSignAssoc; | |
115 | } | |
116 | ||
117 | Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,3,pdgDaughter); | |
118 | if (mcLabel == -1) return bSignAssoc; | |
119 | SetMCLabel(mcLabel); | |
120 | fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel)); | |
121 | ||
122 | if (!fmcPartCandidate){ | |
123 | AliDebug(3,"No part candidate"); | |
124 | return bSignAssoc; | |
125 | } | |
126 | ||
127 | bSignAssoc = kTRUE; | |
128 | return bSignAssoc; | |
129 | } | |
130 | ||
131 | //______________________________________________ | |
132 | Bool_t AliCFVertexingHF3Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC) { | |
133 | // | |
134 | // collecting all the necessary info from MC particle and fill vectorMC: 12 variables | |
135 | // pt_D | |
136 | // y_D | |
137 | // phi_D | |
138 | // ctau | |
139 | // cos point | |
140 | // pt_1 | |
141 | // pt_2 | |
142 | // pt_3 | |
143 | // d0_1 | |
144 | // d0_2 | |
145 | // d0_3 | |
146 | // zPrimVert | |
b7af2639 | 147 | // centrality |
043062fe | 148 | |
149 | Bool_t bGenValues = kFALSE; | |
150 | ||
151 | Int_t pdgCand = -1; | |
152 | if(fDecay==kDplustoKpipi){ | |
153 | pdgCand=411; | |
154 | }else if(fDecay==kDstoKKpi){ | |
155 | pdgCand=431; | |
156 | }else if(fDecay==kLctopKpi){ | |
157 | AliError("LambdaC not yet implemented"); | |
158 | return bGenValues; | |
159 | }else{ | |
160 | AliError("WRONG DECAY SETTING"); | |
161 | return bGenValues; | |
162 | } | |
163 | ||
164 | Double_t vertD[3] = {0,0,0}; // D origin | |
165 | fmcPartCandidate->XvYvZv(vertD); // cm | |
166 | ||
167 | Int_t nprongs = 3; | |
168 | Int_t daughter[3]; | |
169 | Short_t charge = fmcPartCandidate->Charge(); | |
170 | ||
171 | // order the daughters as LS,OS,LS, e.g. D+ -> pi+ K- pi+ | |
172 | // the 2 LS are ordered so that in pos. 0 there is the one with lower label value | |
173 | Int_t index=0; | |
174 | Int_t nDauLS=0; | |
175 | Int_t nDauOS=0; | |
176 | ||
177 | ||
178 | Int_t nDau=fmcPartCandidate->GetNDaughters(); | |
179 | Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0); | |
180 | if(nDau==3){ | |
181 | for(Int_t iDau=0; iDau<3; iDau++){ | |
182 | Int_t ind = labelFirstDau+iDau; | |
183 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 184 | if(!part){ |
185 | AliError("Daughter particle not found in MC array"); | |
186 | return bGenValues; | |
187 | } | |
043062fe | 188 | Short_t signDau=part->Charge(); |
189 | if(signDau==charge){ | |
190 | nDauLS++; | |
191 | daughter[index] = ind; | |
192 | index=2; | |
193 | }else{ | |
194 | daughter[1] = ind; | |
195 | nDauOS++; | |
196 | } | |
197 | } | |
198 | }else if(nDau==2){ | |
199 | for(Int_t iDau=0; iDau<2; iDau++){ | |
200 | Int_t ind = labelFirstDau+iDau; | |
201 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 202 | if(!part){ |
203 | AliError("Daughter particle not found in MC array"); | |
204 | return bGenValues; | |
205 | } | |
043062fe | 206 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); |
207 | if(pdgCode==211 || pdgCode==321 || pdgCode==2212){ | |
208 | Short_t signDau=part->Charge(); | |
209 | if(signDau==charge){ | |
210 | nDauLS++; | |
211 | daughter[index] = ind; | |
212 | index=2; | |
213 | }else{ | |
214 | daughter[1] = ind; | |
215 | nDauOS++; | |
216 | } | |
217 | }else{ | |
218 | Int_t nDauRes=part->GetNDaughters(); | |
219 | if(nDauRes!=2){ | |
220 | AliError("Wrong resonant decay"); | |
221 | return bGenValues; | |
222 | } | |
223 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
224 | for(Int_t iDauRes=0; iDauRes<2; iDauRes++){ | |
225 | Int_t indDR = labelFirstDauRes+iDauRes; | |
226 | AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR)); | |
968b84b9 | 227 | if(!partDR){ |
228 | AliError("Daughter particle not found in MC array"); | |
229 | return bGenValues; | |
230 | } | |
043062fe | 231 | Short_t signDau=partDR->Charge(); |
232 | if(signDau==charge){ | |
233 | nDauLS++; | |
234 | daughter[index] = ind; | |
235 | index=2; | |
236 | }else{ | |
237 | daughter[1] = ind; | |
238 | nDauOS++; | |
239 | } | |
240 | } | |
241 | } | |
242 | } | |
243 | }else{ | |
244 | AliError(Form("Wrong number of daughters %d",nDau)); | |
245 | return bGenValues; | |
246 | } | |
247 | ||
248 | if(nDauLS!=2 || nDauOS!=1){ | |
249 | AliError(Form("Wrong decay channel: LS and OS daughters not OK: %d %d",nDauLS,nDauOS)); | |
250 | return bGenValues; | |
251 | } | |
252 | if(daughter[0]>daughter[2]){ | |
253 | Int_t tmp=daughter[0]; | |
254 | daughter[0]=daughter[2]; | |
255 | daughter[2]=tmp; | |
256 | } | |
257 | ||
258 | // getting the momentum from the daughters and decay vertex | |
259 | Double_t px[3],py[3],pz[3],pt[3]; | |
260 | Double_t vertDec[3] = {0,0,0}; // decay vertex | |
261 | for(Int_t iDau=0; iDau<3; iDau++){ | |
262 | AliAODMCParticle* part=dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter[iDau])); | |
968b84b9 | 263 | if(!part){ |
264 | AliError("Daughter particle not found in MC array"); | |
265 | return bGenValues; | |
266 | } | |
043062fe | 267 | px[iDau]=part->Px(); |
268 | py[iDau]=part->Py(); | |
269 | pz[iDau]=part->Pz(); | |
270 | pt[iDau]=part->Pt(); | |
271 | if(iDau==0) part->XvYvZv(vertDec); | |
272 | } | |
273 | ||
274 | Double_t d0[3] = {0.,0.,0.}; // dummy values!!!! | |
275 | ||
276 | AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vertD,vertDec,nprongs,charge,px,py,pz,d0); | |
277 | Double_t cT = decay->Ct(pdgCand); | |
278 | ||
279 | vectorMC[0] = fmcPartCandidate->Pt(); | |
280 | vectorMC[1] = fmcPartCandidate->Y() ; | |
281 | vectorMC[2] = fmcPartCandidate->Phi(); | |
282 | vectorMC[3] = cT*1.E4 ; // in micron | |
283 | vectorMC[4] = 1.01; // cos pointing angle, dummy value, meaningless in MC | |
284 | vectorMC[5] = pt[0]; | |
285 | vectorMC[6] = pt[1]; | |
286 | vectorMC[7] = pt[2]; | |
287 | vectorMC[8] = 0.; // imppar0, dummy value, meaningless in MC | |
288 | vectorMC[9] = 0.; // imppar1, dummy value, meaningless in MC, in micron | |
289 | vectorMC[10] = 0.; // imppar2, dummy value, meaningless in MC, in micron | |
290 | vectorMC[11] = fzMCVertex; // z of reconstructed of primary vertex | |
b7af2639 | 291 | vectorMC[12] = fCentValue; // reconstructed centrality value |
292 | ||
043062fe | 293 | |
294 | bGenValues = kTRUE; | |
295 | return bGenValues; | |
296 | } | |
297 | ||
298 | ||
299 | //____________________________________________ | |
300 | Bool_t AliCFVertexingHF3Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const | |
301 | { | |
302 | // Fill vector (see above) with reconstructed quantities | |
303 | Bool_t bFillRecoValues=kFALSE; | |
304 | ||
305 | Int_t pdgCand = -1; | |
306 | if(fDecay==kDplustoKpipi){ | |
307 | pdgCand=411; | |
308 | }else if(fDecay==kDstoKKpi){ | |
309 | pdgCand=431; | |
310 | }else if(fDecay==kLctopKpi){ | |
311 | AliError("LambdaC not yet implemented"); | |
312 | return bFillRecoValues; | |
313 | }else{ | |
314 | AliError("WRONG DECAY SETTING"); | |
315 | return bFillRecoValues; | |
316 | } | |
317 | ||
318 | AliAODRecoDecayHF3Prong *decay3 = (AliAODRecoDecayHF3Prong*)fRecoCandidate; | |
319 | Short_t charge=decay3->Charge(); | |
320 | Double_t rapidity=decay3->Y(pdgCand); | |
321 | Double_t cT=decay3->Ct(pdgCand); | |
322 | Double_t pt = decay3->Pt(); | |
323 | Double_t cosPointingAngle = decay3->CosPointingAngle(); | |
324 | Double_t phi = decay3->Phi(); | |
325 | ||
326 | Int_t daughtSorted[3]; | |
327 | Int_t tmpIndex=0; | |
328 | Int_t nDauLS=0; | |
329 | Int_t nDauOS=0; | |
330 | for(Int_t iDau=0; iDau<3; iDau++){ | |
331 | AliAODTrack *trk = (AliAODTrack*)decay3->GetDaughter(iDau); | |
b7af2639 | 332 | Int_t label = TMath::Abs(trk->GetLabel()); |
043062fe | 333 | Short_t chargedau=trk->Charge(); |
334 | if(chargedau==charge){ | |
335 | daughtSorted[tmpIndex]=label; | |
336 | tmpIndex=2; | |
337 | nDauLS++; | |
338 | }else{ | |
339 | daughtSorted[1]=label; | |
340 | nDauOS++; | |
341 | } | |
342 | } | |
343 | ||
344 | if(nDauLS!=2 || nDauOS!=1){ | |
345 | AliError("Wrong decay channel: number of OS and LS tracks not OK"); | |
346 | return bFillRecoValues; | |
347 | } | |
348 | ||
349 | if(daughtSorted[0]>daughtSorted[2]){ | |
350 | Int_t tmp=daughtSorted[0]; | |
351 | daughtSorted[0]=daughtSorted[2]; | |
352 | daughtSorted[2]=tmp; | |
353 | } | |
354 | ||
355 | ||
356 | vectorReco[0] = pt; | |
357 | vectorReco[1] = rapidity; | |
358 | vectorReco[2] = phi; | |
359 | vectorReco[3] = cT*1.E4; // in micron | |
360 | vectorReco[4] = cosPointingAngle; // in micron | |
361 | vectorReco[5] = decay3->PtProng(daughtSorted[0]); | |
362 | vectorReco[6] = decay3->PtProng(daughtSorted[1]); | |
363 | vectorReco[7] = decay3->PtProng(daughtSorted[2]); | |
364 | vectorReco[8] = decay3->Getd0Prong(daughtSorted[0]); | |
365 | vectorReco[9] = decay3->Getd0Prong(daughtSorted[1]); | |
366 | vectorReco[10] = decay3->Getd0Prong(daughtSorted[2]); | |
367 | vectorReco[11] = fzPrimVertex; // z of reconstructed of primary vertex | |
b7af2639 | 368 | vectorReco[12] = fCentValue; //reconstructed centrality value |
369 | ||
370 | ||
043062fe | 371 | bFillRecoValues = kTRUE; |
372 | return bFillRecoValues; | |
373 | } | |
374 | ||
375 | ||
376 | //_____________________________________________________________ | |
377 | Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const | |
378 | { | |
379 | // Check the pdg codes of the daughters | |
380 | Bool_t checkCD = kFALSE; | |
381 | ||
382 | Int_t pdgCand = -1; | |
383 | Int_t pdgDaughter[3]={-1,-1,-1}; | |
384 | if(fDecay==kDplustoKpipi){ | |
385 | pdgCand=411; | |
386 | pdgDaughter[0]=321; | |
387 | pdgDaughter[1]=211; | |
388 | pdgDaughter[2]=211; | |
389 | }else if(fDecay==kDstoKKpi){ | |
390 | pdgCand=431; | |
391 | pdgDaughter[0]=321; | |
392 | pdgDaughter[1]=321; | |
393 | pdgDaughter[2]=211; | |
394 | }else if(fDecay==kLctopKpi){ | |
395 | AliError("LambdaC not yet implemented"); | |
396 | return checkCD; | |
397 | }else{ | |
398 | AliError("WRONG DECAY SETTING"); | |
399 | return checkCD; | |
400 | } | |
401 | ||
402 | ||
403 | Int_t daughter[3]; | |
404 | ||
405 | Int_t nDau=fmcPartCandidate->GetNDaughters(); | |
406 | Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0); | |
407 | if(nDau==3){ | |
408 | for(Int_t iDau=0; iDau<3; iDau++){ | |
409 | Int_t ind = labelFirstDau+iDau; | |
410 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 411 | if(!part){ |
412 | AliError("Daughter particle not found in MC array"); | |
413 | return checkCD; | |
414 | } | |
043062fe | 415 | daughter[iDau]=TMath::Abs(part->GetPdgCode()); |
416 | } | |
417 | }else if(nDau==2){ | |
418 | Int_t nDauFound=0; | |
419 | for(Int_t iDau=0; iDau<2; iDau++){ | |
420 | Int_t ind = labelFirstDau+iDau; | |
421 | AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind)); | |
968b84b9 | 422 | if(!part){ |
423 | AliError("Daughter particle not found in MC array"); | |
424 | return checkCD; | |
425 | } | |
043062fe | 426 | Int_t pdgCode=TMath::Abs(part->GetPdgCode()); |
427 | if(pdgCode==211 || pdgCode==321 || pdgCode==2212){ | |
428 | if(nDauFound>=3) return checkCD; | |
429 | daughter[nDauFound]=pdgCode; | |
430 | nDauFound++; | |
431 | }else{ | |
432 | Int_t nDauRes=part->GetNDaughters(); | |
433 | if(nDauRes!=2) return checkCD; | |
434 | Int_t labelFirstDauRes = part->GetDaughter(0); | |
435 | for(Int_t iDauRes=0; iDauRes<2; iDauRes++){ | |
436 | Int_t indDR = labelFirstDauRes+iDauRes; | |
437 | AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR)); | |
968b84b9 | 438 | if(!partDR){ |
439 | AliError("Daughter particle not found in MC array"); | |
440 | return checkCD; | |
441 | } | |
043062fe | 442 | Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode()); |
443 | if(nDauFound>=3) return checkCD; | |
444 | daughter[nDauFound]=pdgCodeDR; | |
445 | nDauFound++; | |
446 | } | |
447 | } | |
448 | } | |
449 | }else{ | |
450 | return checkCD; | |
451 | } | |
452 | for(Int_t iDau1=0; iDau1<3; iDau1++){ | |
453 | for(Int_t iDau2=iDau1; iDau2<3; iDau2++){ | |
454 | if(daughter[iDau1]<daughter[iDau2]){ | |
455 | Int_t tmp=daughter[iDau1]; | |
456 | daughter[iDau1]=daughter[iDau2]; | |
457 | daughter[iDau2]=tmp; | |
458 | } | |
459 | } | |
460 | } | |
461 | for(Int_t iDau=0; iDau<3; iDau++){ | |
462 | if(daughter[iDau]!=pdgDaughter[iDau]){ | |
463 | AliDebug(2, "Wrong decay channel from MC, skipping!!"); | |
464 | return checkCD; | |
465 | } | |
466 | } | |
467 | ||
468 | checkCD = kTRUE; | |
469 | return checkCD; | |
470 | ||
471 | } |