MINT2
FitAmpListBase.h
Go to the documentation of this file.
1 #ifndef FITAMPLISTBASE_HH
2 #define FITAMPLISTBASE_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 #include <ostream>
9 
10 #include "Mint/counted_ptr.h"
11 
12 #include "Mint/DalitzBoxSet.h"
13 #include "Mint/DalitzBWBoxSet.h"
14 
15 #include "Mint/FitAmpPairList.h"
16 
17 
21 #include "Mint/IntegCalculator.h"
22 #include "Mint/FitAmpListBase.h"
23 
24 class FitAmplitude;
25 
27 {
28  protected:
29  std::vector<FitAmplitude*> _fitAmps;
30  std::vector<MINT::counted_ptr<FitAmpListBase> > _fitAmpLists;
31  // this construct allows us to have amplitudes that are groups of other
32  // amplitudes, that are not broken up - which can be quite useful, for
33  // example for a model-independent amplitude.
34 
36 
37  virtual void deleteAll();
38  public:
40  FitAmpListBase(const FitAmpListBase& other);
41  FitAmpListBase(const FitAmpListBase& other, std::string name);
42 
43  /*
44  The copy constructor copies like this: There'll be 'physical'
45  copies of all Amplitudes, but the FitParameters remain the
46  same (pointers to the same FitParameter Object). This is
47  useful for the CP-conj coding as it is now, but perhaps a bit
48  counter-intuitive. Needs to be reviewed at some point. This
49  behaviour is defined in the copy constructor of the
50  FitAmplitude class.
51  */
52 
53  // following two routines are the same for now:
54  virtual int addCopyWithSameFitParameters(const FitAmpListBase& other, double factor=1);
55  virtual int addCopyOfSubsetWithSameFitParameters(const FitAmpListBase& other, std::string name, double factor=1 );
56  virtual bool addAmplitude(FitAmplitude* fa);
57  virtual int add(const FitAmpListBase& other, double factor=1);
58  virtual int addAsList(const FitAmpListBase& other, double factor=1);
59 
60  virtual unsigned int size() const;
61 
62  virtual FitAmplitude* getAmpPtr(unsigned int i);
63  const FitAmplitude* getAmpPtr(unsigned int i) const;
64 
65  virtual bool CPConjugateSameFitParameters();
67 
70 
73 
74  virtual bool setLSameFitParameters(int L);
76 
77  // if you inherit from this class, you must re-implement
78  // the clone routine below, otherwise error.
80  // ... see example in FitAmpSum. The Trick is the different new...
82 
83  // dirty triple hack:
85  return 0;
86  }
88  return 0;
89  }
91  return 0;
92  }
93 
94  // DalitzBoxSet makeBoxes(MINT::IReturnRealForEvent<IDalitzEvent>* pdf
95  // , double nSigma = 2
96  // );
99  , double nSigma=2);
100 
101  // DalitzBWBoxSet makeBWBoxes( MINT::IReturnRealForEvent<IDalitzEvent>* pdf
102  // , TRandom* rnd=gRandom
103  // );
106  , TRandom* rnd=gRandom);
107 
108 
109  void setAllAmpsTo(const std::complex<double> z);
110 
111  virtual ~FitAmpListBase();
112 
113  virtual void printLargestAmp(IDalitzEvent& evt, std::ostream& os = std::cout);
114  virtual void printAllAmps(std::ostream& os = std::cout)const;
115  virtual void printAllAmps(IDalitzEvent& evt, std::ostream& os = std::cout);
116  virtual void printNonZeroWithValue(IDalitzEvent& evt, std::ostream& os = std::cout);
117  virtual void printNonZero(std::ostream& os = std::cout) const;
118  virtual void print(std::ostream& os=std::cout) const;
119 
120 
122  double efficiency(IDalitzEvent& evt);
123 
124  virtual void multiply(double r); // by value
125  virtual void multiply(const std::complex<double>& z); // by value
126  virtual void multiply(const MINT::counted_ptr<MINT::IReturnComplex> irc); // by ref
128  // (last one not const because getVal(evt) is not const)
129 
130  FitAmpListBase& operator*=(double r);
131  FitAmpListBase& operator*=(const std::complex<double>& z);
133 
134  FitAmpListBase operator*(double r) const;
135  FitAmpListBase operator*(const std::complex<double>& z) const;
137 
138  void normalizeAmps(DalitzEventList& evtList);
139  std::vector<double> normFactors(DalitzEventList& evtList);
140  void randomizeStartVals(int seed = 0);
141  void randomizePhaseStartVals(int seed = 0);
142 
143  void setTag(int tag);
144 
145  friend class FitAmplitude;
146 
147 
148  FitAmpListBase& operator=(const FitAmpListBase& other);
150  FitAmpListBase operator+(const FitAmpListBase& other) const;
151 };
152 
153 FitAmpListBase operator*(double r, const FitAmpListBase& rhs);
154 FitAmpListBase operator*(const std::complex<double>& z, const FitAmpListBase& rhs);
156  , const FitAmpListBase& rhs);
157 
158 std::ostream& operator<<(std::ostream& os, const FitAmpListBase& fal);
159 
160 #endif
161 //
virtual MINT::counted_ptr< FitAmpListBase > GetCloneOfSubsetSameFitParameters(std::string name) const
virtual int add(const FitAmpListBase &other, double factor=1)
virtual MINT::counted_ptr< IIntegrationCalculator > makeIntegrationCalculator()
virtual bool addAmplitude(FitAmplitude *fa)
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual MINT::counted_ptr< FitAmpPairList > makeFitAmpPairList()
virtual MINT::counted_ptr< FitAmpListBase > GetCConjugateInitialStateSameFitParameters() const
virtual int addCopyWithSameFitParameters(const FitAmpListBase &other, double factor=1)
DalitzBWBoxSet makeBWBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, TRandom *rnd=gRandom)
virtual bool CPConjugateSameFitParameters()
virtual void printNonZero(std::ostream &os=std::cout) const
DalitzBoxSet makeBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, double nSigma=2)
void setTag(int tag)
void setEfficiency(const MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > &eff)
FitAmpListBase operator *(double r) const
FitAmpListBase operator+(const FitAmpListBase &other) const
virtual void printLargestAmp(IDalitzEvent &evt, std::ostream &os=std::cout)
virtual void deleteAll()
virtual int addAsList(const FitAmpListBase &other, double factor=1)
virtual MINT::counted_ptr< FitAmpListBase > GetCPConjugateSameFitParameters() const
std::vector< double > normFactors(DalitzEventList &evtList)
virtual int addCopyOfSubsetWithSameFitParameters(const FitAmpListBase &other, std::string name, double factor=1)
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
FitAmpListBase & operator *=(double r)
std::ostream & operator<<(std::ostream &os, const FitAmpListBase &fal)
virtual void printNonZeroWithValue(IDalitzEvent &evt, std::ostream &os=std::cout)
std::vector< FitAmplitude * > _fitAmps
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
double efficiency(IDalitzEvent &evt)
void randomizeStartVals(int seed=0)
void normalizeAmps(DalitzEventList &evtList)
std::vector< MINT::counted_ptr< FitAmpListBase > > _fitAmpLists
virtual MINT::counted_ptr< FitAmpListBase > GetDifferentLSameFitParameters(int L) const
virtual bool setLSameFitParameters(int L)
virtual MINT::counted_ptr< FitAmpListBase > GetCConjugateFinalStateSameFitParameters() const
virtual bool CConjugateInitialStateSameFitParameters()
void setAllAmpsTo(const std::complex< double > z)
void randomizePhaseStartVals(int seed=0)
virtual ~FitAmpListBase()
FitAmpListBase & operator=(const FitAmpListBase &other)
virtual bool CConjugateFinalStateSameFitParameters()
virtual unsigned int size() const
FitAmpListBase operator *(double r, const FitAmpListBase &rhs)
virtual void print(std::ostream &os=std::cout) const
virtual void printAllAmps(std::ostream &os=std::cout) const
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()
virtual void multiply(double r)
FitAmpListBase & operator+=(const FitAmpListBase &other)