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