MINT2
Amplitude.h
Go to the documentation of this file.
1 #ifndef AMPLITUDE_HH
2 #define AMPLITUDE_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:17:57 GMT
5 
6 #include <complex>
7 #include <vector>
8 #include <iostream>
9 
10 #include "TRandom.h"
11 
12 #include "Mint/AmpInitialiser.h"
14 #include "Mint/ISpinFactor.h"
15 #include "Mint/LineshapeMaker.h"
16 
17 #include "Mint/ILineshape.h"
18 
21 
22 #include "Mint/DalitzBox.h"
23 #include "Mint/DalitzBWBox.h"
24 #include "Mint/DalitzBoxSet.h"
25 #include "Mint/DalitzBWBoxSet.h"
27 
28 #include "Mint/Permutation.h"
29 
30 #include "Mint/DalitzEvent.h"
31 
32 #include "Mint/counted_ptr.h"
33 
34 #include "Mint/FitParDependent.h"
35 #include "Mint/IFitParRegister.h"
36 #include "Mint/CachedByEvent.h"
37 
38 class FitAmplitude;
39 
40 class Amplitude
41 //: virtual public MINT::IReturnRealForEvent<IDalitzEvent>
42 : virtual public MINT::IReturnComplexForEvent<IDalitzEvent>
43 , public CachedByEvent<std::complex<double> >
44 , public MINT::FitParDependent
45 {
46  protected:
49  std::string _prefix;
50  std::string _lsPrefix;
51  char _spd;
52  std::string _lopt;
53  std::vector<double> _numOpts;
54 
56  bool _init;
57 
58  std::vector<ILineshape*> _LineshapeList;
59 
60  const std::string& prefix() const{return _prefix;}
61  std::string& prefix(){return _prefix;}
62  const std::string& lsPrefix() const{return _lsPrefix;}
63  std::string& lsPrefix(){return _lsPrefix;}
64 
65 
66  bool addLineshape(ILineshape* ls);
67 
68  virtual double boxFactor(){ return 1;}
69 
71  counted_tree_ptr);
72  bool createLineshapes(const AssociatedDecayTree* treePtr=0);
73  bool deleteLineshapes();
74 
75  bool deleteDependants();
76  bool createDependants();
77 
78  bool renew();
79 
80  bool initialised() const{
81  if(! _init) return false;
82  if(_pat.empty()) return false;
83  return true;
84  }
85  bool initialise(const DalitzEventPattern& pat){
86  _pat = pat;
87  return renew();
88  }
90  if(initialised()) return true;
91  return initialise(pat);
92  }
93 
94  std::complex<double> LineshapeProduct(IDalitzEvent& evt);
95  // double LineshapeGaussProduct();
96  std::complex<double> SpinFactorValue(IDalitzEvent& evt);
97  std::complex<double> getOnePermutationsVal(IDalitzEvent& evt);
98  public:
99  Amplitude( const DecayTree& decay
100  , const std::string& namePrefix=""
101  , const std::string& lineshapePrefix=""
102  , char SPD_Wave='?' // not really in use anymore
103  , const std::string& opt=""
104  , const std::vector<double>& numOpt = std::vector<double>()
105  , IFitParRegister* daddy=0
106  );
107 
108  Amplitude( const AmpInitialiser& ampInit
109  , IFitParRegister* daddy=0
110  );
111 
112  Amplitude( const Amplitude& other
113  , IFitParRegister* newDaddy=0
114  );
115 
116  bool resetTree(const DecayTree& dt);
117  bool CPConjugate();
118  bool CConjugateFinalState();
119  bool CConjugateInitialState();
120  bool setL(int L);
121 
122  virtual std::complex<double> getVal(IDalitzEvent& evt){
123  //return getNewVal(evt);// (for debugging)
124  return getValWithCaching(evt);
125  }
126 
127  virtual std::complex<double> getVal(IDalitzEvent* evt); // for backward compatibility only, will be removed
128 
129  virtual std::complex<double> getNewVal(IDalitzEvent& evt);
130 
131 
132 
133  double Prob(IDalitzEvent& evt){
134  std::complex<double> res = getVal(evt);
135  return res.real()*res.real() + res.imag()*res.imag();
136  }
137 
138  // virtual double gaussProb();
139 
140  // virtual double RealVal(IDalitzEvent& evt){return Prob(evt);}
141  virtual std::complex<double> ComplexVal(IDalitzEvent& evt){return getVal(evt);}
142 
144  return _associatingDecayTree.getTree(pat);
145  }
148  }
149  void CheckAndMatchPattern(const DalitzEventPattern& pat) const{
150  theDecay(pat);// happens automatically, here.
151  }
154  }
155 
156 
159  }
160 
163  }
164 
165 
166  std::string name() const;
167  void print(std::ostream& out = std::cout) const;
168 
170  return _spinFactor;
171  }
172 
173 
174  virtual DalitzBoxSet MakeBox(const DalitzEventPattern &pat
175  , const Permutation& perm
176  , double nSigma = 3
177  );
178 
179  virtual DalitzBoxSet MakeBoxes(const DalitzEventPattern& pat
180  , double nSigma=3);
181 
182 
183  virtual DalitzBWBox MakeBWBox(const DalitzEventPattern &pat
184  , const Permutation& perm
185  , TRandom* rnd=gRandom
186  );
188  , TRandom* rnd=gRandom
189  );
190 
191 
192  virtual ~Amplitude();
193 
194  friend class FitAmplitude;
195 };
196 
197 std::ostream& operator<<(std::ostream& out, const Amplitude& amp);
198 
199 #endif
200 //
virtual std::complex< double > getNewVal(IDalitzEvent &evt)
Definition: Amplitude.cpp:401
std::complex< double > getOnePermutationsVal(IDalitzEvent &evt)
Definition: Amplitude.cpp:366
std::string _prefix
Definition: Amplitude.h:49
virtual std::complex< double > ComplexVal(IDalitzEvent &evt)
Definition: Amplitude.h:141
bool initialised() const
Definition: Amplitude.h:80
bool deleteDependants()
Definition: Amplitude.cpp:78
std::complex< double > getValWithCaching(IDalitzEvent &evt)
Definition: CachedByEvent.h:66
double Prob(IDalitzEvent &evt)
Definition: Amplitude.h:133
std::string name() const
Definition: Amplitude.cpp:446
virtual DalitzBoxSet MakeBox(const DalitzEventPattern &pat, const Permutation &perm, double nSigma=3)
Definition: Amplitude.cpp:255
const std::string & prefix() const
Definition: Amplitude.h:60
std::string & lsPrefix()
Definition: Amplitude.h:63
bool initialiseIfNeeded(const DalitzEventPattern &pat)
Definition: Amplitude.h:89
bool createDependants()
Definition: Amplitude.cpp:89
DalitzEventPattern _pat
Definition: Amplitude.h:55
virtual ~Amplitude()
Definition: Amplitude.cpp:74
ISpinFactor * spinFactor()
Definition: Amplitude.h:169
virtual DalitzBoxSet MakeBoxes(const DalitzEventPattern &pat, double nSigma=3)
Definition: Amplitude.cpp:242
DecayTree getBareTree() const
std::string _lsPrefix
Definition: Amplitude.h:50
AssociatingDecayTree _associatingDecayTree
Definition: Amplitude.h:47
const DalitzEventPattern & getTreePattern() const
char _spd
Definition: Amplitude.h:51
bool createLineshapes(const MINT::const_counted_ptr< AssociatedDecayTree > &counted_tree_ptr)
Definition: Amplitude.cpp:155
std::vector< ILineshape * > _LineshapeList
Definition: Amplitude.h:58
bool _init
Definition: Amplitude.h:56
const std::string & lsPrefix() const
Definition: Amplitude.h:62
bool CConjugateFinalState()
Definition: Amplitude.cpp:129
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: Amplitude.h:122
virtual double boxFactor()
Definition: Amplitude.h:68
bool CPConjugate()
Definition: Amplitude.cpp:123
bool setL(int L)
Definition: Amplitude.cpp:142
bool resetTree(const DecayTree &dt)
Definition: Amplitude.cpp:117
bool addLineshape(ILineshape *ls)
Definition: Amplitude.cpp:148
bool initialise(const DalitzEventPattern &pat)
Definition: Amplitude.h:85
Amplitude(const DecayTree &decay, const std::string &namePrefix="", const std::string &lineshapePrefix="", char SPD_Wave='?', const std::string &opt="", const std::vector< double > &numOpt=std::vector< double >(), IFitParRegister *daddy=0)
DalitzEventPattern getTreePattern() const
Definition: Amplitude.h:161
std::vector< double > _numOpts
Definition: Amplitude.h:53
const AssociatedDecayTree & getTree(const DalitzEventPattern &pat) const
void CheckAndMatchPattern(IDalitzEvent &evt) const
Definition: Amplitude.h:152
virtual const DalitzEventPattern & eventPattern() const =0
Amplitude & amp()
Definition: FitAmplitude.h:163
const AssociatedDecayTree & theDecay(const DalitzEventPattern &pat) const
Definition: Amplitude.h:143
bool deleteLineshapes()
Definition: Amplitude.cpp:192
const AssociatedDecayTree & theDecay(IDalitzEvent &evt) const
Definition: Amplitude.h:146
virtual DalitzBWBox MakeBWBox(const DalitzEventPattern &pat, const Permutation &perm, TRandom *rnd=gRandom)
Definition: Amplitude.cpp:321
void print(std::ostream &out=std::cout) const
Definition: Amplitude.cpp:453
std::string _lopt
Definition: Amplitude.h:52
std::string & prefix()
Definition: Amplitude.h:61
DecayTree theBareDecay() const
Definition: Amplitude.h:157
bool renew()
Definition: Amplitude.cpp:109
std::ostream & operator<<(std::ostream &out, const Amplitude &amp)
Definition: Amplitude.cpp:457
ISpinFactor * _spinFactor
Definition: Amplitude.h:48
void CheckAndMatchPattern(const DalitzEventPattern &pat) const
Definition: Amplitude.h:149
std::complex< double > SpinFactorValue(IDalitzEvent &evt)
Definition: Amplitude.cpp:205
virtual DalitzBWBoxSet MakeBWBoxes(const DalitzEventPattern &pat, TRandom *rnd=gRandom)
Definition: Amplitude.cpp:300
bool CConjugateInitialState()
Definition: Amplitude.cpp:136
std::complex< double > LineshapeProduct(IDalitzEvent &evt)
Definition: Amplitude.cpp:224