1 /**************************************************************************
2 * Copyright(c) 2007-2011, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////
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) //
26 ///////////////////////////////////////////////////////////////////
28 #include "AliAODMCParticle.h"
29 #include "AliAODEvent.h"
30 #include "TClonesArray.h"
31 #include "AliCFVertexingHF.h"
32 #include "AliESDtrack.h"
33 #include "TDatabasePDG.h"
35 #include "AliCFVertexingHF3Prong.h"
36 #include "AliCFContainer.h"
38 ClassImp(AliCFVertexingHF3Prong)
41 //_________________________________________
42 AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(Int_t decay):
49 //_________________________________________
50 AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(TClonesArray *mcArray, UShort_t originDselection, Int_t decay):
51 AliCFVertexingHF(mcArray, originDselection),
60 //_____________________________________
61 AliCFVertexingHF3Prong& AliCFVertexingHF3Prong::operator=(const AliCFVertexingHF3Prong& c){
65 AliCFVertexingHF::operator=(c);
71 //__________________________________________
72 Bool_t AliCFVertexingHF3Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand){
73 // Checks if candidate is signal and D meson is present in MC array
75 Bool_t bSignAssoc = kFALSE;
76 fRecoCandidate = recoCand;
78 if (!fRecoCandidate) {
79 AliError("fRecoCandidate not found, problem in assignement\n");
84 Int_t pdgDaughter[3]={-1,-1,-1};
85 if(fDecay==kDplustoKpipi){
90 }else if(fDecay==kDstoKKpi){
95 }else if(fDecay==kLctopKpi){
96 AliError("LambdaC not yet implemented");
99 AliError("WRONG DECAY SETTING");
103 Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,3,pdgDaughter);
104 if (mcLabel == -1) return bSignAssoc;
106 fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel));
108 if (!fmcPartCandidate){
109 AliDebug(3,"No part candidate");
117 //______________________________________________
118 Bool_t AliCFVertexingHF3Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC) {
120 // collecting all the necessary info from MC particle and fill vectorMC: 12 variables
134 Bool_t bGenValues = kFALSE;
137 if(fDecay==kDplustoKpipi){
139 }else if(fDecay==kDstoKKpi){
141 }else if(fDecay==kLctopKpi){
142 AliError("LambdaC not yet implemented");
145 AliError("WRONG DECAY SETTING");
149 Double_t vertD[3] = {0,0,0}; // D origin
150 fmcPartCandidate->XvYvZv(vertD); // cm
154 Short_t charge = fmcPartCandidate->Charge();
156 // order the daughters as LS,OS,LS, e.g. D+ -> pi+ K- pi+
157 // the 2 LS are ordered so that in pos. 0 there is the one with lower label value
163 Int_t nDau=fmcPartCandidate->GetNDaughters();
164 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
166 for(Int_t iDau=0; iDau<3; iDau++){
167 Int_t ind = labelFirstDau+iDau;
168 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
169 Short_t signDau=part->Charge();
172 daughter[index] = ind;
180 for(Int_t iDau=0; iDau<2; iDau++){
181 Int_t ind = labelFirstDau+iDau;
182 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
183 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
184 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
185 Short_t signDau=part->Charge();
188 daughter[index] = ind;
195 Int_t nDauRes=part->GetNDaughters();
197 AliError("Wrong resonant decay");
200 Int_t labelFirstDauRes = part->GetDaughter(0);
201 for(Int_t iDauRes=0; iDauRes<2; iDauRes++){
202 Int_t indDR = labelFirstDauRes+iDauRes;
203 AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR));
204 Short_t signDau=partDR->Charge();
207 daughter[index] = ind;
217 AliError(Form("Wrong number of daughters %d",nDau));
221 if(nDauLS!=2 || nDauOS!=1){
222 AliError(Form("Wrong decay channel: LS and OS daughters not OK: %d %d",nDauLS,nDauOS));
225 if(daughter[0]>daughter[2]){
226 Int_t tmp=daughter[0];
227 daughter[0]=daughter[2];
231 // getting the momentum from the daughters and decay vertex
232 Double_t px[3],py[3],pz[3],pt[3];
233 Double_t vertDec[3] = {0,0,0}; // decay vertex
234 for(Int_t iDau=0; iDau<3; iDau++){
235 AliAODMCParticle* part=dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter[iDau]));
240 if(iDau==0) part->XvYvZv(vertDec);
243 Double_t d0[3] = {0.,0.,0.}; // dummy values!!!!
245 AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vertD,vertDec,nprongs,charge,px,py,pz,d0);
246 Double_t cT = decay->Ct(pdgCand);
248 vectorMC[0] = fmcPartCandidate->Pt();
249 vectorMC[1] = fmcPartCandidate->Y() ;
250 vectorMC[2] = fmcPartCandidate->Phi();
251 vectorMC[3] = cT*1.E4 ; // in micron
252 vectorMC[4] = 1.01; // cos pointing angle, dummy value, meaningless in MC
256 vectorMC[8] = 0.; // imppar0, dummy value, meaningless in MC
257 vectorMC[9] = 0.; // imppar1, dummy value, meaningless in MC, in micron
258 vectorMC[10] = 0.; // imppar2, dummy value, meaningless in MC, in micron
259 vectorMC[11] = fzMCVertex; // z of reconstructed of primary vertex
266 //____________________________________________
267 Bool_t AliCFVertexingHF3Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const
269 // Fill vector (see above) with reconstructed quantities
270 Bool_t bFillRecoValues=kFALSE;
273 if(fDecay==kDplustoKpipi){
275 }else if(fDecay==kDstoKKpi){
277 }else if(fDecay==kLctopKpi){
278 AliError("LambdaC not yet implemented");
279 return bFillRecoValues;
281 AliError("WRONG DECAY SETTING");
282 return bFillRecoValues;
285 AliAODRecoDecayHF3Prong *decay3 = (AliAODRecoDecayHF3Prong*)fRecoCandidate;
286 Short_t charge=decay3->Charge();
287 Double_t rapidity=decay3->Y(pdgCand);
288 Double_t cT=decay3->Ct(pdgCand);
289 Double_t pt = decay3->Pt();
290 Double_t cosPointingAngle = decay3->CosPointingAngle();
291 Double_t phi = decay3->Phi();
293 Int_t daughtSorted[3];
297 for(Int_t iDau=0; iDau<3; iDau++){
298 AliAODTrack *trk = (AliAODTrack*)decay3->GetDaughter(iDau);
299 Int_t label = trk->GetLabel();
300 Short_t chargedau=trk->Charge();
301 if(chargedau==charge){
302 daughtSorted[tmpIndex]=label;
306 daughtSorted[1]=label;
311 if(nDauLS!=2 || nDauOS!=1){
312 AliError("Wrong decay channel: number of OS and LS tracks not OK");
313 return bFillRecoValues;
316 if(daughtSorted[0]>daughtSorted[2]){
317 Int_t tmp=daughtSorted[0];
318 daughtSorted[0]=daughtSorted[2];
324 vectorReco[1] = rapidity;
326 vectorReco[3] = cT*1.E4; // in micron
327 vectorReco[4] = cosPointingAngle; // in micron
328 vectorReco[5] = decay3->PtProng(daughtSorted[0]);
329 vectorReco[6] = decay3->PtProng(daughtSorted[1]);
330 vectorReco[7] = decay3->PtProng(daughtSorted[2]);
331 vectorReco[8] = decay3->Getd0Prong(daughtSorted[0]);
332 vectorReco[9] = decay3->Getd0Prong(daughtSorted[1]);
333 vectorReco[10] = decay3->Getd0Prong(daughtSorted[2]);
334 vectorReco[11] = fzPrimVertex; // z of reconstructed of primary vertex
336 bFillRecoValues = kTRUE;
337 return bFillRecoValues;
341 //_____________________________________________________________
342 Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
344 // Check the pdg codes of the daughters
345 Bool_t checkCD = kFALSE;
348 Int_t pdgDaughter[3]={-1,-1,-1};
349 if(fDecay==kDplustoKpipi){
354 }else if(fDecay==kDstoKKpi){
359 }else if(fDecay==kLctopKpi){
360 AliError("LambdaC not yet implemented");
363 AliError("WRONG DECAY SETTING");
370 Int_t nDau=fmcPartCandidate->GetNDaughters();
371 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
373 for(Int_t iDau=0; iDau<3; iDau++){
374 Int_t ind = labelFirstDau+iDau;
375 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
376 daughter[iDau]=TMath::Abs(part->GetPdgCode());
380 for(Int_t iDau=0; iDau<2; iDau++){
381 Int_t ind = labelFirstDau+iDau;
382 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
383 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
384 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
385 if(nDauFound>=3) return checkCD;
386 daughter[nDauFound]=pdgCode;
389 Int_t nDauRes=part->GetNDaughters();
390 if(nDauRes!=2) return checkCD;
391 Int_t labelFirstDauRes = part->GetDaughter(0);
392 for(Int_t iDauRes=0; iDauRes<2; iDauRes++){
393 Int_t indDR = labelFirstDauRes+iDauRes;
394 AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR));
395 Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode());
396 if(nDauFound>=3) return checkCD;
397 daughter[nDauFound]=pdgCodeDR;
405 for(Int_t iDau1=0; iDau1<3; iDau1++){
406 for(Int_t iDau2=iDau1; iDau2<3; iDau2++){
407 if(daughter[iDau1]<daughter[iDau2]){
408 Int_t tmp=daughter[iDau1];
409 daughter[iDau1]=daughter[iDau2];
414 for(Int_t iDau=0; iDau<3; iDau++){
415 if(daughter[iDau]!=pdgDaughter[iDau]){
416 AliDebug(2, "Wrong decay channel from MC, skipping!!");