]>
Commit | Line | Data |
---|---|---|
e5b3650b | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt, Svein Lindal * | |
5 | * Version 1.0 * | |
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 | //--------------------------------------------- | |
18 | // Class containing the aod information we need | |
19 | //--------------------------------------------- | |
20 | //////////////////////////////////////////////// | |
21 | ||
22 | #include "AliAODConversionParticle.h" | |
e5b3650b | 23 | #include "AliStack.h" |
24 | #include "AliESDEvent.h" | |
e5b3650b | 25 | #include "TParticle.h" |
81900183 | 26 | #include <iostream> |
e5b3650b | 27 | |
28 | class AliAODv0; | |
29 | class AliESDtrack; | |
30 | ||
31 | using namespace std; | |
32 | ||
33 | ClassImp(AliAODConversionParticle) | |
34 | ||
35 | ||
36 | ||
37 | AliAODConversionParticle::AliAODConversionParticle() : | |
38 | AliAODPhoton(), | |
39 | fChi2(0), | |
40 | fIMass(0), | |
81900183 | 41 | fTagged(kFALSE), |
e5b3650b | 42 | fMCStack(NULL), |
43 | fESDEvent(NULL) | |
44 | { | |
45 | //Default constructor | |
46 | fLabel[0] = -1; | |
47 | fLabel[1] = -1; | |
48 | } | |
49 | ||
50 | AliAODConversionParticle::AliAODConversionParticle(TLorentzVector & momentum) : | |
51 | AliAODPhoton(momentum), | |
52 | fChi2(-1), | |
53 | fIMass(-1), | |
81900183 | 54 | fTagged(kFALSE), |
e5b3650b | 55 | fMCStack(NULL), |
56 | fESDEvent(NULL) | |
57 | { | |
58 | //Default constructor | |
59 | fLabel[0] = -1; | |
60 | fLabel[1] = -1; | |
61 | } | |
62 | ||
81900183 | 63 | AliAODConversionParticle::AliAODConversionParticle(AliGammaConversionAODObject *obj): |
64 | AliAODPhoton(obj->Px(),obj->Py(),obj->Pz(),obj->E()), | |
65 | fChi2(0), | |
66 | fIMass(0), | |
67 | fTagged(kFALSE), | |
68 | fMCStack(NULL), | |
69 | fESDEvent(NULL) | |
70 | { | |
71 | ||
72 | fIMass=obj->IMass(); | |
73 | ||
74 | // fIMass=obj->M(); | |
75 | //Default constructor | |
76 | fLabel[0] = obj->GetLabel1(); | |
77 | fLabel[1] = obj->GetLabel2(); | |
78 | ||
79 | } | |
80 | ||
81 | AliAODConversionParticle::AliAODConversionParticle(AliKFParticle * gammakf,Int_t label1,Int_t label2): | |
82 | AliAODPhoton(gammakf->Px(),gammakf->Py(),gammakf->Pz(), gammakf->E()), | |
83 | fChi2(0), | |
84 | fIMass(0), | |
85 | fTagged(kFALSE), | |
86 | fMCStack(NULL), | |
87 | fESDEvent(NULL) | |
88 | { | |
7be31c4b | 89 | |
81900183 | 90 | fLabel[0] = label1; |
91 | fLabel[1] = label2; | |
7be31c4b | 92 | |
81900183 | 93 | fIMass=gammakf->GetMass(); |
94 | ||
95 | ||
7be31c4b | 96 | } |
97 | ||
98 | ||
81900183 | 99 | |
100 | AliAODConversionParticle::AliAODConversionParticle(AliAODConversionParticle *y1,AliAODConversionParticle *y2): | |
101 | AliAODPhoton(y1->Px()+y2->Px(),y1->Py()+y2->Py(),y1->Pz()+y2->Pz(),y1->E()+y2->E()), | |
102 | fChi2(0), | |
103 | fIMass(0), | |
104 | fTagged(kFALSE), | |
105 | fMCStack(NULL), | |
106 | fESDEvent(NULL) | |
107 | { | |
108 | fIMass=M(); | |
1793f717 | 109 | fLabel[0] = -1; |
110 | fLabel[1] = -1; | |
81900183 | 111 | } |
112 | ||
e5b3650b | 113 | AliAODConversionParticle::AliAODConversionParticle(const AliAODConversionParticle & original) : |
114 | AliAODPhoton(original), | |
115 | fChi2(original.fChi2), | |
116 | fIMass(original.fIMass), | |
81900183 | 117 | fTagged(original.fTagged), |
e5b3650b | 118 | fMCStack(original.fMCStack), |
119 | fESDEvent(original.fESDEvent) | |
120 | { | |
121 | //Copy constructor | |
122 | fLabel[0] = original.fLabel[0]; | |
123 | fLabel[1] = original.fLabel[1]; | |
124 | } | |
125 | ||
126 | ||
127 | AliAODConversionParticle & AliAODConversionParticle::operator = (const AliAODConversionParticle & /*source*/) | |
128 | { | |
129 | // assignment operator | |
130 | return *this; | |
131 | } | |
132 | ||
133 | ||
134 | Int_t AliAODConversionParticle::GetGammaMCLabel() const{ | |
135 | // returns the MC label of the gamma (if both electrons have the same mother) | |
136 | Int_t iResult = -1; | |
137 | if(fMCStack != NULL){ | |
138 | Int_t mcLabel1= GetElectronMCLabel1(); | |
139 | Int_t mcLabel2= GetElectronMCLabel2(); | |
140 | if(mcLabel1>=0 && mcLabel2>=0){ | |
141 | TParticle *electron1 = fMCStack->Particle(mcLabel1); | |
142 | TParticle *electron2 = fMCStack->Particle(mcLabel2); | |
143 | if(electron1->GetMother(0) == electron2->GetMother(0)){ | |
144 | iResult = electron1->GetMother(0); | |
145 | } | |
146 | } | |
147 | } | |
148 | return iResult; | |
149 | } | |
150 | ||
151 | Int_t AliAODConversionParticle::GetElectronUniqueID(Int_t mcLabel1, Int_t mcLabel2) const{ | |
152 | Int_t iResult = -1; | |
153 | if(fMCStack != NULL){ | |
154 | if(mcLabel1>=0 && mcLabel2>=0){ | |
155 | TParticle *electron1 = fMCStack->Particle(mcLabel1); | |
156 | TParticle *electron2 = fMCStack->Particle(mcLabel2); | |
157 | if(electron1->GetMother(0) == electron2->GetMother(0)){ | |
158 | if(electron1->GetUniqueID() == electron2->GetUniqueID()){ | |
159 | iResult = (Int_t)electron1->GetUniqueID(); | |
160 | } | |
161 | } | |
162 | } | |
163 | } | |
164 | ||
165 | return iResult; | |
166 | } | |
167 | ||
168 | Int_t AliAODConversionParticle::GetElectronUniqueID() const{ | |
169 | // returns the unique id of the electrons if they have the same mother and unique id | |
170 | if(fMCStack != NULL){ | |
171 | return GetElectronUniqueID(GetElectronMCLabel1(), GetElectronMCLabel2()); | |
172 | } | |
173 | return -1; | |
174 | } | |
175 | ||
176 | ||
177 | Int_t AliAODConversionParticle::GetMCLabel(Int_t label) const { | |
178 | //returns the MC label of the first electron | |
179 | Int_t iResult=-1; | |
180 | if(fESDEvent != NULL){ | |
181 | if(label>=0){ | |
182 | iResult = fESDEvent->GetTrack(label)->GetLabel(); | |
183 | } | |
184 | } | |
185 | return iResult; | |
186 | } | |
187 | ||
188 | Int_t AliAODConversionParticle::GetElectronMCLabel1() const{ | |
189 | //returns the MC label of the first electron | |
190 | if(fLabel[0] >=0) { | |
191 | return GetMCLabel(fLabel[0]); | |
192 | } | |
193 | ||
194 | return -1; | |
195 | } | |
196 | ||
197 | Int_t AliAODConversionParticle::GetElectronMCLabel2() const{ | |
198 | //returns the MC label of the first electron | |
199 | if(fLabel[1] >=0) { | |
200 | return GetMCLabel(fLabel[1]); | |
201 | } | |
202 | ||
203 | return -1; | |
204 | } | |
81900183 | 205 | |
206 | ///_________________________________________________________ | |
207 | Bool_t AliAODConversionParticle::IsMySpawn(const Int_t trackId, const Int_t nSpawn, const Int_t * const spawnList) const { | |
208 | for(int iSpawn = 0; iSpawn < nSpawn; iSpawn++) { | |
209 | //cout << spawnList[iSpawn] << endl;; | |
210 | if(spawnList[iSpawn] == trackId) return kTRUE; | |
211 | } | |
212 | return kFALSE; | |
213 | } | |
214 |