]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliConversionPhotonBase.cxx
comment
[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 {
14   //Default constructor
15   fLabel[0] = -1;
16   fLabel[1] = -1;
17
18   fMCLabel[0]=-1;
19   fMCLabel[1]=-1;
20   
21
22   fArmenteros[0]=-999;
23   fArmenteros[1]=-999;
24
25   fConversionPoint[0]=-999;
26   fConversionPoint[1]=-999;
27   fConversionPoint[2]=-999;
28 }
29
30
31 AliConversionPhotonBase::AliConversionPhotonBase(const AliConversionPhotonBase & original) :
32 fV0Index(original.fV0Index),
33 fChi2perNDF(original.fChi2perNDF),
34 fTagged(original.fTagged),
35   fIMass(original.fIMass)
36   {
37   //Copy constructor
38   fLabel[0] = original.fLabel[0];
39   fLabel[1] = original.fLabel[1];
40
41   fMCLabel[0]=original.fMCLabel[0];
42   fMCLabel[1]=original.fMCLabel[1];
43
44   fArmenteros[0]=original.fArmenteros[0];
45   fArmenteros[1]=original.fArmenteros[1];
46
47   fConversionPoint[0]=original.fConversionPoint[0];
48   fConversionPoint[1]=original.fConversionPoint[1];
49   fConversionPoint[2]=original.fConversionPoint[2];
50
51   }
52
53 AliConversionPhotonBase::~AliConversionPhotonBase() {
54 // empty standard destructor
55
56 }
57
58
59 AliConversionPhotonBase & AliConversionPhotonBase::operator = (const AliConversionPhotonBase & /*source*/)
60 {
61   // assignment operator
62   return *this;
63 }
64
65 TParticle *AliConversionPhotonBase::GetMCParticle(AliStack *fMCStack){
66     if(!fMCStack){printf("MC Stack not defined");return 0x0;}
67
68     Int_t label=GetMCParticleLabel(fMCStack);
69
70     if(label>-1){
71         return fMCStack->Particle(label);
72     }
73
74     return 0x0;
75 }
76
77 Int_t AliConversionPhotonBase::GetMCParticleLabel(AliStack *fMCStack){
78     if(!fMCStack){printf("MC Stack not defined");return -1;}
79
80     TParticle *fPositiveMCParticle=GetPositiveMCDaughter(fMCStack);
81     TParticle *fNegativeMCParticle=GetNegativeMCDaughter(fMCStack);
82
83     if(!fPositiveMCParticle||!fNegativeMCParticle){return -1;}
84
85     if(fPositiveMCParticle->GetMother(0)>-1&&(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))){
86
87             return fPositiveMCParticle->GetMother(0);
88     }
89
90     return -1;
91 }
92
93
94 TParticle *AliConversionPhotonBase::GetMCDaughter(AliStack *fMCStack,Int_t label){
95     if(!fMCStack){printf("MC Stack not defined \n");return 0x0;}
96     if(label<0||label>1){printf("Requested index out of bounds: %i \n",label);return 0x0;}
97
98     if(fMCLabel[label]>-1){
99         TParticle *fMCDaughter=fMCStack->Particle(fMCLabel[label]);
100         return fMCDaughter;}
101     else return 0x0;
102 }