AliPhysics  b555aef (b555aef)
AliAODConversionMother.cxx
Go to the documentation of this file.
3 #include "AliKFParticle.h"
4 
5 // Author D. Lohner (Daniel.Lohner@cern.ch)
6 
7 using namespace std;
8 
10 
13  fMCLabel(-1),
14  fChi2(-1),
15  fOpeningAngle(-1),
16  fAlpha(-1),
17  fWeight(1),
18  fdcaBetweenPhotons(1),
19  fdcaZPrimVtx(100),
20  fdcaRPrimVtx(100),
21  fQuality(0),
22  fTrueMeson(0)
23 {
24  fLabel[0] = -1;
25  fLabel[1] = -1;
26  fLabel[2] = 0;
27 
28  fProductionVtx[0]=0;
29  fProductionVtx[1]=0;
30  fProductionVtx[2]=0;
31 
32 }
33 
36 fMCLabel(kf->GetMCLabel()),
37 fChi2(kf->GetChi2()),
38 fOpeningAngle(kf->GetOpeningAngle()),
39 fAlpha(kf->GetAlpha()),
40 fWeight(1),
41 fdcaBetweenPhotons(100),
42 fdcaZPrimVtx(100),
43 fdcaRPrimVtx(100),
44 fQuality(0),
45 fTrueMeson(0)
46 {
47  // Set 4momentu
48  SetPxPyPzE(kf->GetPx(),kf->GetPy(),kf->GetPz(),kf->GetE());
49 
50  fProductionVtx[0]=0;
51  fProductionVtx[1]=0;
52  fProductionVtx[2]=0;
53 
54  //Set Decay Photon Labels
55  fLabel[0]=kf->GetGammaLabel(0);
56  fLabel[1]=kf->GetGammaLabel(1);
57  fLabel[2]=0;
58 }
59 
62 fMCLabel(-1),
63 fChi2(-1),
64 fOpeningAngle(-1),
65 fAlpha(-1),
66 fWeight(1),
68 fdcaZPrimVtx(100),
69 fdcaRPrimVtx(100),
70 fQuality(0),
71 fTrueMeson(0)
72 {
73  // Set 4momentum
74  SetPxPyPzE(y1->Px()+y2->Px(),y1->Py()+y2->Py(),y1->Pz()+y2->Pz(),y1->E()+y2->E());
75 
76  // Calculate Opening Angle
77  TVector3 v1(y1->Px(),y1->Py(),y1->Pz());
78  TVector3 v2(y2->Px(),y2->Py(),y2->Pz());
79  fOpeningAngle=v1.Angle(v2);
81  DetermineMesonQuality(y1,y2);
82  // Calculate Alpha
83  if((y1->E()+y2->E()) != 0){
84  fAlpha=(y1->E()-y2->E())/(y1->E()+y2->E());
85  }
86 
87  // Set Chi2 to the mean chi2 of gammas
88  // fChi2=0.5*(y1->GetChi2perNDF()+y2->GetChi2perNDF());
89 
90  //Set Decay Photon Labels
91  fLabel[0]=-1;
92  fLabel[1]=-1;
93  fLabel[2]=0;
94 }
95 
98 fMCLabel(-1),
99 fChi2(-1),
100 fOpeningAngle(-1),
101 fAlpha(-1),
102 fWeight(1),
104 fdcaZPrimVtx(100),
105 fdcaRPrimVtx(100),
106 fQuality(0),
107 fTrueMeson(0)
108 {
109  // Set 4momentum
110  SetPxPyPzE(meson->Px()+gamma->Px(),meson->Py()+gamma->Py(),meson->Pz()+gamma->Pz(),meson->E()+gamma->E());
111 
112  // Calculate Opening Angle
113  TVector3 v1(meson->Px(),meson->Py(),meson->Pz());
114  TVector3 v2(gamma->Px(),gamma->Py(),gamma->Pz());
115  fOpeningAngle=v1.Angle(v2);
116 
117  fProductionVtx[0]=0;
118  fProductionVtx[1]=0;
119  fProductionVtx[2]=0;
120 
121  // Calculate Alpha
122  if((meson->E()+gamma->E()) != 0){
123  fAlpha=(meson->E()-gamma->E())/(meson->E()+gamma->E());
124  }
125 
126  // Set Chi2 to the mean chi2 of gammas
127  // fChi2=0.5*(y1->GetChi2perNDF()+y2->GetChi2perNDF());
128 
129  //Set Decay Photon Labels
130  fLabel[0]=-1;
131  fLabel[1]=-1;
132  fLabel[2]=0;
133 }
134 
135 
138 fMCLabel(-1),
139 fChi2(-1),
140 fOpeningAngle(-1),
141 fAlpha(-1),
142 fWeight(1),
144 fdcaZPrimVtx(100),
145 fdcaRPrimVtx(100),
146 fQuality(0),
147 fTrueMeson(0)
148 {
149  // Set 4momentum
150  SetPxPyPzE(meson1->Px()+meson2->Px(),meson1->Py()+meson2->Py(),meson1->Pz()+meson2->Pz(),meson1->E()+meson2->E());
151 
152  // Calculate Opening Angle
153  TVector3 v1(meson1->Px(),meson1->Py(),meson1->Pz());
154  TVector3 v2(meson2->Px(),meson2->Py(),meson2->Pz());
155  fOpeningAngle=v1.Angle(v2);
156 
157  fProductionVtx[0]=0;
158  fProductionVtx[1]=0;
159  fProductionVtx[2]=0;
160 
161  // Calculate Alpha
162  if((meson1->E()+meson2->E()) != 0){
163  fAlpha=(meson1->E()-meson2->E())/(meson1->E()+meson2->E());
164  }
165 
166  // Set Chi2 to the mean chi2 of gammas
167  // fChi2=0.5*(y1->GetChi2perNDF()+y2->GetChi2perNDF());
168 
169  //Set Decay Photon Labels
170  fLabel[0]=-1;
171  fLabel[1]=-1;
172  fLabel[2]=0;
173 }
174 
175 
178 fMCLabel(-1),
179 fChi2(-1),
180 fOpeningAngle(-1),
181 fAlpha(-1),
182 fWeight(1),
184 fdcaZPrimVtx(100),
185 fdcaRPrimVtx(100),
186 fQuality(0),
187 fTrueMeson(0)
188 {
189  // Set 4momentum
190  SetPxPyPzE(v0->Px()+gamma->Px(),v0->Py()+gamma->Py(),v0->Pz()+gamma->Pz(),v0->E()+gamma->E());
191 
192  // Calculate Opening Angle
193  TVector3 v1(v0->Px(),v0->Py(),v0->Pz());
194  TVector3 v2(gamma->Px(),gamma->Py(),gamma->Pz());
195  fOpeningAngle=v1.Angle(v2);
196 
197  fProductionVtx[0]=0;
198  fProductionVtx[1]=0;
199  fProductionVtx[2]=0;
200 
201  // Calculate Alpha
202  if((v0->E()+gamma->E()) != 0){
203  fAlpha=(v0->E()-gamma->E())/(v0->E()+gamma->E());
204  }
205 
206  // Set Chi2 to the mean chi2 of gammas
207  // fChi2=0.5*(y1->GetChi2perNDF()+y2->GetChi2perNDF());
208 
209  //Set Decay Photon Labels
210  fLabel[0]=-1;
211  fLabel[1]=-1;
212  fLabel[2]=0;
213 }
214 
215 
217  // empty standard destructor
218 }
219 
220 TParticle *AliAODConversionMother::GetMCParticle(AliMCEvent *mcEvent){
221  if(!mcEvent){AliError("MCEvent not defined");return 0x0;}
222 
223  if(fMCLabel>-1){
224  return mcEvent->Particle(fMCLabel);
225  }
226  return 0x0;
227 }
228 
229 Bool_t AliAODConversionMother::IsTrueMeson(AliMCEvent *mcEvent,Int_t pdgcode){
230  TParticle *part=GetMCParticle(mcEvent);
231 
232  if(part){
233  // Check if it is a true photon
234  if(part->GetPdgCode()==pdgcode){
235  return kTRUE;
236  }
237  }
238  return kFALSE;
239 }
240 
242 
243  TVector3 a(y1->GetConversionX(),y1->GetConversionY(),y1->GetConversionZ());
244  TVector3 b(y1->GetPx(),y1->GetPy(),y1->GetPz());
245  TVector3 c(y2->GetConversionX(),y2->GetConversionY(),y2->GetConversionZ());
246  TVector3 d(y2->GetPx(),y2->GetPy(),y2->GetPz());
247 
248  TVector3 n = b.Cross(d);
249  TVector3 nn = n.Unit();
250 
251  Double_t dist = 0;
252  if (n.Mag() == 0){
253  TVector3 e = a-c;
254  if (d.Mag() != 0){
255  dist = TMath::Abs((e.Cross(d)).Mag())/TMath::Abs(d.Mag());
256  }
257  prodPoint[0] = 0;
258  prodPoint[1] = 0;
259  prodPoint[2] = 0;
260  } else {
261  dist = TMath::Abs(n.Dot(c-a))/TMath::Abs(n.Mag());
262  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));
263  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));
264 
265  TVector3 S1 = a + lambda* b;
266  TVector3 S2 = c + mu* d;
267  TVector3 Prod = S1 + 0.5*dist*(S2-S1).Unit();
268  prodPoint[0] = Prod(0);
269  prodPoint[1] = Prod(1);
270  prodPoint[2] = Prod(2);
271 
272  }
273  if (dist > 1000) dist = 999.;
274  return dist;
275 }
276 
279 
280  Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
281 
282  Double_t absoluteP = TMath::Sqrt(TMath::Power(Px(),2) + TMath::Power(Py(),2) + TMath::Power(Pz(),2));
283  Double_t p[3] = {Px()/absoluteP,Py()/absoluteP,Pz()/absoluteP};
284  Double_t CP[3];
285 
286  CP[0] = fProductionVtx[0] - primCo[0];
287  CP[1] = fProductionVtx[1] - primCo[1];
288  CP[2] = fProductionVtx[2] - primCo[2];
289 
290  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]);
291 
292  Double_t S[3];
293  S[0] = fProductionVtx[0] + p[0]*Lambda;
294  S[1] = fProductionVtx[1] + p[1]*Lambda;
295  S[2] = fProductionVtx[2] + p[2]*Lambda;
296 
297  fdcaRPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
298  fdcaZPrimVtx = primCo[2]-S[2];
299 
300 
301 // cout << "DCA z: " << dca[1] << "\t DCA r: " << dca[0] << "\t DCA 3d: " << TMath::Sqrt(dca[1]*dca[1] + dca[0]*dca[0]) << endl;
302 
303 
304  return;
305 }
306 
309  UChar_t photonQA1 = y1->GetPhotonQuality();
310  UChar_t photonQA2 = y2->GetPhotonQuality();
311 
312  if (photonQA1 == 0 || photonQA2 == 0){
313  fQuality = 0;
314  return;
315  }
316  if (photonQA1 == 1 && photonQA2 == 1){
317  fQuality = 1;
318  return;
319  }
320  if (photonQA1 == 2 && photonQA2 == 2){
321  fQuality = 4;
322  return;
323  }
324  if (photonQA1 == 3 && photonQA2 == 3){
325  fQuality = 6;
326  return;
327  }
328  if (photonQA1 == 1){
329  if (photonQA2 == 2){
330  fQuality = 2;
331  return;
332  }
333  if (photonQA2 == 3){
334  fQuality = 3;
335  return;
336  }
337  }
338  if (photonQA2 == 1){
339  if (photonQA1 == 2){
340  fQuality = 2;
341  return;
342  }
343  if (photonQA1 == 3){
344  fQuality = 3;
345  return;
346  }
347  }
348  if ((photonQA1 == 2 && photonQA2 == 3)|| (photonQA1 == 3 && photonQA2 == 2)){
349  fQuality = 5;
350  return;
351  }
352 
353 }
354 
virtual Double_t GetPy() const
double Double_t
Definition: External.C:58
virtual Double_t GetPz() const
TCanvas * c
Definition: TestFitELoss.C:172
Double_t GetChi2(const TH1F *h1, const TH1F *h2, TH1F *hchi2, Int_t &ndof)
Double_t Dot(const AliVParticle &trk1, const AliVParticle &trk2)
Bool_t IsTrueMeson(AliMCEvent *mcEvent, Int_t pdgcode)
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
TParticle * GetMCParticle(AliMCEvent *mcEvent)
Int_t GetGammaLabel(Int_t i) const
Double_t Mag(const AliVParticle &trk)
void DetermineMesonQuality(const AliAODConversionPhoton *y1, const AliAODConversionPhoton *y2)
Float_t CalculateDistanceBetweenPhotons(const AliAODConversionPhoton *y1, const AliAODConversionPhoton *y2, Double_t prodPoint[3])
virtual Double_t GetPx() const
bool Bool_t
Definition: External.C:53
TString meson
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)