]>
Commit | Line | Data |
---|---|---|
7cc34f08 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | //------------------------------------------------------------------------------ | |
17 | // Impementation of AliMCInfoCuts class. It keeps selection cuts for MC tracks. | |
18 | // | |
19 | // | |
20 | // Author: J.Otwinowski 04/02/2008 | |
21 | //------------------------------------------------------------------------------ | |
22 | ||
23 | #include <iostream> | |
24 | #include <TArrayI.h> | |
25 | #include <TList.h> | |
26 | ||
27 | #include "AliLog.h" | |
28 | #include "AliMCInfoCuts.h" | |
29 | ||
30 | using namespace std; | |
31 | ||
32 | ClassImp(AliMCInfoCuts) | |
33 | ||
34 | //_____________________________________________________________________________ | |
35 | AliMCInfoCuts::AliMCInfoCuts(const Char_t* name,const Char_t *title) : | |
36 | AliAnalysisCuts(name, title) | |
37 | , fMinRowsWithDigits(0) | |
38 | , fMaxR(0) | |
39 | , fMaxVz(0) | |
40 | , fMinTPCSignal(0) | |
41 | , fMaxTPCSignal(0) | |
42 | , fMinTrackLength(0) | |
43 | , aTrackParticles(0) | |
44 | { | |
45 | // default constructor | |
46 | ||
47 | // init data members with defaults | |
36c8e4e6 | 48 | InitME(); |
7cc34f08 | 49 | } |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | AliMCInfoCuts::~AliMCInfoCuts() | |
53 | { | |
54 | // destructor | |
55 | if(aTrackParticles != 0) | |
56 | { | |
57 | delete aTrackParticles; | |
58 | aTrackParticles = 0; | |
59 | } | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
36c8e4e6 | 63 | void AliMCInfoCuts::InitME() |
7cc34f08 | 64 | { |
65 | // set default values | |
66 | SetMinRowsWithDigits(); | |
67 | SetMaxR(); | |
68 | SetMaxVz(); | |
69 | SetRangeTPCSignal(); | |
70 | SetMinTrackLength(); | |
71 | ||
72 | // create aTrackParticles array | |
73 | aTrackParticles = new TArrayI(kNParticles); // max nb. of particles | |
74 | aTrackParticles->Reset(0); | |
75 | ||
76 | // create an array of track particles: e, muons, pions, kaons, protons | |
77 | if(aTrackParticles != 0) | |
78 | { | |
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 | |
90 | } | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | void AliMCInfoCuts::AddPdgParticle(Int_t idx, Int_t pdgcode) const | |
95 | { | |
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"); | |
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | Bool_t AliMCInfoCuts::IsPdgParticle(Int_t pdgcode) const | |
103 | { | |
104 | // check PDG particle | |
105 | if(aTrackParticles == 0) { | |
106 | AliDebug(AliLog::kError, "ERROR: Cannot get particle array"); | |
107 | return kFALSE; | |
108 | } | |
109 | ||
110 | Int_t size = aTrackParticles->GetSize(); | |
111 | for(int i=0; i<size; ++i) { | |
112 | if(pdgcode == aTrackParticles->At(i)) return kTRUE; | |
113 | } | |
114 | return kFALSE; | |
115 | } | |
116 | ||
117 | //_____________________________________________________________________________ | |
118 | Bool_t AliMCInfoCuts::IsPosPdgParticle(Int_t pdgcode) const | |
119 | { | |
120 | // check PDG particle (only positive charged) | |
121 | if(aTrackParticles == 0) { | |
122 | AliDebug(AliLog::kError, "ERROR: Cannot get particle array"); | |
123 | return kFALSE; | |
124 | } | |
125 | ||
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; | |
131 | // | |
132 | if(pdgcode == aTrackParticles->At(i)) return kTRUE; | |
133 | } | |
134 | return kFALSE; | |
135 | } | |
136 | ||
137 | ||
138 | //_____________________________________________________________________________ | |
139 | Long64_t AliMCInfoCuts::Merge(TCollection* list) | |
140 | { | |
141 | // Merge list of objects (needed by PROOF) | |
142 | if (!list) | |
143 | return 0; | |
144 | ||
145 | if (list->IsEmpty()) | |
146 | return 1; | |
147 | ||
148 | TIterator* iter = list->MakeIterator(); | |
149 | TObject* obj = 0; | |
150 | ||
151 | Int_t count=0; | |
152 | while((obj = iter->Next()) != 0) | |
153 | { | |
154 | AliMCInfoCuts* entry = dynamic_cast<AliMCInfoCuts*>(obj); | |
155 | if (entry == 0) | |
156 | continue; | |
157 | ||
158 | count++; | |
159 | } | |
160 | ||
161 | return count; | |
162 | } |