-Move cent, z axis into sparse
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliKFConversionMother.cxx
1 #include "AliKFConversionMother.h"
2 #include "AliKFParticle.h"
3 #include "TMath.h"
4 #include "TVector3.h"
5
6 using namespace std;
7
8 ClassImp(AliKFConversionMother)
9
10 AliKFConversionMother::AliKFConversionMother() :
11 AliKFParticle(),
12     fMCLabel(-1),
13     fOpeningAngle(-1),
14     fAlpha(-1)
15
16 {
17   //Default constructor
18   fLabel[0] = -1;
19   fLabel[1] = -1;
20 }
21
22 /*AliKFConversionMother::AliKFConversionMother(const AliKFParticle& d1, const AliKFParticle& d2) :
23 AliKFParticle(d1,d2),
24 fOpeningAngle(-1),
25 fAlpha(-1)
26
27 {
28   //Default constructor
29   fLabel[0] = -1;
30   fLabel[1] = -1;
31
32         // Calculate Opening Angle
33         TVector3 v1(d1.GetPx(),d1.GetPy(),d1.GetPz());
34         TVector3 v2(d2.GetPx(),d2.GetPy(),d2.GetPz());
35         fOpeningAngle=v1.Angle(v2);
36         // Calculate Alpha
37         if((d1.GetE()+d2.GetE()) != 0){
38             fAlpha=TMath::Abs((d1.GetE()-d2.GetE())/(d1.GetE()+d2.GetE()));
39         }
40 }*/
41
42 AliKFConversionMother::AliKFConversionMother(const AliKFConversionPhoton& d1, const AliKFConversionPhoton& d2) :
43 AliKFParticle(d1,d2),
44 fMCLabel(-1),
45 fOpeningAngle(-1),
46 fAlpha(-1)
47
48 {
49   //Default constructor
50     fLabel[0] = -1;
51     fLabel[1] = -1;
52
53         // Calculate Opening Angle
54         TVector3 v1(d1.GetPx(),d1.GetPy(),d1.GetPz());
55         TVector3 v2(d2.GetPx(),d2.GetPy(),d2.GetPz());
56         fOpeningAngle=v1.Angle(v2);
57         // Calculate Alpha
58         if((d1.GetE()+d2.GetE()) != 0){
59             fAlpha=TMath::Abs((d1.GetE()-d2.GetE())/(d1.GetE()+d2.GetE()));
60         }
61 }
62
63 AliKFConversionMother::AliKFConversionMother(const AliKFConversionMother & original) :
64 AliKFParticle(original),
65 fMCLabel(original.fMCLabel),
66 fOpeningAngle(original.fOpeningAngle),
67 fAlpha(original.fAlpha)
68 {
69   //Copy constructor
70   fLabel[0] = original.fLabel[0];
71   fLabel[1] = original.fLabel[1];
72 }
73
74
75 AliKFConversionMother & AliKFConversionMother::operator = (const AliKFConversionMother & /*source*/)
76 {
77   // assignment operator
78   return *this;
79 }
80
81 Double_t AliKFConversionMother::GetRapidity()
82 {
83     Double_t rapidity;
84     if(GetE() - GetPz() <= 0 || GetE() + GetPz() <= 0){
85         AliWarning("Error: |Pz| > E !!!! ");
86         rapidity=8.;
87     } else {
88         rapidity = 0.5*(TMath::Log((GetE() +GetPz()) / (GetE()-GetPz())));
89     }
90
91 return rapidity;
92 }
93
94 Double_t AliKFConversionMother::Phi() const
95 {
96     Double_t phi = AliKFParticle::GetPhi();
97     if (phi < 0.) phi += 2. * TMath::Pi();
98     return phi;
99 }