]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/AliAODConversionParticle.cxx
Adding AliAODConversionParticle class
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliAODConversionParticle.cxx
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"
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(AliAODConversionParticle)
35
36
37
38 AliAODConversionParticle::AliAODConversionParticle() :
39   AliAODPhoton(),
40   fChi2(0),
41   fIMass(0), 
42 //fTagged(kFALSE),
43   fMCStack(NULL),
44   fESDEvent(NULL)
45 {
46   //Default constructor
47   fLabel[0] = -1;
48   fLabel[1] = -1;
49 }
50
51 AliAODConversionParticle::AliAODConversionParticle(TLorentzVector & momentum) :
52   AliAODPhoton(momentum),
53   fChi2(-1),
54   fIMass(-1), 
55 //fTagged(kFALSE),
56   fMCStack(NULL),
57   fESDEvent(NULL)
58 {
59   //Default constructor
60   fLabel[0] = -1;
61   fLabel[1] = -1;
62 }
63
64 AliAODConversionParticle::AliAODConversionParticle(const AliAODConversionParticle & original) :
65   AliAODPhoton(original),
66   fChi2(original.fChi2),
67   fIMass(original.fIMass),
68   //fTagged(original.fTagged),
69   fMCStack(original.fMCStack),
70   fESDEvent(original.fESDEvent)
71 {
72   //Copy constructor
73   fLabel[0] = original.fLabel[0];
74   fLabel[1] = original.fLabel[1];
75 }
76
77
78 AliAODConversionParticle & AliAODConversionParticle::operator = (const AliAODConversionParticle & /*source*/)
79 {
80   // assignment operator
81   return *this;
82 }
83
84
85 Int_t AliAODConversionParticle::GetGammaMCLabel() const{
86   // returns the MC label of the gamma (if both electrons have the same mother)
87   Int_t iResult = -1;
88   if(fMCStack != NULL){
89     Int_t mcLabel1= GetElectronMCLabel1();
90     Int_t mcLabel2= GetElectronMCLabel2();
91     if(mcLabel1>=0 && mcLabel2>=0){
92       TParticle *electron1 = fMCStack->Particle(mcLabel1);
93       TParticle *electron2 = fMCStack->Particle(mcLabel2);
94       if(electron1->GetMother(0) == electron2->GetMother(0)){
95         iResult = electron1->GetMother(0);
96       }
97     }
98   }
99   return iResult;
100 }
101
102 Int_t AliAODConversionParticle::GetElectronUniqueID(Int_t mcLabel1, Int_t mcLabel2) const{
103   Int_t iResult = -1;
104   if(fMCStack != NULL){
105     if(mcLabel1>=0 && mcLabel2>=0){
106       TParticle *electron1 = fMCStack->Particle(mcLabel1);
107       TParticle *electron2 = fMCStack->Particle(mcLabel2);
108       if(electron1->GetMother(0) == electron2->GetMother(0)){
109         if(electron1->GetUniqueID() == electron2->GetUniqueID()){
110           iResult = (Int_t)electron1->GetUniqueID();
111         }
112       }
113     }
114   }
115   
116   return iResult;
117 }
118
119 Int_t AliAODConversionParticle::GetElectronUniqueID() const{
120   // returns the unique id of the electrons if they have the same mother and unique id
121   if(fMCStack != NULL){
122     return GetElectronUniqueID(GetElectronMCLabel1(), GetElectronMCLabel2());
123   }  
124   return -1;
125 }
126
127
128 Int_t AliAODConversionParticle::GetMCLabel(Int_t label) const {
129   //returns the MC label of the first electron
130   Int_t iResult=-1;
131   if(fESDEvent != NULL){
132     if(label>=0){
133       iResult = fESDEvent->GetTrack(label)->GetLabel();
134     }
135   }
136   return iResult;
137 }
138
139 Int_t AliAODConversionParticle::GetElectronMCLabel1() const{
140   //returns the MC label of the first electron
141   if(fLabel[0] >=0) {
142     return GetMCLabel(fLabel[0]);
143   }
144   
145   return -1;
146 }
147
148 Int_t AliAODConversionParticle::GetElectronMCLabel2() const{
149   //returns the MC label of the first electron
150   if(fLabel[1] >=0) {
151     return GetMCLabel(fLabel[1]);
152   }
153   
154   return -1;
155 }