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)
45 // default constructor
47 // init data members with defaults
51 //_____________________________________________________________________________
52 AliMCInfoCuts::~AliMCInfoCuts()
55 if(aTrackParticles != 0)
57 delete aTrackParticles;
62 //_____________________________________________________________________________
63 void AliMCInfoCuts::InitME()
66 SetMinRowsWithDigits();
72 // create aTrackParticles array
73 aTrackParticles = new TArrayI(kNParticles); // max nb. of particles
74 aTrackParticles->Reset(0);
76 // create an array of track particles: e, muons, pions, kaons, protons
77 if(aTrackParticles != 0)
79 // keep order adding a new particles
80 AddPdgParticle(0,ep); // e+
81 AddPdgParticle(1,em); // e-
82 AddPdgParticle(2,mup); // mu+
83 AddPdgParticle(3,mum); // mu-
84 AddPdgParticle(4,pip); // pi+
85 AddPdgParticle(5,pim); // pi-
86 AddPdgParticle(6,kp); // K+
87 AddPdgParticle(7,km); // K-
88 AddPdgParticle(8,prot); // p
89 AddPdgParticle(9,protbar); // p_bar
93 //_____________________________________________________________________________
94 void AliMCInfoCuts::AddPdgParticle(Int_t idx, Int_t pdgcode) const
96 // add particle to the array
97 if(aTrackParticles != 0) aTrackParticles->AddAt(pdgcode,idx);
98 else AliDebug(AliLog::kError, "ERROR: Cannot add particle to the array");
101 //_____________________________________________________________________________
102 Bool_t AliMCInfoCuts::IsPdgParticle(Int_t pdgcode) const
104 // check PDG particle
105 if(aTrackParticles == 0) {
106 AliDebug(AliLog::kError, "ERROR: Cannot get particle array");
110 Int_t size = aTrackParticles->GetSize();
111 for(int i=0; i<size; ++i) {
112 if(pdgcode == aTrackParticles->At(i)) return kTRUE;
117 //_____________________________________________________________________________
118 Bool_t AliMCInfoCuts::IsPosPdgParticle(Int_t pdgcode) const
120 // check PDG particle (only positive charged)
121 if(aTrackParticles == 0) {
122 AliDebug(AliLog::kError, "ERROR: Cannot get particle array");
126 Int_t size = aTrackParticles->GetSize();
127 for(int i=0; i<size; ++i) {
128 // leptons have oposite pdg convension from hadrons (e+/e- = -11/11)
129 if(pdgcode > 0 && (pdgcode == 11 || pdgcode == 13)) return kFALSE;
130 if(pdgcode < 0 && (pdgcode != -11 || pdgcode != -13) ) return kFALSE;
132 if(pdgcode == aTrackParticles->At(i)) return kTRUE;
138 //_____________________________________________________________________________
139 Long64_t AliMCInfoCuts::Merge(TCollection* list)
141 // Merge list of objects (needed by PROOF)
148 TIterator* iter = list->MakeIterator();
152 while((obj = iter->Next()) != 0)
154 AliMCInfoCuts* entry = dynamic_cast<AliMCInfoCuts*>(obj);