]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliConversionPhotonBase.cxx
changes in AddTask pPb
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliConversionPhotonBase.cxx
1 #include "AliConversionPhotonBase.h"
2 #include <iostream>
3
4 using namespace std;
5
6 ClassImp(AliConversionPhotonBase)
7
8 AliConversionPhotonBase::AliConversionPhotonBase() :
9 fV0Index(-1),
10   fChi2perNDF(-1),
11   fTagged(kFALSE),
12   fIMass(-999),
13   fPsiPair(-999)
14 {
15   //Default constructor
16   fLabel[0] = -1;
17   fLabel[1] = -1;
18
19   fMCLabel[0]=-1;
20   fMCLabel[1]=-1;
21   
22
23   fArmenteros[0]=-999;
24   fArmenteros[1]=-999;
25
26   fConversionPoint[0]=-999;
27   fConversionPoint[1]=-999;
28   fConversionPoint[2]=-999;
29 }
30
31
32 AliConversionPhotonBase::AliConversionPhotonBase(const AliConversionPhotonBase & original) :
33 fV0Index(original.fV0Index),
34 fChi2perNDF(original.fChi2perNDF),
35 fTagged(original.fTagged),
36 fIMass(original.fIMass),
37 fPsiPair(original.fPsiPair)
38   {
39   //Copy constructor
40   fLabel[0] = original.fLabel[0];
41   fLabel[1] = original.fLabel[1];
42
43   fMCLabel[0]=original.fMCLabel[0];
44   fMCLabel[1]=original.fMCLabel[1];
45
46   fArmenteros[0]=original.fArmenteros[0];
47   fArmenteros[1]=original.fArmenteros[1];
48
49   fConversionPoint[0]=original.fConversionPoint[0];
50   fConversionPoint[1]=original.fConversionPoint[1];
51   fConversionPoint[2]=original.fConversionPoint[2];
52
53   }
54
55 AliConversionPhotonBase::~AliConversionPhotonBase() {
56 // empty standard destructor
57
58 }
59
60
61 AliConversionPhotonBase & AliConversionPhotonBase::operator = (const AliConversionPhotonBase & /*source*/)
62 {
63   // assignment operator
64   return *this;
65 }
66
67 TParticle *AliConversionPhotonBase::GetMCParticle(AliStack *fMCStack){
68     if(!fMCStack){printf("MC Stack not defined");return 0x0;}
69
70     Int_t label=GetMCParticleLabel(fMCStack);
71
72     if(label>-1){
73         return fMCStack->Particle(label);
74     }
75
76     return 0x0;
77 }
78
79 Bool_t AliConversionPhotonBase::IsTruePhoton(AliStack *fMCStack){
80     TParticle *mcgamma=GetMCParticle(fMCStack);
81
82     if(mcgamma){
83         // Check if it is a true photon
84         if(mcgamma->GetPdgCode()==22){
85         return kTRUE;
86         }
87     }
88     return kFALSE;
89 }
90
91 Int_t AliConversionPhotonBase::GetMCParticleLabel(AliStack *fMCStack){
92     if(!fMCStack){printf("MC Stack not defined");return -1;}
93
94     TParticle *fPositiveMCParticle=GetPositiveMCDaughter(fMCStack);
95     TParticle *fNegativeMCParticle=GetNegativeMCDaughter(fMCStack);
96
97     if(!fPositiveMCParticle||!fNegativeMCParticle){return -1;}
98
99     if(fPositiveMCParticle->GetMother(0)>-1&&(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))){
100
101             return fPositiveMCParticle->GetMother(0);
102     }
103
104     return -1;
105 }
106
107
108 TParticle *AliConversionPhotonBase::GetMCDaughter(AliStack *fMCStack,Int_t label){
109     if(!fMCStack){printf("MC Stack not defined \n");return 0x0;}
110     if(label<0||label>1){printf("Requested index out of bounds: %i \n",label);return 0x0;}
111
112     if(fMCLabel[label]>-1){
113         TParticle *fMCDaughter=fMCStack->Particle(fMCLabel[label]);
114         return fMCDaughter;}
115     else return 0x0;
116 }