]>
Commit | Line | Data |
---|---|---|
7b6a4dcd | 1 | #include "AliAnalysisTaskSE.h" |
2 | #include "AliAnalysisManager.h" | |
3 | #include "AliAnalysisDataContainer.h" | |
4 | #include "AliESDEvent.h" | |
5 | #include "AliStack.h" | |
6 | #include "AliCentrality.h" | |
7 | #include "AliMCEventHandler.h" | |
8 | #include "AliMCEvent.h" | |
9 | #include "AliMultiplicity.h" | |
10 | #include <TParticle.h> | |
11 | #include <TSystem.h> | |
12 | #include <TTree.h> | |
13 | #include <TNtuple.h> | |
14 | #include <TH1F.h> | |
15 | #include <TH2F.h> | |
16 | #include <TChain.h> | |
17 | #include "AliESDInputHandlerRP.h" | |
18 | #include "AliAnalysisTaskCheckHFMCProd.h" | |
19 | ||
20 | /************************************************************************** | |
21 | * Copyright(c) 1998-2012, ALICE Experiment at CERN, All rights reserved. * | |
22 | * * | |
23 | * Author: The ALICE Off-line Project. * | |
24 | * Contributors are mentioned in the code where appropriate. * | |
25 | * * | |
26 | * Permission to use, copy, modify and distribute this software and its * | |
27 | * documentation strictly for non-commercial purposes is hereby granted * | |
28 | * without fee, provided that the above copyright notice appears in all * | |
29 | * copies and that both the copyright notice and this permission notice * | |
30 | * appear in the supporting documentation. The authors make no claims * | |
31 | * about the suitability of this software for any purpose. It is * | |
32 | * provided "as is" without express or implied warranty. * | |
33 | **************************************************************************/ | |
34 | ||
35 | /* $Id$ */ | |
36 | ||
37 | //************************************************************************* | |
38 | // Implementation of class AliAnalysisTaskCheckHFMCProd | |
39 | // AliAnalysisTask to check MC production at ESD+Kine level | |
40 | // | |
41 | // | |
42 | // Authors: F. Prino, prino@to.infn.it | |
43 | // | |
44 | //************************************************************************* | |
45 | ||
46 | ClassImp(AliAnalysisTaskCheckHFMCProd) | |
47 | //______________________________________________________________________________ | |
48 | AliAnalysisTaskCheckHFMCProd::AliAnalysisTaskCheckHFMCProd() : AliAnalysisTaskSE("HFMCChecks"), | |
49 | fOutput(0), | |
50 | fHistoNEvents(0), | |
51 | fHistoTracks(0), | |
52 | fHistoSelTracks(0), | |
53 | fHistoTracklets(0), | |
54 | fHistoSPD3DVtxX(0), | |
55 | fHistoSPD3DVtxY(0), | |
56 | fHistoSPD3DVtxZ(0), | |
57 | fHistoSPDZVtxX(0), | |
58 | fHistoSPDZVtxY(0), | |
59 | fHistoSPDZVtxZ(0), | |
60 | fHistoTRKVtxX(0), | |
61 | fHistoTRKVtxY(0), | |
62 | fHistoTRKVtxZ(0), | |
63 | fHistoNcharmed(0), | |
64 | fHistoNbVsNc(0), | |
65 | fPbPb(kFALSE), | |
66 | fReadMC(kTRUE) | |
67 | { | |
68 | // | |
69 | DefineInput(0, TChain::Class()); | |
70 | DefineOutput(1, TList::Class()); | |
71 | } | |
72 | ||
73 | ||
74 | //___________________________________________________________________________ | |
75 | AliAnalysisTaskCheckHFMCProd::~AliAnalysisTaskCheckHFMCProd(){ | |
76 | // | |
77 | if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return; | |
78 | if (fOutput) { | |
79 | delete fOutput; | |
80 | fOutput = 0; | |
81 | } | |
82 | } | |
83 | ||
84 | //___________________________________________________________________________ | |
85 | void AliAnalysisTaskCheckHFMCProd::UserCreateOutputObjects() { | |
86 | // create output histos | |
87 | ||
88 | fOutput = new TList(); | |
89 | fOutput->SetOwner(); | |
90 | fOutput->SetName("OutputHistos"); | |
91 | ||
92 | fHistoNEvents = new TH1F("hNEvents", "Number of processed events",3,-0.5,2.5); | |
93 | fHistoNEvents->Sumw2(); | |
94 | fHistoNEvents->SetMinimum(0); | |
95 | fOutput->Add(fHistoNEvents); | |
96 | ||
97 | Double_t maxMult=100.; | |
98 | if(fPbPb) maxMult=10000.; | |
99 | fHistoTracks = new TH1F("hTracks","",100,0.,maxMult*2); | |
100 | fHistoTracks->Sumw2(); | |
101 | fOutput->Add(fHistoTracks); | |
102 | fHistoSelTracks = new TH1F("hSelTracks","",100,0.,maxMult); | |
103 | fHistoSelTracks->Sumw2(); | |
104 | fOutput->Add(fHistoSelTracks); | |
105 | fHistoTracklets = new TH1F("hTracklets","",100,0.,maxMult); | |
106 | fHistoTracklets->Sumw2(); | |
107 | fOutput->Add(fHistoTracklets); | |
108 | ||
109 | fHistoSPD3DVtxX = new TH1F("hSPD3DvX","",100,-1.,1.); | |
110 | fHistoSPD3DVtxX->Sumw2(); | |
111 | fOutput->Add(fHistoSPD3DVtxX); | |
112 | fHistoSPD3DVtxY = new TH1F("hSPD3DvY","",100,-1.,1.); | |
113 | fHistoSPD3DVtxY->Sumw2(); | |
114 | fOutput->Add(fHistoSPD3DVtxY); | |
115 | fHistoSPD3DVtxZ = new TH1F("hSPD3DvZ","",100,-15.,15.); | |
116 | fHistoSPD3DVtxZ->Sumw2(); | |
117 | fOutput->Add(fHistoSPD3DVtxZ); | |
118 | ||
119 | fHistoSPDZVtxX = new TH1F("hSPDZvX","",100,-1.,1.); | |
120 | fHistoSPDZVtxX->Sumw2(); | |
121 | fOutput->Add(fHistoSPDZVtxX); | |
122 | fHistoSPDZVtxY = new TH1F("hSPDZvY","",100,-1.,1.); | |
123 | fHistoSPDZVtxY->Sumw2(); | |
124 | fOutput->Add(fHistoSPDZVtxY); | |
125 | fHistoSPDZVtxZ = new TH1F("hSPDZvZ","",100,-15.,15.); | |
126 | fHistoSPDZVtxZ->Sumw2(); | |
127 | fOutput->Add(fHistoSPDZVtxZ); | |
128 | ||
129 | ||
130 | fHistoTRKVtxX = new TH1F("hTRKvX","",100,-1.,1.); | |
131 | fHistoTRKVtxX->Sumw2(); | |
132 | fOutput->Add(fHistoTRKVtxX); | |
133 | fHistoTRKVtxY = new TH1F("hTRKvY","",100,-1.,1.); | |
134 | fHistoTRKVtxY->Sumw2(); | |
135 | fOutput->Add(fHistoTRKVtxY); | |
136 | fHistoTRKVtxZ = new TH1F("hTRKvZ","",100,-15.,15.); | |
137 | fHistoTRKVtxZ->Sumw2(); | |
138 | fOutput->Add(fHistoTRKVtxZ); | |
139 | ||
140 | Int_t nBinscb=11; | |
141 | if(fPbPb) nBinscb=200; | |
142 | Double_t maxncn=nBinscb-0.5; | |
143 | fHistoNcharmed = new TH2F("hncharmed","",100,0.,maxMult,nBinscb,-0.5,maxncn); | |
144 | fHistoNcharmed->Sumw2(); | |
145 | fOutput->Add(fHistoNcharmed); | |
146 | fHistoNbVsNc = new TH2F("hnbvsnc","",nBinscb,-0.5,maxncn,nBinscb,-0.5,maxncn); | |
147 | fHistoNbVsNc->Sumw2(); | |
148 | fOutput->Add(fHistoNbVsNc); | |
149 | ||
150 | fHistYPtPrompt[0] = new TH2F("hyptd0prompt","D0 - Prompt",20,0.,20.,20,-2.,2.); | |
151 | fHistYPtPrompt[1] = new TH2F("hyptdplusprompt","Dplus - Prompt",20,0.,20.,20,-2.,2.); | |
152 | fHistYPtPrompt[2] = new TH2F("hyptdstarprompt","Dstar - Prompt",20,0.,20.,20,-2.,2.); | |
153 | fHistYPtPrompt[3] = new TH2F("hyptdsprompt","Ds - Prompt",20,0.,20.,20,-2.,2.); | |
154 | fHistYPtPrompt[4] = new TH2F("hyptlcprompt","Lc - Prompt",20,0.,20.,20,-2.,2.); | |
155 | ||
156 | fHistYPtFeeddown[0] = new TH2F("hyptd0feeddown","D0 - Feeddown",20,0.,20.,20,-2.,2.); | |
157 | fHistYPtFeeddown[1] = new TH2F("hyptdplusfeeddown","Dplus - Feeddown",20,0.,20.,20,-2.,2.); | |
158 | fHistYPtFeeddown[2] = new TH2F("hyptdstarfeedown","Dstar - Feeddown",20,0.,20.,20,-2.,2.); | |
159 | fHistYPtFeeddown[3] = new TH2F("hyptdsfeedown","Ds - Feeddown",20,0.,20.,20,-2.,2.); | |
160 | fHistYPtFeeddown[4] = new TH2F("hyptlcfeedown","Lc - Feeddown",20,0.,20.,20,-2.,2.); | |
161 | ||
162 | for(Int_t ih=0; ih<5; ih++){ | |
163 | fHistYPtPrompt[ih]->Sumw2(); | |
164 | fHistYPtPrompt[ih]->SetMinimum(0); | |
165 | fOutput->Add(fHistYPtPrompt[ih]); | |
166 | fHistYPtFeeddown[ih]->Sumw2(); | |
167 | fHistYPtFeeddown[ih]->SetMinimum(0); | |
168 | fOutput->Add(fHistYPtFeeddown[ih]); | |
169 | } | |
170 | ||
171 | fHistYPtD0byDecChannel[0] = new TH2F("hyptD02","D0 - 2prong",20,0.,20.,20,-2.,2.); | |
172 | fHistYPtD0byDecChannel[1] = new TH2F("hyptD04","D0 - 4prong",20,0.,20.,20,-2.,2.); | |
173 | fHistYPtDplusbyDecChannel[0] = new TH2F("hyptDplusnonreson","Dplus - non reson",20,0.,20.,20,-2.,2.); | |
174 | fHistYPtDplusbyDecChannel[1] = new TH2F("hyptDplusreson","Dplus - reson via K0*",20,0.,20.,20,-2.,2.); | |
175 | fHistYPtDsbyDecChannel[0] = new TH2F("hyptdsphi","Ds - vis Phi",20,0.,20.,20,-2.,2.); | |
176 | fHistYPtDsbyDecChannel[1] = new TH2F("hyptdsk0st","Ds - via k0*",20,0.,20.,20,-2.,2.); | |
177 | ||
178 | for(Int_t ih=0; ih<2; ih++){ | |
179 | ||
180 | fHistYPtD0byDecChannel[ih]->Sumw2(); | |
181 | fHistYPtD0byDecChannel[ih]->SetMinimum(0); | |
182 | fOutput->Add(fHistYPtD0byDecChannel[ih]); | |
183 | fHistYPtDplusbyDecChannel[ih]->Sumw2(); | |
184 | fHistYPtDplusbyDecChannel[ih]->SetMinimum(0); | |
185 | fOutput->Add(fHistYPtDplusbyDecChannel[ih]); | |
186 | fHistYPtDsbyDecChannel[ih]->Sumw2(); | |
187 | fHistYPtDsbyDecChannel[ih]->SetMinimum(0); | |
188 | fOutput->Add(fHistYPtDsbyDecChannel[ih]); | |
189 | } | |
190 | ||
191 | ||
192 | PostData(1,fOutput); | |
193 | ||
194 | } | |
195 | //______________________________________________________________________________ | |
196 | void AliAnalysisTaskCheckHFMCProd::UserExec(Option_t *) | |
197 | { | |
198 | // | |
199 | ||
200 | AliESDEvent *esd = (AliESDEvent*) (InputEvent()); | |
201 | ||
202 | ||
203 | if(!esd) { | |
204 | printf("AliAnalysisTaskSDDRP::Exec(): bad ESD\n"); | |
205 | return; | |
206 | } | |
207 | ||
208 | fHistoNEvents->Fill(0); | |
209 | ||
210 | Int_t nTracks=esd->GetNumberOfTracks(); | |
211 | fHistoTracks->Fill(nTracks); | |
212 | Int_t nSelTracks=0; | |
213 | for(Int_t it=0; it<nTracks; it++){ | |
214 | AliESDtrack* tr=esd->GetTrack(it); | |
215 | UInt_t status=tr->GetStatus(); | |
216 | if(!(status&AliESDtrack::kITSrefit)) continue; | |
217 | if(!(status&AliESDtrack::kTPCin)) continue; | |
218 | nSelTracks++; | |
219 | } | |
220 | fHistoSelTracks->Fill(nSelTracks); | |
221 | ||
222 | const AliMultiplicity* mult=esd->GetMultiplicity(); | |
223 | Int_t nTracklets=mult->GetNumberOfTracklets(); | |
224 | fHistoTracklets->Fill(nTracklets); | |
225 | ||
226 | const AliESDVertex *spdv=esd->GetVertex(); | |
227 | if(spdv && spdv->IsFromVertexer3D()){ | |
228 | fHistoSPD3DVtxX->Fill(spdv->GetXv()); | |
229 | fHistoSPD3DVtxY->Fill(spdv->GetYv()); | |
230 | fHistoSPD3DVtxZ->Fill(spdv->GetZv()); | |
231 | } | |
232 | if(spdv && spdv->IsFromVertexerZ()){ | |
233 | fHistoSPDZVtxX->Fill(spdv->GetXv()); | |
234 | fHistoSPDZVtxY->Fill(spdv->GetYv()); | |
235 | fHistoSPDZVtxZ->Fill(spdv->GetZv()); | |
236 | } | |
237 | const AliESDVertex *trkv=esd->GetPrimaryVertex(); | |
238 | if(trkv && trkv->GetNContributors()>1){ | |
239 | fHistoTRKVtxX->Fill(trkv->GetXv()); | |
240 | fHistoTRKVtxY->Fill(trkv->GetYv()); | |
241 | fHistoTRKVtxZ->Fill(trkv->GetZv()); | |
242 | } | |
243 | ||
244 | AliStack* stack=0; | |
245 | ||
246 | if(fReadMC){ | |
247 | AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
248 | if (!eventHandler) { | |
249 | Printf("ERROR: Could not retrieve MC event handler"); | |
250 | return; | |
251 | } | |
252 | AliMCEvent* mcEvent = eventHandler->MCEvent(); | |
253 | if (!mcEvent) { | |
254 | Printf("ERROR: Could not retrieve MC event"); | |
255 | return; | |
256 | } | |
257 | stack = mcEvent->Stack(); | |
258 | if (!stack) { | |
259 | Printf("ERROR: stack not available"); | |
260 | return; | |
261 | } | |
262 | ||
263 | ||
264 | Int_t nParticles=stack->GetNtrack(); | |
265 | Double_t dNchdy = 0.; | |
266 | Int_t nb = 0, nc=0; | |
267 | Int_t nCharmed=0.; | |
268 | for (Int_t i=0;i<nParticles;i++){ | |
269 | TParticle* part = (TParticle*)stack->Particle(i); | |
270 | Int_t absPdg=TMath::Abs(part->GetPdgCode()); | |
271 | if(absPdg==4) nc++; | |
272 | if(absPdg==5) nb++; | |
273 | if(stack->IsPhysicalPrimary(i)){ | |
274 | Double_t eta=part->Eta(); | |
275 | if(TMath::Abs(eta)<0.5) dNchdy+=0.6666; // 2/3 for the ratio charged/all | |
276 | } | |
277 | ||
278 | Int_t iPart=-1; | |
279 | Int_t iType=0; | |
280 | if(absPdg==421){ | |
281 | iType=CheckD0Decay(i,stack); | |
282 | if(iType>=0) iPart=0; | |
283 | } | |
284 | else if(absPdg==411){ | |
285 | iType=CheckDplusDecay(i,stack); | |
286 | if(iType>=0) iPart=1; | |
287 | } | |
288 | else if(absPdg==413){ | |
289 | iType=CheckDstarDecay(i,stack); | |
290 | if(iType>=0) iPart=2; | |
291 | } | |
292 | else if(absPdg==431){ | |
293 | iType=CheckDsDecay(i,stack); | |
294 | if(iType==0 || iType==1) iPart=3; | |
295 | } | |
296 | else if(absPdg==4122){ | |
297 | iType=CheckLcDecay(i,stack); | |
298 | if(iType>=0) iPart=4; | |
299 | } | |
300 | if(iPart<0) continue; | |
301 | if(iType<0) continue; | |
302 | nCharmed++; | |
303 | Float_t rapid=-999.; | |
304 | if (part->Energy() != TMath::Abs(part->Pz())){ | |
305 | rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz())); | |
306 | } | |
307 | if(iPart==0 && iType<=1){ | |
308 | fHistYPtD0byDecChannel[iType]->Fill(part->Pt(),rapid); | |
309 | }else if(iPart==1 && iType<=1){ | |
310 | fHistYPtDplusbyDecChannel[iType]->Fill(part->Pt(),rapid); | |
311 | }else if(iPart==3 && iType<=1){ | |
312 | fHistYPtDsbyDecChannel[iType]->Fill(part->Pt(),rapid); | |
313 | } | |
314 | ||
315 | TParticle* runningpart=part; | |
316 | Int_t iFromB=-1; | |
317 | while(1){ | |
318 | Int_t labmoth=runningpart->GetFirstMother(); | |
319 | if(labmoth==-1) break; | |
320 | TParticle *mot=(TParticle*)stack->Particle(labmoth); | |
321 | Int_t pdgmoth=TMath::Abs(mot->GetPdgCode()); | |
322 | if(pdgmoth==5){ | |
323 | iFromB=1; | |
324 | break; | |
325 | }else if(pdgmoth==4){ | |
326 | iFromB=0; | |
327 | break; | |
328 | } | |
329 | runningpart=mot; | |
330 | } | |
331 | if(iFromB<0) continue; | |
332 | if(iFromB==0 && iPart>=0 && iPart<5) fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid); | |
333 | else if(iFromB==1 && iPart>=0 && iPart<5) fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid); | |
334 | ||
335 | } | |
336 | printf(" ---> %f %d %d %d\n",dNchdy,nCharmed,nc,nb); | |
337 | fHistoNcharmed->Fill(dNchdy,nCharmed); | |
338 | fHistoNbVsNc->Fill(nc,nb); | |
339 | } | |
340 | ||
341 | PostData(1,fOutput); | |
342 | ||
343 | } | |
344 | //______________________________________________________________________________ | |
345 | void AliAnalysisTaskCheckHFMCProd::Terminate(Option_t */*option*/) | |
346 | { | |
347 | // Terminate analysis | |
348 | fOutput = dynamic_cast<TList*> (GetOutputData(1)); | |
349 | if (!fOutput) { | |
350 | printf("ERROR: fOutput not available\n"); | |
351 | return; | |
352 | } | |
353 | ||
354 | return; | |
355 | } | |
356 | ||
357 | ||
358 | ||
359 | ||
360 | //______________________________________________________________________________ | |
361 | Int_t AliAnalysisTaskCheckHFMCProd::CheckD0Decay(Int_t labD0, AliStack* stack) const{ | |
362 | ||
363 | if(labD0<0) return -1; | |
364 | TParticle* dp = (TParticle*)stack->Particle(labD0); | |
365 | Int_t pdgdp=dp->GetPdgCode(); | |
366 | Int_t nDau=dp->GetNDaughters(); | |
7b6a4dcd | 367 | |
368 | if(nDau==2){ | |
369 | Int_t nKaons=0; | |
370 | Int_t nPions=0; | |
371 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
372 | if(iDau<0) return -1; | |
373 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
374 | Int_t pdgdau=dau->GetPdgCode(); | |
375 | if(TMath::Abs(pdgdau)==321){ | |
376 | if(pdgdp>0 && pdgdau>0) return -1; | |
377 | if(pdgdp<0 && pdgdau<0) return -1; | |
378 | nKaons++; | |
379 | }else if(TMath::Abs(pdgdau)==211){ | |
380 | if(pdgdp<0 && pdgdau>0) return -1; | |
381 | if(pdgdp>0 && pdgdau<0) return -1; | |
382 | nPions++; | |
383 | }else{ | |
384 | return -1; | |
385 | } | |
386 | } | |
387 | if(nPions!=1) return -1; | |
388 | if(nKaons!=1) return -1; | |
389 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
390 | if(iDau<0) return -1; | |
391 | } | |
392 | return 0; | |
393 | } | |
394 | ||
395 | if(nDau==3 || nDau==4){ | |
396 | Int_t nKaons=0; | |
397 | Int_t nPions=0; | |
398 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
399 | if(iDau<0) return -1; | |
400 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
401 | Int_t pdgdau=dau->GetPdgCode(); | |
402 | if(TMath::Abs(pdgdau)==321){ | |
403 | if(pdgdp>0 && pdgdau>0) return -1; | |
404 | if(pdgdp<0 && pdgdau<0) return -1; | |
405 | nKaons++; | |
406 | }else if(TMath::Abs(pdgdau)==113 || TMath::Abs(pdgdau)==313){ | |
407 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
408 | if(resDau<0) return -1; | |
409 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
410 | Int_t pdgresdau=resdau->GetPdgCode(); | |
411 | if(TMath::Abs(pdgresdau)==321){ | |
412 | if(pdgdp>0 && pdgresdau>0) return -1; | |
413 | if(pdgdp<0 && pdgresdau<0) return -1; | |
414 | nKaons++; | |
415 | } | |
416 | if(TMath::Abs(pdgresdau)==211){ | |
417 | nPions++; | |
418 | } | |
419 | } | |
420 | }else if(TMath::Abs(pdgdau)==211){ | |
421 | nPions++; | |
422 | }else{ | |
423 | return -1; | |
424 | } | |
425 | } | |
426 | if(nPions!=3) return -1; | |
427 | if(nKaons!=1) return -1; | |
428 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
429 | if(iDau<0) return -1; | |
430 | } | |
431 | return 1; | |
432 | } | |
433 | ||
434 | return -1; | |
435 | } | |
436 | ||
437 | ||
438 | //______________________________________________________________________________ | |
439 | Int_t AliAnalysisTaskCheckHFMCProd::CheckDplusDecay(Int_t labDplus, AliStack* stack) const{ | |
440 | ||
441 | if(labDplus<0) return -1; | |
442 | TParticle* dp = (TParticle*)stack->Particle(labDplus); | |
443 | Int_t pdgdp=dp->GetPdgCode(); | |
444 | Int_t nDau=dp->GetNDaughters(); | |
7b6a4dcd | 445 | |
446 | if(nDau==3){ | |
447 | Int_t nKaons=0; | |
448 | Int_t nPions=0; | |
449 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
450 | if(iDau<0) return -1; | |
451 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
452 | Int_t pdgdau=dau->GetPdgCode(); | |
453 | if(TMath::Abs(pdgdau)==321){ | |
454 | if(pdgdp>0 && pdgdau>0) return -1; | |
455 | if(pdgdp<0 && pdgdau<0) return -1; | |
456 | nKaons++; | |
457 | }else if(TMath::Abs(pdgdau)==211){ | |
458 | if(pdgdp<0 && pdgdau>0) return -1; | |
459 | if(pdgdp>0 && pdgdau<0) return -1; | |
460 | nPions++; | |
461 | }else{ | |
462 | return -1; | |
463 | } | |
464 | } | |
465 | if(nPions!=2) return -1; | |
466 | if(nKaons!=1) return -1; | |
467 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
468 | if(iDau<0) return -1; | |
469 | } | |
470 | return 0; | |
471 | } | |
472 | ||
473 | if(nDau==2){ | |
474 | Int_t nKaons=0; | |
475 | Int_t nPions=0; | |
476 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
477 | if(iDau<0) return -1; | |
478 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
479 | Int_t pdgdau=dau->GetPdgCode(); | |
480 | if(TMath::Abs(pdgdau)==313){ | |
481 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
482 | if(resDau<0) return -1; | |
483 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
484 | Int_t pdgresdau=resdau->GetPdgCode(); | |
485 | if(TMath::Abs(pdgresdau)==321){ | |
486 | if(pdgdp>0 && pdgresdau>0) return -1; | |
487 | if(pdgdp<0 && pdgresdau<0) return -1; | |
488 | nKaons++; | |
489 | } | |
490 | if(TMath::Abs(pdgresdau)==211){ | |
491 | if(pdgdp<0 && pdgresdau>0) return -1; | |
492 | if(pdgdp>0 && pdgresdau<0) return -1; | |
493 | nPions++; | |
494 | } | |
495 | } | |
496 | }else if(TMath::Abs(pdgdau)==211){ | |
497 | if(pdgdp<0 && pdgdau>0) return -1; | |
498 | if(pdgdp>0 && pdgdau<0) return -1; | |
499 | nPions++; | |
500 | }else{ | |
501 | return -1; | |
502 | } | |
503 | } | |
504 | if(nPions!=2) return -1; | |
505 | if(nKaons!=1) return -1; | |
506 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
507 | if(iDau<0) return -1; | |
508 | } | |
509 | return 1; | |
510 | } | |
511 | return -1; | |
512 | } | |
513 | ||
514 | //______________________________________________________________________________ | |
515 | Int_t AliAnalysisTaskCheckHFMCProd::CheckDsDecay(Int_t labDs, AliStack* stack) const{ | |
516 | // Ds decay | |
517 | if(labDs<0) return -1; | |
518 | TParticle* dp = (TParticle*)stack->Particle(labDs); | |
519 | Int_t pdgdp=dp->GetPdgCode(); | |
520 | Int_t nDau=dp->GetNDaughters(); | |
7b6a4dcd | 521 | |
522 | if(nDau==3){ | |
523 | Int_t nKaons=0; | |
524 | Int_t nPions=0; | |
525 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
526 | if(iDau<0) return -1; | |
527 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
528 | Int_t pdgdau=dau->GetPdgCode(); | |
529 | if(TMath::Abs(pdgdau)==321){ | |
530 | nKaons++; | |
531 | }else if(TMath::Abs(pdgdau)==211){ | |
532 | if(pdgdp<0 && pdgdau>0) return -1; | |
533 | if(pdgdp>0 && pdgdau<0) return -1; | |
534 | nPions++; | |
535 | }else{ | |
536 | return -1; | |
537 | } | |
538 | } | |
539 | if(nPions!=1) return -1; | |
540 | if(nKaons!=2) return -1; | |
541 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
542 | if(iDau<0) return -1; | |
543 | } | |
544 | return 2; | |
545 | } | |
546 | ||
547 | if(nDau==2){ | |
548 | Int_t nKaons=0; | |
549 | Int_t nPions=0; | |
550 | Bool_t isPhi=kFALSE; | |
551 | Bool_t isk0st=kFALSE; | |
552 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
553 | if(iDau<0) return -1; | |
554 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
555 | Int_t pdgdau=dau->GetPdgCode(); | |
556 | if(TMath::Abs(pdgdau)==313){ | |
557 | isk0st=kTRUE; | |
558 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
559 | if(resDau<0) return -1; | |
560 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
561 | Int_t pdgresdau=resdau->GetPdgCode(); | |
562 | if(TMath::Abs(pdgresdau)==321){ | |
563 | nKaons++; | |
564 | } | |
565 | if(TMath::Abs(pdgresdau)==211){ | |
566 | if(pdgdp<0 && pdgresdau>0) return -1; | |
567 | if(pdgdp>0 && pdgresdau<0) return -1; | |
568 | nPions++; | |
569 | } | |
570 | } | |
571 | }else if(TMath::Abs(pdgdau)==333){ | |
572 | isPhi=kTRUE; | |
573 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
574 | if(resDau<0) return -1; | |
575 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
48709ec3 | 576 | if(!resdau) return -1; |
7b6a4dcd | 577 | Int_t pdgresdau=resdau->GetPdgCode(); |
578 | if(TMath::Abs(pdgresdau)==321){ | |
579 | nKaons++; | |
580 | }else{ | |
581 | return -1; | |
582 | } | |
583 | } | |
584 | }else if(TMath::Abs(pdgdau)==211){ | |
585 | if(pdgdp<0 && pdgdau>0) return -1; | |
586 | if(pdgdp>0 && pdgdau<0) return -1; | |
587 | nPions++; | |
588 | }else if(TMath::Abs(pdgdau)==321){ | |
589 | nKaons++; | |
590 | }else{ | |
591 | return -1; | |
592 | } | |
593 | } | |
594 | if(nPions!=1) return -1; | |
595 | if(nKaons!=2) return -1; | |
596 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
597 | if(iDau<0) return -1; | |
598 | } | |
599 | if(isk0st) return 1; | |
600 | else if(isPhi) return 0; | |
601 | else return 3; | |
602 | } | |
603 | return -1; | |
604 | } | |
605 | ||
606 | //______________________________________________________________________________ | |
607 | Int_t AliAnalysisTaskCheckHFMCProd::CheckDstarDecay(Int_t labDstar, AliStack* stack) const{ | |
608 | ||
609 | if(labDstar<0) return -1; | |
610 | TParticle* dp = (TParticle*)stack->Particle(labDstar); | |
611 | Int_t pdgdp=dp->GetPdgCode(); | |
612 | Int_t nDau=dp->GetNDaughters(); | |
613 | if(nDau!=2) return -1; | |
614 | ||
615 | Int_t nKaons=0; | |
616 | Int_t nPions=0; | |
617 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
618 | if(iDau<0) return -1; | |
619 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
620 | Int_t pdgdau=dau->GetPdgCode(); | |
621 | if(TMath::Abs(pdgdau)==421){ | |
622 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
623 | if(resDau<0) return -1; | |
624 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
625 | Int_t pdgresdau=resdau->GetPdgCode(); | |
626 | if(TMath::Abs(pdgresdau)==321){ | |
627 | if(pdgdp>0 && pdgresdau>0) return -1; | |
628 | if(pdgdp<0 && pdgresdau<0) return -1; | |
629 | nKaons++; | |
630 | } | |
631 | if(TMath::Abs(pdgresdau)==211){ | |
632 | if(pdgdp<0 && pdgresdau>0) return -1; | |
633 | if(pdgdp>0 && pdgresdau<0) return -1; | |
634 | nPions++; | |
635 | } | |
636 | } | |
637 | }else if(TMath::Abs(pdgdau)==211){ | |
638 | if(pdgdp<0 && pdgdau>0) return -1; | |
639 | if(pdgdp>0 && pdgdau<0) return -1; | |
640 | nPions++; | |
641 | }else{ | |
642 | return -1; | |
643 | } | |
644 | } | |
645 | if(nPions!=2) return -1; | |
646 | if(nKaons!=1) return -1; | |
647 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
648 | if(iDau<0) return -1; | |
649 | } | |
650 | return 0; | |
651 | ||
652 | } | |
653 | ||
654 | //______________________________________________________________________________ | |
655 | Int_t AliAnalysisTaskCheckHFMCProd::CheckLcDecay(Int_t labLc, AliStack* stack) const{ | |
656 | if(labLc<0) return -1; | |
657 | TParticle* dp = (TParticle*)stack->Particle(labLc); | |
658 | Int_t pdgdp=dp->GetPdgCode(); | |
659 | Int_t nDau=dp->GetNDaughters(); | |
7b6a4dcd | 660 | |
661 | if(nDau==3){ | |
662 | Int_t nKaons=0; | |
663 | Int_t nPions=0; | |
664 | Int_t nProtons=0; | |
665 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
666 | if(iDau<0) return -1; | |
667 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
668 | Int_t pdgdau=dau->GetPdgCode(); | |
669 | if(TMath::Abs(pdgdau)==321){ | |
670 | if(pdgdp>0 && pdgdau>0) return -1; | |
671 | if(pdgdp<0 && pdgdau<0) return -1; | |
672 | nKaons++; | |
673 | }else if(TMath::Abs(pdgdau)==211){ | |
674 | if(pdgdp<0 && pdgdau>0) return -1; | |
675 | if(pdgdp>0 && pdgdau<0) return -1; | |
676 | nPions++; | |
677 | }else if(TMath::Abs(pdgdau)==2212){ | |
678 | if(pdgdp<0 && pdgdau>0) return -1; | |
679 | if(pdgdp>0 && pdgdau<0) return -1; | |
680 | nProtons++; | |
681 | }else{ | |
682 | return -1; | |
683 | } | |
684 | } | |
685 | if(nPions!=1) return -1; | |
686 | if(nKaons!=1) return -1; | |
687 | if(nProtons!=1) return -1; | |
688 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
689 | if(iDau<0) return -1; | |
690 | } | |
691 | return 0; | |
692 | } | |
693 | ||
694 | if(nDau==2){ | |
695 | Int_t nKaons=0; | |
696 | Int_t nPions=0; | |
697 | Int_t nProtons=0; | |
698 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
699 | if(iDau<0) return -1; | |
700 | TParticle* dau=(TParticle*)stack->Particle(iDau); | |
701 | Int_t pdgdau=dau->GetPdgCode(); | |
702 | if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224 | |
703 | || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){ | |
704 | Int_t nDauRes=dau->GetNDaughters(); | |
705 | if(nDauRes!=2) return -1; | |
706 | for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){ | |
707 | if(resDau<0) return -1; | |
708 | TParticle* resdau=(TParticle*)stack->Particle(resDau); | |
709 | Int_t pdgresdau=resdau->GetPdgCode(); | |
710 | if(TMath::Abs(pdgresdau)==321){ | |
711 | if(pdgdp>0 && pdgresdau>0) return -1; | |
712 | if(pdgdp<0 && pdgresdau<0) return -1; | |
713 | nKaons++; | |
714 | } | |
715 | if(TMath::Abs(pdgresdau)==211){ | |
716 | if(pdgdp<0 && pdgresdau>0) return -1; | |
717 | if(pdgdp>0 && pdgresdau<0) return -1; | |
718 | nPions++; | |
719 | } | |
720 | if(TMath::Abs(pdgresdau)==2212){ | |
721 | if(pdgdp<0 && pdgresdau>0) return -1; | |
722 | if(pdgdp>0 && pdgresdau<0) return -1; | |
723 | nProtons++; | |
724 | } | |
725 | } | |
726 | }else if(TMath::Abs(pdgdau)==321){ | |
727 | if(pdgdp>0 && pdgdau>0) return -1; | |
728 | if(pdgdp<0 && pdgdau<0) return -1; | |
729 | nKaons++; | |
730 | }else if(TMath::Abs(pdgdau)==211){ | |
731 | if(pdgdp<0 && pdgdau>0) return -1; | |
732 | if(pdgdp>0 && pdgdau<0) return -1; | |
733 | nPions++; | |
734 | }else if(TMath::Abs(pdgdau)==2212){ | |
735 | if(pdgdp<0 && pdgdau>0) return -1; | |
736 | if(pdgdp>0 && pdgdau<0) return -1; | |
737 | nProtons++; | |
738 | }else{ | |
739 | return -1; | |
740 | } | |
741 | } | |
742 | if(nPions!=1) return -1; | |
743 | if(nKaons!=1) return -1; | |
744 | if(nProtons!=1) return -1; | |
745 | for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){ | |
746 | if(iDau<0) return -1; | |
747 | } | |
748 | return 1; | |
749 | } | |
750 | return -1; | |
751 | } | |
752 |