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 // Impementation of AliMCInfoCuts class. It keeps selection cuts for MC tracks.
20 // Author: J.Otwinowski 04/02/2008
21 //------------------------------------------------------------------------------
28 #include "AliMCInfoCuts.h"
32 ClassImp(AliMCInfoCuts)
34 //_____________________________________________________________________________
35 AliMCInfoCuts::AliMCInfoCuts(const Char_t* name,const Char_t *title) :
36 AliAnalysisCuts(name, title)
37 , fMinRowsWithDigits(0)
44 // default constructor
46 // init data members with defaults
50 //_____________________________________________________________________________
51 AliMCInfoCuts::~AliMCInfoCuts()
54 if(aTrackParticles != 0)
56 delete aTrackParticles;
61 //_____________________________________________________________________________
62 void AliMCInfoCuts::Init()
65 SetMinRowsWithDigits();
70 // create aTrackParticles array
71 aTrackParticles = new TArrayI(kNParticles); // max nb. of particles
72 aTrackParticles->Reset(0);
74 // create an array of track particles: e, muons, pions, kaons, protons
75 if(aTrackParticles != 0)
77 // keep order adding a new particles
78 AddPdgParticle(0,ep); // e+
79 AddPdgParticle(1,em); // e-
80 AddPdgParticle(2,mup); // mu+
81 AddPdgParticle(3,mum); // mu-
82 AddPdgParticle(4,pip); // pi+
83 AddPdgParticle(5,pim); // pi-
84 AddPdgParticle(6,kp); // K+
85 AddPdgParticle(7,km); // K-
86 AddPdgParticle(8,prot); // p
87 AddPdgParticle(9,protbar); // p_bar
91 //_____________________________________________________________________________
92 void AliMCInfoCuts::AddPdgParticle(Int_t idx, Int_t pdgcode) const
94 // add particle to the array
95 if(aTrackParticles != 0) aTrackParticles->AddAt(pdgcode,idx);
96 else AliDebug(AliLog::kError, "ERROR: Cannot add particle to the array");
99 //_____________________________________________________________________________
100 Bool_t AliMCInfoCuts::IsPdgParticle(Int_t pdgcode) const
102 // check PDG particle
103 if(aTrackParticles == 0) {
104 AliDebug(AliLog::kError, "ERROR: Cannot get particle array");
108 Int_t size = aTrackParticles->GetSize();
109 for(int i=0; i<size; ++i) {
110 if(pdgcode == aTrackParticles->At(i)) return kTRUE;
115 //_____________________________________________________________________________
116 Bool_t AliMCInfoCuts::IsPosPdgParticle(Int_t pdgcode) const
118 // check PDG particle (only positive charged)
119 if(aTrackParticles == 0) {
120 AliDebug(AliLog::kError, "ERROR: Cannot get particle array");
124 Int_t size = aTrackParticles->GetSize();
125 for(int i=0; i<size; ++i) {
126 // leptons have oposite pdg convension from hadrons (e+/e- = -11/11)
127 if(pdgcode > 0 && (pdgcode == 11 || pdgcode == 13)) return kFALSE;
128 if(pdgcode < 0 && (pdgcode != -11 || pdgcode != -13) ) return kFALSE;
130 if(pdgcode == aTrackParticles->At(i)) return kTRUE;
136 //_____________________________________________________________________________
137 Long64_t AliMCInfoCuts::Merge(TCollection* list)
139 // Merge list of objects (needed by PROOF)
146 TIterator* iter = list->MakeIterator();
150 while((obj = iter->Next()) != 0)
152 AliMCInfoCuts* entry = dynamic_cast<AliMCInfoCuts*>(obj);