1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 analysis utils for MC data
18 // stored in stack or event header.
20 // - method to check the origin of a given track/cluster
21 // - method to obtain the generated jets
23 //*-- Author: Gustavo Conesa (LNF-INFN)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
30 #include "TParticle.h"
31 #include "TDatabasePDG.h"
34 //---- ANALYSIS system ----
35 #include "AliMCAnalysisUtils.h"
36 #include "AliCaloTrackReader.h"
38 #include "AliGenPythiaEventHeader.h"
39 #include "AliAODMCParticle.h"
41 ClassImp(AliMCAnalysisUtils)
43 //________________________________________
44 AliMCAnalysisUtils::AliMCAnalysisUtils() :
49 fMCGenerator(kPythia),
50 fMCGeneratorString("PYTHIA"),
51 fDaughMom(), fDaughMom2(),
52 fMotherMom(), fGMotherMom()
57 //_______________________________________
58 AliMCAnalysisUtils::~AliMCAnalysisUtils()
60 // Remove all pointers.
69 //_____________________________________________________________________________________________
70 Int_t AliMCAnalysisUtils::CheckCommonAncestor(Int_t index1, Int_t index2,
71 const AliCaloTrackReader* reader,
72 Int_t & ancPDG, Int_t & ancStatus,
73 TLorentzVector & momentum, TVector3 & prodVertex)
75 // Check the first common ancestor of 2 clusters, given the most likely labels of the primaries generating such clusters.
84 if(label1[0]==label2[0])
86 //printf("AliMCAnalysisUtils::CheckCommonAncestor() - Already the same label: %d\n",label1[0]);
92 if(reader->ReadAODMCParticles())
94 TClonesArray * mcparticles = reader->GetAODMCParticles();
96 Int_t label=label1[0];
97 if(label < 0) return -1;
99 while(label > -1 && counter1 < 99)
102 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
105 label = mom->GetMother() ;
106 label1[counter1]=label;
108 //printf("\t counter %d, label %d\n", counter1,label);
111 //printf("Org label2=%d,\n",label2[0]);
113 if(label < 0) return -1;
115 while(label > -1 && counter2 < 99)
118 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
121 label = mom->GetMother() ;
122 label2[counter2]=label;
124 //printf("\t counter %d, label %d\n", counter2,label);
128 { //Kine stack from ESDs
129 AliStack * stack = reader->GetStack();
131 Int_t label=label1[0];
132 while(label > -1 && counter1 < 99)
135 TParticle * mom = stack->Particle(label);
138 label = mom->GetFirstMother() ;
139 label1[counter1]=label;
141 //printf("\t counter %d, label %d\n", counter1,label);
144 //printf("Org label2=%d,\n",label2[0]);
147 while(label > -1 && counter2 < 99)
150 TParticle * mom = stack->Particle(label);
153 label = mom->GetFirstMother() ;
154 label2[counter2]=label;
156 //printf("\t counter %d, label %d\n", counter2,label);
158 }// Kine stack from ESDs
159 }//First labels not the same
161 if((counter1==99 || counter2==99) && fDebug >=0)
162 printf("AliMCAnalysisUtils::CheckCommonAncestor() - Genealogy too large c1: %d, c2= %d\n", counter1, counter2);
163 //printf("CheckAncestor:\n");
165 Int_t commonparents = 0;
167 //printf("counters %d %d \n",counter1, counter2);
168 for (Int_t c1 = 0; c1 < counter1; c1++)
170 for (Int_t c2 = 0; c2 < counter2; c2++)
172 if(label1[c1]==label2[c2] && label1[c1]>-1)
174 ancLabel = label1[c1];
177 if(reader->ReadAODMCParticles())
179 AliAODMCParticle * mom = (AliAODMCParticle *) reader->GetAODMCParticles()->At(label1[c1]);
183 ancPDG = mom->GetPdgCode();
184 ancStatus = mom->GetStatus();
185 momentum.SetPxPyPzE(mom->Px(),mom->Py(),mom->Pz(),mom->E());
186 prodVertex.SetXYZ(mom->Xv(),mom->Yv(),mom->Zv());
191 TParticle * mom = (reader->GetStack())->Particle(label1[c1]);
195 ancPDG = mom->GetPdgCode();
196 ancStatus = mom->GetStatusCode();
197 mom->Momentum(momentum);
198 prodVertex.SetXYZ(mom->Vx(),mom->Vy(),mom->Vz());
202 //First ancestor found, end the loops
206 }//second cluster loop
207 }//first cluster loop
213 momentum.SetXYZT(0,0,0,0);
214 prodVertex.SetXYZ(-10,-10,-10);
220 //________________________________________________________________________________________
221 Int_t AliMCAnalysisUtils::CheckOrigin(const Int_t * label, Int_t nlabels,
222 const AliCaloTrackReader* reader, Int_t calorimeter)
224 // Play with the montecarlo particles if available.
229 printf("AliMCAnalysisUtils::CheckOrigin(nlabel<=0) - No MC labels available, please check!!!\n");
233 TObjArray* arrayCluster = 0;
234 if ( calorimeter == AliCaloTrackReader::kEMCAL ) arrayCluster = reader->GetEMCALClusters();
235 else if ( calorimeter == AliCaloTrackReader::kPHOS ) arrayCluster = reader->GetPHOSClusters ();
237 //Select where the information is, ESD-galice stack or AOD mcparticles branch
238 if(reader->ReadStack()){
239 tag = CheckOriginInStack(label, nlabels, reader->GetStack(), arrayCluster);
241 else if(reader->ReadAODMCParticles()){
242 tag = CheckOriginInAOD(label, nlabels, reader->GetAODMCParticles(),arrayCluster);
248 //____________________________________________________________________________________________________
249 Int_t AliMCAnalysisUtils::CheckOrigin(Int_t label, const AliCaloTrackReader* reader, Int_t calorimeter)
251 // Play with the montecarlo particles if available.
256 printf("AliMCAnalysisUtils::CheckOrigin(label<0) - No MC labels available, please check!!!\n");
260 TObjArray* arrayCluster = 0;
261 if ( calorimeter == AliCaloTrackReader::kEMCAL ) arrayCluster = reader->GetEMCALClusters();
262 else if ( calorimeter == AliCaloTrackReader::kPHOS ) arrayCluster = reader->GetPHOSClusters();
264 Int_t labels[]={label};
266 //Select where the information is, ESD-galice stack or AOD mcparticles branch
267 if(reader->ReadStack()){
268 tag = CheckOriginInStack(labels, 1,reader->GetStack(),arrayCluster);
270 else if(reader->ReadAODMCParticles()){
271 tag = CheckOriginInAOD(labels, 1,reader->GetAODMCParticles(),arrayCluster);
277 //__________________________________________________________________________________________
278 Int_t AliMCAnalysisUtils::CheckOriginInStack(const Int_t *labels, Int_t nlabels,
279 AliStack* stack, const TObjArray* arrayCluster)
281 // Play with the MC stack if available. Tag particles depending on their origin.
282 // Do same things as in CheckOriginInAOD but different input.
284 //generally speaking, label is the MC label of a reconstructed
285 //entity (track, cluster, etc) for which we want to know something
286 //about its heritage, but one can also use it directly with stack
287 //particles not connected to reconstructed entities
292 printf("AliMCAnalysisUtils::CheckOriginInStack() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
297 Int_t label=labels[0];//Most significant particle contributing to the cluster
299 if(label >= 0 && label < stack->GetNtrack())
301 //MC particle of interest is the "mom" of the entity
302 TParticle * mom = stack->Particle(label);
304 Int_t mPdgSign = mom->GetPdgCode();
305 Int_t mPdg = TMath::Abs(mPdgSign);
306 Int_t mStatus = mom->GetStatusCode() ;
307 Int_t iParent = mom->GetFirstMother() ;
309 if(fDebug > 0 && label < 8 && fMCGenerator != kBoxLike) printf("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent);
311 //GrandParent of the entity
312 TParticle * parent = NULL;
317 parent = stack->Particle(iParent);
321 pPdg = TMath::Abs(parent->GetPdgCode());
322 pStatus = parent->GetStatusCode();
325 else if(fDebug > 0 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - Parent with label %d\n",iParent);
329 printf("AliMCAnalysisUtils::CheckOriginInStack() - Cluster most contributing mother and its parent: \n");
330 printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
331 printf("\t Parent label %d, pdg %d, status %d\n",iParent, pPdg, pStatus);
334 //Check if "mother" of entity is converted, if not, get the first non converted mother
335 if((mPdg == 22 || mPdg == 11) && (pPdg == 22 || pPdg == 11) && mStatus == 0)
337 SetTagBit(tag,kMCConversion);
339 //Check if the mother is photon or electron with status not stable
340 while ((pPdg == 22 || pPdg == 11) && mStatus != 1)
343 iMom = mom->GetFirstMother();
344 mom = stack->Particle(iMom);
345 mPdgSign = mom->GetPdgCode();
346 mPdg = TMath::Abs(mPdgSign);
347 mStatus = mom->GetStatusCode() ;
348 iParent = mom->GetFirstMother() ;
350 if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent);
355 parent = stack->Particle(iParent);
358 pPdg = TMath::Abs(parent->GetPdgCode());
359 pStatus = parent->GetStatusCode();
362 else {// in case of gun/box simulations
371 printf("AliMCAnalysisUtils::CheckOriginInStack() - Converted photon/electron: \n");
372 printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
373 printf("\t Parent label %d, pdg %d, status %d\n",iParent, pPdg, pStatus);
376 }//mother and parent are electron or photon and have status 0
377 else if((mPdg == 22 || mPdg == 11) && mStatus == 0)
379 //Still a conversion but only one electron/photon generated. Just from hadrons but not decays.
380 if(pPdg == 2112 || pPdg == 211 || pPdg == 321 ||
381 pPdg == 2212 || pPdg == 130 || pPdg == 13 )
383 SetTagBit(tag,kMCConversion);
384 iMom = mom->GetFirstMother();
385 mom = stack->Particle(iMom);
386 mPdgSign = mom->GetPdgCode();
387 mPdg = TMath::Abs(mPdgSign);
391 printf("AliMCAnalysisUtils::CheckOriginInStack() - Converted hadron: \n");
392 printf("\t Mother label %d, pdg %d, status %d\n",iMom, mPdg, mStatus);
396 //Comment for the next lines, we do not check the parent of the hadron for the moment.
397 //iParent = mom->GetFirstMother() ;
398 //if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - Mother is parton %d\n",iParent);
402 // parent = stack->Particle(iParent);
403 // pPdg = TMath::Abs(parent->GetPdgCode());
406 // conversion into electrons/photons checked
408 //first check for typical charged particles
409 if (mPdg == 13) SetTagBit(tag,kMCMuon);
410 else if(mPdg == 211) SetTagBit(tag,kMCPion);
411 else if(mPdg == 321) SetTagBit(tag,kMCKaon);
412 else if(mPdgSign == 2212) SetTagBit(tag,kMCProton);
413 else if(mPdgSign == -2212) SetTagBit(tag,kMCAntiProton);
414 else if(mPdgSign == 2112) SetTagBit(tag,kMCNeutron);
415 else if(mPdgSign == -2112) SetTagBit(tag,kMCAntiNeutron);
417 //check for pi0 and eta (shouldn't happen unless their decays were turned off)
421 SetTagBit(tag,kMCPi0Decay);
424 printf("AliMCAnalysisUtils::CheckOriginInStack() - First mother is directly pi0, not decayed by generator \n");
426 CheckOverlapped2GammaDecay(labels,nlabels, iMom, stack, tag); //set to kMCPi0 if 2 gammas in same cluster
431 SetTagBit(tag,kMCEtaDecay);
434 printf("AliMCAnalysisUtils::CheckOriginInStack() - First mother is directly eta, not decayed by generator \n");
436 CheckOverlapped2GammaDecay(labels,nlabels, iMom, stack, tag); //set to kMCEta if 2 gammas in same cluster
441 SetTagBit(tag,kMCPhoton);
445 SetTagBit(tag,kMCPi0Decay);
447 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - PYTHIA pi0 decay photon, parent pi0 with status 11 \n");
449 CheckOverlapped2GammaDecay(labels,nlabels, iParent, stack, tag); //set to kMCPi0 if 2 gammas in same cluster
450 // In case it did not merge, check if the decay companion is lost
451 if(!CheckTagBit(tag, kMCPi0) && !CheckTagBit(tag,kMCDecayPairInCalo))
452 CheckLostDecayPair(arrayCluster,iMom, iParent, stack, tag);
454 //printf("Bit set is Merged %d, Pair in calo %d, Lost %d\n",CheckTagBit(tag, kMCPi0),CheckTagBit(tag,kMCDecayPairInCalo),CheckTagBit(tag,kMCDecayPairLost));
456 else if (pPdg == 221)
458 SetTagBit(tag, kMCEtaDecay);
460 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInStack() - PYTHIA eta decay photon, parent pi0 with status 11 \n");
462 CheckOverlapped2GammaDecay(labels,nlabels, iParent, stack, tag);//set to kMCEta if 2 gammas in same cluster
463 // In case it did not merge, check if the decay companion is lost
464 if(!CheckTagBit(tag, kMCEta) && !CheckTagBit(tag,kMCDecayPairInCalo))
465 CheckLostDecayPair(arrayCluster,iMom, iParent, stack, tag);
467 else if(mStatus == 1)
468 { //undecayed particle
469 if(fMCGenerator == kPythia)
471 if(iParent < 8 && iParent > 5)
473 if(pPdg == 22) SetTagBit(tag,kMCPrompt);
474 else SetTagBit(tag,kMCFragmentation);
476 else if(iParent <= 5)
478 SetTagBit(tag, kMCISR); //Initial state radiation
480 else SetTagBit(tag,kMCUnknown);
483 else if(fMCGenerator == kHerwig)
491 if(parent->GetFirstMother()<=5) break;
492 iParent = parent->GetFirstMother();
493 parent=stack->Particle(iParent);
494 pStatus= parent->GetStatusCode();
495 pPdg = TMath::Abs(parent->GetPdgCode());
497 }//Look for the parton
499 if(iParent < 8 && iParent > 5)
501 if(pPdg == 22) SetTagBit(tag,kMCPrompt);
502 else SetTagBit(tag,kMCFragmentation);
504 else SetTagBit(tag,kMCISR);//Initial state radiation
506 else SetTagBit(tag,kMCUnknown);
509 else SetTagBit(tag,kMCOtherDecay);
513 //Electron check. Where did that electron come from?
514 else if(mPdg == 11){ //electron
515 if(pPdg == 11 && parent)
517 Int_t iGrandma = parent->GetFirstMother();
520 TParticle* gma = (TParticle*)stack->Particle(iGrandma); //get mother
521 Int_t gPdg = TMath::Abs(gma->GetPdgCode());
523 if (gPdg == 23) { SetTagBit(tag,kMCZDecay); } //parent is Z-boson
524 else if (gPdg == 24) { SetTagBit(tag,kMCWDecay); } //parent is W-boson
528 SetTagBit(tag,kMCElectron);
530 if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInStack() - Checking ancestors of electrons\n");
532 if (pPdg == 111) { SetTagBit(tag,kMCPi0Decay); SetTagBit(tag, kMCDecayDalitz) ; } //Pi0 Dalitz decay
533 else if (pPdg == 221) { SetTagBit(tag,kMCEtaDecay); SetTagBit(tag, kMCDecayDalitz) ; } //Eta Dalitz decay
534 else if((499 < pPdg && pPdg < 600)||(4999 < pPdg && pPdg < 6000)) { SetTagBit(tag,kMCEFromB); } //b-->e decay
535 else if((399 < pPdg && pPdg < 500)||(3999 < pPdg && pPdg < 5000)) { //check charm decay
538 Int_t iGrandma = parent->GetFirstMother();
541 TParticle* gma = (TParticle*)stack->Particle(iGrandma); //get mother of charm
542 Int_t gPdg = TMath::Abs(gma->GetPdgCode());
543 if((499 < gPdg && gPdg < 600)||(4999 < gPdg && gPdg < 6000)) SetTagBit(tag,kMCEFromCFromB); //b-->c-->e
544 else SetTagBit(tag,kMCEFromC); //c-->e
546 else SetTagBit(tag,kMCEFromC); //c-->e
551 //if it is not from any of the above, where is it from?
552 if(pPdg > 10000) SetTagBit(tag,kMCUnknown);
554 else SetTagBit(tag,kMCOtherDecay);
556 if(fDebug > 0 && parent) printf("AliMCAnalysisUtils::CheckOriginInStack() - Status %d Electron from other origin: %s (pPdg = %d) %s (mpdg = %d)\n",mStatus,parent->GetName(),pPdg,mom->GetName(),mPdg);
559 //Cluster was made by something else
563 printf("AliMCAnalysisUtils::CheckOriginInStack() - \tSetting kMCUnknown for cluster from %s (pdg = %d, Parent pdg = %d)\n",
564 mom->GetName(),mPdg,pPdg);
566 SetTagBit(tag,kMCUnknown);
571 if(label < 0 && (fDebug >= 0))
572 printf("AliMCAnalysisUtils::CheckOriginInStack() *** bad label or no stack ***: label %d \n", label);
574 if(label >= stack->GetNtrack() && (fDebug >= 0))
575 printf("AliMCAnalysisUtils::CheckOriginInStack() *** large label ***: label %d, n tracks %d \n", label, stack->GetNtrack());
577 SetTagBit(tag,kMCUnknown);
585 //________________________________________________________________________________________________________
586 Int_t AliMCAnalysisUtils::CheckOriginInAOD(const Int_t *labels, Int_t nlabels,
587 const TClonesArray *mcparticles, const TObjArray* arrayCluster)
589 // Play with the MCParticles in AOD if available. Tag particles depending on their origin.
590 // Do same things as in CheckOriginInStack but different input.
595 printf("AliMCAnalysisUtils::CheckOriginInAOD() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
600 Int_t label=labels[0];//Most significant particle contributing to the cluster
602 Int_t nprimaries = mcparticles->GetEntriesFast();
603 if(label >= 0 && label < nprimaries)
606 AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label);
608 Int_t mPdgSign = mom->GetPdgCode();
609 Int_t mPdg = TMath::Abs(mPdgSign);
610 Int_t iParent = mom->GetMother() ;
612 if(fDebug > 0 && label < 8 && fMCGenerator != kBoxLike) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);
615 AliAODMCParticle * parent = NULL ;
619 parent = (AliAODMCParticle *) mcparticles->At(iParent);
620 pPdg = TMath::Abs(parent->GetPdgCode());
622 else if(fDebug > 0 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Parent with label %d\n",iParent);
626 printf("AliMCAnalysisUtils::CheckOriginInAOD() - Cluster most contributing mother and its parent: \n");
628 printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
629 iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
632 printf("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
633 iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary());
636 //Check if mother is converted, if not, get the first non converted mother
637 if((mPdg == 22 || mPdg == 11) && (pPdg == 22 || pPdg == 11) && !mom->IsPrimary())
639 SetTagBit(tag,kMCConversion);
641 //Check if the mother is photon or electron with status not stable
642 while ((pPdg == 22 || pPdg == 11) && !mom->IsPhysicalPrimary())
645 iMom = mom->GetMother();
646 mom = (AliAODMCParticle *) mcparticles->At(iMom);
647 mPdgSign = mom->GetPdgCode();
648 mPdg = TMath::Abs(mPdgSign);
649 iParent = mom->GetMother() ;
650 if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);
653 if(iParent >= 0 && parent)
655 parent = (AliAODMCParticle *) mcparticles->At(iParent);
656 pPdg = TMath::Abs(parent->GetPdgCode());
658 // printf("\t While Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
659 // printf("\t While Parent label %d, pdg %d, Primary? %d, Physical Primary? %d\n",iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary());
665 printf("AliMCAnalysisUtils::CheckOriginInAOD() - Converted photon/electron : \n");
667 printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
668 iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
671 printf("\t Parent label %d, pdg %d, Primary? %d, Physical Primary? %d\n",
672 iParent, pPdg, parent->IsPrimary(), parent->IsPhysicalPrimary());
675 }//mother and parent are electron or photon and have status 0 and parent is photon or electron
676 else if((mPdg == 22 || mPdg == 11) && !mom->IsPrimary())
678 //Still a conversion but only one electron/photon generated. Just from hadrons
679 if(pPdg == 2112 || pPdg == 211 || pPdg == 321 ||
680 pPdg == 2212 || pPdg == 130 || pPdg == 13 )
682 SetTagBit(tag,kMCConversion);
683 iMom = mom->GetMother();
684 mom = (AliAODMCParticle *) mcparticles->At(iMom);
685 mPdgSign = mom->GetPdgCode();
686 mPdg = TMath::Abs(mPdgSign);
690 printf("AliMCAnalysisUtils::CheckOriginInAOD() - Converted hadron : \n");
691 printf("\t Mother label %d, pdg %d, Primary? %d, Physical Primary? %d\n",iMom, mPdg, mom->IsPrimary(), mom->IsPhysicalPrimary());
695 //Comment for next lines, we do not check the parent of the hadron for the moment.
696 //iParent = mom->GetMother() ;
697 //if(fDebug > 0 && label < 8 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Mother is parton %d\n",iParent);
701 // parent = (AliAODMCParticle *) mcparticles->At(iParent);
702 // pPdg = TMath::Abs(parent->GetPdgCode());
706 //printf("Final mother mPDG %d\n",mPdg);
708 // conversion into electrons/photons checked
710 //first check for typical charged particles
711 if (mPdg == 13) SetTagBit(tag,kMCMuon);
712 else if(mPdg == 211) SetTagBit(tag,kMCPion);
713 else if(mPdg == 321) SetTagBit(tag,kMCKaon);
714 else if(mPdgSign == 2212) SetTagBit(tag,kMCProton);
715 else if(mPdgSign == 2112) SetTagBit(tag,kMCNeutron);
716 else if(mPdgSign == -2212) SetTagBit(tag,kMCAntiProton);
717 else if(mPdgSign == -2112) SetTagBit(tag,kMCAntiNeutron);
719 //check for pi0 and eta (shouldn't happen unless their decays were turned off)
722 SetTagBit(tag,kMCPi0Decay);
724 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - First mother is directly pi0, not decayed by generator \n");
726 CheckOverlapped2GammaDecay(labels,nlabels, iMom, mcparticles, tag); //set to kMCPi0 if 2 gammas in same cluster
730 SetTagBit(tag,kMCEtaDecay);
732 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - First mother is directly eta, not decayed by generator \n");
734 CheckOverlapped2GammaDecay(labels,nlabels, iMom, mcparticles, tag); //set to kMCEta if 2 gammas in same cluster
739 SetTagBit(tag,kMCPhoton);
743 SetTagBit(tag,kMCPi0Decay);
745 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Generator pi0 decay photon \n");
747 CheckOverlapped2GammaDecay(labels,nlabels, iParent, mcparticles, tag); //set to kMCPi0 if 2 gammas in same cluster
748 // In case it did not merge, check if the decay companion is lost
749 if(!CheckTagBit(tag, kMCPi0) && !CheckTagBit(tag,kMCDecayPairInCalo) && !CheckTagBit(tag,kMCDecayPairLost))
751 CheckLostDecayPair(arrayCluster,iMom, iParent, mcparticles, tag);
754 //printf("Bit set is Merged %d, Pair in calo %d, Lost %d\n",CheckTagBit(tag, kMCPi0),CheckTagBit(tag,kMCDecayPairInCalo),CheckTagBit(tag,kMCDecayPairLost));
756 else if (pPdg == 221)
758 SetTagBit(tag, kMCEtaDecay);
760 if(fDebug > 2 ) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Generator eta decay photon \n");
762 CheckOverlapped2GammaDecay(labels,nlabels, iParent, mcparticles, tag); //set to kMCEta if 2 gammas in same cluster
763 // In case it did not merge, check if the decay companion is lost
764 if(!CheckTagBit(tag, kMCEta) && !CheckTagBit(tag,kMCDecayPairInCalo))
765 CheckLostDecayPair(arrayCluster,iMom, iParent, mcparticles, tag);
767 else if( mom->IsPhysicalPrimary() && ( fMCGenerator == kPythia || fMCGenerator == kHerwig ) ) //undecayed particle
769 if(iParent < 8 && iParent > 5 )
771 if(pPdg == 22) SetTagBit(tag,kMCPrompt);
772 else SetTagBit(tag,kMCFragmentation);
774 else if( iParent <= 5 && ( fMCGenerator == kPythia || fMCGenerator == kHerwig ) )
776 SetTagBit(tag, kMCISR); //Initial state radiation
778 else SetTagBit(tag,kMCUnknown);
780 else SetTagBit(tag,kMCOtherDecay);
784 //Electron check. Where did that electron come from?
787 if(pPdg == 11 && parent)
789 Int_t iGrandma = parent->GetMother();
792 AliAODMCParticle* gma = (AliAODMCParticle*)mcparticles->At(iGrandma);
793 Int_t gPdg = TMath::Abs(gma->GetPdgCode());
795 if (gPdg == 23) { SetTagBit(tag,kMCZDecay); } //parent is Z-boson
796 else if (gPdg == 24) { SetTagBit(tag,kMCWDecay); } //parent is W-boson
800 SetTagBit(tag,kMCElectron);
802 if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Checking ancestors of electrons");
804 if (pPdg == 111) { SetTagBit(tag,kMCPi0Decay); SetTagBit(tag,kMCDecayDalitz);} //Pi0 Dalitz decay
805 else if (pPdg == 221) { SetTagBit(tag,kMCEtaDecay); SetTagBit(tag,kMCDecayDalitz);} //Eta Dalitz decay
806 else if((499 < pPdg && pPdg < 600)||(4999 < pPdg && pPdg < 6000)) { SetTagBit(tag,kMCEFromB);} //b-hadron decay
807 else if((399 < pPdg && pPdg < 500)||(3999 < pPdg && pPdg < 5000))
808 { //c-hadron decay check
811 Int_t iGrandma = parent->GetMother();
814 AliAODMCParticle* gma = (AliAODMCParticle*)mcparticles->At(iGrandma); //charm's mother
815 Int_t gPdg = TMath::Abs(gma->GetPdgCode());
816 if((499 < gPdg && gPdg < 600)||(4999 < gPdg && gPdg < 6000)) SetTagBit(tag,kMCEFromCFromB); //b-->c-->e decay
817 else SetTagBit(tag,kMCEFromC); //c-hadron decay
819 else SetTagBit(tag,kMCEFromC); //c-hadron decay
822 { //prompt or other decay
823 TParticlePDG* foo = TDatabasePDG::Instance()->GetParticle(pPdg);
824 TParticlePDG* foo1 = TDatabasePDG::Instance()->GetParticle(mPdg);
826 if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - Electron from other origin: %s (pPdg = %d) %s (mPdg = %d)\n",
827 foo->GetName(), pPdg,foo1->GetName(),mPdg);
829 if(pPdg > 10000) SetTagBit(tag,kMCUnknown);
830 else SetTagBit(tag,kMCOtherDecay);
833 //cluster was made by something else
836 if(fDebug > 0) printf("AliMCAnalysisUtils::CheckOriginInAOD() - \tSetting kMCUnknown for cluster with pdg = %d, Parent pdg = %d\n",
838 SetTagBit(tag,kMCUnknown);
843 if(label < 0 && (fDebug >= 0) )
844 printf("AliMCAnalysisUtils::CheckOriginInAOD() *** bad label or no mcparticles ***: label %d \n", label);
846 if(label >= mcparticles->GetEntriesFast() && (fDebug >= 0) )
847 printf("AliMCAnalysisUtils::CheckOriginInAOD() *** large label ***: label %d, n tracks %d \n", label, mcparticles->GetEntriesFast());
849 SetTagBit(tag,kMCUnknown);
857 //_________________________________________________________________________________________
858 void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels,
859 Int_t mesonIndex, AliStack *stack,
862 // Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in stack.
864 if(labels[0] < 0 || labels[0] > stack->GetNtrack() || nlabels <= 1) {
865 if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Exit : label[0] %d, n primaries %d, nlabels %d \n",
866 labels[0],stack->GetNtrack(), nlabels);
870 TParticle * meson = stack->Particle(mesonIndex);
871 Int_t mesonPdg = meson->GetPdgCode();
872 if(mesonPdg!=111 && mesonPdg!=221)
874 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Wrong pi0/eta PDG : %d \n",mesonPdg);
878 if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - %s, label %d\n",meson->GetName(), mesonIndex);
880 //Check if meson decayed into 2 daughters or if both were kept.
881 if(meson->GetNDaughters() != 2)
884 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. Number of daughters is %d, not 2 \n",meson->GetNDaughters());
889 Int_t iPhoton0 = meson->GetDaughter(0);
890 Int_t iPhoton1 = meson->GetDaughter(1);
891 TParticle *photon0 = stack->Particle(iPhoton0);
892 TParticle *photon1 = stack->Particle(iPhoton1);
894 //Check if both daughters are photons
895 if(photon0->GetPdgCode() != 22 || photon1->GetPdgCode()!=22)
898 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. PDG: daughter 1 = %d, of daughter 2 = %d \n",photon0->GetPdgCode(),photon1->GetPdgCode());
903 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Daughter labels : photon0 = %d, photon1 = %d \n",iPhoton0,iPhoton1);
905 //Check if both photons contribute to the cluster
906 Bool_t okPhoton0 = kFALSE;
907 Bool_t okPhoton1 = kFALSE;
909 if(fDebug > 3) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Labels loop:\n");
911 Bool_t conversion = kFALSE;
913 for(Int_t i = 0; i < nlabels; i++)
915 if(fDebug > 3) printf("\t at begin:label %d/%d: %d, ok? photon1 %d, photon2 %d\n", i+1, nlabels, labels[i], okPhoton0, okPhoton1);
917 //If we already found both, break the loop
918 if(okPhoton0 && okPhoton1) break;
920 Int_t index = labels[i];
921 if (iPhoton0 == index)
926 else if (iPhoton1 == index)
932 //Trace back the mother in case it was a conversion
934 if(index >= stack->GetNtrack())
936 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) Particle index %d larger than size of list %d !!\n",
937 index,stack->GetNtrack());
941 TParticle * daught = stack->Particle(index);
942 Int_t tmpindex = daught->GetFirstMother();
943 if(fDebug > 3) printf("\t Conversion? : mother %d\n",tmpindex);
946 //MC particle of interest is the mother
947 if(fDebug > 3) printf("\t \t parent index %d\n",tmpindex);
948 daught = stack->Particle(tmpindex);
949 if (iPhoton0 == tmpindex)
955 else if (iPhoton1 == tmpindex)
962 tmpindex = daught->GetFirstMother();
964 }//While to check if pi0/eta daughter was one of these contributors to the cluster
966 if(i == 0 && (!okPhoton0 && !okPhoton1) && fDebug>=0)
967 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Something happens, first label should be from a photon decay!\n");
969 }//loop on list of labels
971 //If both photons contribute tag as the corresponding meson.
972 if(okPhoton0 && okPhoton1)
975 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - %s OVERLAPPED DECAY \n", meson->GetName());
977 if(!CheckTagBit(tag,kMCConversion) && conversion) SetTagBit(tag,kMCConversion) ;
979 if(mesonPdg == 111) SetTagBit(tag,kMCPi0);
980 else SetTagBit(tag,kMCEta);
985 //________________________________________________________________________________________________________
986 void AliMCAnalysisUtils::CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels, Int_t mesonIndex,
987 const TClonesArray *mcparticles, Int_t & tag )
989 // Check if cluster is formed from the contribution of 2 decay photons from pi0 or eta. Input in AODMCParticles.
991 if(labels[0] < 0 || labels[0] > mcparticles->GetEntriesFast() || nlabels <= 1)
994 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Exit : label[0] %d, n primaries %d, nlabels %d \n",
995 labels[0],mcparticles->GetEntriesFast(), nlabels);
999 AliAODMCParticle * meson = (AliAODMCParticle *) mcparticles->At(mesonIndex);
1000 Int_t mesonPdg = meson->GetPdgCode();
1001 if(mesonPdg != 111 && mesonPdg != 221)
1003 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Wrong pi0/eta PDG : %d \n",mesonPdg);
1007 if(fDebug > 2) printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - pdg %d, label %d, ndaughters %d\n", mesonPdg, mesonIndex, meson->GetNDaughters());
1011 if(meson->GetNDaughters() != 2)
1014 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(ESD) - Not overalapped. Number of daughters is %d, not 2 \n",meson->GetNDaughters());
1018 Int_t iPhoton0 = meson->GetDaughter(0);
1019 Int_t iPhoton1 = meson->GetDaughter(1);
1020 //if((iPhoton0 == -1) || (iPhoton1 == -1)){
1022 // printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Exit : Not overlapped. At least a daughter do not exists : d1 %d, d2 %d \n", iPhoton0, iPhoton1);
1025 AliAODMCParticle *photon0 = (AliAODMCParticle *) mcparticles->At(iPhoton0);
1026 AliAODMCParticle *photon1 = (AliAODMCParticle *) mcparticles->At(iPhoton1);
1028 //Check if both daughters are photons
1029 if(photon0->GetPdgCode() != 22 && photon1->GetPdgCode()!=22)
1031 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Not overlapped. PDG: daughter 1 = %d, of daughter 2 = %d \n",photon0->GetPdgCode(),photon1->GetPdgCode());
1036 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Daughter labels : photon0 = %d, photon1 = %d \n",iPhoton0,iPhoton1);
1038 //Check if both photons contribute to the cluster
1039 Bool_t okPhoton0 = kFALSE;
1040 Bool_t okPhoton1 = kFALSE;
1043 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Labels loop:\n");
1045 Bool_t conversion = kFALSE;
1047 for(Int_t i = 0; i < nlabels; i++)
1050 printf("\t label %d/%d: %d, ok? %d, %d\n", i, nlabels, labels[i], okPhoton0, okPhoton1);
1052 if(labels[i]<0) continue;
1054 //If we already found both, break the loop
1055 if(okPhoton0 && okPhoton1) break;
1057 Int_t index = labels[i];
1058 if (iPhoton0 == index)
1063 else if (iPhoton1 == index)
1069 //Trace back the mother in case it was a conversion
1071 if(index >= mcparticles->GetEntriesFast())
1073 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) Particle index %d larger than size of list %d !!\n",index,mcparticles->GetEntriesFast());
1077 AliAODMCParticle * daught = (AliAODMCParticle*) mcparticles->At(index);
1078 Int_t tmpindex = daught->GetMother();
1080 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Conversion? : mother %d\n",tmpindex);
1084 //MC particle of interest is the mother
1086 printf("\t parent index %d\n",tmpindex);
1087 daught = (AliAODMCParticle*) mcparticles->At(tmpindex);
1088 //printf("tmpindex %d\n",tmpindex);
1089 if (iPhoton0 == tmpindex)
1095 else if (iPhoton1 == tmpindex)
1102 tmpindex = daught->GetMother();
1104 }//While to check if pi0/eta daughter was one of these contributors to the cluster
1106 if(i == 0 && (!okPhoton0 && !okPhoton1) && fDebug>=0 )
1107 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - Something happens, first label should be from a photon decay!\n");
1109 }//loop on list of labels
1111 //If both photons contribute tag as the corresponding meson.
1112 if(okPhoton0 && okPhoton1)
1115 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) - %s OVERLAPPED DECAY \n",
1116 (TDatabasePDG::Instance()->GetParticle(mesonPdg))->GetName());
1118 if(!CheckTagBit(tag,kMCConversion) && conversion)
1121 printf("AliMCAnalysisUtils::CheckOverlapped2GammaDecay(AOD) Second decay photon produced a conversion \n");
1122 SetTagBit(tag,kMCConversion) ;
1125 if(mesonPdg == 111) SetTagBit(tag,kMCPi0);
1126 else SetTagBit(tag,kMCEta);
1131 //______________________________________________________________________________________________________
1132 void AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray* arrayCluster, Int_t iMom, Int_t iParent,
1133 AliStack * stack, Int_t & tag)
1135 // Check on ESDs if the current decay photon has the second photon companion lost.
1137 if(!arrayCluster || iMom < 0 || iParent < 0|| !stack) return;
1139 TParticle * parent= stack->Particle(iParent);
1141 if(parent->GetNDaughters()!=2)
1143 SetTagBit(tag, kMCDecayPairLost);
1147 Int_t pairLabel = -1;
1148 if ( iMom != parent->GetDaughter(0) ) pairLabel = parent->GetDaughter(0);
1149 else if( iMom != parent->GetDaughter(1) ) pairLabel = parent->GetDaughter(1);
1153 SetTagBit(tag, kMCDecayPairLost);
1157 for(Int_t iclus = 0; iclus < arrayCluster->GetEntriesFast(); iclus++)
1159 AliVCluster * cluster = (AliVCluster*) arrayCluster->At(iclus);
1160 for(UInt_t ilab = 0; ilab< cluster->GetNLabels(); ilab++)
1162 Int_t label = cluster->GetLabels()[ilab];
1163 if(label==pairLabel)
1165 SetTagBit(tag, kMCDecayPairInCalo);
1168 else if(label== iParent || label== iMom)
1172 else // check the ancestry
1174 TParticle * mother = stack->Particle(label);
1175 Int_t momPDG = TMath::Abs(mother->GetPdgCode());
1176 if(momPDG!=11 && momPDG!=22) continue;
1178 //Check if "mother" of entity is converted, if not, get the first non converted mother
1179 Int_t iParentClus = mother->GetFirstMother();
1180 if(iParentClus < 0) continue;
1182 TParticle * parentClus = stack->Particle(iParentClus);
1183 if(!parentClus) continue;
1185 Int_t parentClusPDG = TMath::Abs(parentClus->GetPdgCode());
1186 Int_t parentClusStatus = parentClus->GetStatusCode();
1188 if( parentClusPDG != 22 && parentClusPDG != 11 && parentClusStatus != 0) continue;
1190 //printf("Conversion\n");
1192 //Check if the mother is photon or electron with status not stable
1193 while ((parentClusPDG == 22 || parentClusPDG == 11) && parentClusStatus != 1)
1196 label = iParentClus;
1197 momPDG = parentClusPDG;
1199 iParentClus = parentClus->GetFirstMother();
1200 if(iParentClus < 0) break;
1202 parentClus = stack->Particle(iParentClus);
1203 if(!parentClus) break;
1205 parentClusPDG = TMath::Abs(parentClus->GetPdgCode());
1206 parentClusStatus = parentClus->GetStatusCode() ;
1209 if((momPDG == 22 || parentClusPDG ==22) && (label==pairLabel || iParentClus == pairLabel))
1211 SetTagBit(tag, kMCDecayPairInCalo);
1212 //printf("Conversion is paired\n");
1221 SetTagBit(tag, kMCDecayPairLost);
1225 //______________________________________________________________________________________________________
1226 void AliMCAnalysisUtils::CheckLostDecayPair(const TObjArray * arrayCluster,Int_t iMom, Int_t iParent,
1227 const TClonesArray* mcparticles, Int_t & tag)
1229 // Check on AODs if the current decay photon has the second photon companion lost.
1231 if(!arrayCluster || iMom < 0 || iParent < 0|| !mcparticles) return;
1233 AliAODMCParticle * parent = (AliAODMCParticle*) mcparticles->At(iParent);
1235 //printf("*** Check label %d with parent %d\n",iMom, iParent);
1237 if(parent->GetNDaughters()!=2)
1239 SetTagBit(tag, kMCDecayPairLost);
1240 //printf("\t ndaugh = %d\n",parent->GetNDaughters());
1244 Int_t pairLabel = -1;
1245 if ( iMom != parent->GetDaughter(0) ) pairLabel = parent->GetDaughter(0);
1246 else if( iMom != parent->GetDaughter(1) ) pairLabel = parent->GetDaughter(1);
1250 //printf("\t pair Label not found = %d\n",pairLabel);
1251 SetTagBit(tag, kMCDecayPairLost);
1255 //printf("\t *** find pair %d\n",pairLabel);
1257 for(Int_t iclus = 0; iclus < arrayCluster->GetEntriesFast(); iclus++)
1259 AliVCluster * cluster = (AliVCluster*) arrayCluster->At(iclus);
1260 //printf("\t \t ** Cluster %d, nlabels %d\n",iclus,cluster->GetNLabels());
1261 for(UInt_t ilab = 0; ilab< cluster->GetNLabels(); ilab++)
1263 Int_t label = cluster->GetLabels()[ilab];
1265 //printf("\t \t label %d\n",label);
1267 if(label==pairLabel)
1269 //printf("\t \t Pair found\n");
1270 SetTagBit(tag, kMCDecayPairInCalo);
1273 else if(label== iParent || label== iMom)
1275 //printf("\t \t skip\n");
1278 else // check the ancestry
1280 AliAODMCParticle * mother = (AliAODMCParticle*) mcparticles->At(label);
1281 Int_t momPDG = TMath::Abs(mother->GetPdgCode());
1282 if(momPDG!=11 && momPDG!=22)
1284 //printf("\t \t skip, pdg %d\n",momPDG);
1288 //Check if "mother" of entity is converted, if not, get the first non converted mother
1289 Int_t iParentClus = mother->GetMother();
1290 if(iParentClus < 0) continue;
1292 AliAODMCParticle * parentClus = (AliAODMCParticle*) mcparticles->At(iParentClus);
1293 if(!parentClus) continue;
1295 Int_t parentClusPDG = TMath::Abs(parentClus->GetPdgCode());
1296 Int_t parentClusStatus = parentClus->GetStatus();
1298 if( parentClusPDG != 22 && parentClusPDG != 11 && parentClusStatus != 0)
1300 //printf("\t \t skip, not a conversion, parent: pdg %d, status %d\n",parentClusPDG,parentClusStatus);
1304 //printf("\t \t Conversion\n");
1306 //Check if the mother is photon or electron with status not stable
1307 while ((parentClusPDG == 22 || parentClusPDG == 11) && parentClusStatus != 1)
1310 label = iParentClus;
1311 momPDG = parentClusPDG;
1313 iParentClus = parentClus->GetMother();
1314 if(iParentClus < 0) break;
1316 parentClus = (AliAODMCParticle*) mcparticles->At(iParentClus);
1317 if(!parentClus) break;
1319 parentClusPDG = TMath::Abs(parentClus->GetPdgCode());
1320 parentClusStatus = parentClus->GetStatus() ;
1323 if((momPDG == 22 || parentClusPDG ==22) && (label==pairLabel || iParentClus == pairLabel))
1325 SetTagBit(tag, kMCDecayPairInCalo);
1326 //printf("\t \t Conversion is paired: mom %d, parent %d\n",label,iParentClus);
1331 //printf("\t \t Skip, finally label %d, pdg %d, parent label %d, pdg %d, status %d\n",label,momPDG,iParentClus,parentClusPDG,parentClusStatus);
1340 SetTagBit(tag, kMCDecayPairLost);
1345 //_____________________________________________________________________
1346 TList * AliMCAnalysisUtils::GetJets(const AliCaloTrackReader * reader)
1348 // Return list of jets (TParticles) and index of most likely parton that originated it.
1350 AliStack * stack = reader->GetStack();
1351 Int_t iEvent = reader->GetEventNumber();
1352 AliGenEventHeader * geh = reader->GetGenEventHeader();
1353 if(fCurrentEvent!=iEvent){
1354 fCurrentEvent = iEvent;
1355 fJetsList = new TList;
1356 Int_t nTriggerJets = 0;
1357 Float_t tmpjet[]={0,0,0,0};
1359 //printf("Event %d %d\n",fCurrentEvent,iEvent);
1360 //Get outgoing partons
1361 if(stack->GetNtrack() < 8) return fJetsList;
1362 TParticle * parton1 = stack->Particle(6);
1363 TParticle * parton2 = stack->Particle(7);
1365 printf("AliMCAnalysisUtils::GetJets() - parton 6 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1366 parton1->GetName(),parton1->Pt(),parton1->Energy(),parton1->Phi()*TMath::RadToDeg(),parton1->Eta());
1367 printf("AliMCAnalysisUtils::GetJets() - parton 7 : %s, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1368 parton2->GetName(),parton2->Pt(),parton2->Energy(),parton2->Phi()*TMath::RadToDeg(),parton2->Eta());
1370 // //Trace the jet from the mother parton
1377 // TParticle * tmptmp = new TParticle;
1378 // for(Int_t i = 0; i< stack->GetNprimary(); i++){
1379 // tmptmp = stack->Particle(i);
1381 // if(tmptmp->GetStatusCode() == 1){
1382 // pt = tmptmp->Pt();
1383 // e = tmptmp->Energy();
1384 // Int_t imom = tmptmp->GetFirstMother();
1386 // //printf("1st imom %d\n",imom);
1389 // tmptmp = stack->Particle(imom);
1390 // imom = tmptmp->GetFirstMother();
1391 // //printf("imom %d \n",imom);
1393 // //printf("Last imom %d %d\n",imom1, imom);
1398 // else if (imom1 == 7){
1405 // printf("JET 1, pt %2.2f, e %2.2f; JET 2, pt %2.2f, e %2.2f \n",pt1,e1,pt2,e2);
1407 //Get the jet, different way for different generator
1409 if(fMCGenerator == kPythia)
1411 TParticle * jet = 0x0;
1412 AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) geh;
1413 nTriggerJets = pygeh->NTriggerJets();
1415 printf("AliMCAnalysisUtils::GetJets() - PythiaEventHeader: Njets: %d\n",nTriggerJets);
1417 for(Int_t i = 0; i< nTriggerJets; i++)
1419 pygeh->TriggerJet(i, tmpjet);
1420 jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
1421 //Assign an outgoing parton as mother
1422 Float_t phidiff1 = TMath::Abs(jet->Phi()-parton1->Phi());
1423 Float_t phidiff2 = TMath::Abs(jet->Phi()-parton2->Phi());
1424 if(phidiff1 > phidiff2) jet->SetFirstMother(7);
1425 else jet->SetFirstMother(6);
1428 printf("AliMCAnalysisUtils::GetJets() - PYTHIA Jet %d: mother %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1429 i, jet->GetFirstMother(),jet->Pt(),jet->Energy(),jet->Phi()*TMath::RadToDeg(),jet->Eta());
1430 fJetsList->Add(jet);
1432 }//Pythia triggered jets
1434 else if (fMCGenerator == kHerwig)
1438 TParticle * tmp = parton1;
1439 if(parton1->GetPdgCode()!=22)
1442 if(tmp->GetFirstDaughter()==-1) return fJetsList;
1443 tmp = stack->Particle(tmp->GetFirstDaughter());
1444 pdg = tmp->GetPdgCode();
1447 //Add found jet to list
1448 TParticle *jet1 = new TParticle(*tmp);
1449 jet1->SetFirstMother(6);
1450 fJetsList->Add(jet1);
1451 //printf("jet 1: first daughter %d, last daughter %d\n", tmp->GetFirstDaughter(), tmp->GetLastDaughter());
1452 //tmp = stack->Particle(tmp->GetFirstDaughter());
1456 printf("AliMCAnalysisUtils::GetJets() - HERWIG Jet 1: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1457 jet1->GetFirstMother(),jet1->GetStatusCode(),jet1->Pt(),jet1->Energy(),jet1->Phi()*TMath::RadToDeg(),jet1->Eta());
1463 if(parton2->GetPdgCode()!=22)
1467 if(tmp->GetFirstDaughter()==-1) return fJetsList;
1468 tmp = stack->Particle(tmp->GetFirstDaughter());
1469 pdg = tmp->GetPdgCode();
1472 //Add found jet to list
1473 TParticle *jet2 = new TParticle(*tmp);
1474 jet2->SetFirstMother(7);
1475 fJetsList->Add(jet2);
1478 printf("AliMCAnalysisUtils::GetJets() - HERWIG Jet 2: mother %d, status %d, pt %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1479 jet2->GetFirstMother(),jet2->GetStatusCode(),jet2->Pt(),jet2->Energy(),jet2->Phi()*TMath::RadToDeg(),jet2->Eta());
1480 //Int_t first = tmp->GetFirstDaughter();
1481 //Int_t last = tmp->GetLastDaughter();
1482 //printf("jet 2: first daughter %d, last daughter %d, pdg %d\n",first, last, tmp->GetPdgCode());
1483 // for(Int_t d = first ; d < last+1; d++){
1484 // tmp = stack->Particle(d);
1485 // if(i == tmp->GetFirstMother())
1486 // printf("Daughter n %d, Mother %d, name %s, status %d, pT %2.2f,E %2.2f, phi %2.2f, eta %2.2f \n",
1487 // d,tmp->GetFirstMother(), tmp->GetName(), tmp->GetStatusCode(),tmp->Pt(),tmp->Energy(),tmp->Phi()*TMath::RadToDeg(),tmp->Eta());
1491 }//Herwig generated jets
1498 //__________________________________________________________________________________________________________
1499 TLorentzVector AliMCAnalysisUtils::GetDaughter(Int_t idaugh, Int_t label,
1500 const AliCaloTrackReader* reader,
1501 Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & daughlabel)
1503 // Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother.
1504 fDaughMom.SetPxPyPzE(0,0,0,0);
1506 if(reader->ReadStack())
1508 if(!reader->GetStack())
1511 printf("AliMCAnalysisUtils::GetDaughter() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1517 Int_t nprimaries = reader->GetStack()->GetNtrack();
1518 if(label >= 0 && label < nprimaries)
1520 TParticle * momP = reader->GetStack()->Particle(label);
1521 daughlabel = momP->GetDaughter(idaugh);
1523 if(daughlabel < 0 || daughlabel >= nprimaries)
1529 TParticle * daughP = reader->GetStack()->Particle(daughlabel);
1530 daughP->Momentum(fDaughMom);
1531 pdg = daughP->GetPdgCode();
1532 status = daughP->GetStatusCode();
1540 else if(reader->ReadAODMCParticles())
1542 TClonesArray* mcparticles = reader->GetAODMCParticles();
1546 printf("AliMCAnalysisUtils::GetDaughter() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1552 Int_t nprimaries = mcparticles->GetEntriesFast();
1553 if(label >= 0 && label < nprimaries)
1555 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1556 daughlabel = momP->GetDaughter(idaugh);
1558 if(daughlabel < 0 || daughlabel >= nprimaries)
1564 AliAODMCParticle * daughP = (AliAODMCParticle *) mcparticles->At(daughlabel);
1565 fDaughMom.SetPxPyPzE(daughP->Px(),daughP->Py(),daughP->Pz(),daughP->E());
1566 pdg = daughP->GetPdgCode();
1567 status = daughP->GetStatus();
1581 //______________________________________________________________________________________________________
1582 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader, Bool_t & ok)
1584 // Return the kinematics of the particle that generated the signal.
1586 Int_t pdg = -1; Int_t status = -1; Int_t momlabel = -1;
1587 return GetMother(label,reader,pdg,status, ok,momlabel);
1590 //_________________________________________________________________________________________
1591 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader,
1592 Int_t & pdg, Int_t & status, Bool_t & ok)
1594 // Return the kinematics of the particle that generated the signal.
1596 Int_t momlabel = -1;
1597 return GetMother(label,reader,pdg,status, ok,momlabel);
1600 //______________________________________________________________________________________________________
1601 TLorentzVector AliMCAnalysisUtils::GetMother(Int_t label, const AliCaloTrackReader* reader,
1602 Int_t & pdg, Int_t & status, Bool_t & ok, Int_t & momlabel)
1604 // Return the kinematics of the particle that generated the signal, its pdg and its status and its label mother.
1606 fMotherMom.SetPxPyPzE(0,0,0,0);
1608 if(reader->ReadStack())
1610 if(!reader->GetStack())
1613 printf("AliMCAnalysisUtils::GetMother() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1618 if(label >= 0 && label < reader->GetStack()->GetNtrack())
1620 TParticle * momP = reader->GetStack()->Particle(label);
1621 momP->Momentum(fMotherMom);
1622 pdg = momP->GetPdgCode();
1623 status = momP->GetStatusCode();
1624 momlabel = momP->GetFirstMother();
1632 else if(reader->ReadAODMCParticles())
1634 TClonesArray* mcparticles = reader->GetAODMCParticles();
1638 printf("AliMCAnalysisUtils::GetMother() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1644 Int_t nprimaries = mcparticles->GetEntriesFast();
1645 if(label >= 0 && label < nprimaries)
1647 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1648 fMotherMom.SetPxPyPzE(momP->Px(),momP->Py(),momP->Pz(),momP->E());
1649 pdg = momP->GetPdgCode();
1650 status = momP->GetStatus();
1651 momlabel = momP->GetMother();
1665 //___________________________________________________________________________________
1666 TLorentzVector AliMCAnalysisUtils::GetMotherWithPDG(Int_t label, Int_t pdg,
1667 const AliCaloTrackReader* reader,
1668 Bool_t & ok, Int_t & momlabel)
1670 // Return the kinematics of the particle that generated the signal.
1672 fGMotherMom.SetPxPyPzE(0,0,0,0);
1674 if(reader->ReadStack())
1676 if(!reader->GetStack())
1679 printf("AliMCAnalysisUtils::GetMotherWithPDG() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1685 if(label >= 0 && label < reader->GetStack()->GetNtrack())
1687 TParticle * momP = reader->GetStack()->Particle(label);
1689 Int_t grandmomLabel = momP->GetFirstMother();
1690 Int_t grandmomPDG = -1;
1691 TParticle * grandmomP = 0x0;
1692 while (grandmomLabel >=0 )
1694 grandmomP = reader->GetStack()->Particle(grandmomLabel);
1695 grandmomPDG = grandmomP->GetPdgCode();
1696 if(grandmomPDG==pdg)
1698 momlabel = grandmomLabel;
1699 fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
1703 grandmomLabel = grandmomP->GetFirstMother();
1707 if(grandmomPDG!=pdg) printf("AliMCAnalysisUtils::GetMotherWithPDG(ESD) - mother with PDG %d, not found! \n",pdg);
1710 else if(reader->ReadAODMCParticles())
1712 TClonesArray* mcparticles = reader->GetAODMCParticles();
1716 printf("AliMCAnalysisUtils::GetMotherWithPDG() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1722 Int_t nprimaries = mcparticles->GetEntriesFast();
1723 if(label >= 0 && label < nprimaries)
1725 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1727 Int_t grandmomLabel = momP->GetMother();
1728 Int_t grandmomPDG = -1;
1729 AliAODMCParticle * grandmomP = 0x0;
1730 while (grandmomLabel >=0 )
1732 grandmomP = (AliAODMCParticle *) mcparticles->At(grandmomLabel);
1733 grandmomPDG = grandmomP->GetPdgCode();
1734 if(grandmomPDG==pdg)
1736 //printf("AliMCAnalysisUtils::GetMotherWithPDG(AOD) - mother with PDG %d FOUND! \n",pdg);
1737 momlabel = grandmomLabel;
1738 fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
1742 grandmomLabel = grandmomP->GetMother();
1746 if(grandmomPDG!=pdg) printf("AliMCAnalysisUtils::GetMotherWithPDG(AOD) - mother with PDG %d, NOT found! \n",pdg);
1756 //______________________________________________________________________________________________
1757 TLorentzVector AliMCAnalysisUtils::GetGrandMother(Int_t label, const AliCaloTrackReader* reader,
1758 Int_t & pdg, Int_t & status, Bool_t & ok,
1759 Int_t & grandMomLabel, Int_t & greatMomLabel)
1761 // Return the kinematics of the particle that generated the signal.
1763 fGMotherMom.SetPxPyPzE(0,0,0,0);
1765 if(reader->ReadStack())
1767 if(!reader->GetStack())
1770 printf("AliMCAnalysisUtils::GetGrandMother() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1776 if(label >= 0 && label < reader->GetStack()->GetNtrack())
1778 TParticle * momP = reader->GetStack()->Particle(label);
1780 grandMomLabel = momP->GetFirstMother();
1782 TParticle * grandmomP = 0x0;
1784 if (grandMomLabel >=0 )
1786 grandmomP = reader->GetStack()->Particle(grandMomLabel);
1787 pdg = grandmomP->GetPdgCode();
1788 status = grandmomP->GetStatusCode();
1790 fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->Energy());
1791 greatMomLabel = grandmomP->GetFirstMother();
1796 else if(reader->ReadAODMCParticles())
1798 TClonesArray* mcparticles = reader->GetAODMCParticles();
1802 printf("AliMCAnalysisUtils::GetGrandMother() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1808 Int_t nprimaries = mcparticles->GetEntriesFast();
1809 if(label >= 0 && label < nprimaries)
1811 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1813 grandMomLabel = momP->GetMother();
1815 AliAODMCParticle * grandmomP = 0x0;
1817 if(grandMomLabel >=0 )
1819 grandmomP = (AliAODMCParticle *) mcparticles->At(grandMomLabel);
1820 pdg = grandmomP->GetPdgCode();
1821 status = grandmomP->GetStatus();
1823 fGMotherMom.SetPxPyPzE(grandmomP->Px(),grandmomP->Py(),grandmomP->Pz(),grandmomP->E());
1824 greatMomLabel = grandmomP->GetMother();
1835 //_______________________________________________________________________________________________________________
1836 void AliMCAnalysisUtils::GetMCDecayAsymmetryAngleForPDG(Int_t label, Int_t pdg, const AliCaloTrackReader* reader,
1837 Float_t & asym, Float_t & angle, Bool_t & ok)
1839 // In case of an eta or pi0 decay into 2 photons, get the asymmetry in the energy of the photons.
1841 if(reader->ReadStack())
1843 if(!reader->GetStack())
1846 printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1850 if(label >= 0 && label < reader->GetStack()->GetNtrack())
1852 TParticle * momP = reader->GetStack()->Particle(label);
1854 Int_t grandmomLabel = momP->GetFirstMother();
1855 Int_t grandmomPDG = -1;
1856 TParticle * grandmomP = 0x0;
1857 while (grandmomLabel >=0 )
1859 grandmomP = reader->GetStack()->Particle(grandmomLabel);
1860 grandmomPDG = grandmomP->GetPdgCode();
1862 if(grandmomPDG==pdg) break;
1864 grandmomLabel = grandmomP->GetFirstMother();
1868 if(grandmomPDG==pdg && grandmomP->GetNDaughters()==2)
1870 TParticle * d1 = reader->GetStack()->Particle(grandmomP->GetDaughter(0));
1871 TParticle * d2 = reader->GetStack()->Particle(grandmomP->GetDaughter(1));
1872 if(d1->GetPdgCode() == 22 && d1->GetPdgCode() == 22)
1874 asym = (d1->Energy()-d2->Energy())/grandmomP->Energy();
1875 d1->Momentum(fDaughMom );
1876 d2->Momentum(fDaughMom2);
1877 angle = fDaughMom.Angle(fDaughMom2.Vect());
1883 printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG(ESD) - mother with PDG %d, not found! \n",pdg);
1888 else if(reader->ReadAODMCParticles())
1890 TClonesArray* mcparticles = reader->GetAODMCParticles();
1894 printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1900 Int_t nprimaries = mcparticles->GetEntriesFast();
1901 if(label >= 0 && label < nprimaries)
1903 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1905 Int_t grandmomLabel = momP->GetMother();
1906 Int_t grandmomPDG = -1;
1907 AliAODMCParticle * grandmomP = 0x0;
1908 while (grandmomLabel >=0 )
1910 grandmomP = (AliAODMCParticle *) mcparticles->At(grandmomLabel);
1911 grandmomPDG = grandmomP->GetPdgCode();
1913 if(grandmomPDG==pdg) break;
1915 grandmomLabel = grandmomP->GetMother();
1919 if(grandmomPDG==pdg && grandmomP->GetNDaughters()==2)
1921 AliAODMCParticle * d1 = (AliAODMCParticle *) mcparticles->At(grandmomP->GetDaughter(0));
1922 AliAODMCParticle * d2 = (AliAODMCParticle *) mcparticles->At(grandmomP->GetDaughter(1));
1923 if(d1->GetPdgCode() == 22 && d1->GetPdgCode() == 22)
1925 asym = (d1->E()-d2->E())/grandmomP->E();
1926 fDaughMom .SetPxPyPzE(d1->Px(),d1->Py(),d1->Pz(),d1->E());
1927 fDaughMom2.SetPxPyPzE(d2->Px(),d2->Py(),d2->Pz(),d2->E());
1928 angle = fDaughMom.Angle(fDaughMom2.Vect());
1934 printf("AliMCAnalysisUtils::GetMCDecayAsymmetryForPDG(AOD) - mother with PDG %d, not found! \n",pdg);
1944 //_________________________________________________________________________________________________
1945 Int_t AliMCAnalysisUtils::GetNDaughters(Int_t label, const AliCaloTrackReader* reader, Bool_t & ok)
1947 // Return the the number of daughters of a given MC particle.
1949 if(reader->ReadStack())
1951 if(!reader->GetStack())
1954 printf("AliMCAnalysisUtils::GetNDaughters() - Stack is not available, check analysis settings in configuration file, STOP!!\n");
1959 if(label >= 0 && label < reader->GetStack()->GetNtrack())
1961 TParticle * momP = reader->GetStack()->Particle(label);
1963 return momP->GetNDaughters();
1971 else if(reader->ReadAODMCParticles())
1973 TClonesArray* mcparticles = reader->GetAODMCParticles();
1977 printf("AliMCAnalysisUtils::GetNDaughters() - AODMCParticles is not available, check analysis settings in configuration file!!\n");
1983 Int_t nprimaries = mcparticles->GetEntriesFast();
1984 if(label >= 0 && label < nprimaries)
1986 AliAODMCParticle * momP = (AliAODMCParticle *) mcparticles->At(label);
1988 return momP->GetNDaughters();
2002 //_________________________________________________________________________________
2003 Int_t AliMCAnalysisUtils::GetNOverlaps(const Int_t * label, UInt_t nlabels,
2004 Int_t mctag, Int_t mesonLabel,
2005 AliCaloTrackReader * reader, Int_t *overpdg)
2007 // Compare the primary depositing more energy with the rest,
2008 // if no photon/electron (conversion) or neutral meson as comon ancestor, consider it as other particle contributing.
2009 // Give as input the meson label in case it was a pi0 or eta merged cluster.
2010 // Init overpdg with nlabels.
2012 Int_t ancPDG = 0, ancStatus = -1;
2013 TVector3 prodVertex;
2015 Int_t noverlaps = 0;
2018 for (UInt_t ilab = 1; ilab < nlabels; ilab++ )
2020 ancLabel = CheckCommonAncestor(label[0],label[ilab],reader,ancPDG,ancStatus,fMotherMom,prodVertex);
2022 //printf("Overlaps, i %d: Main Label %d, second label %d, ancestor: Label %d, pdg %d - tag %d \n",
2023 // ilab,label[0],label[ilab],ancLabel,ancPDG, mctag);
2025 Bool_t overlap = kFALSE;
2030 //printf("\t \t \t No Label = %d\n",ancLabel);
2032 else if( ( ancPDG==111 || ancPDG==221 ) && ( CheckTagBit(mctag,kMCPi0) || CheckTagBit(mctag,kMCEta)) && mesonLabel != ancLabel)
2034 //printf("\t \t meson Label %d, ancestor Label %d\n",mesonLabel,ancLabel);
2037 else if( ancPDG!=22 && TMath::Abs(ancPDG)!=11 && ancPDG != 111 && ancPDG != 221 )
2039 //printf("\t \t \t Non EM PDG = %d\n",ancPDG);
2043 if( !overlap ) continue ;
2045 // We have at least one overlap
2047 //printf("Overlap!!!!!!!!!!!!!!\n");
2051 // What is the origin of the overlap?
2052 Bool_t mOK = 0, gOK = 0;
2053 Int_t mpdg = -999999, gpdg = -1;
2054 Int_t mstatus = -1, gstatus = -1;
2055 Int_t gLabel = -1, ggLabel = -1;
2057 GetMother (label[ilab],reader,mpdg,mstatus,mOK);
2059 GetGrandMother(label[ilab],reader,gpdg,gstatus,gOK, gLabel,ggLabel);
2061 //printf("\t Overlap!, mother pdg %d; grand mother pdg %d",mpdg,gpdg);
2063 if( ( mpdg == 22 || TMath::Abs(mpdg==11) ) &&
2064 ( gpdg == 22 || TMath::Abs(gpdg==11) ) &&
2067 Int_t labeltmp = gLabel;
2068 while( ( gpdg == 22 || TMath::Abs(gpdg==11) ) && gLabel >=0 )
2071 fGMotherMom = GetGrandMother(labeltmp,reader,gpdg,gstatus,ok, gLabel,ggLabel);
2075 overpdg[noverlaps-1] = mpdg;
2082 //________________________________________________________
2083 void AliMCAnalysisUtils::Print(const Option_t * opt) const
2085 // Print some relevant parameters set for the analysis.
2090 printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
2092 printf("Debug level = %d\n",fDebug);
2093 printf("MC Generator = %s\n",fMCGeneratorString.Data());
2098 //__________________________________________________
2099 void AliMCAnalysisUtils::PrintMCTag(Int_t tag) const
2101 // Print the assigned origins to this particle.
2103 printf("AliMCAnalysisUtils::PrintMCTag() - tag %d \n photon %d, conv %d, prompt %d, frag %d, isr %d, \n pi0 decay %d, eta decay %d, other decay %d pi0 %d, eta %d \n electron %d, muon %d,pion %d, proton %d, neutron %d, \n kaon %d, a-proton %d, a-neutron %d, unk %d, bad %d\n",
2105 CheckTagBit(tag,kMCPhoton),
2106 CheckTagBit(tag,kMCConversion),
2107 CheckTagBit(tag,kMCPrompt),
2108 CheckTagBit(tag,kMCFragmentation),
2109 CheckTagBit(tag,kMCISR),
2110 CheckTagBit(tag,kMCPi0Decay),
2111 CheckTagBit(tag,kMCEtaDecay),
2112 CheckTagBit(tag,kMCOtherDecay),
2113 CheckTagBit(tag,kMCPi0),
2114 CheckTagBit(tag,kMCEta),
2115 CheckTagBit(tag,kMCElectron),
2116 CheckTagBit(tag,kMCMuon),
2117 CheckTagBit(tag,kMCPion),
2118 CheckTagBit(tag,kMCProton),
2119 CheckTagBit(tag,kMCAntiNeutron),
2120 CheckTagBit(tag,kMCKaon),
2121 CheckTagBit(tag,kMCAntiProton),
2122 CheckTagBit(tag,kMCAntiNeutron),
2123 CheckTagBit(tag,kMCUnknown),
2124 CheckTagBit(tag,kMCBadLabel)
2128 //__________________________________________________
2129 void AliMCAnalysisUtils::SetMCGenerator(Int_t mcgen)
2131 // Set the generator type.
2133 fMCGenerator = mcgen ;
2134 if (mcgen == kPythia) fMCGeneratorString = "PYTHIA";
2135 else if(mcgen == kHerwig) fMCGeneratorString = "HERWIG";
2136 else if(mcgen == kHijing) fMCGeneratorString = "HIJING";
2139 fMCGeneratorString = "";
2140 fMCGenerator = kBoxLike ;
2145 //__________________________________________________
2146 void AliMCAnalysisUtils::SetMCGenerator(TString mcgen)
2148 // Set the generator type.
2150 fMCGeneratorString = mcgen ;
2152 if (mcgen == "PYTHIA") fMCGenerator = kPythia;
2153 else if(mcgen == "HERWIG") fMCGenerator = kHerwig;
2154 else if(mcgen == "HIJING") fMCGenerator = kHijing;
2157 fMCGenerator = kBoxLike;
2158 fMCGeneratorString = "" ;