1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt, Svein Lindal *
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 //---------------------------------------------
18 // Class containing the aod information we need
19 //---------------------------------------------
20 ////////////////////////////////////////////////
22 #include "AliAODConversionParticle.h"
24 #include "AliESDEvent.h"
25 #include "TParticle.h"
33 ClassImp(AliAODConversionParticle)
37 AliAODConversionParticle::AliAODConversionParticle() :
50 AliAODConversionParticle::AliAODConversionParticle(TLorentzVector & momentum) :
51 AliAODPhoton(momentum),
63 AliAODConversionParticle::AliAODConversionParticle(AliGammaConversionAODObject *obj):
64 AliAODPhoton(obj->Px(),obj->Py(),obj->Pz(),obj->E()),
76 fLabel[0] = obj->GetLabel1();
77 fLabel[1] = obj->GetLabel2();
81 AliAODConversionParticle::AliAODConversionParticle(AliKFParticle * gammakf,Int_t label1,Int_t label2):
82 AliAODPhoton(gammakf->Px(),gammakf->Py(),gammakf->Pz(), gammakf->E()),
93 fIMass=gammakf->GetMass();
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()),
113 AliAODConversionParticle::AliAODConversionParticle(const AliAODConversionParticle & original) :
114 AliAODPhoton(original),
115 fChi2(original.fChi2),
116 fIMass(original.fIMass),
117 fTagged(original.fTagged),
118 fMCStack(original.fMCStack),
119 fESDEvent(original.fESDEvent)
122 fLabel[0] = original.fLabel[0];
123 fLabel[1] = original.fLabel[1];
127 AliAODConversionParticle & AliAODConversionParticle::operator = (const AliAODConversionParticle & /*source*/)
129 // assignment operator
134 Int_t AliAODConversionParticle::GetGammaMCLabel() const{
135 // returns the MC label of the gamma (if both electrons have the same mother)
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);
151 Int_t AliAODConversionParticle::GetElectronUniqueID(Int_t mcLabel1, Int_t mcLabel2) const{
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();
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());
177 Int_t AliAODConversionParticle::GetMCLabel(Int_t label) const {
178 //returns the MC label of the first electron
180 if(fESDEvent != NULL){
182 iResult = fESDEvent->GetTrack(label)->GetLabel();
188 Int_t AliAODConversionParticle::GetElectronMCLabel1() const{
189 //returns the MC label of the first electron
191 return GetMCLabel(fLabel[0]);
197 Int_t AliAODConversionParticle::GetElectronMCLabel2() const{
198 //returns the MC label of the first electron
200 return GetMCLabel(fLabel[1]);
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;
215 ///_______________________________________________________________________________
216 void AliAODConversionParticle::GetGrandChildren(const TClonesArray * photons, Int_t* trackLabels) {
217 ///Get the track labels of the electrons reconstructed as gamma forming the pion
219 for(Int_t i = 0; i< 2; i++) {
220 AliAODConversionParticle * gamma = dynamic_cast<AliAODConversionParticle*>(photons->At(GetTrackLabel(i)));
223 for(Int_t j = 0; j< 2; j++) {
224 trackLabels[ i*2+ j] = gamma->GetTrackLabel(j);
228 cout << "AliAODConversionParticle::GetTrackLabels() :: Not good!!!"<<endl;