]>
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 | ||
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 | //----------------------------------------------------------------------- | |
22 | ||
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" | |
30 | ||
31 | #include "AliCFVertexingHF2Prong.h" | |
32 | #include "AliCFContainer.h" | |
ec5288c3 | 33 | #include "AliCFTaskVertexingHF.h" |
379592af | 34 | |
35 | ClassImp(AliCFVertexingHF2Prong) | |
36 | ||
37 | ||
38 | //_________________________________________ | |
39 | AliCFVertexingHF2Prong::AliCFVertexingHF2Prong(TClonesArray *mcArray, UShort_t originDselection): | |
f2703bd2 | 40 | AliCFVertexingHF(mcArray, originDselection) |
379592af | 41 | { |
f2703bd2 | 42 | // |
43 | // constructor | |
44 | // | |
45 | ||
46 | SetNProngs(2); | |
2bf2e62b | 47 | fPtAccCut=new Float_t[fProngs]; |
48 | fEtaAccCut=new Float_t[fProngs]; | |
49 | for(Int_t iP=0; iP<fProngs; iP++){ | |
50 | fPtAccCut[iP]=0.1; | |
51 | fEtaAccCut[iP]=0.9; | |
52 | } | |
53 | ||
379592af | 54 | } |
55 | ||
56 | ||
57 | //_____________________________________ | |
f2703bd2 | 58 | AliCFVertexingHF2Prong& AliCFVertexingHF2Prong::operator=(const AliCFVertexingHF2Prong& c) |
59 | { | |
60 | // | |
61 | // copy constructor | |
62 | // | |
379592af | 63 | |
f2703bd2 | 64 | if (this != &c) { |
65 | AliCFVertexingHF::operator=(c); | |
66 | } | |
67 | return *this; | |
379592af | 68 | } |
69 | ||
70 | //__________________________________________ | |
f2703bd2 | 71 | Bool_t AliCFVertexingHF2Prong::SetRecoCandidateParam(AliAODRecoDecayHF *recoCand) |
72 | { | |
73 | // | |
74 | // setting the recontructed candidate | |
75 | // | |
76 | ||
77 | Bool_t bSignAssoc = kFALSE; | |
78 | fRecoCandidate = recoCand; | |
79 | if (!fRecoCandidate) { | |
80 | AliError("fRecoCandidate not found, problem in assignement\n"); | |
81 | return bSignAssoc; | |
82 | } | |
83 | ||
84 | if (fRecoCandidate->GetPrimaryVtx()) AliDebug(3,"fReco Candidate has a pointer to PrimVtx\n"); | |
85 | if (recoCand->GetPrimaryVtx()) AliDebug(3,"Reco Cand has a pointer to PrimVtx\n"); | |
86 | ||
87 | Int_t pdgCand = 421; | |
88 | Int_t pdgDgD0toKpi[2]={321,211}; | |
89 | Int_t nentries = fmcArray->GetEntriesFast(); | |
379592af | 90 | |
f2703bd2 | 91 | AliDebug(3,Form("nentries = %d\n", nentries)); |
379592af | 92 | |
f2703bd2 | 93 | Int_t mcLabel = fRecoCandidate->MatchToMC(pdgCand,fmcArray,2,pdgDgD0toKpi); |
94 | if (mcLabel == -1) return bSignAssoc; | |
fbec9fa9 | 95 | |
1f780958 | 96 | if (fRecoCandidate->NumberOfFakeDaughters()>0){ |
97 | fFake = 0; // fake candidate | |
98 | if (fFakeSelection==1) return bSignAssoc; | |
99 | } | |
100 | if (fRecoCandidate->NumberOfFakeDaughters()==0){ | |
101 | fFake = 2; // non-fake candidate | |
102 | if (fFakeSelection==2) return bSignAssoc; | |
103 | } | |
fbec9fa9 | 104 | |
f2703bd2 | 105 | SetMCLabel(mcLabel); |
106 | fmcPartCandidate = dynamic_cast<AliAODMCParticle*>(fmcArray->At(fmcLabel)); | |
107 | if (!fmcPartCandidate){ | |
108 | AliDebug(3,"No part candidate"); | |
109 | return bSignAssoc; | |
110 | } | |
111 | bSignAssoc = kTRUE; | |
112 | return bSignAssoc; | |
379592af | 113 | } |
114 | ||
115 | //______________________________________________ | |
f2703bd2 | 116 | Bool_t AliCFVertexingHF2Prong::GetGeneratedValuesFromMCParticle(Double_t* vectorMC) |
117 | { | |
379592af | 118 | // |
119 | // collecting all the necessary info (pt, y, cosThetaStar, ptPi, ptKa, cT) from MC particle | |
120 | // | |
121 | ||
122 | Bool_t bGenValues = kFALSE; | |
379592af | 123 | Double_t vtx1[3] = {0,0,0}; // primary vertex |
124 | Double_t vtx2daughter0[3] = {0,0,0}; // secondary vertex from daughter 0 | |
125 | Double_t vtx2daughter1[3] = {0,0,0}; // secondary vertex from daughter 1 | |
126 | fmcPartCandidate->XvYvZv(vtx1); // cm | |
127 | ||
379592af | 128 | Int_t daughter0 = fmcPartCandidate->GetDaughter(0); |
129 | Int_t daughter1 = fmcPartCandidate->GetDaughter(1); | |
130 | AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); | |
131 | AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); | |
86df816f | 132 | if(!mcPartDaughter0 || !mcPartDaughter1) return bGenValues; |
379592af | 133 | |
134 | // getting vertex from daughters | |
135 | mcPartDaughter0->XvYvZv(vtx2daughter0); // cm | |
136 | mcPartDaughter1->XvYvZv(vtx2daughter1); //cm | |
5afa2cf0 | 137 | 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) { |
f2703bd2 | 138 | AliError("Daughters have different secondary vertex, skipping the track"); |
139 | return bGenValues; | |
379592af | 140 | } |
141 | ||
142 | Int_t nprongs = 2; | |
143 | Short_t charge = 0; | |
144 | // always instantiate the AliAODRecoDecay with the positive daughter first, the negative second | |
145 | AliAODMCParticle* positiveDaugh = mcPartDaughter0; | |
146 | AliAODMCParticle* negativeDaugh = mcPartDaughter1; | |
147 | if (mcPartDaughter0->GetPdgCode()<0 && mcPartDaughter1->GetPdgCode()>0){ | |
148 | // inverting in case the positive daughter is the second one | |
149 | positiveDaugh = mcPartDaughter1; | |
150 | negativeDaugh = mcPartDaughter0; | |
151 | } | |
152 | // getting the momentum from the daughters | |
153 | Double_t px[2] = {positiveDaugh->Px(), negativeDaugh->Px()}; | |
154 | Double_t py[2] = {positiveDaugh->Py(), negativeDaugh->Py()}; | |
155 | Double_t pz[2] = {positiveDaugh->Pz(), negativeDaugh->Pz()}; | |
156 | ||
157 | Double_t d0[2] = {0.,0.}; | |
158 | ||
159 | AliAODRecoDecayHF* decay = new AliAODRecoDecayHF(vtx1,vtx2daughter0,nprongs,charge,px,py,pz,d0); | |
160 | ||
161 | Double_t cosThetaStar = 0.; | |
162 | Double_t cosThetaStarD0 = 0.; | |
163 | Double_t cosThetaStarD0bar = 0.; | |
164 | cosThetaStarD0 = decay->CosThetaStar(1,421,211,321); | |
165 | cosThetaStarD0bar = decay->CosThetaStar(0,421,321,211); | |
166 | if (fmcPartCandidate->GetPdgCode() == 421){ // D0 | |
f2703bd2 | 167 | AliDebug(3, Form("D0, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode())); |
168 | cosThetaStar = cosThetaStarD0; | |
379592af | 169 | } |
170 | else if (fmcPartCandidate->GetPdgCode() == -421){ // D0bar{ | |
f2703bd2 | 171 | AliDebug(3, Form("D0bar, with pdgprong0 = %d, pdgprong1 = %d",mcPartDaughter0->GetPdgCode(),mcPartDaughter1->GetPdgCode())); |
172 | cosThetaStar = cosThetaStarD0bar; | |
379592af | 173 | } |
174 | else{ | |
f2703bd2 | 175 | AliWarning("There are problems!! particle was expected to be either a D0 or a D0bar, check..."); |
176 | return vectorMC; | |
379592af | 177 | } |
178 | if (cosThetaStar < -1 || cosThetaStar > 1) { | |
f2703bd2 | 179 | AliWarning("Invalid value for cosine Theta star, returning"); |
180 | return bGenValues; | |
379592af | 181 | } |
182 | ||
183 | //ct | |
184 | Double_t cT = decay->Ct(421); | |
185 | // get the pT of the daughters | |
186 | Double_t pTpi = 0.; | |
187 | Double_t pTK = 0.; | |
188 | ||
189 | if (TMath::Abs(mcPartDaughter0->GetPdgCode()) == 211) { | |
190 | pTpi = mcPartDaughter0->Pt(); | |
191 | pTK = mcPartDaughter1->Pt(); | |
192 | } | |
193 | else { | |
194 | pTpi = mcPartDaughter1->Pt(); | |
195 | pTK = mcPartDaughter0->Pt(); | |
196 | } | |
197 | ||
ec5288c3 | 198 | switch (fConfiguration){ |
199 | case AliCFTaskVertexingHF::kSnail: | |
200 | vectorMC[0] = fmcPartCandidate->Pt(); | |
201 | vectorMC[1] = fmcPartCandidate->Y() ; | |
202 | vectorMC[2] = cosThetaStar ; | |
203 | vectorMC[3] = pTpi ; | |
204 | vectorMC[4] = pTK ; | |
205 | vectorMC[5] = cT*1.E4 ; // in micron | |
206 | vectorMC[6] = 0.; // dummy value for dca, meaningless in MC | |
207 | vectorMC[7] = -80000.; // dummy value for d0pixd0K, meaningless in MC, in micron^2 | |
208 | vectorMC[8] = 1.01; // dummy value for cosPointing, meaningless in MC | |
209 | vectorMC[9] = fmcPartCandidate->Phi(); | |
210 | vectorMC[10] = fzMCVertex; // z of reconstructed of primary vertex | |
211 | vectorMC[11] = fCentValue; //reconstructed centrality | |
212 | vectorMC[12] = 1.; // fake: always filling with 1 at MC level | |
213 | vectorMC[13] = 1.01; // dummy value for cosPointingXY multiplicity | |
214 | vectorMC[14] = 0.; // dummy value for NormalizedDecayLengthXY multiplicity | |
215 | vectorMC[15] = fMultiplicity; // reconstructed multiplicity | |
216 | break; | |
217 | case AliCFTaskVertexingHF::kCheetah: | |
218 | vectorMC[0] = fmcPartCandidate->Pt(); | |
219 | vectorMC[1] = fmcPartCandidate->Y() ; | |
220 | vectorMC[2] = cT*1.E4; // in micron | |
221 | vectorMC[3] = fmcPartCandidate->Phi(); | |
222 | vectorMC[4] = fzMCVertex; | |
223 | vectorMC[5] = fCentValue; // dummy value for dca, meaningless in MC | |
224 | vectorMC[6] = 1. ; // fake: always filling with 1 at MC level | |
225 | vectorMC[7] = fMultiplicity; // dummy value for d0pi, meaningless in MC, in micron | |
226 | break; | |
227 | } | |
f2703bd2 | 228 | delete decay; |
379592af | 229 | bGenValues = kTRUE; |
230 | return bGenValues; | |
231 | } | |
379592af | 232 | //____________________________________________ |
233 | Bool_t AliCFVertexingHF2Prong::GetRecoValuesFromCandidate(Double_t *vectorReco) const | |
f2703bd2 | 234 | { |
235 | // | |
236 | // Getting the reconstructed values from the candidate | |
237 | // | |
238 | ||
239 | Bool_t bFillRecoValues=kFALSE; | |
240 | ||
241 | AliAODRecoDecayHF2Prong *d0toKpi = (AliAODRecoDecayHF2Prong*)fRecoCandidate; | |
242 | ||
243 | if (d0toKpi->GetPrimaryVtx())AliDebug(3,"d0toKpi has primary vtx\n"); | |
244 | if (fRecoCandidate->GetPrimaryVtx())AliDebug(3,"fRecoCandidate has primary vtx\n"); | |
245 | ||
246 | Double_t pt = d0toKpi->Pt(); | |
247 | Double_t rapidity = d0toKpi->YD0(); | |
248 | Double_t invMass=0.; | |
249 | Double_t cosThetaStar = 9999.; | |
250 | Double_t pTpi = 0.; | |
251 | Double_t pTK = 0.; | |
252 | Double_t dca = d0toKpi->GetDCA(); | |
253 | Double_t d0pi = 0.; | |
254 | Double_t d0K = 0.; | |
255 | Double_t d0xd0 = d0toKpi->Prodd0d0(); | |
256 | Double_t cosPointingAngle = d0toKpi->CosPointingAngle(); | |
257 | Double_t phi = d0toKpi->Phi(); | |
258 | Int_t pdgCode = fmcPartCandidate->GetPdgCode(); | |
ec5288c3 | 259 | Double_t cosPointingAngleXY = d0toKpi->CosPointingAngleXY(); |
260 | Double_t normDecayLengthXY = d0toKpi->NormalizedDecayLengthXY(); | |
f2703bd2 | 261 | |
262 | if (pdgCode > 0){ | |
263 | cosThetaStar = d0toKpi->CosThetaStarD0(); | |
264 | pTpi = d0toKpi->PtProng(0); | |
265 | pTK = d0toKpi->PtProng(1); | |
266 | d0pi = d0toKpi->Getd0Prong(0); | |
267 | d0K = d0toKpi->Getd0Prong(1); | |
268 | invMass=d0toKpi->InvMassD0(); | |
269 | } | |
270 | else { | |
271 | cosThetaStar = d0toKpi->CosThetaStarD0bar(); | |
272 | pTpi = d0toKpi->PtProng(1); | |
273 | pTK = d0toKpi->PtProng(0); | |
274 | d0pi = d0toKpi->Getd0Prong(1); | |
275 | d0K = d0toKpi->Getd0Prong(0); | |
276 | invMass= d0toKpi->InvMassD0bar(); | |
277 | } | |
278 | ||
279 | Double_t cT = d0toKpi->CtD0(); | |
280 | ||
ec5288c3 | 281 | switch (fConfiguration){ |
282 | case AliCFTaskVertexingHF::kSnail: | |
283 | vectorReco[0] = pt; | |
284 | vectorReco[1] = rapidity; | |
285 | vectorReco[2] = cosThetaStar; | |
286 | vectorReco[3] = pTpi; | |
287 | vectorReco[4] = pTK; | |
288 | vectorReco[5] = cT*1.E4; // in micron | |
289 | vectorReco[6] = dca*1.E4; // in micron | |
290 | vectorReco[7] = d0xd0*1.E8; // in micron^2 | |
291 | vectorReco[8] = cosPointingAngle; | |
292 | vectorReco[9] = phi; | |
293 | vectorReco[10] = fzPrimVertex; // z of reconstructed of primary vertex | |
294 | vectorReco[11] = fCentValue; //reconstructed centrality | |
295 | vectorReco[12] = fFake; // whether the reconstructed candidate was a fake (fFake = 0) or not (fFake = 2) | |
296 | vectorReco[13] = cosPointingAngleXY; | |
297 | vectorReco[14] = normDecayLengthXY; // in cm | |
298 | vectorReco[15] = fMultiplicity; // reconstructed multiplicity | |
299 | break; | |
300 | case AliCFTaskVertexingHF::kCheetah: | |
301 | vectorReco[0] = pt; | |
302 | vectorReco[1] = rapidity ; | |
303 | vectorReco[2] = cT*1.E4; // in micron | |
304 | vectorReco[3] = phi; | |
305 | vectorReco[4] = fzPrimVertex; | |
306 | vectorReco[5] = fCentValue; | |
307 | vectorReco[6] = fFake ; | |
308 | vectorReco[7] = fMultiplicity; | |
309 | break; | |
310 | } | |
b7af2639 | 311 | |
f2703bd2 | 312 | bFillRecoValues = kTRUE; |
379592af | 313 | |
f2703bd2 | 314 | return bFillRecoValues; |
379592af | 315 | } |
316 | ||
379592af | 317 | //_____________________________________________________________ |
318 | Bool_t AliCFVertexingHF2Prong::CheckMCChannelDecay() const | |
319 | { | |
f2703bd2 | 320 | // |
321 | // checking the MC decay channel | |
322 | // | |
323 | Bool_t checkCD = kFALSE; | |
324 | Int_t daughter0 = fmcPartCandidate->GetDaughter(0); | |
325 | Int_t daughter1 = fmcPartCandidate->GetDaughter(1); | |
326 | AliAODMCParticle* mcPartDaughter0 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter0)); | |
327 | AliAODMCParticle* mcPartDaughter1 = dynamic_cast<AliAODMCParticle*>(fmcArray->At(daughter1)); | |
328 | ||
329 | if (!mcPartDaughter0 || !mcPartDaughter1) { | |
330 | AliDebug (2,"Problems in the MC Daughters\n"); | |
331 | return checkCD; | |
332 | } | |
333 | ||
334 | if (!(TMath::Abs(mcPartDaughter0->GetPdgCode())==321 && | |
335 | TMath::Abs(mcPartDaughter1->GetPdgCode())==211) && | |
336 | !(TMath::Abs(mcPartDaughter0->GetPdgCode())==211 && | |
337 | TMath::Abs(mcPartDaughter1->GetPdgCode())==321)) { | |
338 | AliDebug(2, "The D0 MC doesn't come from a Kpi decay, skipping!!"); | |
339 | return checkCD; | |
340 | } | |
341 | ||
342 | checkCD = kTRUE; | |
343 | return checkCD; | |
344 | ||
379592af | 345 | } |
346 |