1 /**************************************************************************
2 * Copyright(c) 1998-2009, 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 **************************************************************************/
16 //-----------------------------------------------------------------------
17 // Class for HF corrections as a function of many variables and step
18 // Author : C. Zampolli, CERN
19 // D. Caffarri, Univ & INFN Padova caffarri@pd.infn.it
20 // Base class for HF Unfolding - agrelli@uu.nl
21 //-----------------------------------------------------------------------
23 #include "AliAODRecoDecayHF2Prong.h"
24 #include "AliAODMCParticle.h"
25 #include "AliAODEvent.h"
26 #include "TClonesArray.h"
27 #include "AliCFVertexingHF.h"
28 #include "AliESDtrack.h"
29 #include "TDatabasePDG.h"
31 #include "AliCFVertexingHF2Prong.h"
32 #include "AliCFContainer.h"
34 ClassImp(AliCFVertexingHF2Prong)
37 //_________________________________________
38 AliCFVertexingHF2Prong::AliCFVertexingHF2Prong(TClonesArray *mcArray, UShort_t originDselection):
39 AliCFVertexingHF(mcArray, originDselection)
46 fPtAccCut=new Float_t[fProngs];
47 fEtaAccCut=new Float_t[fProngs];
48 for(Int_t iP=0; iP<fProngs; iP++){
56 //_____________________________________
57 AliCFVertexingHF2Prong& AliCFVertexingHF2Prong::operator=(const AliCFVertexingHF2Prong& c)
64 AliCFVertexingHF::operator=(c);
69 //__________________________________________
70 Bool_t AliCFVertexingHF2Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand)
73 // setting the recontructed candidate
76 Bool_t bSignAssoc = kFALSE;
77 fRecoCandidate = recoCand;
78 if (!fRecoCandidate) {
79 AliError("fRecoCandidate not found, problem in assignement\n");
83 if (fRecoCandidate->GetPrimaryVtx()) AliDebug(3,"fReco Candidate has a pointer to PrimVtx\n");
84 if (recoCand->GetPrimaryVtx()) AliDebug(3,"Reco Cand has a pointer to PrimVtx\n");
87 Int_t pdgDgD0toKpi[2]={321,211};
88 Int_t nentries = fmcArray->GetEntriesFast();
90 AliDebug(3,Form("nentries = %d\n", nentries));
92 Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,2,pdgDgD0toKpi);
93 if (mcLabel == -1) return bSignAssoc;
95 if ((fRecoCandidate->NumberOfFakeDaughters()>0)&&(fFakeSelection==1)) return bSignAssoc;
96 if ((fRecoCandidate->NumberOfFakeDaughters()==0)&&(fFakeSelection==2)) return bSignAssoc;
99 fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel));
100 if (!fmcPartCandidate){
101 AliDebug(3,"No part candidate");
108 //______________________________________________
109 Bool_t AliCFVertexingHF2Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC)
112 // collecting all the necessary info (pt, y, cosThetaStar, ptPi, ptKa, cT) from MC particle
115 Bool_t bGenValues = kFALSE;
116 Double_t vtx1[3] = {0,0,0}; // primary vertex
117 Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0
118 Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1
119 fmcPartCandidate->XvYvZv(vtx1); // cm
121 Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
122 Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
123 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
124 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
125 if(!mcPartDaughter0 || !mcPartDaughter1) return bGenValues;
127 // getting vertex from daughters
128 mcPartDaughter0->XvYvZv(vtx2daughter0); // cm
129 mcPartDaughter1->XvYvZv(vtx2daughter1); //cm
130 if (TMath::Abs(vtx2daughter0[0] - vtx2daughter1[0]) > 1E-5 || TMath::Abs(vtx2daughter0[1] - vtx2daughter1[1]) > 1E-5 || TMath::Abs(vtx2daughter0[2] - vtx2daughter1[2])>1E-5) {
131 AliError("Daughters have different secondary vertex, skipping the track");
137 // always instantiate the AliAODRecoDecay with the positive daughter first, the negative second
138 AliAODMCParticle* positiveDaugh = mcPartDaughter0;
139 AliAODMCParticle* negativeDaugh = mcPartDaughter1;
140 if (mcPartDaughter0->GetPdgCode()<0 && mcPartDaughter1->GetPdgCode()>0){
141 // inverting in case the positive daughter is the second one
142 positiveDaugh = mcPartDaughter1;
143 negativeDaugh = mcPartDaughter0;
145 // getting the momentum from the daughters
146 Double_t px[2] = {positiveDaugh->Px(), negativeDaugh->Px()};
147 Double_t py[2] = {positiveDaugh->Py(), negativeDaugh->Py()};
148 Double_t pz[2] = {positiveDaugh->Pz(), negativeDaugh->Pz()};
150 Double_t d0[2] = {0.,0.};
152 AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0);
154 Double_t cosThetaStar = 0.;
155 Double_t cosThetaStarD0 = 0.;
156 Double_t cosThetaStarD0bar = 0.;
157 cosThetaStarD0 = decay->CosThetaStar(1,421,211,321);
158 cosThetaStarD0bar = decay->CosThetaStar(0,421,321,211);
159 if (fmcPartCandidate->GetPdgCode() == 421){ // D0
160 AliDebug(3, Form("D0, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode()));
161 cosThetaStar = cosThetaStarD0;
163 else if (fmcPartCandidate->GetPdgCode() == -421){ // D0bar{
164 AliDebug(3, Form("D0bar, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode()));
165 cosThetaStar = cosThetaStarD0bar;
168 AliWarning("There are problems!! particle was expected to be either a D0 or a D0bar, check...");
171 if (cosThetaStar < -1 || cosThetaStar > 1) {
172 AliWarning("Invalid value for cosine Theta star, returning");
177 Double_t cT = decay->Ct(421);
178 // get the pT of the daughters
182 if (TMath::Abs(mcPartDaughter0->GetPdgCode()) == 211) {
183 pTpi = mcPartDaughter0->Pt();
184 pTK = mcPartDaughter1->Pt();
187 pTpi = mcPartDaughter1->Pt();
188 pTK = mcPartDaughter0->Pt();
191 vectorMC[0] = fmcPartCandidate->Pt();
192 vectorMC[1] = fmcPartCandidate->Y() ;
193 vectorMC[2] = cosThetaStar ;
196 vectorMC[5] = cT*1.E4 ; // in micron
197 vectorMC[6] = 0.; // dummy value, meaningless in MC
198 vectorMC[7] = 0.; // dummy value, meaningless in MC, in micron
199 vectorMC[8] = 0.; // dummy value, meaningless in MC, in micron
200 vectorMC[9] = -100000.; // dummy value, meaningless in MC, in micron^2
201 vectorMC[10] = 1.01; // dummy value, meaningless in MC
202 vectorMC[11] = fmcPartCandidate->Phi();
203 vectorMC[12] = fzMCVertex; // z of reconstructed of primary vertex
204 vectorMC[13] = fCentValue; //reconstructed centrality
210 //____________________________________________
211 Bool_t AliCFVertexingHF2Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const
214 // Getting the reconstructed values from the candidate
217 Bool_t bFillRecoValues=kFALSE;
219 AliAODRecoDecayHF2Prong *d0toKpi = (AliAODRecoDecayHF2Prong*)fRecoCandidate;
221 if (d0toKpi->GetPrimaryVtx())AliDebug(3,"d0toKpi has primary vtx\n");
222 if (fRecoCandidate->GetPrimaryVtx())AliDebug(3,"fRecoCandidate has primary vtx\n");
224 Double_t pt = d0toKpi->Pt();
225 Double_t rapidity = d0toKpi->YD0();
227 Double_t cosThetaStar = 9999.;
230 Double_t dca = d0toKpi->GetDCA();
233 Double_t d0xd0 = d0toKpi->Prodd0d0();
234 Double_t cosPointingAngle = d0toKpi->CosPointingAngle();
235 Double_t phi = d0toKpi->Phi();
236 Int_t pdgCode = fmcPartCandidate->GetPdgCode();
239 cosThetaStar = d0toKpi->CosThetaStarD0();
240 pTpi = d0toKpi->PtProng(0);
241 pTK = d0toKpi->PtProng(1);
242 d0pi = d0toKpi->Getd0Prong(0);
243 d0K = d0toKpi->Getd0Prong(1);
244 invMass=d0toKpi->InvMassD0();
247 cosThetaStar = d0toKpi->CosThetaStarD0bar();
248 pTpi = d0toKpi->PtProng(1);
249 pTK = d0toKpi->PtProng(0);
250 d0pi = d0toKpi->Getd0Prong(1);
251 d0K = d0toKpi->Getd0Prong(0);
252 invMass= d0toKpi->InvMassD0bar();
255 Double_t cT = d0toKpi->CtD0();
258 vectorReco[1] = rapidity;
259 vectorReco[2] = cosThetaStar;
260 vectorReco[3] = pTpi;
262 vectorReco[5] = cT*1.E4; // in micron
263 vectorReco[6] = dca*1.E4; // in micron
264 vectorReco[7] = d0pi*1.E4; // in micron
265 vectorReco[8] = d0K*1.E4; // in micron
266 vectorReco[9] = d0xd0*1.E8; // in micron^2
267 vectorReco[10] = cosPointingAngle; // in micron
268 vectorReco[11] = phi;
269 vectorReco[12] = fzPrimVertex; // z of reconstructed of primary vertex
270 vectorReco[13] = fCentValue; //reconstructed centrality
272 bFillRecoValues = kTRUE;
274 return bFillRecoValues;
277 //_____________________________________________________________
278 Bool_t AliCFVertexingHF2Prong::CheckMCChannelDecay() const
281 // checking the MC decay channel
283 Bool_t checkCD = kFALSE;
284 Int_t daughter0 = fmcPartCandidate->GetDaughter(0);
285 Int_t daughter1 = fmcPartCandidate->GetDaughter(1);
286 AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0));
287 AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1));
289 if (!mcPartDaughter0 || !mcPartDaughter1) {
290 AliDebug (2,"Problems in the MC Daughters\n");
294 if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==321 &&
295 TMath::Abs(mcPartDaughter1->GetPdgCode())==211) &&
296 !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 &&
297 TMath::Abs(mcPartDaughter1->GetPdgCode())==321)) {
298 AliDebug(2, "The D0 MC doesn't come from a Kpi decay, skipping!!");