MINT2
SpinFactor3.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:18:13 GMT
3 
4 #include "Mint/SpinFactors.h"
5 
6 #include "Mint/DecayTree.h"
7 #include "Mint/SpinSumV.h"
8 #include "Mint/SpinSumT.h"
9 #include "Mint/Utils.h"
11 
12 #include "Mint/ZTspin1.h"
13 #include "Mint/ZTspin2.h"
14 
15 #include <iostream>
16 
17 using namespace std;
18 using namespace MINT;
19 
21 
23  if(0==_exampleDecay){
24  _exampleDecay = new DecayTree(421);
25  _exampleDecay->addDgtr(310, 113)->addDgtr(211, -211);// Ks rho - why not
26  _exampleDecay->addDgtr(-211, 200321)->addDgtr(321, -10323);
27  }
28  return *_exampleDecay;
29 }
30 
32  return getExampleDecay();
33 }
34 
36  if(0 == R){
37  cout << " SpinFactor3::setSpin can't set spin, R==0"
38  << " probably need to parse tree, first."
39  << endl;
40  return false;
41  }
42  if(R->getVal().J() == "0"){
43  _spin = 0;
44  }else if(R->getVal().J() == "1"){
45  _spin = 1;
46  }else if(R->getVal().J() == "2"){
47  _spin = 2;
48  }else{
49  cout << "SpinFactor3::setSpin() Don't know how to"
50  << " handle resonance with spin = " << R->getVal().J()
51  << "\n > looking at decay\n" << theDecay()
52  << "\n > Sorry, will crash now!" << endl;
53  throw "sorry";
54  }
55  return true;
56 }
57 
59  if(fsPS.size() < 3) fsPS.reserve(3);
60 
61  if(theDecay(pat).nDgtr() == (int)(theDecay(pat).finalState().size())){
62  _nonResonant = true;
63  return true;
64  }
65 
66  for(int i=0; i< theDecay(pat).nDgtr(); i++){
67  const_counted_ptr<AssociatedDecayTree> dgtr= theDecay(pat).getDgtrTreePtr(i);
68  if (! dgtr->isFinalState()) R = dgtr;
69  else fsPS[0] = dgtr;
70  }
71  if(0==R || 0==fsPS[0]){
72  cout << "SpinFactor3::parseTree"
73  << " Didn't find R or P1 " << R << ", " << fsPS[0] << endl;
74  return false;
75  }
76  if(R->nDgtr() != 2){
77  cout << "ERROR in SpinFactor3::parseTree"
78  << " Resonance should have 2 daughters, but it says it has "
79  << R->nDgtr() << "."
80  << endl;
81  return false;
82  }
83  fsPS[1] = R->getDgtrTreePtr(0);
84  fsPS[2] = R->getDgtrTreePtr(1);
85 
86  //normalOrder(fsPS[1], fsPS[2]);
87 
88 // printYourself();
89 
90  setSpin();
91  return true;
92 
93 }
94 
95 void SpinFactor3::printYourself(std::ostream& os)const{
96  os << "INFO from SpinFactor3::printYourself():\n"
97  << " > parsed the following tree "
98  << theDecay().oneLiner() << " like this:\n"
99  << " > R = " << R->getVal().name()
100  << ", fsPS[0]=C= " << fsPS[0]->getVal().name()
101  << ", fsPS[1]=A= " << fsPS[1]->getVal().name()
102  << ", fsPS[2]=B= " << fsPS[2]->getVal().name()
103  << endl;
104 }
105 
107  if(_nonResonant){
108  return nonResVal();
109  }
110 
111  if(! ( fsPS[0] && fsPS[1] && fsPS[2])) parseTree(evt.eventPattern());
112 
113  if(0 == R){
114  cout << "ERROR in SpinFactor3::getVal(): 0 == R"
115  << endl;
116  throw "such things shouldn't happen";
117  }
118 
119  if(_spin == 0){
120  return spinZeroVal();
121  }else if(_spin == 1){
122  return spinOneVal(evt);
123  }else if(_spin == 2){
124  return spinTwoVal(evt);
125  }else{
126  cout << "SpinFactor3::getVal() Don't know how to"
127  << " handle resonance with spin = " << R->getVal().J()
128  << "\n > looking at decay\n" << theDecay()
129  << "\n > Sorry, will crash now!" << endl;
130  throw "sorry";
131  }
132  return -9999;
133 
134 }
135 
137 
138  double m2AC = (p(0, evt) + p(1, evt)).M2();
139  double m2BC = (p(0, evt) + p(2, evt)).M2();
140 
141  // cout << "GS spin factor " << m2AC - m2BC << endl;
142  return (m2AC - m2BC)/(GeV*GeV);
143 }
144 
146  // parsed as:
147  // D -> V P0; V->P1, P2;
148  // fsPS[0] && fsPS[1] && fsPS[2]
149 
150  bool dbThis=false;
151 
152  TLorentzVector pV = p(1, evt) + p(2, evt);
153  TLorentzVector pD = pV + p(0, evt);
154  double mr = mRes(R, evt);
155  SpinSumV spin_sum(pV, mr);
156 
157  TLorentzVector lhs = pD + p(0, evt);
158  TLorentzVector rhs = p(1, evt) - p(2, evt);
159 
160  if(dbThis){
161  cout << " spinOneVal for " << theDecay().oneLiner()
162  << "\n > compare: Sandwich: "
163  << -spin_sum.Sandwich(lhs, rhs)
164  << "\n > from masses "
165  << spinOneFromMasses(evt)
166  << "\n > ratio sw/m "
167  << -spin_sum.Sandwich(lhs, rhs)/spinOneFromMasses(evt)
168  << "\n > from Zemach " << spinOneFromZemach(evt)
169  << "\n > ratios sw/Zemach "
170  << spin_sum.Sandwich(lhs, rhs)/spinOneFromZemach(evt)
171  << endl;
172  }
173 
174  // note '-' sign. This makes my decay-tree
175  // sorting algorithm and this spin factor
176  // comparible with BaBar/BELLE spin
177  // factor conventions.
178  return -spin_sum.Sandwich(lhs, rhs)/(GeV*GeV);
179 }
180 
182  // all wrong - just experimenting - don't use!!
183 
184  TLorentzVector pV = p(1, evt) + p(2, evt);
185  TLorentzVector qV = p(1, evt) - p(2, evt);
186  TLorentzVector pD = pV + p(0, evt);
187  TLorentzVector qD = pV - p(0, evt);
188  //TLorentzVector qD = pD + p(0);
189 
190  double mr = mRes(R, evt);
191  double mD = pD.M();
192 
193  ZTspin1 tV(qV, pV, mr);
194  ZTspin1 tD(qD, pD, mD);
195  // ZTspin1 tP(pD + p(0), pD-p(0), mD);
196  ZTspin1 tP(p(0, evt), pD, mD);
197  //double norm = 1.;//tV.M() * tD.M();
198  //return tV.Contract(pD + p(0)); << this works
199  return tV.Contract(tP );
200  // return tV.Contract(tD)/norm;
201 
202  //ZTspin1 tVinD(tV, pD, mD);
203 
204  //double norm = 1.;// tVinD.M() * tD.M();
205  //return tD.Contract(tVinD)/norm;
206 
207 }
208 
210  // parsed as:
211  // D -> V P0; V->P1, P2;
212  // fsPS[0] && fsPS[1] && fsPS[2]
213 
214  double MV = mRes(R, evt);
215  double mA = fsPS[1]->getVal().mass();
216  double mB = fsPS[2]->getVal().mass();
217 
218  double mC = fsPS[0]->getVal().mass();
219 
220  double mD = (p(0, evt)+p(1, evt)+p(2, evt)).M();
221 
222  double m2AC = (p(0, evt) + p(1, evt)).M2();
223  double m2BC = (p(0, evt) + p(2, evt)).M2();
224 
225  return (m2AC - m2BC + (mD*mD - mC*mC)*(mB*mB-mA*mA)/(MV*MV))/(GeV*GeV);
226 
227 }
228 
230  // parsed as:
231  // D -> V P0; V->P1, P2;
232  // fsPS[0] && fsPS[1] && fsPS[2]
233 
234  double MV = mRes(R, evt);
235  double mA = fsPS[1]->getVal().mass();
236  double mB = fsPS[2]->getVal().mass();
237 
238  double mC = fsPS[0]->getVal().mass();
239 
240  double mD = (p(0, evt)+p(1, evt)+p(2, evt)).M();
241 
242  double m2AB = (p(1, evt) + p(2, evt)).M2();
243  double m2AC = (p(0, evt) + p(1, evt)).M2();
244  double m2BC = (p(0, evt) + p(2, evt)).M2();
245 
246  Double_t term1 = m2BC-m2AC+(mD*mD-mC*mC)*(mA*mA-mB*mB)/(MV*MV);
247  Double_t term2 = m2AB-2.0*mD*mD-2.0*mC*mC+pow(mD*mD-mC*mC,2)/(MV*MV);
248  Double_t term3 = m2AB-2.0*mA*mA-2.0*mB*mB+pow(mA*mA-mB*mB,2)/(MV*MV);
249 
250  return (pow(term1,2)-(1.0/3.0)*term2*term3)/(GeV*GeV*GeV*GeV);
251 }
252 //
254  // parsed as:
255  // D -> T P0; T->P1, P2;
256  bool dbThis=false;
257 
258  TLorentzVector pT = p(1, evt) + p(2, evt);
259  TLorentzVector pD = pT + p(0, evt);
260  double mr = mRes(R, evt);
261  SpinSumT spin_sum(pT, mr);
262 
263  TLorentzVector lhs = pD + p(0, evt);
264  TLorentzVector rhs = p(1, evt) - p(2, evt);
265 
266  double returnVal = spin_sum.Sandwich(lhs, lhs, rhs, rhs)/(GeV*GeV*GeV*GeV);
267  if(dbThis){
268  cout << "spin-2 spin factor got called for "
269  << theDecay().oneLiner()
270  << "\n > returning " << returnVal
271  << "\n > compare " << spinTwoFromMasses(evt)
272  << "\n > ratio " << returnVal/spinTwoFromMasses(evt)
273  << endl;
274  }
275 
276  return returnVal;
277 }
278 
279 //
bool setSpin()
Definition: SpinFactor3.cpp:35
double spinOneFromZemach(IDalitzEvent &evt)
double spinOneFromMasses(IDalitzEvent &evt)
static DecayTree * _exampleDecay
Definition: SpinFactor3.h:12
double Sandwich(const TLorentzVector &lhs, const TLorentzVector &rhs) const
Definition: SpinSumV.h:32
bool parseTree(const DalitzEventPattern &pat)
Definition: SpinFactor3.cpp:58
virtual double getVal(IDalitzEvent &evt)
bool isFinalState() const
Definition: DDTree.h:93
virtual void printYourself(std::ostream &os=std::cout) const
Definition: SpinFactor3.cpp:95
double GSSpinFactor(IDalitzEvent &evt)
double Contract(const TLorentzVector &rhs) const
Definition: ZTspin1.h:15
double spinTwoFromMasses(IDalitzEvent &evt)
virtual const DalitzEventPattern & eventPattern() const =0
static const double GeV
Definition: ZTspin1.h:9
double spinOneVal(IDalitzEvent &evt)
static const DecayTree & getExampleDecay()
Definition: SpinFactor3.cpp:22
int nDgtr() const
Definition: DDTree.h:96
double Sandwich(const TLorentzVector &lm, const TLorentzVector &ln, const TLorentzVector &ra, const TLorentzVector &rb)
Definition: SpinSumT.h:19
DDTree< DecayTreeItem > DecayTree
Definition: DecayTree.h:35
double spinTwoVal(IDalitzEvent &evt)
virtual const DecayTree & exampleDecay()
Definition: SpinFactor3.cpp:31