34 #ifndef StDecayAngle_hh
35 #define StDecayAngle_hh
36 #include "TLorentzVector.h"
39 #define UNSHIFTED kFALSE
42 static TVector3 StDecayAngleBeam(0.,0.,1.);
43 static TLorentzVector StDecayAngleParent;
44 static TLorentzVector StDecayAngleDaughter;
45 static TLorentzVector StDecayAngleParentCopy;
46 static TLorentzVector StDecayAngleDaughterCopy;
47 static Bool_t StDecayAngleShifted = UNSHIFTED;
53 static Float_t decayTheta();
54 static Float_t decayTheta(
55 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
56 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
57 static Float_t decayCosTheta();
58 static Float_t decayCosTheta(
59 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
60 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
62 static Float_t decayThetaLab(
63 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
64 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
65 static Float_t decayCosThetaLab(
66 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
67 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
69 static Float_t polarityTheta();
70 static Float_t polarityTheta(
71 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
72 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
73 static Float_t polarityCosTheta();
74 static Float_t polarityCosTheta(
75 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
76 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
78 static TVector3 getShiftedDaughter(
79 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
80 Float_t px2, Float_t py2, Float_t pz2, Float_t m2);
82 static void setBeam(Float_t x, Float_t y, Float_t z);
83 static void setParentDaughter(
84 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
85 Float_t px2, Float_t py2, Float_t pz2, Float_t m2,
86 Bool_t shift=UNSHIFTED);
87 static void shiftToRest();
88 static Bool_t different(TLorentzVector& v,
89 Float_t px , Float_t py , Float_t pz , Float_t m );
94 inline void StDecayAngle::setBeam(Float_t x, Float_t y, Float_t z) {
95 StDecayAngleBeam.SetXYZ(x,y,z);
98 inline Float_t StDecayAngle::decayTheta(
99 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
100 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
101 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2,SHIFTED);
105 inline Float_t StDecayAngle::decayCosTheta(
106 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
107 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
108 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2,SHIFTED);
109 return decayCosTheta();
112 inline Float_t StDecayAngle::decayThetaLab(
113 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
114 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
115 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2);
119 inline Float_t StDecayAngle::decayCosThetaLab(
120 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
121 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
122 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2);
123 return decayCosTheta();
126 inline Float_t StDecayAngle::polarityTheta(
127 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
128 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
129 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2,SHIFTED);
130 return polarityTheta();
133 inline Float_t StDecayAngle::polarityCosTheta(
134 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
135 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
136 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2,SHIFTED);
137 return polarityCosTheta();
140 inline void StDecayAngle::setParentDaughter(
141 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
142 Float_t px2, Float_t py2, Float_t pz2, Float_t m2,
144 if (different(StDecayAngleParentCopy,px1,py1,pz1,m1)) {
145 StDecayAngleParentCopy.SetXYZT(px1,py1,pz1,m1);
146 StDecayAngleParent.SetXYZM(px1,py1,pz1,m1);
148 if (different(StDecayAngleDaughterCopy,px2,py2,pz2,m2)) {
149 StDecayAngleDaughterCopy.SetXYZT(px2,py2,pz2,m2);
150 StDecayAngleDaughter.SetXYZM(px2,py2,pz2,m2);
151 StDecayAngleShifted = UNSHIFTED;
152 }
else if (StDecayAngleShifted && !shift) {
153 StDecayAngleDaughter.SetXYZM(px2,py2,pz2,m2);
154 StDecayAngleShifted = UNSHIFTED;
156 if (shift) shiftToRest();
159 inline void StDecayAngle::shiftToRest() {
160 if (!StDecayAngleShifted) {
161 StDecayAngleDaughter.Boost(-StDecayAngleParent.BoostVector());
162 StDecayAngleShifted = SHIFTED;
166 inline TVector3 StDecayAngle::getShiftedDaughter(
167 Float_t px1, Float_t py1, Float_t pz1, Float_t m1,
168 Float_t px2, Float_t py2, Float_t pz2, Float_t m2) {
169 setParentDaughter(px1,py1,pz1,m1,px2,py2,pz2,m2,SHIFTED);
170 return TVector3(StDecayAngleDaughter.Vect());
173 inline Float_t StDecayAngle::decayTheta() {
174 return StDecayAngleDaughter.Vect().Angle(StDecayAngleParent.Vect());
177 inline Float_t StDecayAngle::decayCosTheta() {
178 return TMath::Cos(decayTheta());
181 inline Float_t StDecayAngle::polarityTheta() {
182 return StDecayAngleDaughter.Vect().Angle(
183 StDecayAngleParent.Vect().Cross(StDecayAngleBeam));
186 inline Float_t StDecayAngle::polarityCosTheta() {
187 return TMath::Cos(polarityTheta());
190 inline Bool_t StDecayAngle::different(TLorentzVector& v,
191 Float_t px , Float_t py , Float_t pz , Float_t m ) {
192 return ((px != v.X()) || (py != v.Y()) || (pz != v.Z()) || (m != v.T()));