MINT2
FitAmpPairList.h
Go to the documentation of this file.
1 #ifndef FIT_AMP_PAIR_LIST_HH
2 #define FIT_AMP_PAIR_LIST_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:03 GMT
5 
6 #include "Mint/FitAmpPair.h"
7 #include "Mint/DalitzHistoSet.h"
9 #include "Mint/FitFractionList.h"
10 
13 
14 #include "Mint/IDalitzEvent.h"
15 
16 #include "Mint/counted_ptr.h"
17 //#include <vector>
18 
19 #include "Mint/PolymorphVector.h"
20 
21 class FitAmplitude;
22 class IDalitzEvent;
23 namespace MINT{
24  class Minimiser;
25 }
26 
28 : public MINT::PolymorphVector<FitAmpPair> // std::vector<FitAmpPair>
29 , virtual public IIntegrationCalculator
30 {
31 
33  void applyHistoOption();
34 
35  int _Nevents;
36  double _sum;
37  double _sumsq;
38 
39  double _psSum;
40  double _psSumSq;
41 
42  bool _slow;
43 
45 
47 
49 
50  double phaseSpaceIntegral()const; // only for debug
51 
52  std::string dirName() const;
53  bool makeDirectory(const std::string& asSubdirOf=".")const;
54  virtual double oldVariance() const;
55 
56  bool reset();
57  public:
59  FitAmpPairList(const FitAmpPairList& other);
60  virtual ~FitAmpPairList(){}
61 
64 
65  virtual void addAmps(FitAmplitude* a1, FitAmplitude* a2); // for backwards compatibility, will be removed
66  virtual void addAmps(FitAmplitude& a1, FitAmplitude& a2);
67  virtual void addEvent(IDalitzEvent* evtPtr, double weight=1);
68  virtual void addEvent(IDalitzEvent& evt, double weight=1);
69  virtual void addEvent(MINT::counted_ptr<IDalitzEvent> evtPtr
70  , double weight=1);
71  virtual void reAddEvent(IDalitzEvent& evt, double weight=1);
72  // virtual void reAddEvent(MINT::counted_ptr<IDalitzEvent> evtPtr
73  // , double weight=1);
74 
75  bool isCompatibleWith(const FitAmpPairList& other) const;
76  virtual bool add(const FitAmpPairList& otherList);
77  virtual bool add(const FitAmpPairList* otherListPtr);
78  virtual bool add(MINT::const_counted_ptr<FitAmpPairList> otherListPtr);
79 
80  virtual bool append(const FitAmpPairList& otherListPtr);
81  virtual bool append(const FitAmpPairList* otherListPtr);
82  virtual bool append(MINT::const_counted_ptr<FitAmpPairList> otherListPtr);
83 
84  virtual int numEvents() const;
85  virtual double integral() const;
86 
87  std::complex<double> ComplexIntegralForTags(int tag1, int tag2) const;
88 
89  double integralForMatchingPatterns(bool match,int pattern_sign) const;
90  std::complex<double> ComplexSumForMatchingPatterns(bool match) const;
91 
92  virtual double variance() const;
93  virtual double sumOfVariances() const;
94  virtual std::complex<double> ComplexSum() const;
95  virtual void Gradient(MINT::MinuitParameterSet* mps, std::vector<double>& grad);
96  virtual void GradientForLasso(MINT::MinuitParameterSet* mps, std::vector<double>& grad);
97 
98  double sumOfSqrtFitFractions();
101  double sumOfFitFractions();
102  int numberOfFitFractionsLargerThanThreshold(double threshold);
103 
106  bool doFractions();
107 
109  void unsetEfficiency();
110  double efficiency(IDalitzEvent* evtPtr);
111  bool haveEfficiency() const{return 0 != _efficiency;}
112 
113  virtual bool makeAndStoreFractions(MINT::Minimiser* mini=0){
114  return makeAndStoreFractions("FitAmpResults.txt","fitFractions.root",mini);}
115  virtual bool makeAndStoreFractions(const std::string& fname, const std::string& fnameROOT, MINT::Minimiser* min=0);
116  virtual double getFractionChi2() const;
117 
118  virtual DalitzHistoSet histoSet() const;
121  void saveEachAmpsHistograms(const std::string& prefix) const;
122  std::vector<DalitzHistoSet> GetEachAmpsHistograms();
123 
125  void saveInterferenceHistograms(const std::string& prefix) const;
126  std::vector<DalitzHistoSet> GetInterferenceHistograms();
127 
128  virtual void doFinalStats(MINT::Minimiser* min=0);
129  virtual void doFinalStatsAndSave(MINT::Minimiser* min=0,const std::string& fname = "FitAmpResults.txt", const std::string& fnameROOT="fitFractions.root"){
130  makeAndStoreFractions(fname,fnameROOT,min);
131  }
132 
133 
134  virtual bool save(const std::string& asSubdirOf=".") const;
135  virtual bool retrieve(const std::string& asSubdirOf=".") ;
136 
137  virtual void print(std::ostream& os=std::cout) const;
138 
139  bool needToReIntegrate() const;
140  void startIntegration();
141  void startReIntegration();
143  void endIntegration();
144 
145 
146  void setSlow();
147  void setFast();
148 
149  bool slow() const{return _slow;}
150  bool fast() const{return !_slow;}
151 
153  FitAmpPairList operator+(const FitAmpPairList& other) const;
154 };
155 
156 std::ostream& operator<<(std::ostream& os, const FitAmpPairList& fap);
157 
158 #endif
159 //
virtual double getFractionChi2() const
virtual void doFinalStatsAndSave(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults.txt", const std::string &fnameROOT="fitFractions.root")
virtual bool append(const FitAmpPairList &otherListPtr)
FitFractionList _singleAmpFractions
FitAmpPairList & operator+=(const FitAmpPairList &other)
void startForcedReIntegration()
std::complex< double > ComplexIntegralForTags(int tag1, int tag2) const
virtual void addAmps(FitAmplitude *a1, FitAmplitude *a2)
std::ostream & operator<<(std::ostream &os, const FitAmpPairList &fap)
MINT::NamedParameter< std::string > HistoOption
virtual void reAddEvent(IDalitzEvent &evt, double weight=1)
std::vector< DalitzHistoSet > GetEachAmpsHistograms()
virtual void GradientForLasso(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
void saveEachAmpsHistograms(const std::string &prefix) const
FitAmpPairCovariance _cov
virtual void doFinalStats(MINT::Minimiser *min=0)
virtual ~FitAmpPairList()
virtual double oldVariance() const
virtual double variance() const
std::vector< DalitzHistoSet > GetInterferenceHistograms()
double integralForMatchingPatterns(bool match, int pattern_sign) const
bool isCompatibleWith(const FitAmpPairList &other) const
FitAmpPairList operator+(const FitAmpPairList &other) const
std::complex< double > ComplexSumForMatchingPatterns(bool match) const
bool slow() const
virtual bool add(const FitAmpPairList &otherList)
void setEfficiency(MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > eff)
double phaseSpaceIntegral() const
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
bool needToReIntegrate() const
virtual double integral() const
virtual double sumOfVariances() const
bool makeDirectory(const std::string &asSubdirOf=".") const
int numberOfFitFractionsLargerThanThreshold(double threshold)
virtual std::complex< double > ComplexSum() const
virtual bool makeAndStoreFractions(MINT::Minimiser *mini=0)
FitFractionList getInterferenceTerms() const
double sumOfFitFractions()
virtual bool save(const std::string &asSubdirOf=".") const
MINT::counted_ptr< IIntegrationCalculator > clone_IIntegrationCalculator() const
virtual void Gradient(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
virtual DalitzHistoSet un_normalised_histoSetIm() const
double efficiency(IDalitzEvent *evtPtr)
FitFractionList getFractions() const
void saveInterferenceHistograms(const std::string &prefix) const
bool haveEfficiency() const
DalitzHistoSet interferenceHistoSet() const
virtual int numEvents() const
virtual void addEvent(IDalitzEvent *evtPtr, double weight=1)
std::string dirName() const
double sumOfSqrtFitFractions()
virtual DalitzHistoSet histoSet() const
virtual DalitzHistoSet un_normalised_histoSetRe() const
double absSumOfSqrtInterferenceFractions()
virtual bool retrieve(const std::string &asSubdirOf=".")
FitFractionList _interferenceFractions
double absSumOfInterferenceFractions()
virtual void print(std::ostream &os=std::cout) const
bool fast() const