]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/AliGammaConversionAODObject.cxx
Added functionality to also process calorimeter data + some changes in cuts (Ana)
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliGammaConversionAODObject.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt                        *
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 "AliGammaConversionAODObject.h"
23 //#include "AliAODv0.h"
24 #include "AliStack.h"
25 #include "AliESDEvent.h"
26 //#include "AliESDtrack.h"
27 #include "TParticle.h"
28
29 class AliAODv0;
30 class AliESDtrack;
31
32 using namespace std;
33
34 ClassImp(AliGammaConversionAODObject)
35
36
37
38 AliGammaConversionAODObject::AliGammaConversionAODObject() :
39   TObject(),
40   fPx(0),
41   fPy(0),
42   fPz(0),
43   fLabel1(-1),
44   fLabel2(-1),
45   fMCStack(NULL),
46   fESDEvent(NULL)
47 {
48         
49 }
50
51
52 AliGammaConversionAODObject::AliGammaConversionAODObject(const AliGammaConversionAODObject & original) :
53   TObject(original),
54   fPx(original.fPx),
55   fPy(original.fPy),
56   fPz(original.fPz),
57   fLabel1(original.fLabel1),
58   fLabel2(original.fLabel2),
59   fMCStack(original.fMCStack),
60   fESDEvent(original.fESDEvent)
61 {
62         
63 }
64
65
66 AliGammaConversionAODObject & AliGammaConversionAODObject::operator = (const AliGammaConversionAODObject & /*source*/)
67 {
68   // assignment operator
69   return *this;
70 }
71
72 Int_t AliGammaConversionAODObject::GetGammaMCLabel() const{
73   // returns the MC label of the gamma (if both electrons have the same mother)
74   Int_t iResult = -1;
75   if(fMCStack != NULL){
76     Int_t mcLabel1= GetElectronMCLabel1();
77     Int_t mcLabel2= GetElectronMCLabel2();
78     if(mcLabel1>=0 && mcLabel2>=0){
79       TParticle *electron1 = fMCStack->Particle(mcLabel1);
80       TParticle *electron2 = fMCStack->Particle(mcLabel2);
81       if(electron1->GetMother(0) == electron2->GetMother(0)){
82         iResult = electron1->GetMother(0);
83       }
84     }
85   }
86   return iResult;
87 }
88
89 Int_t AliGammaConversionAODObject::GetElectronUniqueID() const{
90   // returns the unique id of the electrons if they have the same mother and unique id
91   Int_t iResult = -1;
92   if(fMCStack != NULL){
93     Int_t mcLabel1= GetElectronMCLabel1();
94     Int_t mcLabel2= GetElectronMCLabel2();
95     if(mcLabel1>=0 && mcLabel2>=0){
96       TParticle *electron1 = fMCStack->Particle(mcLabel1);
97       TParticle *electron2 = fMCStack->Particle(mcLabel2);
98       if(electron1->GetMother(0) == electron2->GetMother(0)){
99         if(electron1->GetUniqueID() == electron2->GetUniqueID()){
100           iResult = (Int_t)electron1->GetUniqueID();
101         }
102       }
103     }
104   }
105   return iResult;
106 }
107
108 Int_t AliGammaConversionAODObject::GetElectronMCLabel1() const{
109   //returns the MC label of the first electron
110   Int_t iResult=-1;
111   if(fESDEvent != NULL){
112     if(fLabel1>=0){
113       iResult = (fESDEvent->GetTrack(fLabel1))->GetLabel();
114     }
115   }
116   return iResult;
117 }
118
119 Int_t AliGammaConversionAODObject::GetElectronMCLabel2() const{
120   //returns the MC label of the first electron
121   Int_t iResult=-1;
122   if(fESDEvent != NULL){
123     if(fLabel2>=0){
124       iResult = (fESDEvent->GetTrack(fLabel2))->GetLabel();
125     }
126   }
127   return iResult;
128 }