1 #include "AliAnalysisTaskSE.h"
2 #include "AliAnalysisManager.h"
3 #include "AliAnalysisDataContainer.h"
4 #include "AliESDEvent.h"
6 #include "AliCentrality.h"
7 #include "AliMCEventHandler.h"
8 #include "AliMCEvent.h"
9 #include "AliMultiplicity.h"
10 #include <TParticle.h>
17 #include "AliESDInputHandlerRP.h"
18 #include "AliAnalysisTaskCheckHFMCProd.h"
20 /**************************************************************************
21 * Copyright(c) 1998-2012, ALICE Experiment at CERN, All rights reserved. *
23 * Author: The ALICE Off-line Project. *
24 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
37 //*************************************************************************
38 // Implementation of class AliAnalysisTaskCheckHFMCProd
39 // AliAnalysisTask to check MC production at ESD+Kine level
42 // Authors: F. Prino, prino@to.infn.it
44 //*************************************************************************
46 ClassImp(AliAnalysisTaskCheckHFMCProd)
47 //______________________________________________________________________________
48 AliAnalysisTaskCheckHFMCProd::AliAnalysisTaskCheckHFMCProd() : AliAnalysisTaskSE("HFMCChecks"),
67 fHistOriginFeeddown(0),
68 fSearchUpToQuark(kFALSE),
73 DefineInput(0, TChain::Class());
74 DefineOutput(1, TList::Class());
78 //___________________________________________________________________________
79 AliAnalysisTaskCheckHFMCProd::~AliAnalysisTaskCheckHFMCProd(){
81 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
88 //___________________________________________________________________________
89 void AliAnalysisTaskCheckHFMCProd::UserCreateOutputObjects() {
90 // create output histos
92 fOutput = new TList();
94 fOutput->SetName("OutputHistos");
96 fHistoNEvents = new TH1F("hNEvents", "Number of processed events",3,-0.5,2.5);
97 fHistoNEvents->Sumw2();
98 fHistoNEvents->SetMinimum(0);
99 fOutput->Add(fHistoNEvents);
101 Double_t maxMult=100.;
102 if(fSystem==1) maxMult=10000.;
103 if(fSystem==2) maxMult=500.;
104 fHistoPhysPrim = new TH1F("hPhysPrim","",100,0.,maxMult);
105 fHistoPhysPrim->Sumw2();
106 fOutput->Add(fHistoPhysPrim);
107 fHistoTracks = new TH1F("hTracks","",100,0.,maxMult*2);
108 fHistoTracks->Sumw2();
109 fOutput->Add(fHistoTracks);
110 fHistoSelTracks = new TH1F("hSelTracks","",100,0.,maxMult);
111 fHistoSelTracks->Sumw2();
112 fOutput->Add(fHistoSelTracks);
113 fHistoTracklets = new TH1F("hTracklets","",100,0.,maxMult);
114 fHistoTracklets->Sumw2();
115 fOutput->Add(fHistoTracklets);
117 fHistoSPD3DVtxX = new TH1F("hSPD3DvX","",100,-1.,1.);
118 fHistoSPD3DVtxX->Sumw2();
119 fOutput->Add(fHistoSPD3DVtxX);
120 fHistoSPD3DVtxY = new TH1F("hSPD3DvY","",100,-1.,1.);
121 fHistoSPD3DVtxY->Sumw2();
122 fOutput->Add(fHistoSPD3DVtxY);
123 fHistoSPD3DVtxZ = new TH1F("hSPD3DvZ","",100,-15.,15.);
124 fHistoSPD3DVtxZ->Sumw2();
125 fOutput->Add(fHistoSPD3DVtxZ);
127 fHistoSPDZVtxX = new TH1F("hSPDZvX","",100,-1.,1.);
128 fHistoSPDZVtxX->Sumw2();
129 fOutput->Add(fHistoSPDZVtxX);
130 fHistoSPDZVtxY = new TH1F("hSPDZvY","",100,-1.,1.);
131 fHistoSPDZVtxY->Sumw2();
132 fOutput->Add(fHistoSPDZVtxY);
133 fHistoSPDZVtxZ = new TH1F("hSPDZvZ","",100,-15.,15.);
134 fHistoSPDZVtxZ->Sumw2();
135 fOutput->Add(fHistoSPDZVtxZ);
138 fHistoTRKVtxX = new TH1F("hTRKvX","",100,-1.,1.);
139 fHistoTRKVtxX->Sumw2();
140 fOutput->Add(fHistoTRKVtxX);
141 fHistoTRKVtxY = new TH1F("hTRKvY","",100,-1.,1.);
142 fHistoTRKVtxY->Sumw2();
143 fOutput->Add(fHistoTRKVtxY);
144 fHistoTRKVtxZ = new TH1F("hTRKvZ","",100,-15.,15.);
145 fHistoTRKVtxZ->Sumw2();
146 fOutput->Add(fHistoTRKVtxZ);
149 if(fSystem==1) nBinscb=200;
150 if(fSystem==2) nBinscb=21;
151 Double_t maxncn=nBinscb-0.5;
152 fHistoNcharmed = new TH2F("hncharmed","",100,0.,maxMult,nBinscb,-0.5,maxncn);
153 fHistoNcharmed->Sumw2();
154 fOutput->Add(fHistoNcharmed);
155 fHistoNbVsNc = new TH2F("hnbvsnc","",nBinscb,-0.5,maxncn,nBinscb,-0.5,maxncn);
156 fHistoNbVsNc->Sumw2();
157 fOutput->Add(fHistoNbVsNc);
159 fHistYPtPrompt[0] = new TH2F("hyptD0prompt","D0 - Prompt",40,0.,40.,20,-2.,2.);
160 fHistYPtPrompt[1] = new TH2F("hyptDplusprompt","Dplus - Prompt",40,0.,40.,20,-2.,2.);
161 fHistYPtPrompt[2] = new TH2F("hyptDstarprompt","Dstar - Prompt",40,0.,40.,20,-2.,2.);
162 fHistYPtPrompt[3] = new TH2F("hyptDsprompt","Ds - Prompt",40,0.,40.,20,-2.,2.);
163 fHistYPtPrompt[4] = new TH2F("hyptLcprompt","Lc - Prompt",40,0.,40.,20,-2.,2.);
165 fHistBYPtAllDecay[0] = new TH2F("hyptB0AllDecay","B0 - All",40,0.,40.,40,-2.,2.);
166 fHistBYPtAllDecay[1] = new TH2F("hyptBplusAllDecay","Bplus - All",40,0.,40.,40,-2.,2.);
167 fHistBYPtAllDecay[2] = new TH2F("hyptBstarAllDecay","Bstar - All",40,0.,40.,40,-2.,2.);
168 fHistBYPtAllDecay[3] = new TH2F("hyptBsAllDecay","Bs - All",40,0.,40.,40,-2.,2.);
169 fHistBYPtAllDecay[4] = new TH2F("hyptLbAllDecay","LB - All",40,0.,40.,40,-2.,2.);
171 fHistYPtAllDecay[0] = new TH2F("hyptD0AllDecay","D0 - All",40,0.,40.,40,-2.,2.);
172 fHistYPtAllDecay[1] = new TH2F("hyptDplusAllDecay","Dplus - All",40,0.,40.,40,-2.,2.);
173 fHistYPtAllDecay[2] = new TH2F("hyptDstarAllDecay","Dstar - All",40,0.,40.,40,-2.,2.);
174 fHistYPtAllDecay[3] = new TH2F("hyptDsAllDecay","Ds - All",40,0.,40.,40,-2.,2.);
175 fHistYPtAllDecay[4] = new TH2F("hyptLcAllDecay","Lc - All",40,0.,40.,40,-2.,2.);
177 fHistYPtPromptAllDecay[0] = new TH2F("hyptD0promptAllDecay","D0 - Prompt",40,0.,40.,40,-2.,2.);
178 fHistYPtPromptAllDecay[1] = new TH2F("hyptDpluspromptAllDecay","Dplus - Prompt",40,0.,40.,40,-2.,2.);
179 fHistYPtPromptAllDecay[2] = new TH2F("hyptDstarpromptAllDecay","Dstar - Prompt",40,0.,40.,40,-2.,2.);
180 fHistYPtPromptAllDecay[3] = new TH2F("hyptDspromptAllDecay","Ds - Prompt",40,0.,40.,40,-2.,2.);
181 fHistYPtPromptAllDecay[4] = new TH2F("hyptLcpromptAllDecay","Lc - Prompt",40,0.,40.,40,-2.,2.);
183 fHistYPtFeeddownAllDecay[0] = new TH2F("hyptD0feeddownAllDecay","D0 - FromB",40,0.,40.,40,-2.,2.);
184 fHistYPtFeeddownAllDecay[1] = new TH2F("hyptDplusfeeddownAllDecay","Dplus - FromB",40,0.,40.,40,-2.,2.);
185 fHistYPtFeeddownAllDecay[2] = new TH2F("hyptDstarfeeddownAllDecay","Dstar - FromB",40,0.,40.,40,-2.,2.);
186 fHistYPtFeeddownAllDecay[3] = new TH2F("hyptDsfeeddownAllDecay","Ds - FromB",40,0.,40.,40,-2.,2.);
187 fHistYPtFeeddownAllDecay[4] = new TH2F("hyptLcfeeddownAllDecay","Lc - FromB",40,0.,40.,40,-2.,2.);
190 fHistYPtFeeddown[0] = new TH2F("hyptD0feeddown","D0 - Feeddown",40,0.,40.,20,-2.,2.);
191 fHistYPtFeeddown[1] = new TH2F("hyptDplusfeeddown","Dplus - Feeddown",40,0.,40.,20,-2.,2.);
192 fHistYPtFeeddown[2] = new TH2F("hyptDstarfeedown","Dstar - Feeddown",40,0.,40.,20,-2.,2.);
193 fHistYPtFeeddown[3] = new TH2F("hyptDsfeedown","Ds - Feeddown",40,0.,40.,20,-2.,2.);
194 fHistYPtFeeddown[4] = new TH2F("hyptLcfeedown","Lc - Feeddown",40,0.,40.,20,-2.,2.);
196 for(Int_t ih=0; ih<5; ih++){
197 fHistBYPtAllDecay[ih]->Sumw2();
198 fHistBYPtAllDecay[ih]->SetMinimum(0);
199 fOutput->Add(fHistBYPtAllDecay[ih]);
200 fHistYPtAllDecay[ih]->Sumw2();
201 fHistYPtAllDecay[ih]->SetMinimum(0);
202 fOutput->Add(fHistYPtAllDecay[ih]);
203 fHistYPtPromptAllDecay[ih]->Sumw2();
204 fHistYPtPromptAllDecay[ih]->SetMinimum(0);
205 fOutput->Add(fHistYPtPromptAllDecay[ih]);
206 fHistYPtFeeddownAllDecay[ih]->Sumw2();
207 fHistYPtFeeddownAllDecay[ih]->SetMinimum(0);
208 fOutput->Add(fHistYPtFeeddownAllDecay[ih]);
209 fHistYPtPrompt[ih]->Sumw2();
210 fHistYPtPrompt[ih]->SetMinimum(0);
211 fOutput->Add(fHistYPtPrompt[ih]);
212 fHistYPtFeeddown[ih]->Sumw2();
213 fHistYPtFeeddown[ih]->SetMinimum(0);
214 fOutput->Add(fHistYPtFeeddown[ih]);
217 fHistYPtD0byDecChannel[0] = new TH2F("hyptD02","D0 - 2prong",40,0.,40.,20,-2.,2.);
218 fHistYPtD0byDecChannel[1] = new TH2F("hyptD04","D0 - 4prong",40,0.,40.,20,-2.,2.);
219 fHistYPtDplusbyDecChannel[0] = new TH2F("hyptDplusnonreson","Dplus - non reson",40,0.,40.,20,-2.,2.);
220 fHistYPtDplusbyDecChannel[1] = new TH2F("hyptDplusreson","Dplus - reson via K0*",40,0.,40.,20,-2.,2.);
221 fHistYPtDsbyDecChannel[0] = new TH2F("hyptDsphi","Ds - vis Phi",40,0.,40.,20,-2.,2.);
222 fHistYPtDsbyDecChannel[1] = new TH2F("hyptDsk0st","Ds - via k0*",40,0.,40.,20,-2.,2.);
224 for(Int_t ih=0; ih<2; ih++){
226 fHistYPtD0byDecChannel[ih]->Sumw2();
227 fHistYPtD0byDecChannel[ih]->SetMinimum(0);
228 fOutput->Add(fHistYPtD0byDecChannel[ih]);
229 fHistYPtDplusbyDecChannel[ih]->Sumw2();
230 fHistYPtDplusbyDecChannel[ih]->SetMinimum(0);
231 fOutput->Add(fHistYPtDplusbyDecChannel[ih]);
232 fHistYPtDsbyDecChannel[ih]->Sumw2();
233 fHistYPtDsbyDecChannel[ih]->SetMinimum(0);
234 fOutput->Add(fHistYPtDsbyDecChannel[ih]);
237 fHistOriginPrompt=new TH1F("hOriginPrompt","",100,0.,0.5);
238 fHistOriginPrompt->Sumw2();
239 fHistOriginPrompt->SetMinimum(0);
240 fOutput->Add(fHistOriginPrompt);
241 fHistOriginFeeddown=new TH1F("hOriginFeeddown","",100,0.,0.5);
242 fHistOriginFeeddown->Sumw2();
243 fHistOriginFeeddown->SetMinimum(0);
244 fOutput->Add(fHistOriginFeeddown);
249 //______________________________________________________________________________
250 void AliAnalysisTaskCheckHFMCProd::UserExec(Option_t *)
254 AliESDEvent *esd = (AliESDEvent*) (InputEvent());
258 printf("AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
262 fHistoNEvents->Fill(0);
264 Int_t nTracks=esd->GetNumberOfTracks();
265 fHistoTracks->Fill(nTracks);
267 for(Int_t it=0; it<nTracks; it++){
268 AliESDtrack* tr=esd->GetTrack(it);
269 UInt_t status=tr->GetStatus();
270 if(!(status&AliESDtrack::kITSrefit)) continue;
271 if(!(status&AliESDtrack::kTPCin)) continue;
274 fHistoSelTracks->Fill(nSelTracks);
276 const AliMultiplicity* mult=esd->GetMultiplicity();
277 Int_t nTracklets=mult->GetNumberOfTracklets();
278 fHistoTracklets->Fill(nTracklets);
280 const AliESDVertex *spdv=esd->GetVertex();
281 if(spdv && spdv->IsFromVertexer3D()){
282 fHistoSPD3DVtxX->Fill(spdv->GetXv());
283 fHistoSPD3DVtxY->Fill(spdv->GetYv());
284 fHistoSPD3DVtxZ->Fill(spdv->GetZv());
286 if(spdv && spdv->IsFromVertexerZ()){
287 fHistoSPDZVtxX->Fill(spdv->GetXv());
288 fHistoSPDZVtxY->Fill(spdv->GetYv());
289 fHistoSPDZVtxZ->Fill(spdv->GetZv());
291 const AliESDVertex *trkv=esd->GetPrimaryVertex();
292 if(trkv && trkv->GetNContributors()>1){
293 fHistoTRKVtxX->Fill(trkv->GetXv());
294 fHistoTRKVtxY->Fill(trkv->GetYv());
295 fHistoTRKVtxZ->Fill(trkv->GetZv());
301 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
303 Printf("ERROR: Could not retrieve MC event handler");
306 AliMCEvent* mcEvent = eventHandler->MCEvent();
308 Printf("ERROR: Could not retrieve MC event");
311 stack = mcEvent->Stack();
313 Printf("ERROR: stack not available");
316 const AliVVertex* mcVert=mcEvent->GetPrimaryVertex();
318 Printf("ERROR: generated vertex not available");
323 Int_t nParticles=stack->GetNtrack();
324 Double_t dNchdy = 0.;
328 for (Int_t i=0;i<nParticles;i++){
329 TParticle* part = (TParticle*)stack->Particle(i);
330 Int_t absPdg=TMath::Abs(part->GetPdgCode());
333 if(stack->IsPhysicalPrimary(i)){
334 Double_t eta=part->Eta();
335 if(TMath::Abs(eta)<0.5){
336 dNchdy+=0.6666; // 2/3 for the ratio charged/all
341 if (part->Energy() != TMath::Abs(part->Pz())){
342 rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz()));
351 iType=CheckD0Decay(i,stack);
352 if(iType>=0) iPart=0;
354 else if(absPdg==411){
356 iType=CheckDplusDecay(i,stack);
357 if(iType>=0) iPart=1;
359 else if(absPdg==413){
361 iType=CheckDstarDecay(i,stack);
362 if(iType>=0) iPart=2;
364 else if(absPdg==431){
366 iType=CheckDsDecay(i,stack);
367 if(iType==0 || iType==1) iPart=3;
369 else if(absPdg==4122){
371 iType=CheckLcDecay(i,stack);
372 if(iType>=0) iPart=4;
374 if(iSpecies>=0) fHistYPtAllDecay[iSpecies]->Fill(part->Pt(),rapid);
376 // check beauty mesons
377 if(absPdg==511) fHistBYPtAllDecay[0]->Fill(part->Pt(),rapid);
378 else if(absPdg==521) fHistBYPtAllDecay[1]->Fill(part->Pt(),rapid);
379 else if(absPdg==513) fHistBYPtAllDecay[2]->Fill(part->Pt(),rapid);
380 else if(absPdg==531) fHistBYPtAllDecay[3]->Fill(part->Pt(),rapid);
381 else if(absPdg==5122) fHistBYPtAllDecay[4]->Fill(part->Pt(),rapid);
383 if(iSpecies<0) continue; // not a charm meson
385 Double_t distx=part->Vx()-mcVert->GetX();
386 Double_t disty=part->Vy()-mcVert->GetY();
387 Double_t distz=part->Vz()-mcVert->GetZ();
388 Double_t distToVert=TMath::Sqrt(distx*distx+disty*disty+distz*distz);
389 printf("Particle %d dist from origin=%f\n",absPdg,distToVert);
390 TParticle* runningpart=part;
393 if(fSearchUpToQuark){
395 Int_t labmoth=runningpart->GetFirstMother();
396 if(labmoth==-1) break;
397 TParticle *mot=(TParticle*)stack->Particle(labmoth);
398 pdgmoth=TMath::Abs(mot->GetPdgCode());
402 }else if(pdgmoth==4){
411 Int_t labmoth=runningpart->GetFirstMother();
412 if(labmoth==-1) break;
413 TParticle *mot=(TParticle*)stack->Particle(labmoth);
414 pdgmoth=TMath::Abs(mot->GetPdgCode());
415 if(pdgmoth>=500 && pdgmoth<=599){
419 if(pdgmoth>=5000 && pdgmoth<=5999){
426 printf(" From B %d\n",iFromB);
429 fHistYPtPromptAllDecay[iSpecies]->Fill(part->Pt(),rapid);
430 fHistOriginPrompt->Fill(distToVert);
433 fHistYPtFeeddownAllDecay[iSpecies]->Fill(part->Pt(),rapid);
434 fHistOriginFeeddown->Fill(distToVert);
437 if(iPart<0) continue;
438 if(iType<0) continue;
440 if(iPart==0 && iType<=1){
441 fHistYPtD0byDecChannel[iType]->Fill(part->Pt(),rapid);
442 }else if(iPart==1 && iType<=1){
443 fHistYPtDplusbyDecChannel[iType]->Fill(part->Pt(),rapid);
444 }else if(iPart==3 && iType<=1){
445 fHistYPtDsbyDecChannel[iType]->Fill(part->Pt(),rapid);
448 if(iFromB==0 && iPart>=0 && iPart<5) fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid);
449 else if(iFromB==1 && iPart>=0 && iPart<5) fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid);
452 fHistoNcharmed->Fill(dNchdy,nCharmed);
453 fHistoNbVsNc->Fill(nc,nb);
454 fHistoPhysPrim->Fill(nPhysPrim);
460 //______________________________________________________________________________
461 void AliAnalysisTaskCheckHFMCProd::Terminate(Option_t */*option*/)
463 // Terminate analysis
464 fOutput = dynamic_cast<TList*> (GetOutputData(1));
466 printf("ERROR: fOutput not available\n");
476 //______________________________________________________________________________
477 Int_t AliAnalysisTaskCheckHFMCProd::CheckD0Decay(Int_t labD0, AliStack* stack) const{
479 if(labD0<0) return -1;
480 TParticle* dp = (TParticle*)stack->Particle(labD0);
481 Int_t pdgdp=dp->GetPdgCode();
482 Int_t nDau=dp->GetNDaughters();
487 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
488 if(iDau<0) return -1;
489 TParticle* dau=(TParticle*)stack->Particle(iDau);
490 Int_t pdgdau=dau->GetPdgCode();
491 if(TMath::Abs(pdgdau)==321){
492 if(pdgdp>0 && pdgdau>0) return -1;
493 if(pdgdp<0 && pdgdau<0) return -1;
495 }else if(TMath::Abs(pdgdau)==211){
496 if(pdgdp<0 && pdgdau>0) return -1;
497 if(pdgdp>0 && pdgdau<0) return -1;
503 if(nPions!=1) return -1;
504 if(nKaons!=1) return -1;
505 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
506 if(iDau<0) return -1;
511 if(nDau==3 || nDau==4){
514 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
515 if(iDau<0) return -1;
516 TParticle* dau=(TParticle*)stack->Particle(iDau);
517 Int_t pdgdau=dau->GetPdgCode();
518 if(TMath::Abs(pdgdau)==321){
519 if(pdgdp>0 && pdgdau>0) return -1;
520 if(pdgdp<0 && pdgdau<0) return -1;
522 }else if(TMath::Abs(pdgdau)==113 || TMath::Abs(pdgdau)==313){
523 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
524 if(resDau<0) return -1;
525 TParticle* resdau=(TParticle*)stack->Particle(resDau);
526 Int_t pdgresdau=resdau->GetPdgCode();
527 if(TMath::Abs(pdgresdau)==321){
528 if(pdgdp>0 && pdgresdau>0) return -1;
529 if(pdgdp<0 && pdgresdau<0) return -1;
532 if(TMath::Abs(pdgresdau)==211){
536 }else if(TMath::Abs(pdgdau)==211){
542 if(nPions!=3) return -1;
543 if(nKaons!=1) return -1;
544 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
545 if(iDau<0) return -1;
554 //______________________________________________________________________________
555 Int_t AliAnalysisTaskCheckHFMCProd::CheckDplusDecay(Int_t labDplus, AliStack* stack) const{
557 if(labDplus<0) return -1;
558 TParticle* dp = (TParticle*)stack->Particle(labDplus);
559 Int_t pdgdp=dp->GetPdgCode();
560 Int_t nDau=dp->GetNDaughters();
565 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
566 if(iDau<0) return -1;
567 TParticle* dau=(TParticle*)stack->Particle(iDau);
568 Int_t pdgdau=dau->GetPdgCode();
569 if(TMath::Abs(pdgdau)==321){
570 if(pdgdp>0 && pdgdau>0) return -1;
571 if(pdgdp<0 && pdgdau<0) return -1;
573 }else if(TMath::Abs(pdgdau)==211){
574 if(pdgdp<0 && pdgdau>0) return -1;
575 if(pdgdp>0 && pdgdau<0) return -1;
581 if(nPions!=2) return -1;
582 if(nKaons!=1) return -1;
583 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
584 if(iDau<0) return -1;
592 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
593 if(iDau<0) return -1;
594 TParticle* dau=(TParticle*)stack->Particle(iDau);
595 Int_t pdgdau=dau->GetPdgCode();
596 if(TMath::Abs(pdgdau)==313){
597 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
598 if(resDau<0) return -1;
599 TParticle* resdau=(TParticle*)stack->Particle(resDau);
600 Int_t pdgresdau=resdau->GetPdgCode();
601 if(TMath::Abs(pdgresdau)==321){
602 if(pdgdp>0 && pdgresdau>0) return -1;
603 if(pdgdp<0 && pdgresdau<0) return -1;
606 if(TMath::Abs(pdgresdau)==211){
607 if(pdgdp<0 && pdgresdau>0) return -1;
608 if(pdgdp>0 && pdgresdau<0) return -1;
612 }else if(TMath::Abs(pdgdau)==211){
613 if(pdgdp<0 && pdgdau>0) return -1;
614 if(pdgdp>0 && pdgdau<0) return -1;
620 if(nPions!=2) return -1;
621 if(nKaons!=1) return -1;
622 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
623 if(iDau<0) return -1;
630 //______________________________________________________________________________
631 Int_t AliAnalysisTaskCheckHFMCProd::CheckDsDecay(Int_t labDs, AliStack* stack) const{
633 if(labDs<0) return -1;
634 TParticle* dp = (TParticle*)stack->Particle(labDs);
635 Int_t pdgdp=dp->GetPdgCode();
636 Int_t nDau=dp->GetNDaughters();
641 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
642 if(iDau<0) return -1;
643 TParticle* dau=(TParticle*)stack->Particle(iDau);
644 Int_t pdgdau=dau->GetPdgCode();
645 if(TMath::Abs(pdgdau)==321){
647 }else if(TMath::Abs(pdgdau)==211){
648 if(pdgdp<0 && pdgdau>0) return -1;
649 if(pdgdp>0 && pdgdau<0) return -1;
655 if(nPions!=1) return -1;
656 if(nKaons!=2) return -1;
657 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
658 if(iDau<0) return -1;
667 Bool_t isk0st=kFALSE;
668 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
669 if(iDau<0) return -1;
670 TParticle* dau=(TParticle*)stack->Particle(iDau);
671 Int_t pdgdau=dau->GetPdgCode();
672 if(TMath::Abs(pdgdau)==313){
674 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
675 if(resDau<0) return -1;
676 TParticle* resdau=(TParticle*)stack->Particle(resDau);
677 Int_t pdgresdau=resdau->GetPdgCode();
678 if(TMath::Abs(pdgresdau)==321){
681 if(TMath::Abs(pdgresdau)==211){
682 if(pdgdp<0 && pdgresdau>0) return -1;
683 if(pdgdp>0 && pdgresdau<0) return -1;
687 }else if(TMath::Abs(pdgdau)==333){
689 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
690 if(resDau<0) return -1;
691 TParticle* resdau=(TParticle*)stack->Particle(resDau);
692 if(!resdau) return -1;
693 Int_t pdgresdau=resdau->GetPdgCode();
694 if(TMath::Abs(pdgresdau)==321){
700 }else if(TMath::Abs(pdgdau)==211){
701 if(pdgdp<0 && pdgdau>0) return -1;
702 if(pdgdp>0 && pdgdau<0) return -1;
704 }else if(TMath::Abs(pdgdau)==321){
710 if(nPions!=1) return -1;
711 if(nKaons!=2) return -1;
712 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
713 if(iDau<0) return -1;
716 else if(isPhi) return 0;
722 //______________________________________________________________________________
723 Int_t AliAnalysisTaskCheckHFMCProd::CheckDstarDecay(Int_t labDstar, AliStack* stack) const{
725 if(labDstar<0) return -1;
726 TParticle* dp = (TParticle*)stack->Particle(labDstar);
727 Int_t pdgdp=dp->GetPdgCode();
728 Int_t nDau=dp->GetNDaughters();
729 if(nDau!=2) return -1;
733 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
734 if(iDau<0) return -1;
735 TParticle* dau=(TParticle*)stack->Particle(iDau);
736 Int_t pdgdau=dau->GetPdgCode();
737 if(TMath::Abs(pdgdau)==421){
738 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
739 if(resDau<0) return -1;
740 TParticle* resdau=(TParticle*)stack->Particle(resDau);
741 Int_t pdgresdau=resdau->GetPdgCode();
742 if(TMath::Abs(pdgresdau)==321){
743 if(pdgdp>0 && pdgresdau>0) return -1;
744 if(pdgdp<0 && pdgresdau<0) return -1;
747 if(TMath::Abs(pdgresdau)==211){
748 if(pdgdp<0 && pdgresdau>0) return -1;
749 if(pdgdp>0 && pdgresdau<0) return -1;
753 }else if(TMath::Abs(pdgdau)==211){
754 if(pdgdp<0 && pdgdau>0) return -1;
755 if(pdgdp>0 && pdgdau<0) return -1;
761 if(nPions!=2) return -1;
762 if(nKaons!=1) return -1;
763 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
764 if(iDau<0) return -1;
770 //______________________________________________________________________________
771 Int_t AliAnalysisTaskCheckHFMCProd::CheckLcDecay(Int_t labLc, AliStack* stack) const{
772 if(labLc<0) return -1;
773 TParticle* dp = (TParticle*)stack->Particle(labLc);
774 Int_t pdgdp=dp->GetPdgCode();
775 Int_t nDau=dp->GetNDaughters();
781 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
782 if(iDau<0) return -1;
783 TParticle* dau=(TParticle*)stack->Particle(iDau);
784 Int_t pdgdau=dau->GetPdgCode();
785 if(TMath::Abs(pdgdau)==321){
786 if(pdgdp>0 && pdgdau>0) return -1;
787 if(pdgdp<0 && pdgdau<0) return -1;
789 }else if(TMath::Abs(pdgdau)==211){
790 if(pdgdp<0 && pdgdau>0) return -1;
791 if(pdgdp>0 && pdgdau<0) return -1;
793 }else if(TMath::Abs(pdgdau)==2212){
794 if(pdgdp<0 && pdgdau>0) return -1;
795 if(pdgdp>0 && pdgdau<0) return -1;
801 if(nPions!=1) return -1;
802 if(nKaons!=1) return -1;
803 if(nProtons!=1) return -1;
804 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
805 if(iDau<0) return -1;
814 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
815 if(iDau<0) return -1;
816 TParticle* dau=(TParticle*)stack->Particle(iDau);
817 Int_t pdgdau=dau->GetPdgCode();
818 if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224
819 || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){
820 Int_t nDauRes=dau->GetNDaughters();
821 if(nDauRes!=2) return -1;
822 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
823 if(resDau<0) return -1;
824 TParticle* resdau=(TParticle*)stack->Particle(resDau);
825 Int_t pdgresdau=resdau->GetPdgCode();
826 if(TMath::Abs(pdgresdau)==321){
827 if(pdgdp>0 && pdgresdau>0) return -1;
828 if(pdgdp<0 && pdgresdau<0) return -1;
831 if(TMath::Abs(pdgresdau)==211){
832 if(pdgdp<0 && pdgresdau>0) return -1;
833 if(pdgdp>0 && pdgresdau<0) return -1;
836 if(TMath::Abs(pdgresdau)==2212){
837 if(pdgdp<0 && pdgresdau>0) return -1;
838 if(pdgdp>0 && pdgresdau<0) return -1;
842 }else if(TMath::Abs(pdgdau)==321){
843 if(pdgdp>0 && pdgdau>0) return -1;
844 if(pdgdp<0 && pdgdau<0) return -1;
846 }else if(TMath::Abs(pdgdau)==211){
847 if(pdgdp<0 && pdgdau>0) return -1;
848 if(pdgdp>0 && pdgdau<0) return -1;
850 }else if(TMath::Abs(pdgdau)==2212){
851 if(pdgdp<0 && pdgdau>0) return -1;
852 if(pdgdp>0 && pdgdau<0) return -1;
858 if(nPions!=1) return -1;
859 if(nKaons!=1) return -1;
860 if(nProtons!=1) return -1;
861 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
862 if(iDau<0) return -1;