MINT2
SpinFactor.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:12 GMT
3 #include "Mint/SpinFactor.h"
4 #include "Mint/Utils.h"
5 #include <algorithm> // for swap
6 #include <cstdlib>
7 
8 using namespace std;
9 using namespace MINT;
10 
11 TLorentzVector SpinFactor::p(int i, IDalitzEvent& evt){
12  // momenta of the fsPS.
13  if(i >= (int) fsPS.size() || i < 0){
14  throw "index out of range";
15  }else{
16  if(! fsPS[i] ){
17  throw "tree not parsed";
18  }
19 
20  /*
21  debug code, leave it in for now:
22  std::cout << " SpinFactor p(" << i << ") called" << endl;
23  cout << " fsPs[i] " << fsPS[i] << endl;
24  cout << "fsPS[i]->getVal() " << fsPS[i]->getVal() << endl;
25  cout << "fsPS[i]->getVal().asi(0) " << fsPS[i]->getVal().asi(0) << endl;
26 
27  std::cout << " getEvent() gettin p ("
28  << fsPS[i]->getVal().asi(0)
29  << ")" << std::endl;
30  */
31  //theDecay(evt);
32  TLorentzVector p4(evt.p(fsPS[i]->getVal().asi(0)));
33  if (theDecay(evt).getVal().parityFactor() < 0){
34  // if the mother is an anti-particle, we multiply all
35  // 3 momenta with -1. This makes an "anti" tree a CP
36  // conjugate tree, not just C conjuate.
37  // See also the comment in DecayTreeItem.h.
38  p4.SetX( -p4.X());
39  p4.SetY( -p4.Y());
40  p4.SetZ( -p4.Z());
41  }
42  return p4;
43  }
44 }
45 
47  // return PDG mass for final state paticles
48  if(adt->isFinalState()) return mRes(adt->getVal(), evt);
49  // return sqrt(p^2) for spin projectors
50  return adt->getVal().mReco(&evt) ;
51 }
52 
54  return adt.mRes(&evt);
55 }
56 
57 void SpinFactor::printParsing(std::ostream& os) const{
58  for(int i=0; i < _nFinal; i++){
59  if(0 == fsPS[i]) continue;
60  if(i > 0) os << ", ";
61  os << " fsPs[" << anythingToString(i) << "] ="
62  << fsPS[i]->getVal().name();
63  }
64  os << endl;
65 }
virtual void printParsing(std::ostream &os=std::cout) const
Definition: SpinFactor.cpp:57
const ValueType & getVal() const
Definition: DDTree.h:102
bool isFinalState() const
Definition: DDTree.h:93
virtual const TLorentzVector & p(unsigned int i) const =0
TLorentzVector p(int i, IDalitzEvent &evt)
Definition: SpinFactor.cpp:11
double mRes(const AssociatedDecayTreeItem &adt, IDalitzEvent &evt)
Definition: SpinFactor.cpp:53
std::string anythingToString(const T &anything)
Definition: Utils.h:62
double mReco(const IDalitzEvent *evt) const
double mRes(const IDalitzEvent *evt=0) const