MINT2
FitAmpSum.h
Go to the documentation of this file.
1 #ifndef FITAMPSUM_HH
2 #define FITAMPSUM_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:03 GMT
5 
6 #include <complex>
7 #include <iostream>
8 
9 #include "Mint/DalitzBoxSet.h"
10 #include "Mint/DalitzBWBoxSet.h"
11 #include "Mint/IntegCalculator.h"
17 #include "Mint/NamedParameter.h"
19 #include "Mint/FitAmpList.h"
20 
21 #include <vector>
22 
23 // note - this inherits now from FitAmpList, and that from FitAmpLisBase
24 // many methods formerly defined here are now defined there.
25 
26 class FitAmpSum
27 : public FitAmpList
28 , virtual public ILookLikeFitAmpSum
29 , virtual public IFastAmplitudeIntegrable
30 , virtual public MINT::IReturnRealForEvent<IDalitzEvent>
31 , virtual public MINT::IReturnComplexForEvent<IDalitzEvent>
32 {
33  protected:
35  public:
36  FitAmpSum(const DalitzEventPattern& pat
37  , const char* fname=0
38  , MINT::MinuitParameterSet* pset=0
39  , const std::string& prefix=""
40  , const std::string& lineshapePrefix=""
41  , const std::string& opt=""
42  );
43 
44  FitAmpSum(const DalitzEventPattern& pat
46  , const std::string& prefix=""
47  , const std::string& lineshapePrefix=""
48  , const std::string& opt=""
49  );
50 
51  FitAmpSum(const DalitzEventPattern& pat
52  , const std::string& prefix
53  , const std::string& lineshapePrefix=""
54  , const std::string& opt=""
55  );
56 
57  FitAmpSum(const FitAmpSum& other);
58  FitAmpSum(const FitAmpList& other);
59  /*
60  The copy constructor copies like this: There'll be 'physical'
61  copies of all Amplitudes, but the FitParameters remain the
62  same (pointers to the same FitParameter Object). This is
63  useful for the CP-conj coding as it is now, but perhaps a bit
64  counter-intuitive. needs to be reviewed at some point. This
65  behaviour is defined in the copy constructor of the
66  FitAmplitude class.
67  */
69  // same behaviour for FitParameters as for copy constructor.
71 
72 
73  // if "virtual" works as I think it should
74  // the below is not necessary - leave it in
75  // for now, maybe I had a reason. But might
76  // in future just use FitAmpList's routines.
78  , double nSigma=2){
79  return FitAmpList::makeBoxes(pat, this, nSigma);}
80 
82  , TRandom* rnd=gRandom){
83  return FitAmpList::makeBWBoxes(pat, this, rnd);}
84 
85 
86  virtual std::complex<double> getVal(IDalitzEvent& evt);
87  virtual std::complex<double> getVal(IDalitzEvent* evt);// for backward compatibility
88  virtual void Gradient(IDalitzEvent& evt,std::vector<double>& grad, MINT::MinuitParameterSet* mps);
89  virtual bool useAnalyticGradient() {return _useAnalyticGradient;}
90 
91  /*
92  virtual std::complex<double> getSmootherLargerVal();
93  virtual std::complex<double> getSmootherLargerVal(IDalitzEvent* evt);
94  */
95 
99 
100  virtual double Prob(IDalitzEvent& evt){
101  std::complex<double> res = getVal(evt);
102  return res.real()*res.real() + res.imag()*res.imag();
103  }
104 
105  /*
106  virtual double SmootherLargerProb(){
107  std::complex<double> res = getSmootherLargerVal();
108  return res.real()*res.real() + res.imag()*res.imag();
109  }
110  */
111 
112  virtual double RealVal(IDalitzEvent& evt){
113  return Prob(evt);
114  }
115 
116  /*
117  virtual double SmootherLargerRealVal(){
118  return SmootherLargerProb();
119  }
120  */
121 
122  virtual std::complex<double> ComplexVal(IDalitzEvent& evt){return getVal(evt);}
123  double getAmpSqr(IDalitzEvent& evt, std::vector<std::string> ampNames, bool CC = false);
124 
125 
127  makeEventGenerator(const DalitzEventPattern& pat, TRandom* rnd=gRandom){
129  ptr(new DalitzBWBoxSet(makeBWBoxes(pat, rnd)));
130  return ptr;
131  }
132 
133  virtual void print(std::ostream& os=std::cout) const;
134  virtual void printNonZero(std::ostream& os=std::cout) const;
135  virtual void printValues(IDalitzEvent& evt, std::ostream& os=std::cout) ;
136 
137  virtual ~FitAmpSum();
138 
139  friend class FitAmplitude;
140 
141  FitAmpSum& operator*=(double r);
142  FitAmpSum& operator*=(const std::complex<double>& z);
145 
146  FitAmpSum operator*(double r) const;
147  FitAmpSum operator*(const std::complex<double>& z) const;
150 
151 
152  FitAmpSum& operator=(const FitAmpSum& other);
153  FitAmpSum& operator=(const FitAmpList& other);
154  FitAmpSum& operator+=(const FitAmpSum& other);
155  FitAmpSum operator+(const FitAmpSum& other) const;
156 
157 };
158 
159 FitAmpSum operator*(double r, const FitAmpSum& rhs);
160 FitAmpSum operator*(const std::complex<double>& z, const FitAmpSum& rhs);
162  , const FitAmpSum& rhs);
164  , const FitAmpSum& rhs);
165 
166 
167 #endif
168 //
FitAmpSum operator+(const FitAmpSum &other) const
Definition: FitAmpSum.cpp:488
virtual DalitzBoxSet makeBoxes(const DalitzEventPattern &pat, double nSigma=2)
Definition: FitAmpSum.h:77
virtual MINT::counted_ptr< FitAmpListBase > GetCloneOfSubsetSameFitParameters(std::string name) const
Definition: FitAmpSum.cpp:147
virtual void print(std::ostream &os=std::cout) const
Definition: FitAmpSum.cpp:292
DalitzBWBoxSet makeBWBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, TRandom *rnd=gRandom)
virtual MINT::counted_ptr< FitAmpPairList > makeFitAmpPairList()
Definition: FitAmpSum.cpp:404
DalitzBoxSet makeBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, double nSigma=2)
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
Definition: FitAmpSum.cpp:116
virtual void Gradient(IDalitzEvent &evt, std::vector< double > &grad, MINT::MinuitParameterSet *mps)
Definition: FitAmpSum.cpp:233
FitAmpSum & operator=(const FitAmpSum &other)
Definition: FitAmpSum.cpp:105
virtual std::complex< double > ComplexVal(IDalitzEvent &evt)
Definition: FitAmpSum.h:122
virtual bool useAnalyticGradient()
Definition: FitAmpSum.h:89
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: FitAmpSum.cpp:182
virtual ~FitAmpSum()
Definition: FitAmpSum.cpp:476
virtual double Prob(IDalitzEvent &evt)
Definition: FitAmpSum.h:100
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpSum(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpSum.cpp:20
virtual MINT::counted_ptr< MINT::IUnweightedEventGenerator< IDalitzEvent > > makeEventGenerator(const DalitzEventPattern &pat, TRandom *rnd=gRandom)
Definition: FitAmpSum.h:127
virtual DalitzBWBoxSet makeBWBoxes(const DalitzEventPattern &pat, TRandom *rnd=gRandom)
Definition: FitAmpSum.h:81
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()
Definition: FitAmpSum.cpp:333
FitAmpSum & operator+=(const FitAmpSum &other)
Definition: FitAmpSum.cpp:484
virtual MINT::counted_ptr< IIntegrationCalculator > makeIntegrationCalculator()
Definition: FitAmpSum.cpp:328
virtual void printNonZero(std::ostream &os=std::cout) const
Definition: FitAmpSum.cpp:306
virtual void printValues(IDalitzEvent &evt, std::ostream &os=std::cout)
Definition: FitAmpSum.cpp:316
double getAmpSqr(IDalitzEvent &evt, std::vector< std::string > ampNames, bool CC=false)
Definition: FitAmpSum.cpp:214
FitAmpSum operator *(double r) const
Definition: FitAmpSum.cpp:511
FitAmpSum & operator *=(double r)
Definition: FitAmpSum.cpp:494
virtual double RealVal(IDalitzEvent &evt)
Definition: FitAmpSum.h:112
FitAmpSum operator *(double r, const FitAmpSum &rhs)
Definition: FitAmpSum.cpp:532