]>
Commit | Line | Data |
---|---|---|
2eedd4ed | 1 | #include "AliAODConversionMother.h" |
2 | #include "AliKFConversionMother.h" | |
3 | #include "AliKFParticle.h" | |
4 | ||
5 | ||
6 | // Author D. Lohner (Daniel.Lohner@cern.ch) | |
7 | ||
8 | using namespace std; | |
9 | ||
10 | ClassImp(AliAODConversionMother) | |
11 | ||
12 | AliAODConversionMother::AliAODConversionMother() : | |
13 | AliAODConversionParticle(), | |
92efd725 | 14 | fMCLabel(-1), |
15 | fChi2(-1), | |
16 | fOpeningAngle(-1), | |
69b05e50 | 17 | fAlpha(-1), |
4803eb1f | 18 | fWeight(1), |
19 | fdcaBetweenPhotons(1), | |
20 | fdcaZPrimVtx(100), | |
21 | fdcaRPrimVtx(100), | |
22 | fQuality(0) | |
23 | ||
2eedd4ed | 24 | { |
fd420a4f | 25 | fLabel[0] = -1; |
26 | fLabel[1] = -1; | |
92efd725 | 27 | fLabel[2] = 0; |
4803eb1f | 28 | |
29 | fProductionVtx[0]=0; | |
30 | fProductionVtx[1]=0; | |
31 | fProductionVtx[2]=0; | |
32 | ||
2eedd4ed | 33 | } |
34 | ||
35 | AliAODConversionMother::AliAODConversionMother(AliKFConversionMother *kf): | |
36 | AliAODConversionParticle(), | |
92efd725 | 37 | fMCLabel(kf->GetMCLabel()), |
2eedd4ed | 38 | fChi2(kf->GetChi2()), |
39 | fOpeningAngle(kf->GetOpeningAngle()), | |
69b05e50 | 40 | fAlpha(kf->GetAlpha()), |
4803eb1f | 41 | fWeight(1), |
42 | fdcaBetweenPhotons(100), | |
43 | fdcaZPrimVtx(100), | |
44 | fdcaRPrimVtx(100), | |
45 | fQuality(0) | |
2eedd4ed | 46 | { |
47 | // Set 4momentu | |
48 | SetPxPyPzE(kf->GetPx(),kf->GetPy(),kf->GetPz(),kf->GetE()); | |
49 | ||
4803eb1f | 50 | fProductionVtx[0]=0; |
51 | fProductionVtx[1]=0; | |
52 | fProductionVtx[2]=0; | |
53 | ||
2eedd4ed | 54 | //Set Decay Photon Labels |
55 | fLabel[0]=kf->GetGammaLabel(0); | |
56 | fLabel[1]=kf->GetGammaLabel(1); | |
92efd725 | 57 | fLabel[2]=0; |
2eedd4ed | 58 | } |
59 | ||
60 | AliAODConversionMother::AliAODConversionMother(AliAODConversionPhoton *y1,AliAODConversionPhoton *y2): | |
61 | AliAODConversionParticle(), | |
92efd725 | 62 | fMCLabel(-1), |
2eedd4ed | 63 | fChi2(-1), |
64 | fOpeningAngle(-1), | |
69b05e50 | 65 | fAlpha(-1), |
4803eb1f | 66 | fWeight(1), |
67 | fdcaBetweenPhotons(1), | |
68 | fdcaZPrimVtx(100), | |
69 | fdcaRPrimVtx(100), | |
70 | fQuality(0) | |
2eedd4ed | 71 | { |
72 | // Set 4momentum | |
73 | SetPxPyPzE(y1->Px()+y2->Px(),y1->Py()+y2->Py(),y1->Pz()+y2->Pz(),y1->E()+y2->E()); | |
74 | ||
75 | // Calculate Opening Angle | |
76 | TVector3 v1(y1->Px(),y1->Py(),y1->Pz()); | |
77 | TVector3 v2(y2->Px(),y2->Py(),y2->Pz()); | |
78 | fOpeningAngle=v1.Angle(v2); | |
4803eb1f | 79 | fdcaBetweenPhotons = CalculateDistanceBetweenPhotons(y1,y2,fProductionVtx); |
80 | DetermineMesonQuality(y1,y2); | |
2eedd4ed | 81 | // Calculate Alpha |
82 | if((y1->E()+y2->E()) != 0){ | |
83 | fAlpha=TMath::Abs((y1->E()-y2->E())/(y1->E()+y2->E())); | |
84 | } | |
85 | ||
86 | // Set Chi2 to the mean chi2 of gammas | |
3b77b2d1 | 87 | // fChi2=0.5*(y1->GetChi2perNDF()+y2->GetChi2perNDF()); |
2eedd4ed | 88 | |
89 | //Set Decay Photon Labels | |
90 | fLabel[0]=-1; | |
91 | fLabel[1]=-1; | |
a280ac15 | 92 | fLabel[2]=0; |
2eedd4ed | 93 | } |
94 | ||
95 | AliAODConversionMother::~AliAODConversionMother() { | |
92efd725 | 96 | // empty standard destructor |
97 | } | |
98 | ||
99 | TParticle *AliAODConversionMother::GetMCParticle(AliStack *fMCStack){ | |
100 | if(!fMCStack){AliError("MC Stack not defined");return 0x0;} | |
2eedd4ed | 101 | |
92efd725 | 102 | if(fMCLabel>-1){ |
103 | return fMCStack->Particle(fMCLabel); | |
104 | } | |
105 | return 0x0; | |
106 | } | |
107 | ||
108 | Bool_t AliAODConversionMother::IsTrueMeson(AliStack *fMCStack,Int_t pdgcode){ | |
109 | TParticle *part=GetMCParticle(fMCStack); | |
110 | ||
111 | if(part){ | |
112 | // Check if it is a true photon | |
113 | if(part->GetPdgCode()==pdgcode){ | |
114 | return kTRUE; | |
115 | } | |
116 | } | |
117 | return kFALSE; | |
2eedd4ed | 118 | } |
119 | ||
4803eb1f | 120 | Float_t AliAODConversionMother::CalculateDistanceBetweenPhotons(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2 , Double_t prodPoint[3]){ |
121 | ||
122 | TVector3 a(y1->GetConversionX(),y1->GetConversionY(),y1->GetConversionZ()); | |
123 | TVector3 b(y1->GetPx(),y1->GetPy(),y1->GetPz()); | |
124 | TVector3 c(y2->GetConversionX(),y2->GetConversionY(),y2->GetConversionZ()); | |
125 | TVector3 d(y2->GetPx(),y2->GetPy(),y2->GetPz()); | |
126 | ||
127 | TVector3 n = b.Cross(d); | |
128 | TVector3 nn = n.Unit(); | |
129 | ||
130 | Double_t dist = 0; | |
131 | if (n.Mag() == 0){ | |
132 | TVector3 e = a-c; | |
133 | if (d.Mag() != 0){ | |
134 | dist = TMath::Abs((e.Cross(d)).Mag())/TMath::Abs(d.Mag()); | |
135 | } | |
136 | prodPoint[0] = 0; | |
137 | prodPoint[1] = 0; | |
138 | prodPoint[2] = 0; | |
139 | } else { | |
140 | dist = TMath::Abs(n.Dot(c-a))/TMath::Abs(n.Mag()); | |
141 | Double_t lambda = (b.Dot(d) * (a-c).Dot(d) - d.Dot(d) * (a-c).Dot(b))/(b.Dot(b) * d.Dot(d) - TMath::Power(b.Dot(d),2)); | |
142 | Double_t mu = ((a-c).Dot(d) * b.Dot(b) - (a-c).Dot(b) * b.Dot(d) )/(b.Dot(b) * d.Dot(d) - TMath::Power(b.Dot(d),2)); | |
143 | ||
144 | TVector3 S1 = a + lambda* b; | |
145 | TVector3 S2 = c + mu* d; | |
146 | TVector3 Prod = S1 + 0.5*dist*(S2-S1).Unit(); | |
147 | prodPoint[0] = Prod(0); | |
148 | prodPoint[1] = Prod(1); | |
149 | prodPoint[2] = Prod(2); | |
150 | ||
151 | } | |
152 | return dist; | |
153 | } | |
154 | ||
155 | ///________________________________________________________________________ | |
156 | void AliAODConversionMother::CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex){ | |
157 | ||
158 | Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()}; | |
159 | ||
160 | Double_t absoluteP = TMath::Sqrt(TMath::Power(Px(),2) + TMath::Power(Py(),2) + TMath::Power(Pz(),2)); | |
161 | Double_t p[3] = {Px()/absoluteP,Py()/absoluteP,Pz()/absoluteP}; | |
162 | Double_t CP[3]; | |
163 | ||
164 | CP[0] = fProductionVtx[0] - primCo[0]; | |
165 | CP[1] = fProductionVtx[1] - primCo[1]; | |
166 | CP[2] = fProductionVtx[2] - primCo[2]; | |
167 | ||
168 | Double_t Lambda = - (CP[0]*p[0]+CP[1]*p[1]+CP[2]*p[2])/(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]); | |
169 | ||
170 | Double_t S[3]; | |
171 | S[0] = fProductionVtx[0] + p[0]*Lambda; | |
172 | S[1] = fProductionVtx[1] + p[1]*Lambda; | |
173 | S[2] = fProductionVtx[2] + p[2]*Lambda; | |
174 | ||
175 | fdcaRPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2)); | |
176 | fdcaZPrimVtx = primCo[2]-S[2]; | |
177 | ||
178 | ||
179 | // cout << "DCA z: " << dca[1] << "\t DCA r: " << dca[0] << "\t DCA 3d: " << TMath::Sqrt(dca[1]*dca[1] + dca[0]*dca[0]) << endl; | |
180 | ||
181 | ||
182 | return; | |
183 | } | |
184 | ||
185 | ///________________________________________________________________________ | |
186 | void AliAODConversionMother::DetermineMesonQuality(AliAODConversionPhoton* y1, AliAODConversionPhoton* y2){ | |
187 | UChar_t photonQA1 = y1->GetPhotonQuality(); | |
188 | UChar_t photonQA2 = y2->GetPhotonQuality(); | |
189 | ||
190 | if (photonQA1 == 0 || photonQA2 == 0){ | |
191 | fQuality = 0; | |
192 | return; | |
193 | } | |
194 | if (photonQA1 == 1 && photonQA2 == 1){ | |
195 | fQuality = 1; | |
196 | return; | |
197 | } | |
198 | if (photonQA1 == 2 && photonQA2 == 2){ | |
199 | fQuality = 4; | |
200 | return; | |
201 | } | |
202 | if (photonQA1 == 3 && photonQA2 == 3){ | |
203 | fQuality = 6; | |
204 | return; | |
205 | } | |
206 | if (photonQA1 == 1){ | |
207 | if (photonQA2 == 2){ | |
208 | fQuality = 2; | |
209 | return; | |
210 | } | |
211 | if (photonQA2 == 3){ | |
212 | fQuality = 3; | |
213 | return; | |
214 | } | |
215 | } | |
216 | if (photonQA2 == 1){ | |
217 | if (photonQA1 == 2){ | |
218 | fQuality = 2; | |
219 | return; | |
220 | } | |
221 | if (photonQA1 == 3){ | |
222 | fQuality = 3; | |
223 | return; | |
224 | } | |
225 | } | |
226 | if ((photonQA1 == 2 && photonQA2 == 3)|| (photonQA1 == 3 && photonQA2 == 2)){ | |
227 | fQuality = 5; | |
228 | return; | |
229 | } | |
230 | ||
231 | } |