]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/AliConversionPhotonBase.cxx
changed standard cut for pp & PbPb to have the proper length
[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   fQuality(0)
15 {
16   //Default constructor
17   fLabel[0] = -1;
18   fLabel[1] = -1;
19
20   fMCLabel[0]=-1;
21   fMCLabel[1]=-1;
22   
23
24   fArmenteros[0]=-999;
25   fArmenteros[1]=-999;
26
27   fConversionPoint[0]=-999;
28   fConversionPoint[1]=-999;
29   fConversionPoint[2]=-999;
30 }
31
32
33 AliConversionPhotonBase::AliConversionPhotonBase(const AliConversionPhotonBase & original) :
34 fV0Index(original.fV0Index),
35 fChi2perNDF(original.fChi2perNDF),
36 fTagged(original.fTagged),
37 fIMass(original.fIMass),
38 fPsiPair(original.fPsiPair),
39 fQuality(original.fQuality)
40   {
41   //Copy constructor
42   fLabel[0] = original.fLabel[0];
43   fLabel[1] = original.fLabel[1];
44
45   fMCLabel[0]=original.fMCLabel[0];
46   fMCLabel[1]=original.fMCLabel[1];
47
48   fArmenteros[0]=original.fArmenteros[0];
49   fArmenteros[1]=original.fArmenteros[1];
50
51   fConversionPoint[0]=original.fConversionPoint[0];
52   fConversionPoint[1]=original.fConversionPoint[1];
53   fConversionPoint[2]=original.fConversionPoint[2];
54
55   }
56
57 AliConversionPhotonBase::~AliConversionPhotonBase() {
58 // empty standard destructor
59
60 }
61
62
63 AliConversionPhotonBase & AliConversionPhotonBase::operator = (const AliConversionPhotonBase & /*source*/)
64 {
65   // assignment operator
66   return *this;
67 }
68
69 TParticle *AliConversionPhotonBase::GetMCParticle(AliStack *fMCStack){
70     if(!fMCStack){printf("MC Stack not defined");return 0x0;}
71
72     Int_t label=GetMCParticleLabel(fMCStack);
73
74     if(label>-1){
75         return fMCStack->Particle(label);
76     }
77
78     return 0x0;
79 }
80
81 Bool_t AliConversionPhotonBase::IsTruePhoton(AliStack *fMCStack){
82     TParticle *mcgamma=GetMCParticle(fMCStack);
83
84     if(mcgamma){
85         // Check if it is a true photon
86         if(mcgamma->GetPdgCode()==22){
87         return kTRUE;
88         }
89     }
90     return kFALSE;
91 }
92
93 Int_t AliConversionPhotonBase::GetMCParticleLabel(AliStack *fMCStack){
94     if(!fMCStack){printf("MC Stack not defined");return -1;}
95
96     TParticle *fPositiveMCParticle=GetPositiveMCDaughter(fMCStack);
97     TParticle *fNegativeMCParticle=GetNegativeMCDaughter(fMCStack);
98
99     if(!fPositiveMCParticle||!fNegativeMCParticle){return -1;}
100
101     if(fPositiveMCParticle->GetMother(0)>-1&&(fNegativeMCParticle->GetMother(0) == fPositiveMCParticle->GetMother(0))){
102
103             return fPositiveMCParticle->GetMother(0);
104     }
105
106     return -1;
107 }
108
109
110 TParticle *AliConversionPhotonBase::GetMCDaughter(AliStack *fMCStack,Int_t label){
111     if(!fMCStack){printf("MC Stack not defined \n");return 0x0;}
112     if(label<0||label>1){printf("Requested index out of bounds: %i \n",label);return 0x0;}
113
114     if(fMCLabel[label]>-1){
115         TParticle *fMCDaughter=fMCStack->Particle(fMCLabel[label]);
116         return fMCDaughter;}
117     else return 0x0;
118 }
119
120 ///________________________________________________________________________
121 void AliConversionPhotonBase::DeterminePhotonQuality(AliVTrack* negTrack, AliVTrack* posTrack){
122
123    
124    if(!negTrack || !posTrack) {
125         fQuality = 0;
126         return;
127    }
128    if(negTrack->Charge() == posTrack->Charge()){
129         fQuality = 0;
130         return;
131    }   
132    Int_t nClusterITSneg = negTrack->GetNcls(0);
133    Int_t nClusterITSpos = posTrack->GetNcls(0);
134    
135    if (nClusterITSneg > 1 && nClusterITSpos > 1){
136       fQuality = 3;
137       return;
138    } else if (nClusterITSneg > 1 || nClusterITSpos > 1){
139       fQuality = 2;
140       return;
141    } else {
142       fQuality = 1;
143       return;
144    }
145    return;
146    
147 }