MINT2
MultiTopHat.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:18:03 GMT
3 #include "Mint/MultiTopHat.h"
4 
5 #include "Mint/FitAmplitude.h"
8 #include "Mint/FitAmplitude.h"
9 #include "Mint/IntegCalculator.h"
10 
11 #include <iostream>
12 #include <complex>
13 
14 using namespace std;
15 using namespace MINT;
16 
18  : FitAmpListBase()
19 {
20 }
21 
26  , FitAmpListBase(other)
27 {
28 }
29 
34  , FitAmpListBase(other)
35 {
36 }
38 // need to reform these one day...
39 // ... it all relies on the copy-constructur/=operator in FitAmpitude
40 // not copying the fit parameters, but just their pointers
41 // which will need to be reviewed.
42 //
43  bool dbThis=true;
44  if(dbThis) cout << "FitAmpSum::GetCloneSameFitParameters()" << endl;
45  /*
46  There'll be 'physical' copies of all Amplitudes, but the
47  FitParameters remain the same (pointers to the same
48  FitParameter Object). This is useful for the CP-con coding
49  as it is now, but perhaps a bit counter-intuitive. needs to
50  be reviewed at some point. This behaviour is defined in the
51  copy constructor of the FitAmplitude class.
52  */
53 
54  /*
55  counted_ptr<MultiTopHat>
56  newList(new MultiTopHat((IDalitzEventList*) this->getEventRecord()
57  , _paraFName.c_str(), _minuitParaSet));
58  */
59  counted_ptr<MultiTopHat> newList(new MultiTopHat(*this));
60  newList->deleteAll();
61 
62  newList->add(*this);
63  if(dbThis) cout << "cloning MultiTopHat " << newList->size() << endl;
64  return newList;
65 }
66 
68  if(&other == this) return *this;
69  (FitAmpListBase)(*this) = (FitAmpListBase) (other);
70  return *this;
71 }
73  if(&other == this) return *this;
74  (MultiTopHat)(*this) = other;
75  return *this;
76 }
77 
78 std::complex<double> MultiTopHat::getVal(IDalitzEvent& evt){
79  bool dbthis=false;
80 
81  complex<double> sum(0.0, 0.0);
82 
83  for(unsigned int i=0; i< this->size(); i++){
84  if(dbthis){
85  cout << "MultiTopHat::getVal()"
86  << "\n > for " << getAmpPtr(i)->theBareDecay().oneLiner()
87  << "\n > I get " << getAmpPtr(i)->getVal(evt)
88  << endl;
89  }
90  sum += this->getAmpPtr(i)->getVal(evt);
91  }
92 
93  if(dbthis) cout << "MultiTopHat::getVal(evt):"
94  << " returning this: " << sum
95  << endl;
96 
97  return efficiency(evt)*sum;
98 }
99 
103 }
107  for(unsigned int i=0; i < _fitAmps.size(); i++){
108  if(_fitAmps[i]->canBeIgnored()) continue;
109  l->addAmps( (_fitAmps[i]), (_fitAmps[i]));
110  }
111 
112  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
114  }
115 
116  cout << "MultiTopHat: setting efficiency POINTER "
117  << " in integCalculator to "
118  << _efficiency.get();
119  if(0 == _efficiency.get()){
120  cout << " (0 means no pointer, 100% efficiency).";
121  }
122  cout << endl;
123 
125 
126  cout << "MultiTopHat::makeIntegCalculator(): returning " << endl;
127  l->print();
128  return l;
129 }
130 
134  for(unsigned int i=0; i < _fitAmps.size(); i++){
135  if(_fitAmps[i]->canBeIgnored()) continue;
136  l->addAmps( (_fitAmps[i]), (_fitAmps[i]));
137  }
138 
139  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
141  }
142 
143  cout << "MultiTopHat: setting efficiency POINTER "
144  << " in integCalculator to "
145  << _efficiency.get();
146  if(0 == _efficiency.get()){
147  cout << " (0 means no pointer, 100% efficiency).";
148  }
149  cout << endl;
150 
152 
153 
154  return l;
155 }
156 
158  // deleteAll(); (done by base class)
159 }
160 
161 MultiTopHat&
163  add(other);
164  return *this;
165 }
168  MultiTopHat fas(*this);
169  fas.add(rhs);
170  return fas;
171 }
172 
173 
175  multiply(r);
176  return *this;
177 }
178 MultiTopHat& MultiTopHat::operator*=(const complex<double>& z){
179  multiply(z);
180  return *this;
181 }
183  multiply(irc);
184  return *this;
185 }
186 
188  MultiTopHat fas(*this);
189  fas.multiply(r);
190  return fas;
191 }
192 MultiTopHat MultiTopHat::operator*(const complex<double>& z) const{
193  MultiTopHat fas(*this);
194  fas.multiply(z);
195  return fas;
196 }
198  MultiTopHat fas(*this);
199  fas.multiply(irc);
200  return fas;
201 }
202 
203 
204 MultiTopHat operator*(double r, const MultiTopHat& rhs){
205  MultiTopHat fas(rhs);
206  fas.multiply(r);
207  return fas;
208 }
209 MultiTopHat operator*(const complex<double>& z, const MultiTopHat& rhs){
210  MultiTopHat fas(rhs);
211  fas.multiply(z);
212  return fas;
213 }
215  , const MultiTopHat& rhs){
216  MultiTopHat fas(rhs);
217  fas.multiply(irc);
218  return fas;
219 }
220 
221 
222 
223 //
virtual bool append(const IntegCalculator &other)
virtual bool append(const FitAmpPairList &otherListPtr)
virtual int add(const FitAmpListBase &other, double factor=1)
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual ~MultiTopHat()
virtual MINT::counted_ptr< FitAmpPairList > makeFitAmpPairList()
virtual std::complex< double > getVal(IDalitzEvent &evt)
virtual void addAmps(FitAmplitude *a1, FitAmplitude *a2)
virtual void print(std::ostream &os=std::cout) const
DecayTree theBareDecay() const
Definition: FitAmplitude.h:166
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()
virtual void deleteAll()
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
std::vector< FitAmplitude * > _fitAmps
void setEfficiency(MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > eff)
double efficiency(IDalitzEvent &evt)
virtual void addAmps(FitAmplitude *a1, FitAmplitude *a2)
MultiTopHat & operator+=(const MultiTopHat &other)
MultiTopHat operator+(const MultiTopHat &other) const
std::vector< MINT::counted_ptr< FitAmpListBase > > _fitAmpLists
MultiTopHat & operator *=(double r)
MultiTopHat & operator=(const MultiTopHat &other)
Definition: MultiTopHat.cpp:67
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
Definition: MultiTopHat.cpp:37
std::complex< double > getVal(IDalitzEvent &evt)
Definition: MultiTopHat.cpp:78
virtual MINT::counted_ptr< IIntegrationCalculator > makeIntegrationCalculator()
void oneLiner(std::stringstream &seam, int generation=0) const
Definition: DDTree.h:375
MultiTopHat operator *(double r) const
MultiTopHat operator *(double r, const MultiTopHat &rhs)
virtual unsigned int size() const
void setEfficiency(MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > eff)
X * get() const
Definition: counted_ptr.h:123
virtual void multiply(double r)