MINT2
SpinFactors3Body_ForRunningWidth.cpp
Go to the documentation of this file.
1 // author: Philippe d'Argent (p.dargent@cern.ch)
2 // created: 21 Oct 2015
3 #include "Mint/SpinFactors.h"
5 #include "Mint/DecayTree.h"
6 #include "Mint/Utils.h"
8 
9 #include "Mint/ZTspin1.h"
10 #include "Mint/ZTspin2.h"
11 #include "Mint/LeviCivita.h"
12 #include "Mint/SpinSumV.h"
13 #include "Mint/SpinSumT.h"
14 #include "Mint/ZTgperp.h"
15 #include "Mint/SymmLorentzMatrix.h"
16 #include "Mint/polVector.h"
17 
18 using namespace std;
19 using namespace MINT;
20 
24 
28 
29 //==================================================================
30 //==================================================================
31 
32 
34  if(0==_exampleDecay){
35  _exampleDecay = new DecayTree(20213);
36  _exampleDecay->addDgtr(211, 113)->addDgtr(211,-211);
37  }
38  return *_exampleDecay;
39 }
40 
42  return getExampleDecay();
43 }
44 
46  if(0==_exampleDecay){
47  _exampleDecay = new DecayTree(20213);
48  _exampleDecay->addDgtr(211, 113)->addDgtr(211,-211);
49  _exampleDecay->getVal().setL(2);
50  }
51  return *_exampleDecay;
52 }
53 
55  return getExampleDecay();
56 }
57 
58 
60  bool debugThis=false;
61 
62  if(fsPS.size() < 3) fsPS.reserve(3);
63  for(int i=0; i< theDecay(pat).nDgtr(); i++){
65  theDecay(pat).getDgtrTreePtr(i);
66 
67  if(dgtr->getVal().SVPAT() == "V") V = dgtr;
68  else if(dgtr->getVal().SVPAT() == "P") fsPS[0] = dgtr;
69  }
70  if(0==V || 0==fsPS[0]){
71  cout << "ERROR in SF_AtoVP1_VtoP2P3::parseTree"
72  << " Didn't find V or P1 " << V.get() << ", " << fsPS[0].get() << endl;
73  return false;
74  }
75 
76  if(V->nDgtr() != 2){
77  cout << "ERROR in SF_AtoVP1_VtoP2P3::parseTree"
78  << " V should have 2 daughters, but it says it has "
79  << V->nDgtr() << "."
80  << endl;
81  return false;
82  }
83  fsPS[1] = V->getDgtrTreePtr(0);
84  fsPS[2] = V->getDgtrTreePtr(1);
85 
86  // normalOrder(fsPS[2], fsPS[3]);
87 
88  if(debugThis){
89  cout << "parsed Tree: V:\n"
90  << *V
91  << endl;
92  for(int i=0; i<3; i++){
93  cout << "fsPS[" << i << "]\n"
94  << *(fsPS[i])
95  << endl;
96  }
97  }
98  // this->printYourself();
99  return true;
100 }
101 
103  bool debugThis = false;
104 
105  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
106 
107  TLorentzVector pV = p(1, evt) + p(2, evt);
108  TLorentzVector qV = p(1, evt) - p(2, evt);
109  TLorentzVector pA = p(0, evt) + p(1, evt) + p(2, evt);
110 
111  double MassV = mRes(V, evt);
112  ZTspin1 LV(qV,pV,MassV);
113  polVector e = polVector(pA,pA.M(),getPolarisation());
114 
115  complex<double> sfm(LV.Dot(e.Re()),LV.Dot(e.Im()));
116  return sfm/GeV;
117  (void)debugThis;
118 }
119 void SF_AtoVP1_VtoP2P3::printYourself(ostream& os) const{
120  // bool debugThis = false;
121 
122  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
123  os << "spin factor SF_AtoVP1_VtoP2P3"
124  << "\n\t parsed tree " << theDecay().oneLiner()
125  << "\n like this:" << endl;
126  this->printParsing(os);
127 }
128 
129 
131  bool debugThis = false;
132 
133  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
134 
135  TLorentzVector pV = p(1, evt) + p(2, evt);
136  TLorentzVector qV = p(1, evt) - p(2, evt);
137  TLorentzVector pA = p(0, evt) + p(1, evt) + p(2, evt);
138  TLorentzVector qA = p(0, evt) - pV;
139 
140  double MassV = mRes(V, evt);
141  ZTspin1 LV(qV,pV,MassV);
142  ZTspin2 LA(qA,pA,pA.M());
143  //SpinSumT PA(pA,pA.M());
144 
145  polVector e = polVector(pA,pA.M(),getPolarisation());
146  TLorentzVector tmp = LA.Contract(LV);
147 
148  complex<double> sfm(tmp.Dot(e.Re()),tmp.Dot(e.Im()));
149  return sfm/(GeV*GeV*GeV);
150  //return complex<double>(PA.Sandwich(e.Re(),LV,qA,qA),PA.Sandwich(e.Im(),LV,qA,qA));
151  (void)debugThis;
152  }
153 
154 void SF_AtoVP1_VtoP2P3_D::printYourself(ostream& os) const{
155  // bool debugThis = false;
156 
157  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
158  os << "spin factor SF_AtoVP1_VtoP2P3_D"
159  << "\n\t parsed tree " << theDecay().oneLiner()
160  << "\n like this:" << endl;
161  this->printParsing(os);
162 }
163 
164 //=========================================================
165 
167  if(0==_exampleDecay){
168  _exampleDecay = new DecayTree(20213);
169  _exampleDecay->addDgtr(211, 9010221)->addDgtr(211,-211);
170  }
171  return *_exampleDecay;
172 }
173 
175  return getExampleDecay();
176 }
177 
179  bool debugThis=false;
180 
181  if(fsPS.size() < 3) fsPS.reserve(3);
182  for(int i=0; i< theDecay(pat).nDgtr(); i++){
184  theDecay(pat).getDgtrTreePtr(i);
185 
186  if(dgtr->getVal().SVPAT() == "S") S = dgtr;
187  else if(dgtr->getVal().SVPAT() == "P") fsPS[0] = dgtr;
188  }
189  if(0==S || 0==fsPS[0]){
190  cout << "ERROR in SF_AtoSP1_StoP2P3::parseTree"
191  << " Didn't find S or P1 " << S.get() << ", " << fsPS[0].get() << endl;
192  return false;
193  }
194 
195  if(S->nDgtr() != 2){
196  cout << "ERROR in SF_AtoSP1_StoP2P3::parseTree"
197  << " S should have 2 daughters, but it says it has "
198  << S->nDgtr() << "."
199  << endl;
200  return false;
201  }
202  fsPS[1] = S->getDgtrTreePtr(0);
203  fsPS[2] = S->getDgtrTreePtr(1);
204 
205  // normalOrder(fsPS[2], fsPS[3]);
206 
207  if(debugThis){
208  cout << "parsed Tree: S:\n"
209  << *S
210  << endl;
211  for(int i=0; i<3; i++){
212  cout << "fsPS[" << i << "]\n"
213  << *(fsPS[i])
214  << endl;
215  }
216  }
217  // this->printYourself();
218  return true;
219 }
220 
222  bool debugThis = false;
223 
224  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
225 
226  TLorentzVector pS = p(1, evt) + p(2, evt);
227  TLorentzVector pA = p(0, evt) + pS;
228  TLorentzVector qA = p(0, evt) - pS;
229 
230  polVector e = polVector(pA,pA.M(),getPolarisation());
231  ZTspin1 LA(qA,pA,pA.M());
232 
233  complex<double> sfm(LA.Dot(e.Re()),LA.Dot(e.Im()));
234  return sfm/GeV;
235  (void)debugThis;
236 }
237 
238 void SF_AtoSP1_StoP2P3::printYourself(ostream& os) const{
239  // bool debugThis = false;
240 
241  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
242  os << "spin factor SF_AtoSP1_StoP2P3"
243  << "\n\t parsed tree " << theDecay().oneLiner()
244  << "\n like this:" << endl;
245  this->printParsing(os);
246 }
247 
248 //=========================================================
249 
251  if(0==_exampleDecay){
252  _exampleDecay = new DecayTree(100323);
253  _exampleDecay->addDgtr(321, 113)->addDgtr(211,-211);
254  }
255  return *_exampleDecay;
256 }
257 
259  return getExampleDecay();
260 }
261 
263  bool debugThis=false;
264 
265  if(fsPS.size() < 3) fsPS.reserve(3);
266  for(int i=0; i< theDecay(pat).nDgtr(); i++){
268  theDecay(pat).getDgtrTreePtr(i);
269 
270  if(dgtr->getVal().SVPAT() == "V") V0 = dgtr;
271  else if(dgtr->getVal().SVPAT() == "P") fsPS[0] = dgtr;
272  }
273  if(0==V0 || 0==fsPS[0]){
274  cout << "ERROR in SF_VtoV0P1_V0toP2P3::parseTree"
275  << " Didn't find V0 or P1 " << V0.get() << ", " << fsPS[0].get() << endl;
276  return false;
277  }
278 
279  if(V0->nDgtr() != 2){
280  cout << "ERROR in SF_VtoV0P1_V0toP2P3::parseTree"
281  << " V0 should have 2 daughters, but it says it has "
282  << V0->nDgtr() << "."
283  << endl;
284  return false;
285  }
286  fsPS[1] = V0->getDgtrTreePtr(0);
287  fsPS[2] = V0->getDgtrTreePtr(1);
288 
289  // normalOrder(fsPS[2], fsPS[3]);
290 
291  if(debugThis){
292  cout << "parsed Tree: S:\n"
293  << *V0
294  << endl;
295  for(int i=0; i<3; i++){
296  cout << "fsPS[" << i << "]\n"
297  << *(fsPS[i])
298  << endl;
299  }
300  }
301  // this->printYourself();
302  return true;
303 }
304 
306  bool debugThis = false;
307 
308  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
309 
310  TLorentzVector pV0 = p(1, evt) + p(2, evt);
311  TLorentzVector qV0 = p(1, evt) - p(2, evt);
312  TLorentzVector pV = p(0, evt) + pV0;
313  TLorentzVector qV = p(0, evt) - pV0;
314 
315  polVector e = polVector(pV,pV.M(),getPolarisation());
316  ZTspin1 LV(qV,pV,pV.M());
317  ZTspin1 LV0(qV0,pV0,pV0.M());
318 
319  complex<double> sfm(LeviCivita(e.Re(),pV,LV,LV0),LeviCivita(e.Im(),pV,LV,LV0));
320 
321  return sfm/(GeV*GeV*GeV);
322  (void)debugThis;
323 }
324 
325 void SF_VtoV0P1_V0toP2P3::printYourself(ostream& os) const{
326  // bool debugThis = false;
327 
328  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
329  os << "spin factor SF_VtoV0P1_V0toP2P3"
330  << "\n\t parsed tree " << theDecay().oneLiner()
331  << "\n like this:" << endl;
332  this->printParsing(os);
333 }
334 
335 //=========================================================
336 
338  if(0==_exampleDecay){
339  _exampleDecay = new DecayTree(100443);
340  _exampleDecay->addDgtr(443, 9010221)->addDgtr(211,-211);
341  }
342  return *_exampleDecay;
343 }
344 
346  return getExampleDecay();
347 }
348 
350  bool debugThis=false;
351 
352  if(fsPS.size() < 3) fsPS.reserve(3);
353  for(int i=0; i< theDecay(pat).nDgtr(); i++){
355  theDecay(pat).getDgtrTreePtr(i);
356 
357  if(dgtr->getVal().SVPAT() == "S") S = dgtr;
358  else if(dgtr->getVal().SVPAT() == "V") fsPS[0] = dgtr;
359  }
360  if(0==S || 0==fsPS[0]){
361  cout << "ERROR in SF_VtoSV0_StoP2P3::parseTree"
362  << " Didn't find S or V0 " << S.get() << ", " << fsPS[0].get() << endl;
363  return false;
364  }
365 
366  if(S->nDgtr() != 2){
367  cout << "ERROR in SF_VtoSV0_StoP2P3::parseTree"
368  << " S should have 2 daughters, but it says it has "
369  << S->nDgtr() << "."
370  << endl;
371  return false;
372  }
373  fsPS[1] = S->getDgtrTreePtr(0);
374  fsPS[2] = S->getDgtrTreePtr(1);
375 
376  // normalOrder(fsPS[2], fsPS[3]);
377 
378  if(debugThis){
379  cout << "parsed Tree: S:\n"
380  << *S
381  << endl;
382  for(int i=0; i<3; i++){
383  cout << "fsPS[" << i << "]\n"
384  << *(fsPS[i])
385  << endl;
386  }
387  }
388  // this->printYourself();
389  return true;
390 }
391 
393  bool debugThis = false;
394 
395  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
396 
397  TLorentzVector pV0 = p(0, evt);
398  TLorentzVector pV = p(1, evt) + p(2, evt) + pV0;
399 
400  polVector e = polVector(pV,pV.M(),getPolarisation());
401  polVector eV0 = polVector(pV0,pV0.M(),getPolarisation());
402  eV0.conj();
403 
404  return e.Dot(eV0);
405  (void)debugThis;
406 }
407 
408 void SF_VtoSV0_StoP2P3::printYourself(ostream& os) const{
409  // bool debugThis = false;
410 
411  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
412  os << "spin factor SF_VtoSV0_StoP2P3"
413  << "\n\t parsed tree " << theDecay().oneLiner()
414  << "\n like this:" << endl;
415  this->printParsing(os);
416 }
417 
418 //=========================================================
419 
421  if(0==_exampleDecay){
422  _exampleDecay = new DecayTree(100443);
423  _exampleDecay->addDgtr(321, 120553)->addDgtr(443,-211);
424  }
425  return *_exampleDecay;
426 }
427 
429  return getExampleDecay();
430 }
431 
433  bool debugThis=false;
434 
435  if(fsPS.size() < 3) fsPS.reserve(3);
436  for(int i=0; i< theDecay(pat).nDgtr(); i++){
438  theDecay(pat).getDgtrTreePtr(i);
439 
440  if(dgtr->getVal().SVPAT() == "A") A = dgtr;
441  else if(dgtr->getVal().SVPAT() == "P") fsPS[1] = dgtr;
442  }
443  if(0==A || 0==fsPS[1]){
444  cout << "ERROR in SF_VtoAP1_AtoV0P2::parseTree"
445  << " Didn't find A or P1 " << A.get() << ", " << fsPS[1].get() << endl;
446  return false;
447  }
448 
449  if(A->nDgtr() != 2){
450  cout << "ERROR in SF_VtoAP1_AtoV0P2::parseTree"
451  << " A should have 2 daughters, but it says it has "
452  << A->nDgtr() << "."
453  << endl;
454  return false;
455  }
456 
457 
458  if(A->getDgtrTreePtr(0)->getVal().SVPAT() == "V") {
459  fsPS[0] = A->getDgtrTreePtr(0);
460  fsPS[2] = A->getDgtrTreePtr(1);
461  }
462  else if(A->getDgtrTreePtr(1)->getVal().SVPAT() == "V") {
463  fsPS[0] = A->getDgtrTreePtr(1);
464  fsPS[2] = A->getDgtrTreePtr(0);
465  }
466 
467  if(0==fsPS[2] || 0==fsPS[0]){
468  cout << "ERROR in SF_VtoAP1_AtoV0P2::parseTree"
469  << " Didn't find V0 or P2 " << fsPS[0].get() << ", " << fsPS[2].get() << endl;
470  return false;
471  }
472 
473  // normalOrder(fsPS[2], fsPS[3]);
474 
475  if(debugThis){
476  cout << "parsed Tree: A:\n"
477  << *A
478  << endl;
479  for(int i=0; i<3; i++){
480  cout << "fsPS[" << i << "]\n"
481  << *(fsPS[i])
482  << endl;
483  }
484  }
485  // this->printYourself();
486  return true;
487 }
488 
490  bool debugThis = false;
491 
492  if(! ( fsPS[0] && fsPS[1] && fsPS[2] )) parseTree(evt.eventPattern());
493 
494  TLorentzVector pV0 = p(0, evt);
495  TLorentzVector pV = p(1, evt) + p(2, evt) + pV0;
496  TLorentzVector pA = p(2, evt) + pV0;
497 
498  SpinSumV PA(pA,pA.M());
499 
500  polVector e = polVector(pV,pV.M(),getPolarisation());
501  polVector eV0 = polVector(pV0,pV0.M(),getPolarisation());
502  eV0.conj();
503 
504  TLorentzVectorC tmp( PA.Dot(eV0.Re()) , PA.Dot(eV0.Im()));
505 
506  return eV0.Dot(tmp);
507  (void)debugThis;
508 
509 }
510 
511 void SF_VtoAP1_AtoV0P2::printYourself(ostream& os) const{
512  // bool debugThis = false;
513 
514  if(! ( fsPS[0] && fsPS[1] && fsPS[2]) ) return;
515  os << "spin factor SF_VtoAP1_AtoV0P2"
516  << "\n\t parsed tree " << theDecay().oneLiner()
517  << "\n like this:" << endl;
518  this->printParsing(os);
519 }
520 
521 
static const DecayTree & getExampleDecay()
virtual void printYourself(std::ostream &os=std::cout) const
const X * get() const
Definition: counted_ptr.h:217
virtual bool parseTree(const DalitzEventPattern &pat)
virtual const DecayTree & exampleDecay()
virtual void printYourself(std::ostream &os=std::cout) const
virtual const DecayTree & exampleDecay()
std::string SVPAT() const
virtual void printYourself(std::ostream &os=std::cout) const
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
const TLorentzVector & Re() const
const ValueType & getVal() const
Definition: DDTree.h:102
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
complex< double > Dot(const TLorentzVectorC &rhs)
static const DecayTree & getExampleDecay()
virtual const DecayTree & exampleDecay()
virtual bool parseTree(const DalitzEventPattern &pat)
static const DecayTree & getExampleDecay()
virtual const DecayTree & exampleDecay()
virtual const DalitzEventPattern & eventPattern() const =0
static const double GeV
virtual void printYourself(std::ostream &os=std::cout) const
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
Definition: ZTspin1.h:9
const TLorentzVector & Im() const
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
double LeviCivita(const TLorentzVector &p0, const TLorentzVector &p1, const TLorentzVector &p2, const TLorentzVector &p3)
Definition: LeviCivita.h:12
int nDgtr() const
Definition: DDTree.h:96
virtual const DecayTree & exampleDecay()
virtual bool parseTree(const DalitzEventPattern &pat)
DDTree< DecayTreeItem > DecayTree
Definition: DecayTree.h:35
virtual bool parseTree(const DalitzEventPattern &pat)
virtual const DecayTree & exampleDecay()
static const DecayTree & getExampleDecay()
virtual void printYourself(std::ostream &os=std::cout) const
static const DecayTree & getExampleDecay()
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
virtual void printYourself(std::ostream &os=std::cout) const
virtual bool parseTree(const DalitzEventPattern &pat)
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
static const DecayTree & getExampleDecay()