MINT2
AmpPair.h
Go to the documentation of this file.
1 #ifndef AMP_PAIR_HH
2 #define AMP_PAIR_HH
3 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
4 // status: Mon 9 Feb 2009 19:18:03 GMT
5 
6 #include "Mint/counted_ptr.h"
7 #include <complex>
8 #include <string>
9 #include <map>
10 #include <iostream>
11 
12 #include "Mint/DalitzHistoSet.h"
13 #include "Mint/Amplitude.h"
14 #include "Mint/FitParDependent.h"
15 #include "Mint/IFitParRegister.h"
16 
17 //class FitAmplitude;
18 class IDalitzEvent;
19 
21 
24 
25  std::complex<double> _sum;
26  std::string _sumName;
27 
28  std::complex<double> _sumsq;
29  std::string _sumSqName;
30 
31  long int _Nevents;
32  std::string _NName;
33 
34  double _weightSum;
35  std::string _weightSumName;
36 
39 
40  std::string _name;
41  std::string _dirName;
42 
43  std::complex<double> _lastEntry;
44 
45  std::complex<double> ampValue(IDalitzEvent* evtPtr);
46  int oneOrTwo() const;
47 
48  const DalitzHistoSet& histosRe() const{return _hsRe;}
49  const DalitzHistoSet& histosIm() const{return _hsIm;}
52  /*
53  double ReSquared() const;
54  double ImSquared() const;
55  double ImRe() const;
56  */
57 
58  void addToHistograms(IDalitzEvent* evtPtr, const std::complex<double>& c);
59 
60  const std::string& makeName();
61  const std::string& makeDirName();
62 
63  bool makeDirectory(const std::string& asSubdirOf = ".")const;
64  std::string valueFileName(const std::string& asSubdirOf) const;
65  std::string histoReFileName(const std::string& asSubdirOf) const;
66  std::string histoImFileName(const std::string& asSubdirOf) const;
67  bool saveValues(const std::string& asSubdirOf = ".") const;
68  bool retrieveValues(const std::string& fromDirectory = ".");
69  bool saveHistos(const std::string& asSubdirOf = ".") const;
70  bool retrieveHistos(const std::string& asSubdirOf = ".");
71 
72  bool isCompatibleWith(const AmpPair& other) const;
73  public:
74  AmpPair(Amplitude* a1=0, Amplitude* a2=0);
75  AmpPair(const AmpPair& other);
76 
77  bool add(const AmpPair& other);
78 
79  const std::string& name() const;
80  const std::string& name();
81  const std::string& dirName()const;
82  const std::string& dirName();
83 
84  bool save(const std::string& asSubdirOf=".") const;
85  bool retrieve(const std::string& asSubdirOf=".");
86 
87  bool isSingleAmp() const;
88  bool hasMatchingPattern() const;
89 
90  std::complex<double> add(IDalitzEvent* evt, double weight=1, double efficiency=1);
91  std::complex<double> add(const MINT::counted_ptr<IDalitzEvent>& evt, double weight=1, double efficiency=1);
92 
93  // real part of the above.
94  std::complex<double> integral() const;
95  std::complex<double> variance() const; // not a "real" variance, but something to calculate it from
96  double weightSum() const;
97  long int N() const;
98  std::complex<double> lastEntry() const;
99 
100  DalitzHistoSet histoSet() const;
101 
102  Amplitude* amp1(){return _a1;}
103  Amplitude* amp2(){return _a2;}
104  const Amplitude* amp1() const{return _a1;}
105  const Amplitude* amp2() const{return _a2;}
106 
107  virtual void print(std::ostream& os=std::cout) const;
108 
109  virtual ~AmpPair(){}
110 
111  AmpPair& operator+=(const AmpPair& other);
112  AmpPair operator+(const AmpPair& other) const;
113 
114  // friend class AmpPairCovariance;
115 };
116 
118  public:
119  bool operator()(const AmpPair& a, const AmpPair& b) const;
120 };
121 
123  public:
124  bool operator()(const AmpPair* a, const AmpPair* b) const;
125 };
126 
127 
128 std::ostream& operator<<(std::ostream& os, const AmpPair& fap);
129 
131  public:
132  bool operator()(const std::pair<AmpPair*, int>& a, const std::pair<AmpPair*, int>& b) const;
133 };
134 
135 
136 #endif
137 
std::complex< double > lastEntry() const
Definition: AmpPair.cpp:375
const Amplitude * amp2() const
Definition: AmpPair.h:105
bool hasMatchingPattern() const
Definition: AmpPair.cpp:453
bool retrieve(const std::string &asSubdirOf=".")
Definition: AmpPair.cpp:206
DalitzHistoSet _hsIm
Definition: AmpPair.h:38
long int _Nevents
Definition: AmpPair.h:31
Amplitude * amp1()
Definition: AmpPair.h:102
bool operator()(const AmpPair *a, const AmpPair *b) const
Definition: AmpPair.cpp:502
bool retrieveHistos(const std::string &asSubdirOf=".")
Definition: AmpPair.cpp:238
const std::string & makeName()
Definition: AmpPair.cpp:116
bool add(const AmpPair &other)
Definition: AmpPair.cpp:91
std::string _sumSqName
Definition: AmpPair.h:29
bool save(const std::string &asSubdirOf=".") const
Definition: AmpPair.cpp:194
DalitzHistoSet _hsRe
Definition: AmpPair.h:37
const Amplitude * amp1() const
Definition: AmpPair.h:104
Amplitude * amp2()
Definition: AmpPair.h:103
bool saveHistos(const std::string &asSubdirOf=".") const
Definition: AmpPair.cpp:232
DalitzHistoSet & histosRe()
Definition: AmpPair.h:50
std::complex< double > _lastEntry
Definition: AmpPair.h:43
std::complex< double > _sum
Definition: AmpPair.h:25
virtual ~AmpPair()
Definition: AmpPair.h:109
std::string valueFileName(const std::string &asSubdirOf) const
Definition: AmpPair.cpp:222
std::string histoReFileName(const std::string &asSubdirOf) const
Definition: AmpPair.cpp:225
long int N() const
Definition: AmpPair.cpp:429
AmpPair & operator+=(const AmpPair &other)
Definition: AmpPair.cpp:521
bool makeDirectory(const std::string &asSubdirOf=".") const
Definition: AmpPair.cpp:159
const DalitzHistoSet & histosIm() const
Definition: AmpPair.h:49
const std::string & dirName() const
Definition: AmpPair.cpp:472
bool isCompatibleWith(const AmpPair &other) const
Definition: AmpPair.cpp:87
AmpPair(Amplitude *a1=0, Amplitude *a2=0)
Definition: AmpPair.cpp:24
Amplitude * _a1
Definition: AmpPair.h:22
std::complex< double > integral() const
Definition: AmpPair.cpp:396
const std::string & name() const
Definition: AmpPair.cpp:464
bool operator()(const AmpPair &a, const AmpPair &b) const
Definition: AmpPair.cpp:497
bool saveValues(const std::string &asSubdirOf=".") const
Definition: AmpPair.cpp:245
std::ostream & operator<<(std::ostream &os, const AmpPair &fap)
Definition: AmpPair.cpp:531
double _weightSum
Definition: AmpPair.h:34
Amplitude * _a2
Definition: AmpPair.h:23
std::string _NName
Definition: AmpPair.h:32
void addToHistograms(IDalitzEvent *evtPtr, const std::complex< double > &c)
Definition: AmpPair.cpp:110
AmpPair operator+(const AmpPair &other) const
Definition: AmpPair.cpp:525
bool isSingleAmp() const
Definition: AmpPair.cpp:449
std::string _name
Definition: AmpPair.h:40
int oneOrTwo() const
Definition: AmpPair.cpp:391
std::complex< double > _sumsq
Definition: AmpPair.h:28
DalitzHistoSet histoSet() const
const std::string & makeDirName()
Definition: AmpPair.cpp:128
std::complex< double > variance() const
Definition: AmpPair.cpp:433
std::string _dirName
Definition: AmpPair.h:41
const DalitzHistoSet & histosRe() const
Definition: AmpPair.h:48
std::complex< double > ampValue(IDalitzEvent *evtPtr)
Definition: AmpPair.cpp:378
virtual void print(std::ostream &os=std::cout) const
Definition: AmpPair.cpp:493
bool retrieveValues(const std::string &fromDirectory=".")
Definition: AmpPair.cpp:287
std::string _sumName
Definition: AmpPair.h:26
std::string histoImFileName(const std::string &asSubdirOf) const
Definition: AmpPair.cpp:228
DalitzHistoSet & histosIm()
Definition: AmpPair.h:51
std::string _weightSumName
Definition: AmpPair.h:35
bool operator()(const std::pair< AmpPair *, int > &a, const std::pair< AmpPair *, int > &b) const
Definition: AmpPair.cpp:509
double weightSum() const
Definition: AmpPair.cpp:424