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 fPtAccCut=new Float_t[fProngs];
50 fEtaAccCut=new Float_t[fProngs];
51 for(Int_t iP=0; iP<fProngs; iP++){
57 //_________________________________________
58 AliCFVertexingHF3Prong::AliCFVertexingHF3Prong(TClonesArray *mcArray, UShort_t originDselection, Int_t decay):
59 AliCFVertexingHF(mcArray, originDselection),
65 fPtAccCut=new Float_t[fProngs];
66 fEtaAccCut=new Float_t[fProngs];
67 for(Int_t iP=0; iP<fProngs; iP++){
74 //_____________________________________
75 AliCFVertexingHF3Prong& AliCFVertexingHF3Prong::operator=(const AliCFVertexingHF3Prong& c){
79 AliCFVertexingHF::operator=(c);
85 //__________________________________________
86 Bool_t AliCFVertexingHF3Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand){
87 // Checks if candidate is signal and D meson is present in MC array
89 Bool_t bSignAssoc = kFALSE;
90 fRecoCandidate = recoCand;
92 if (!fRecoCandidate) {
93 AliError("fRecoCandidate not found, problem in assignement\n");
98 Int_t pdgDaughter[3]={-1,-1,-1};
99 if(fDecay==kDplustoKpipi){
104 }else if(fDecay==kDstoKKpi){
109 }else if(fDecay==kLctopKpi){
110 AliError("LambdaC not yet implemented");
113 AliError("WRONG DECAY SETTING");
117 Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,3,pdgDaughter);
118 if (mcLabel == -1) return bSignAssoc;
120 if (fRecoCandidate->NumberOfFakeDaughters()>0){
121 fFake = 0; // fake candidate
122 if (fFakeSelection==1) return bSignAssoc;
124 if (fRecoCandidate->NumberOfFakeDaughters()==0){
125 fFake = 2; // non-fake candidate
126 if (fFakeSelection==2) return bSignAssoc;
130 fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel));
132 if (!fmcPartCandidate){
133 AliDebug(3,"No part candidate");
141 //______________________________________________
142 Bool_t AliCFVertexingHF3Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC) {
144 // collecting all the necessary info from MC particle and fill vectorMC: 12 variables
159 Bool_t bGenValues = kFALSE;
162 if(fDecay==kDplustoKpipi){
164 }else if(fDecay==kDstoKKpi){
166 }else if(fDecay==kLctopKpi){
167 AliError("LambdaC not yet implemented");
170 AliError("WRONG DECAY SETTING");
174 Double_t vertD[3] = {0,0,0}; // D origin
175 fmcPartCandidate->XvYvZv(vertD); // cm
179 Short_t charge = fmcPartCandidate->Charge();
181 // order the daughters as LS,OS,LS, e.g. D+ -> pi+ K- pi+
182 // the 2 LS are ordered so that in pos. 0 there is the one with lower label value
188 Int_t nDau=fmcPartCandidate->GetNDaughters();
189 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
191 for(Int_t iDau=0; iDau<3; iDau++){
192 Int_t ind = labelFirstDau+iDau;
193 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
195 AliError("Daughter particle not found in MC array");
198 Short_t signDau=part->Charge();
201 daughter[index] = ind;
209 for(Int_t iDau=0; iDau<2; iDau++){
210 Int_t ind = labelFirstDau+iDau;
211 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
213 AliError("Daughter particle not found in MC array");
216 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
217 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
218 Short_t signDau=part->Charge();
221 daughter[index] = ind;
228 Int_t nDauRes=part->GetNDaughters();
230 AliError("Wrong resonant decay");
233 Int_t labelFirstDauRes = part->GetDaughter(0);
234 for(Int_t iDauRes=0; iDauRes<2; iDauRes++){
235 Int_t indDR = labelFirstDauRes+iDauRes;
236 AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR));
238 AliError("Daughter particle not found in MC array");
241 Short_t signDau=partDR->Charge();
244 daughter[index] = ind;
254 AliError(Form("Wrong number of daughters %d",nDau));
258 if(nDauLS!=2 || nDauOS!=1){
259 AliError(Form("Wrong decay channel: LS and OS daughters not OK: %d %d",nDauLS,nDauOS));
262 if(daughter[0]>daughter[2]){
263 Int_t tmp=daughter[0];
264 daughter[0]=daughter[2];
268 // getting the momentum from the daughters and decay vertex
269 Double_t px[3],py[3],pz[3],pt[3];
270 Double_t vertDec[3] = {0,0,0}; // decay vertex
271 for(Int_t iDau=0; iDau<3; iDau++){
272 AliAODMCParticle* part=dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter[iDau]));
274 AliError("Daughter particle not found in MC array");
281 if(iDau==0) part->XvYvZv(vertDec);
284 Double_t d0[3] = {0.,0.,0.}; // dummy values!!!!
286 AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vertD,vertDec,nprongs,charge,px,py,pz,d0);
287 Double_t cT = decay->Ct(pdgCand);
289 vectorMC[0] = fmcPartCandidate->Pt();
290 vectorMC[1] = fmcPartCandidate->Y() ;
291 vectorMC[2] = fmcPartCandidate->Phi();
292 vectorMC[3] = cT*1.E4 ; // in micron
293 vectorMC[4] = 1.01; // cos pointing angle, dummy value, meaningless in MC
297 vectorMC[8] = 0.; // imppar0, dummy value, meaningless in MC
298 vectorMC[9] = 0.; // imppar1, dummy value, meaningless in MC, in micron
299 vectorMC[10] = 0.; // imppar2, dummy value, meaningless in MC, in micron
300 vectorMC[11] = fzMCVertex; // z of reconstructed of primary vertex
301 vectorMC[12] = fCentValue; // reconstructed centrality value
302 vectorMC[13] = 1.; // always filling with 1 at MC level
310 //____________________________________________
311 Bool_t AliCFVertexingHF3Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const
313 // Fill vector (see above) with reconstructed quantities
314 Bool_t bFillRecoValues=kFALSE;
317 if(fDecay==kDplustoKpipi){
319 }else if(fDecay==kDstoKKpi){
321 }else if(fDecay==kLctopKpi){
322 AliError("LambdaC not yet implemented");
323 return bFillRecoValues;
325 AliError("WRONG DECAY SETTING");
326 return bFillRecoValues;
329 AliAODRecoDecayHF3Prong *decay3 = (AliAODRecoDecayHF3Prong*)fRecoCandidate;
330 Short_t charge=decay3->Charge();
331 Double_t rapidity=decay3->Y(pdgCand);
332 Double_t cT=decay3->Ct(pdgCand);
333 Double_t pt = decay3->Pt();
334 Double_t cosPointingAngle = decay3->CosPointingAngle();
335 Double_t phi = decay3->Phi();
337 Int_t daughtSorted[3];
341 for(Int_t iDau=0; iDau<3; iDau++){
342 AliAODTrack *trk = (AliAODTrack*)decay3->GetDaughter(iDau);
343 Int_t label = TMath::Abs(trk->GetLabel());
344 Short_t chargedau=trk->Charge();
345 if(chargedau==charge){
346 daughtSorted[tmpIndex]=label;
350 daughtSorted[1]=label;
355 if(nDauLS!=2 || nDauOS!=1){
356 AliError("Wrong decay channel: number of OS and LS tracks not OK");
357 return bFillRecoValues;
360 if(daughtSorted[0]>daughtSorted[2]){
361 Int_t tmp=daughtSorted[0];
362 daughtSorted[0]=daughtSorted[2];
368 vectorReco[1] = rapidity;
370 vectorReco[3] = cT*1.E4; // in micron
371 vectorReco[4] = cosPointingAngle; // in micron
372 vectorReco[5] = decay3->PtProng(daughtSorted[0]);
373 vectorReco[6] = decay3->PtProng(daughtSorted[1]);
374 vectorReco[7] = decay3->PtProng(daughtSorted[2]);
375 vectorReco[8] = decay3->Getd0Prong(daughtSorted[0]);
376 vectorReco[9] = decay3->Getd0Prong(daughtSorted[1]);
377 vectorReco[10] = decay3->Getd0Prong(daughtSorted[2]);
378 vectorReco[11] = fzPrimVertex; // z of reconstructed of primary vertex
379 vectorReco[12] = fCentValue; //reconstructed centrality value
380 vectorReco[13] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2)
383 bFillRecoValues = kTRUE;
384 return bFillRecoValues;
388 //_____________________________________________________________
389 Bool_t AliCFVertexingHF3Prong::CheckMCChannelDecay() const
391 // Check the pdg codes of the daughters
392 Bool_t checkCD = kFALSE;
395 Int_t pdgDaughter[3]={-1,-1,-1};
396 if(fDecay==kDplustoKpipi){
401 }else if(fDecay==kDstoKKpi){
406 }else if(fDecay==kLctopKpi){
407 AliError("LambdaC not yet implemented");
410 AliError("WRONG DECAY SETTING");
417 Int_t nDau=fmcPartCandidate->GetNDaughters();
418 Int_t labelFirstDau = fmcPartCandidate->GetDaughter(0);
420 for(Int_t iDau=0; iDau<3; iDau++){
421 Int_t ind = labelFirstDau+iDau;
422 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
424 AliError("Daughter particle not found in MC array");
427 daughter[iDau]=TMath::Abs(part->GetPdgCode());
431 for(Int_t iDau=0; iDau<2; iDau++){
432 Int_t ind = labelFirstDau+iDau;
433 AliAODMCParticle* part = dynamic_cast<AliAODMCParticle*>(fmcArray->At(ind));
435 AliError("Daughter particle not found in MC array");
438 Int_t pdgCode=TMath::Abs(part->GetPdgCode());
439 if(pdgCode==211 || pdgCode==321 || pdgCode==2212){
440 if(nDauFound>=3) return checkCD;
441 daughter[nDauFound]=pdgCode;
444 Int_t nDauRes=part->GetNDaughters();
445 if(nDauRes!=2) return checkCD;
446 Int_t labelFirstDauRes = part->GetDaughter(0);
447 for(Int_t iDauRes=0; iDauRes<2; iDauRes++){
448 Int_t indDR = labelFirstDauRes+iDauRes;
449 AliAODMCParticle* partDR = dynamic_cast<AliAODMCParticle*>(fmcArray->At(indDR));
451 AliError("Daughter particle not found in MC array");
454 Int_t pdgCodeDR=TMath::Abs(partDR->GetPdgCode());
455 if(nDauFound>=3) return checkCD;
456 daughter[nDauFound]=pdgCodeDR;
464 for(Int_t iDau1=0; iDau1<3; iDau1++){
465 for(Int_t iDau2=iDau1; iDau2<3; iDau2++){
466 if(daughter[iDau1]<daughter[iDau2]){
467 Int_t tmp=daughter[iDau1];
468 daughter[iDau1]=daughter[iDau2];
473 for(Int_t iDau=0; iDau<3; iDau++){
474 if(daughter[iDau]!=pdgDaughter[iDau]){
475 AliDebug(2, "Wrong decay channel from MC, skipping!!");