StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StDecayAngle.hh
1 /***********************************************************************
2  *
3  * $Id: StDecayAngle.hh,v 3.5 2002/04/30 16:02:47 genevb Exp $
4  *
5  * Author: Gene Van Buren, BNL, 26-Nov-2001
6  *
7  ***********************************************************************
8  *
9  * Description: class for returning decay angle characteristics
10  * Particle 1 is the parent of the decay
11  * Particle 2 is the daughter of interest of the decay
12  * px, py, pz, and m are their momemta and mass
13  *
14  ***********************************************************************
15  *
16  * $Log: StDecayAngle.hh,v $
17  * Revision 3.5 2002/04/30 16:02:47 genevb
18  * Common muDst, improved MC code, better kinks, StrangeCuts now a branch
19  *
20  * Revision 3.4 2002/02/10 15:29:09 genevb
21  * Additional functions for momenta of decay daughters in CM frame
22  *
23  * Revision 3.3 2001/11/28 17:54:29 genevb
24  * Some errors/omissions in last check-in
25  *
26  * Revision 3.2 2001/11/28 17:19:42 genevb
27  * Some interface improvements to decay angle formulae
28  *
29  * Revision 3.1 2001/11/28 05:14:59 genevb
30  * Additional decay angle functions
31  *
32  *
33  ***********************************************************************/
34 #ifndef StDecayAngle_hh
35 #define StDecayAngle_hh
36 #include "TLorentzVector.h"
37 
38 #define SHIFTED kTRUE
39 #define UNSHIFTED kFALSE
40 
41 // Default beam axis is z-axis (for polarization calcs)
42 static TVector3 StDecayAngleBeam(0.,0.,1.);
43 static TLorentzVector StDecayAngleParent;
44 static TLorentzVector StDecayAngleDaughter;
45 static TLorentzVector StDecayAngleParentCopy; // Use T (not M) to store
46 static TLorentzVector StDecayAngleDaughterCopy; // value of m in Copy
47 static Bool_t StDecayAngleShifted = UNSHIFTED; // Is daughter shifted?
48 
49 class StDecayAngle {
50  public:
51  StDecayAngle() {}
52  virtual ~StDecayAngle() {}
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);
61 
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);
68 
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);
77 
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);
81 
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 );
90 
91 };
92 
93 
94 inline void StDecayAngle::setBeam(Float_t x, Float_t y, Float_t z) {
95  StDecayAngleBeam.SetXYZ(x,y,z);
96 }
97 
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);
102  return decayTheta();
103 }
104 
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();
110 }
111 
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);
116  return decayTheta();
117 }
118 
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();
124 }
125 
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();
131 }
132 
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();
138 }
139 
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,
143  Bool_t shift) {
144  if (different(StDecayAngleParentCopy,px1,py1,pz1,m1)) {
145  StDecayAngleParentCopy.SetXYZT(px1,py1,pz1,m1);
146  StDecayAngleParent.SetXYZM(px1,py1,pz1,m1);
147  }
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;
155  }
156  if (shift) shiftToRest();
157 }
158 
159 inline void StDecayAngle::shiftToRest() {
160  if (!StDecayAngleShifted) {
161  StDecayAngleDaughter.Boost(-StDecayAngleParent.BoostVector());
162  StDecayAngleShifted = SHIFTED;
163  }
164 }
165 
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());
171 }
172 
173 inline Float_t StDecayAngle::decayTheta() {
174  return StDecayAngleDaughter.Vect().Angle(StDecayAngleParent.Vect());
175 }
176 
177 inline Float_t StDecayAngle::decayCosTheta() {
178  return TMath::Cos(decayTheta());
179 }
180 
181 inline Float_t StDecayAngle::polarityTheta() {
182  return StDecayAngleDaughter.Vect().Angle(
183  StDecayAngleParent.Vect().Cross(StDecayAngleBeam));
184 }
185 
186 inline Float_t StDecayAngle::polarityCosTheta() {
187  return TMath::Cos(polarityTheta());
188 }
189 
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()));
193 }
194 
195 #endif