AliPhysics  2b88e80 (2b88e80)
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 
176  // empty standard destructor
177 }
178 
179 TParticle *AliAODConversionMother::GetMCParticle(AliMCEvent *mcEvent){
180  if(!mcEvent){AliError("MCEvent not defined");return 0x0;}
181 
182  if(fMCLabel>-1){
183  return mcEvent->Particle(fMCLabel);
184  }
185  return 0x0;
186 }
187 
188 Bool_t AliAODConversionMother::IsTrueMeson(AliMCEvent *mcEvent,Int_t pdgcode){
189  TParticle *part=GetMCParticle(mcEvent);
190 
191  if(part){
192  // Check if it is a true photon
193  if(part->GetPdgCode()==pdgcode){
194  return kTRUE;
195  }
196  }
197  return kFALSE;
198 }
199 
201 
202  TVector3 a(y1->GetConversionX(),y1->GetConversionY(),y1->GetConversionZ());
203  TVector3 b(y1->GetPx(),y1->GetPy(),y1->GetPz());
204  TVector3 c(y2->GetConversionX(),y2->GetConversionY(),y2->GetConversionZ());
205  TVector3 d(y2->GetPx(),y2->GetPy(),y2->GetPz());
206 
207  TVector3 n = b.Cross(d);
208  TVector3 nn = n.Unit();
209 
210  Double_t dist = 0;
211  if (n.Mag() == 0){
212  TVector3 e = a-c;
213  if (d.Mag() != 0){
214  dist = TMath::Abs((e.Cross(d)).Mag())/TMath::Abs(d.Mag());
215  }
216  prodPoint[0] = 0;
217  prodPoint[1] = 0;
218  prodPoint[2] = 0;
219  } else {
220  dist = TMath::Abs(n.Dot(c-a))/TMath::Abs(n.Mag());
221  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));
222  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));
223 
224  TVector3 S1 = a + lambda* b;
225  TVector3 S2 = c + mu* d;
226  TVector3 Prod = S1 + 0.5*dist*(S2-S1).Unit();
227  prodPoint[0] = Prod(0);
228  prodPoint[1] = Prod(1);
229  prodPoint[2] = Prod(2);
230 
231  }
232  if (dist > 1000) dist = 999.;
233  return dist;
234 }
235 
238 
239  Double_t primCo[3] = {primVertex->GetX(),primVertex->GetY(),primVertex->GetZ()};
240 
241  Double_t absoluteP = TMath::Sqrt(TMath::Power(Px(),2) + TMath::Power(Py(),2) + TMath::Power(Pz(),2));
242  Double_t p[3] = {Px()/absoluteP,Py()/absoluteP,Pz()/absoluteP};
243  Double_t CP[3];
244 
245  CP[0] = fProductionVtx[0] - primCo[0];
246  CP[1] = fProductionVtx[1] - primCo[1];
247  CP[2] = fProductionVtx[2] - primCo[2];
248 
249  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]);
250 
251  Double_t S[3];
252  S[0] = fProductionVtx[0] + p[0]*Lambda;
253  S[1] = fProductionVtx[1] + p[1]*Lambda;
254  S[2] = fProductionVtx[2] + p[2]*Lambda;
255 
256  fdcaRPrimVtx = TMath::Sqrt( TMath::Power(primCo[0]-S[0],2) + TMath::Power(primCo[1]-S[1],2));
257  fdcaZPrimVtx = primCo[2]-S[2];
258 
259 
260 // cout << "DCA z: " << dca[1] << "\t DCA r: " << dca[0] << "\t DCA 3d: " << TMath::Sqrt(dca[1]*dca[1] + dca[0]*dca[0]) << endl;
261 
262 
263  return;
264 }
265 
268  UChar_t photonQA1 = y1->GetPhotonQuality();
269  UChar_t photonQA2 = y2->GetPhotonQuality();
270 
271  if (photonQA1 == 0 || photonQA2 == 0){
272  fQuality = 0;
273  return;
274  }
275  if (photonQA1 == 1 && photonQA2 == 1){
276  fQuality = 1;
277  return;
278  }
279  if (photonQA1 == 2 && photonQA2 == 2){
280  fQuality = 4;
281  return;
282  }
283  if (photonQA1 == 3 && photonQA2 == 3){
284  fQuality = 6;
285  return;
286  }
287  if (photonQA1 == 1){
288  if (photonQA2 == 2){
289  fQuality = 2;
290  return;
291  }
292  if (photonQA2 == 3){
293  fQuality = 3;
294  return;
295  }
296  }
297  if (photonQA2 == 1){
298  if (photonQA1 == 2){
299  fQuality = 2;
300  return;
301  }
302  if (photonQA1 == 3){
303  fQuality = 3;
304  return;
305  }
306  }
307  if ((photonQA1 == 2 && photonQA2 == 3)|| (photonQA1 == 3 && photonQA2 == 2)){
308  fQuality = 5;
309  return;
310  }
311 
312 }
313 
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)