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"),
69 DefineInput(0, TChain::Class());
70 DefineOutput(1, TList::Class());
74 //___________________________________________________________________________
75 AliAnalysisTaskCheckHFMCProd::~AliAnalysisTaskCheckHFMCProd(){
77 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
84 //___________________________________________________________________________
85 void AliAnalysisTaskCheckHFMCProd::UserCreateOutputObjects() {
86 // create output histos
88 fOutput = new TList();
90 fOutput->SetName("OutputHistos");
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);
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);
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);
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);
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);
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);
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.);
156 fHistYPtAllDecay[0] = new TH2F("hyptd0AllDecay","D0 - All",20,0.,20.,40,-2.,2.);
157 fHistYPtAllDecay[1] = new TH2F("hyptdplusAllDecay","Dplus - All",20,0.,20.,40,-2.,2.);
158 fHistYPtAllDecay[2] = new TH2F("hyptdstarAllDecay","Dstar - All",20,0.,20.,40,-2.,2.);
159 fHistYPtAllDecay[3] = new TH2F("hyptdsAllDecay","Ds - All",20,0.,20.,40,-2.,2.);
160 fHistYPtAllDecay[4] = new TH2F("hyptlcAllDecay","Lc - All",20,0.,20.,40,-2.,2.);
162 fHistYPtPromptAllDecay[0] = new TH2F("hyptd0promptAllDecay","D0 - Prompt",20,0.,20.,40,-2.,2.);
163 fHistYPtPromptAllDecay[1] = new TH2F("hyptdpluspromptAllDecay","Dplus - Prompt",20,0.,20.,40,-2.,2.);
164 fHistYPtPromptAllDecay[2] = new TH2F("hyptdstarpromptAllDecay","Dstar - Prompt",20,0.,20.,40,-2.,2.);
165 fHistYPtPromptAllDecay[3] = new TH2F("hyptdspromptAllDecay","Ds - Prompt",20,0.,20.,40,-2.,2.);
166 fHistYPtPromptAllDecay[4] = new TH2F("hyptlcpromptAllDecay","Lc - Prompt",20,0.,20.,40,-2.,2.);
168 fHistYPtFeeddownAllDecay[0] = new TH2F("hyptd0feeddownAllDecay","D0 - FromB",20,0.,20.,40,-2.,2.);
169 fHistYPtFeeddownAllDecay[1] = new TH2F("hyptdplusfeeddownAllDecay","Dplus - FromB",20,0.,20.,40,-2.,2.);
170 fHistYPtFeeddownAllDecay[2] = new TH2F("hyptdstarfeeddownAllDecay","Dstar - FromB",20,0.,20.,40,-2.,2.);
171 fHistYPtFeeddownAllDecay[3] = new TH2F("hyptdsfeeddownAllDecay","Ds - FromB",20,0.,20.,40,-2.,2.);
172 fHistYPtFeeddownAllDecay[4] = new TH2F("hyptlcfeeddownAllDecay","Lc - FromB",20,0.,20.,40,-2.,2.);
175 fHistYPtFeeddown[0] = new TH2F("hyptd0feeddown","D0 - Feeddown",20,0.,20.,20,-2.,2.);
176 fHistYPtFeeddown[1] = new TH2F("hyptdplusfeeddown","Dplus - Feeddown",20,0.,20.,20,-2.,2.);
177 fHistYPtFeeddown[2] = new TH2F("hyptdstarfeedown","Dstar - Feeddown",20,0.,20.,20,-2.,2.);
178 fHistYPtFeeddown[3] = new TH2F("hyptdsfeedown","Ds - Feeddown",20,0.,20.,20,-2.,2.);
179 fHistYPtFeeddown[4] = new TH2F("hyptlcfeedown","Lc - Feeddown",20,0.,20.,20,-2.,2.);
181 for(Int_t ih=0; ih<5; ih++){
182 fHistYPtAllDecay[ih]->Sumw2();
183 fHistYPtAllDecay[ih]->SetMinimum(0);
184 fOutput->Add(fHistYPtAllDecay[ih]);
185 fHistYPtPromptAllDecay[ih]->Sumw2();
186 fHistYPtPromptAllDecay[ih]->SetMinimum(0);
187 fOutput->Add(fHistYPtPromptAllDecay[ih]);
188 fHistYPtFeeddownAllDecay[ih]->Sumw2();
189 fHistYPtFeeddownAllDecay[ih]->SetMinimum(0);
190 fOutput->Add(fHistYPtFeeddownAllDecay[ih]);
191 fHistYPtPrompt[ih]->Sumw2();
192 fHistYPtPrompt[ih]->SetMinimum(0);
193 fOutput->Add(fHistYPtPrompt[ih]);
194 fHistYPtFeeddown[ih]->Sumw2();
195 fHistYPtFeeddown[ih]->SetMinimum(0);
196 fOutput->Add(fHistYPtFeeddown[ih]);
199 fHistYPtD0byDecChannel[0] = new TH2F("hyptD02","D0 - 2prong",20,0.,20.,20,-2.,2.);
200 fHistYPtD0byDecChannel[1] = new TH2F("hyptD04","D0 - 4prong",20,0.,20.,20,-2.,2.);
201 fHistYPtDplusbyDecChannel[0] = new TH2F("hyptDplusnonreson","Dplus - non reson",20,0.,20.,20,-2.,2.);
202 fHistYPtDplusbyDecChannel[1] = new TH2F("hyptDplusreson","Dplus - reson via K0*",20,0.,20.,20,-2.,2.);
203 fHistYPtDsbyDecChannel[0] = new TH2F("hyptdsphi","Ds - vis Phi",20,0.,20.,20,-2.,2.);
204 fHistYPtDsbyDecChannel[1] = new TH2F("hyptdsk0st","Ds - via k0*",20,0.,20.,20,-2.,2.);
206 for(Int_t ih=0; ih<2; ih++){
208 fHistYPtD0byDecChannel[ih]->Sumw2();
209 fHistYPtD0byDecChannel[ih]->SetMinimum(0);
210 fOutput->Add(fHistYPtD0byDecChannel[ih]);
211 fHistYPtDplusbyDecChannel[ih]->Sumw2();
212 fHistYPtDplusbyDecChannel[ih]->SetMinimum(0);
213 fOutput->Add(fHistYPtDplusbyDecChannel[ih]);
214 fHistYPtDsbyDecChannel[ih]->Sumw2();
215 fHistYPtDsbyDecChannel[ih]->SetMinimum(0);
216 fOutput->Add(fHistYPtDsbyDecChannel[ih]);
223 //______________________________________________________________________________
224 void AliAnalysisTaskCheckHFMCProd::UserExec(Option_t *)
228 AliESDEvent *esd = (AliESDEvent*) (InputEvent());
232 printf("AliAnalysisTaskSDDRP::Exec(): bad ESD\n");
236 fHistoNEvents->Fill(0);
238 Int_t nTracks=esd->GetNumberOfTracks();
239 fHistoTracks->Fill(nTracks);
241 for(Int_t it=0; it<nTracks; it++){
242 AliESDtrack* tr=esd->GetTrack(it);
243 UInt_t status=tr->GetStatus();
244 if(!(status&AliESDtrack::kITSrefit)) continue;
245 if(!(status&AliESDtrack::kTPCin)) continue;
248 fHistoSelTracks->Fill(nSelTracks);
250 const AliMultiplicity* mult=esd->GetMultiplicity();
251 Int_t nTracklets=mult->GetNumberOfTracklets();
252 fHistoTracklets->Fill(nTracklets);
254 const AliESDVertex *spdv=esd->GetVertex();
255 if(spdv && spdv->IsFromVertexer3D()){
256 fHistoSPD3DVtxX->Fill(spdv->GetXv());
257 fHistoSPD3DVtxY->Fill(spdv->GetYv());
258 fHistoSPD3DVtxZ->Fill(spdv->GetZv());
260 if(spdv && spdv->IsFromVertexerZ()){
261 fHistoSPDZVtxX->Fill(spdv->GetXv());
262 fHistoSPDZVtxY->Fill(spdv->GetYv());
263 fHistoSPDZVtxZ->Fill(spdv->GetZv());
265 const AliESDVertex *trkv=esd->GetPrimaryVertex();
266 if(trkv && trkv->GetNContributors()>1){
267 fHistoTRKVtxX->Fill(trkv->GetXv());
268 fHistoTRKVtxY->Fill(trkv->GetYv());
269 fHistoTRKVtxZ->Fill(trkv->GetZv());
275 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
277 Printf("ERROR: Could not retrieve MC event handler");
280 AliMCEvent* mcEvent = eventHandler->MCEvent();
282 Printf("ERROR: Could not retrieve MC event");
285 stack = mcEvent->Stack();
287 Printf("ERROR: stack not available");
292 Int_t nParticles=stack->GetNtrack();
293 Double_t dNchdy = 0.;
296 for (Int_t i=0;i<nParticles;i++){
297 TParticle* part = (TParticle*)stack->Particle(i);
298 Int_t absPdg=TMath::Abs(part->GetPdgCode());
301 if(stack->IsPhysicalPrimary(i)){
302 Double_t eta=part->Eta();
303 if(TMath::Abs(eta)<0.5) dNchdy+=0.6666; // 2/3 for the ratio charged/all
306 if (part->Energy() != TMath::Abs(part->Pz())){
307 rapid=0.5*TMath::Log((part->Energy()+part->Pz())/(part->Energy()-part->Pz()));
316 iType=CheckD0Decay(i,stack);
317 if(iType>=0) iPart=0;
319 else if(absPdg==411){
321 iType=CheckDplusDecay(i,stack);
322 if(iType>=0) iPart=1;
324 else if(absPdg==413){
326 iType=CheckDstarDecay(i,stack);
327 if(iType>=0) iPart=2;
329 else if(absPdg==431){
331 iType=CheckDsDecay(i,stack);
332 if(iType==0 || iType==1) iPart=3;
334 else if(absPdg==4122){
336 iType=CheckLcDecay(i,stack);
337 if(iType>=0) iPart=4;
339 if(iSpecies<0) continue;
340 fHistYPtAllDecay[iSpecies]->Fill(part->Pt(),rapid);
342 TParticle* runningpart=part;
346 Int_t labmoth=runningpart->GetFirstMother();
347 if(labmoth==-1) break;
348 TParticle *mot=(TParticle*)stack->Particle(labmoth);
349 pdgmoth=TMath::Abs(mot->GetPdgCode());
353 }else if(pdgmoth==4){
359 if(iFromB<0) continue;
360 else if(iFromB==0) fHistYPtPromptAllDecay[iSpecies]->Fill(part->Pt(),rapid);
361 else if(iFromB==1) fHistYPtFeeddownAllDecay[iSpecies]->Fill(part->Pt(),rapid);
363 if(iPart<0) continue;
364 if(iType<0) continue;
366 if(iPart==0 && iType<=1){
367 fHistYPtD0byDecChannel[iType]->Fill(part->Pt(),rapid);
368 }else if(iPart==1 && iType<=1){
369 fHistYPtDplusbyDecChannel[iType]->Fill(part->Pt(),rapid);
370 }else if(iPart==3 && iType<=1){
371 fHistYPtDsbyDecChannel[iType]->Fill(part->Pt(),rapid);
374 if(iFromB==0 && iPart>=0 && iPart<5) fHistYPtPrompt[iPart]->Fill(part->Pt(),rapid);
375 else if(iFromB==1 && iPart>=0 && iPart<5) fHistYPtFeeddown[iPart]->Fill(part->Pt(),rapid);
378 fHistoNcharmed->Fill(dNchdy,nCharmed);
379 fHistoNbVsNc->Fill(nc,nb);
385 //______________________________________________________________________________
386 void AliAnalysisTaskCheckHFMCProd::Terminate(Option_t */*option*/)
388 // Terminate analysis
389 fOutput = dynamic_cast<TList*> (GetOutputData(1));
391 printf("ERROR: fOutput not available\n");
401 //______________________________________________________________________________
402 Int_t AliAnalysisTaskCheckHFMCProd::CheckD0Decay(Int_t labD0, AliStack* stack) const{
404 if(labD0<0) return -1;
405 TParticle* dp = (TParticle*)stack->Particle(labD0);
406 Int_t pdgdp=dp->GetPdgCode();
407 Int_t nDau=dp->GetNDaughters();
412 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
413 if(iDau<0) return -1;
414 TParticle* dau=(TParticle*)stack->Particle(iDau);
415 Int_t pdgdau=dau->GetPdgCode();
416 if(TMath::Abs(pdgdau)==321){
417 if(pdgdp>0 && pdgdau>0) return -1;
418 if(pdgdp<0 && pdgdau<0) return -1;
420 }else if(TMath::Abs(pdgdau)==211){
421 if(pdgdp<0 && pdgdau>0) return -1;
422 if(pdgdp>0 && pdgdau<0) return -1;
428 if(nPions!=1) return -1;
429 if(nKaons!=1) return -1;
430 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
431 if(iDau<0) return -1;
436 if(nDau==3 || nDau==4){
439 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
440 if(iDau<0) return -1;
441 TParticle* dau=(TParticle*)stack->Particle(iDau);
442 Int_t pdgdau=dau->GetPdgCode();
443 if(TMath::Abs(pdgdau)==321){
444 if(pdgdp>0 && pdgdau>0) return -1;
445 if(pdgdp<0 && pdgdau<0) return -1;
447 }else if(TMath::Abs(pdgdau)==113 || TMath::Abs(pdgdau)==313){
448 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
449 if(resDau<0) return -1;
450 TParticle* resdau=(TParticle*)stack->Particle(resDau);
451 Int_t pdgresdau=resdau->GetPdgCode();
452 if(TMath::Abs(pdgresdau)==321){
453 if(pdgdp>0 && pdgresdau>0) return -1;
454 if(pdgdp<0 && pdgresdau<0) return -1;
457 if(TMath::Abs(pdgresdau)==211){
461 }else if(TMath::Abs(pdgdau)==211){
467 if(nPions!=3) return -1;
468 if(nKaons!=1) return -1;
469 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
470 if(iDau<0) return -1;
479 //______________________________________________________________________________
480 Int_t AliAnalysisTaskCheckHFMCProd::CheckDplusDecay(Int_t labDplus, AliStack* stack) const{
482 if(labDplus<0) return -1;
483 TParticle* dp = (TParticle*)stack->Particle(labDplus);
484 Int_t pdgdp=dp->GetPdgCode();
485 Int_t nDau=dp->GetNDaughters();
490 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
491 if(iDau<0) return -1;
492 TParticle* dau=(TParticle*)stack->Particle(iDau);
493 Int_t pdgdau=dau->GetPdgCode();
494 if(TMath::Abs(pdgdau)==321){
495 if(pdgdp>0 && pdgdau>0) return -1;
496 if(pdgdp<0 && pdgdau<0) return -1;
498 }else if(TMath::Abs(pdgdau)==211){
499 if(pdgdp<0 && pdgdau>0) return -1;
500 if(pdgdp>0 && pdgdau<0) return -1;
506 if(nPions!=2) return -1;
507 if(nKaons!=1) return -1;
508 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
509 if(iDau<0) return -1;
517 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
518 if(iDau<0) return -1;
519 TParticle* dau=(TParticle*)stack->Particle(iDau);
520 Int_t pdgdau=dau->GetPdgCode();
521 if(TMath::Abs(pdgdau)==313){
522 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
523 if(resDau<0) return -1;
524 TParticle* resdau=(TParticle*)stack->Particle(resDau);
525 Int_t pdgresdau=resdau->GetPdgCode();
526 if(TMath::Abs(pdgresdau)==321){
527 if(pdgdp>0 && pdgresdau>0) return -1;
528 if(pdgdp<0 && pdgresdau<0) return -1;
531 if(TMath::Abs(pdgresdau)==211){
532 if(pdgdp<0 && pdgresdau>0) return -1;
533 if(pdgdp>0 && pdgresdau<0) return -1;
537 }else if(TMath::Abs(pdgdau)==211){
538 if(pdgdp<0 && pdgdau>0) return -1;
539 if(pdgdp>0 && pdgdau<0) return -1;
545 if(nPions!=2) return -1;
546 if(nKaons!=1) return -1;
547 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
548 if(iDau<0) return -1;
555 //______________________________________________________________________________
556 Int_t AliAnalysisTaskCheckHFMCProd::CheckDsDecay(Int_t labDs, AliStack* stack) const{
558 if(labDs<0) return -1;
559 TParticle* dp = (TParticle*)stack->Particle(labDs);
560 Int_t pdgdp=dp->GetPdgCode();
561 Int_t nDau=dp->GetNDaughters();
566 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
567 if(iDau<0) return -1;
568 TParticle* dau=(TParticle*)stack->Particle(iDau);
569 Int_t pdgdau=dau->GetPdgCode();
570 if(TMath::Abs(pdgdau)==321){
572 }else if(TMath::Abs(pdgdau)==211){
573 if(pdgdp<0 && pdgdau>0) return -1;
574 if(pdgdp>0 && pdgdau<0) return -1;
580 if(nPions!=1) return -1;
581 if(nKaons!=2) return -1;
582 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
583 if(iDau<0) return -1;
592 Bool_t isk0st=kFALSE;
593 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
594 if(iDau<0) return -1;
595 TParticle* dau=(TParticle*)stack->Particle(iDau);
596 Int_t pdgdau=dau->GetPdgCode();
597 if(TMath::Abs(pdgdau)==313){
599 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
600 if(resDau<0) return -1;
601 TParticle* resdau=(TParticle*)stack->Particle(resDau);
602 Int_t pdgresdau=resdau->GetPdgCode();
603 if(TMath::Abs(pdgresdau)==321){
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)==333){
614 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
615 if(resDau<0) return -1;
616 TParticle* resdau=(TParticle*)stack->Particle(resDau);
617 if(!resdau) return -1;
618 Int_t pdgresdau=resdau->GetPdgCode();
619 if(TMath::Abs(pdgresdau)==321){
625 }else if(TMath::Abs(pdgdau)==211){
626 if(pdgdp<0 && pdgdau>0) return -1;
627 if(pdgdp>0 && pdgdau<0) return -1;
629 }else if(TMath::Abs(pdgdau)==321){
635 if(nPions!=1) return -1;
636 if(nKaons!=2) return -1;
637 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
638 if(iDau<0) return -1;
641 else if(isPhi) return 0;
647 //______________________________________________________________________________
648 Int_t AliAnalysisTaskCheckHFMCProd::CheckDstarDecay(Int_t labDstar, AliStack* stack) const{
650 if(labDstar<0) return -1;
651 TParticle* dp = (TParticle*)stack->Particle(labDstar);
652 Int_t pdgdp=dp->GetPdgCode();
653 Int_t nDau=dp->GetNDaughters();
654 if(nDau!=2) return -1;
658 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
659 if(iDau<0) return -1;
660 TParticle* dau=(TParticle*)stack->Particle(iDau);
661 Int_t pdgdau=dau->GetPdgCode();
662 if(TMath::Abs(pdgdau)==421){
663 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
664 if(resDau<0) return -1;
665 TParticle* resdau=(TParticle*)stack->Particle(resDau);
666 Int_t pdgresdau=resdau->GetPdgCode();
667 if(TMath::Abs(pdgresdau)==321){
668 if(pdgdp>0 && pdgresdau>0) return -1;
669 if(pdgdp<0 && pdgresdau<0) return -1;
672 if(TMath::Abs(pdgresdau)==211){
673 if(pdgdp<0 && pdgresdau>0) return -1;
674 if(pdgdp>0 && pdgresdau<0) return -1;
678 }else if(TMath::Abs(pdgdau)==211){
679 if(pdgdp<0 && pdgdau>0) return -1;
680 if(pdgdp>0 && pdgdau<0) return -1;
686 if(nPions!=2) return -1;
687 if(nKaons!=1) return -1;
688 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
689 if(iDau<0) return -1;
695 //______________________________________________________________________________
696 Int_t AliAnalysisTaskCheckHFMCProd::CheckLcDecay(Int_t labLc, AliStack* stack) const{
697 if(labLc<0) return -1;
698 TParticle* dp = (TParticle*)stack->Particle(labLc);
699 Int_t pdgdp=dp->GetPdgCode();
700 Int_t nDau=dp->GetNDaughters();
706 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
707 if(iDau<0) return -1;
708 TParticle* dau=(TParticle*)stack->Particle(iDau);
709 Int_t pdgdau=dau->GetPdgCode();
710 if(TMath::Abs(pdgdau)==321){
711 if(pdgdp>0 && pdgdau>0) return -1;
712 if(pdgdp<0 && pdgdau<0) return -1;
714 }else if(TMath::Abs(pdgdau)==211){
715 if(pdgdp<0 && pdgdau>0) return -1;
716 if(pdgdp>0 && pdgdau<0) return -1;
718 }else if(TMath::Abs(pdgdau)==2212){
719 if(pdgdp<0 && pdgdau>0) return -1;
720 if(pdgdp>0 && pdgdau<0) return -1;
726 if(nPions!=1) return -1;
727 if(nKaons!=1) return -1;
728 if(nProtons!=1) return -1;
729 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
730 if(iDau<0) return -1;
739 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
740 if(iDau<0) return -1;
741 TParticle* dau=(TParticle*)stack->Particle(iDau);
742 Int_t pdgdau=dau->GetPdgCode();
743 if(TMath::Abs(pdgdau)==313 || TMath::Abs(pdgdau)==3124 || TMath::Abs(pdgdau)==2224
744 || TMath::Abs(pdgdau)==3122 || TMath::Abs(pdgdau)==311){
745 Int_t nDauRes=dau->GetNDaughters();
746 if(nDauRes!=2) return -1;
747 for(Int_t resDau=dau->GetFirstDaughter(); resDau<=dau->GetLastDaughter(); resDau++){
748 if(resDau<0) return -1;
749 TParticle* resdau=(TParticle*)stack->Particle(resDau);
750 Int_t pdgresdau=resdau->GetPdgCode();
751 if(TMath::Abs(pdgresdau)==321){
752 if(pdgdp>0 && pdgresdau>0) return -1;
753 if(pdgdp<0 && pdgresdau<0) return -1;
756 if(TMath::Abs(pdgresdau)==211){
757 if(pdgdp<0 && pdgresdau>0) return -1;
758 if(pdgdp>0 && pdgresdau<0) return -1;
761 if(TMath::Abs(pdgresdau)==2212){
762 if(pdgdp<0 && pdgresdau>0) return -1;
763 if(pdgdp>0 && pdgresdau<0) return -1;
767 }else if(TMath::Abs(pdgdau)==321){
768 if(pdgdp>0 && pdgdau>0) return -1;
769 if(pdgdp<0 && pdgdau<0) return -1;
771 }else if(TMath::Abs(pdgdau)==211){
772 if(pdgdp<0 && pdgdau>0) return -1;
773 if(pdgdp>0 && pdgdau<0) return -1;
775 }else if(TMath::Abs(pdgdau)==2212){
776 if(pdgdp<0 && pdgdau>0) return -1;
777 if(pdgdp>0 && pdgdau<0) return -1;
783 if(nPions!=1) return -1;
784 if(nKaons!=1) return -1;
785 if(nProtons!=1) return -1;
786 for(Int_t iDau=dp->GetFirstDaughter(); iDau<=dp->GetLastDaughter(); iDau++){
787 if(iDau<0) return -1;