MINT2
DalitzEvent.h
Go to the documentation of this file.
1 #ifndef DALITZ_EVENT_HH
2 #define DALITZ_EVENT_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:00 GMT
5 
6 #include <iostream>
7 #include <string>
8 #include <vector>
9 #include <map>
10 
11 #include "TLorentzVector.h"
12 #include "TVector3.h"
13 
14 #include "Mint/IDalitzEvent.h"
17 
19 
20 #include "Mint/Permutator.h"
21 #include "Mint/PolymorphVector.h"
22 
23 class TRandom;
24 class TNtupleD;
25 class TTree;
26 
27 class DalitzEvent : virtual public IDalitzEvent{
28  protected:
29 
30  static const char ntpNameChars[];
31  static const char prtNameChars[];
32  static std::string prtToNtpName(const std::string& s_in);
33  static std::string ntpToPrtName(const std::string& s_in);
34 
35  static int singleParticleNtpArraySize();
36 
37  static long int _eventCounter;
38 
39  static long int _rememberVectorCounter;
40 
41  // begin all data members:
43  std::vector<TLorentzVector> _p;
44 
45  mutable double _rememberPhaseSpace;
46 
49 
50  double _aValue;
51  double _weight;
53 
54  std::vector<double> _vectorOfValues;
55  std::vector<double> _vectorOfWeights;
56 
57  mutable std::vector< std::vector<double> > _s;
58  mutable std::vector< std::vector<double> > _t;
59  mutable std::map<std::vector<int>, double> _sijMap;
60 
61 
64 
65 
66  // end all data members;
67 
68 
69  const TLorentzVector& p_intern(unsigned int i) const; // 4-vectors
70  TLorentzVector& p_intern(unsigned int i); // 4-vectors
71  double s_intern(unsigned int i, unsigned int j) const; // sij
72  double t_intern(unsigned int i, unsigned int j) const; // tij
73  double evalsij_intern(const std::vector<int>& intern_indices) const;
74  double sijMap_intern(const std::vector<int>& intern_indices) const;
75  double sijMap(const std::vector<int>& indices) const;
76 
77 
78  bool shoutAndKill();
79  double BDet() const;
80  double Delta4() const;
81  double phaseSpace3(double epsilon = 1.e-9) const;
82  double phaseSpace4() const;
83  bool setMomenta(const std::vector<TLorentzVector>& mumAndDgtr_p4);
84  bool setMomenta(const std::vector<TVector3>& mumAndDgtr_p3);
85  void setP(unsigned int i, const TLorentzVector& p4);
86 
87 
88  static bool parseNtpEntryName(const std::string& entry
89  , std::string& part1
90  , std::string& part2);
91 public:
92  DalitzEvent();
94  , const std::vector<TLorentzVector>& mumAndDgtr_p4
95  );
98  , double t01_in
99  , double s12_in, double s23_in, double s34_in
100  , double t40_in
101  );
103  DalitzEvent(const DalitzEventPattern& pat, const double s13, const double s23) ;
105  , const std::vector<TVector3>& mumAndDgtr_p3
106  );
108  );
110  , TRandom* rnd
111  );
112  DalitzEvent(TNtupleD* ntp);
113 
114  DalitzEvent(const IDalitzEvent& ievt);
115  DalitzEvent(const IDalitzEvent* ievt);
116  DalitzEvent(const DalitzEvent* other);
117  DalitzEvent(const DalitzEvent& other);
118 
119  virtual ~DalitzEvent();
120 
121  static long int assignUniqueRememberNumber();
122 
123  IDalitzEvent* clone() const;
124 
125  static long int eventCounter(){ return _eventCounter;}
126 
127  virtual double getWeight() const;
128  virtual void setWeight(double w);
129 
130  virtual void setGeneratorPdfRelativeToPhaseSpace(double gpdf);
131  virtual double getGeneratorPdfRelativeToPhaseSpace()const;
132 
133  virtual const std::vector<double>& getVectorOfValues() const;
134  virtual std::vector<double>& getVectorOfValues();
135  virtual const std::vector<double>& getVectorOfWeights() const;
136  virtual std::vector<double>& getVectorOfWeights();
137  virtual void setValueInVector(unsigned int i, double value);
138  virtual void setWeightInVector(unsigned int i, double weight);
139  virtual double getValueFromVector(unsigned int i) const;
140  virtual double getWeightFromVector(unsigned int i) const;
141 
142  virtual void P_conjugateYourself();
143  virtual void C_conjugateYourself();
144  virtual void CP_conjugateYourself();
145 
146  bool resetST();
147 
149  return _perm[_permutationIndex];
150  }
151 
152  void setPermutationIndex(int i);
153  int numPermutations() const;
154  int permutationIndex() const{
155  return _permutationIndex;
156  }
157 
158 
159  // bool mapMe(const Permutation& mapping);
160  // This changes the indices, so particle 1 becomes (say) particle 3, etc
161  // This is a permanent change to the event.
162  // Not useful for anything except in MappedDalitzBWArea. Dangerous. therefore commented out.
163 
164  bool fromTree(TTree* tree);
165  bool fromNtuple(TNtupleD* ntp);
166  bool fromParasTree(TTree* ntp);
167  bool fromParasTreeOld(TTree* ntp);
168 
169  // required
170  virtual void setAValue(double a){_aValue=a;}
171  virtual double getAValue()const{return _aValue;}
172 
173  virtual const DalitzEventPattern& eventPattern() const{return _pat;}
174  virtual const TLorentzVector& p(unsigned int i) const; // 4-vectors
175  virtual TLorentzVector& p(unsigned int i); // 4-vectors
176  virtual double s(unsigned int i, unsigned int j) const; // sij
177  virtual double t(unsigned int i, unsigned int j) const; // tij
178  virtual double sij(const std::vector<int>& indices) const;
179  virtual double sij(const MINT::PolymorphVector<int>& indices) const{
180  return sij(indices.theVector());
181  }
182 
183  virtual void setMothers3Momentum(const TVector3& mp3);
184 
185  virtual double phaseSpace() const;
186 
187  virtual bool retrieveValue(int i, std::complex<double>& value
188  , long int configNumber=1){
189  /*std::cout << "I remember these numbers: " << std::endl;
190  for(unsigned int j=0; j < _rememberComplexFast.size(); j++){
191  std::complex<double> tempVal;
192  _rememberComplexFast.get(j, tempVal, configNumber);
193  std::cout << j << ") " << tempVal << std::endl;
194  }
195  std::cout << "and I am returning this: " <<
196  _rememberComplexFast.get(i, value, configNumber);
197  std::cout << " " << i << ") " << value << std::endl;
198  */
199  return _rememberComplexFast.get(i, value, configNumber);
200  }
201  virtual void setValue(int i, const std::complex<double>& value
202  , long int configNumber=1){
203  //std::cout << "setting: " << i << ") " << value << std::endl;
204  _rememberComplexFast.set(i,value, configNumber);
205  }
206  virtual bool retrieveValue(int i, double value, long int configNumber=1){
207  return _rememberDoubleFast.get(i, value, configNumber);
208  }
209  virtual void setValue(int i, double value, long int configNumber=1){
210  _rememberDoubleFast.set(i,value, configNumber);
211  }
212 
213  // helpful
214  double sijMin(const std::vector<int>& indices) const;
215  double sijMin(const MINT::PolymorphVector<int>& indices) const{
216  return sijMin(indices.theVector());}
217 
218  double sijMax(const std::vector<int>& indices) const;
219  double sijMax(const MINT::PolymorphVector<int>& indices) const{
220  return sijMax(indices.theVector());}
221 
222  int nDgtr() const{
223  return _pat.size()-1;
224  }
225  double m(unsigned int i) const; // nominal masses (from _pat)
226  double m2(unsigned int i) const; // nominal masses squared
227  TLorentzVector p_dgtr_sum() const;
228  bool kinematicallyAllowed(double epsilon = 1.e-9) const;
229 
230  void print(std::ostream& os = std::cout) const;
231  // generate yourself:
232  void generateThisToPhaseSpace(TRandom* rnd = 0);
233  void generateThisToPhaseSpace(double p_of_D, TRandom* rnd = 0);
234 
235  void generateThisToPhaseSpace(const TVector3& pVec_of_D
236  , TRandom* rnd = 0);
237 
238 
239  std::string makeNtupleVarnames()const;
240  bool fillNtupleVarArray(std::vector<Double_t>& array) const;
241  unsigned int ntupleVarArraySize() const;
242 
243  // mainly for debugging and x-check with prev version
245 };
246 
247 std::ostream& operator<<(std::ostream& os, const DalitzEvent& de);
248 
249 #endif
250 //
virtual double getValueFromVector(unsigned int i) const
virtual void setWeight(double w)
void set(unsigned int i, const T &value, long int configNumber=1)
std::vector< double > _vectorOfValues
Definition: DalitzEvent.h:54
virtual void setMothers3Momentum(const TVector3 &mp3)
static std::string prtToNtpName(const std::string &s_in)
virtual ~DalitzEvent()
std::vector< std::vector< double > > _t
Definition: DalitzEvent.h:58
int numPermutations() const
bool fromParasTreeOld(TTree *ntp)
virtual const std::vector< double > & getVectorOfValues() const
static long int _rememberVectorCounter
Definition: DalitzEvent.h:39
virtual double sij(const std::vector< int > &indices) const
double sijMin(const MINT::PolymorphVector< int > &indices) const
Definition: DalitzEvent.h:215
const TLorentzVector & p_intern(unsigned int i) const
double phaseSpace4() const
std::string makeNtupleVarnames() const
virtual void CP_conjugateYourself()
IDalitzEvent * clone() const
bool fillNtupleVarArray(std::vector< Double_t > &array) const
RememberAnythingFast< double > _rememberDoubleFast
Definition: DalitzEvent.h:48
bool setMomenta(const std::vector< TLorentzVector > &mumAndDgtr_p4)
virtual bool retrieveValue(int i, std::complex< double > &value, long int configNumber=1)
Definition: DalitzEvent.h:187
bool resetST()
virtual double phaseSpace() const
virtual void P_conjugateYourself()
Permutator _perm
Definition: DalitzEvent.h:63
const Permutation & currentPermutation() const
Definition: DalitzEvent.h:148
virtual const DalitzEventPattern & eventPattern() const
Definition: DalitzEvent.h:173
bool fromTree(TTree *tree)
virtual void setValueInVector(unsigned int i, double value)
static long int assignUniqueRememberNumber()
Definition: DalitzEvent.cpp:29
virtual double getAValue() const
Definition: DalitzEvent.h:171
static long int eventCounter()
Definition: DalitzEvent.h:125
bool fromParasTree(TTree *ntp)
virtual double getWeightFromVector(unsigned int i) const
bool shoutAndKill()
virtual double sij(const MINT::PolymorphVector< int > &indices) const
Definition: DalitzEvent.h:179
double Delta4() const
std::vector< double > _vectorOfWeights
Definition: DalitzEvent.h:55
bool get(int i, T &value, long int configNumber=1)
virtual void setValue(int i, double value, long int configNumber=1)
Definition: DalitzEvent.h:209
virtual const std::vector< double > & getVectorOfWeights() const
std::vector< std::vector< double > > _s
Definition: DalitzEvent.h:57
void setPermutationIndex(int i)
double m2(unsigned int i) const
virtual void setWeightInVector(unsigned int i, double weight)
int nDgtr() const
Definition: DalitzEvent.h:222
double phaseSpace3(double epsilon=1.e-9) const
static bool parseNtpEntryName(const std::string &entry, std::string &part1, std::string &part2)
void generateThisToPhaseSpace(TRandom *rnd=0)
virtual double getWeight() const
double _rememberPhaseSpace
Definition: DalitzEvent.h:45
RememberAnythingFast< std::complex< double > > _rememberComplexFast
Definition: DalitzEvent.h:47
double _generatorPdfRelativeToPhaseSpace
Definition: DalitzEvent.h:52
TLorentzVector p_dgtr_sum() const
static std::string ntpToPrtName(const std::string &s_in)
virtual void C_conjugateYourself()
virtual double getGeneratorPdfRelativeToPhaseSpace() const
virtual bool retrieveValue(int i, double value, long int configNumber=1)
Definition: DalitzEvent.h:206
virtual void setValue(int i, const std::complex< double > &value, long int configNumber=1)
Definition: DalitzEvent.h:201
std::vector< TLorentzVector > _p
Definition: DalitzEvent.h:43
virtual void setAValue(double a)
Definition: DalitzEvent.h:170
unsigned int ntupleVarArraySize() const
double sijMap_intern(const std::vector< int > &intern_indices) const
virtual const TLorentzVector & p(unsigned int i) const
DalitzEventPattern _pat
Definition: DalitzEvent.h:42
unsigned int size() const
double t_intern(unsigned int i, unsigned int j) const
bool fromNtuple(TNtupleD *ntp)
virtual double t(unsigned int i, unsigned int j) const
static const char prtNameChars[]
Definition: DalitzEvent.h:31
double sijMin(const std::vector< int > &indices) const
double m(unsigned int i) const
int _permutationIndex
Definition: DalitzEvent.h:62
void print(std::ostream &os=std::cout) const
virtual double s(unsigned int i, unsigned int j) const
static long int _eventCounter
Definition: DalitzEvent.h:37
double evalsij_intern(const std::vector< int > &intern_indices) const
virtual void setGeneratorPdfRelativeToPhaseSpace(double gpdf)
static int singleParticleNtpArraySize()
std::ostream & operator<<(std::ostream &os, const DalitzEvent &de)
Calculate4BodyProps makeCalculate4BodyProps() const
double sijMax(const MINT::PolymorphVector< int > &indices) const
Definition: DalitzEvent.h:219
std::vector< T > & theVector()
double s_intern(unsigned int i, unsigned int j) const
static const char ntpNameChars[]
Definition: DalitzEvent.h:30
double sijMap(const std::vector< int > &indices) const
std::map< std::vector< int >, double > _sijMap
Definition: DalitzEvent.h:59
bool kinematicallyAllowed(double epsilon=1.e-9) const
double _aValue
Definition: DalitzEvent.h:50
double sijMax(const std::vector< int > &indices) const
int permutationIndex() const
Definition: DalitzEvent.h:154
double _weight
Definition: DalitzEvent.h:51
void setP(unsigned int i, const TLorentzVector &p4)
double BDet() const