MINT2
Public Member Functions | Protected Attributes | Friends | List of all members
FitAmpSum Class Reference

#include <FitAmpSum.h>

Inheritance diagram for FitAmpSum:
FitAmpList ILookLikeFitAmpSum IFastAmplitudeIntegrable MINT::IReturnRealForEvent< IDalitzEvent > MINT::IReturnComplexForEvent< IDalitzEvent > FitAmpListBase IFastAmplitudeIntegrable MINT::IReturnRealForEvent< IDalitzEvent > MINT::IReturnRealForEvent< IDalitzEvent > MINT::IReturnComplexForEvent< IDalitzEvent > MINT::IReturnRealForEvent< IDalitzEvent > MINT::IReturnComplexForEvent< IDalitzEvent >

Public Member Functions

 FitAmpSum (const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpSum (const DalitzEventPattern &pat, MINT::MinuitParameterSet *pset, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpSum (const DalitzEventPattern &pat, const std::string &prefix, const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpSum (const FitAmpSum &other)
 
 FitAmpSum (const FitAmpList &other)
 
virtual MINT::counted_ptr< FitAmpListBaseGetCloneSameFitParameters () const
 
virtual MINT::counted_ptr< FitAmpListBaseGetCloneOfSubsetSameFitParameters (std::string name) const
 
virtual DalitzBoxSet makeBoxes (const DalitzEventPattern &pat, double nSigma=2)
 
virtual DalitzBWBoxSet makeBWBoxes (const DalitzEventPattern &pat, TRandom *rnd=gRandom)
 
virtual std::complex< double > getVal (IDalitzEvent &evt)
 
virtual std::complex< double > getVal (IDalitzEvent *evt)
 
virtual void Gradient (IDalitzEvent &evt, std::vector< double > &grad, MINT::MinuitParameterSet *mps)
 
virtual bool useAnalyticGradient ()
 
virtual MINT::counted_ptr< IIntegrationCalculatormakeIntegrationCalculator ()
 
virtual MINT::counted_ptr< IntegCalculatormakeIntegCalculator ()
 
virtual MINT::counted_ptr< FitAmpPairListmakeFitAmpPairList ()
 
virtual double Prob (IDalitzEvent &evt)
 
virtual double RealVal (IDalitzEvent &evt)
 
virtual std::complex< double > ComplexVal (IDalitzEvent &evt)
 
double getAmpSqr (IDalitzEvent &evt, std::vector< std::string > ampNames, bool CC=false)
 
virtual MINT::counted_ptr< MINT::IUnweightedEventGenerator< IDalitzEvent > > makeEventGenerator (const DalitzEventPattern &pat, TRandom *rnd=gRandom)
 
virtual void print (std::ostream &os=std::cout) const
 
virtual void printNonZero (std::ostream &os=std::cout) const
 
virtual void printValues (IDalitzEvent &evt, std::ostream &os=std::cout)
 
virtual ~FitAmpSum ()
 
FitAmpSumoperator *= (double r)
 
FitAmpSumoperator *= (const std::complex< double > &z)
 
FitAmpSumoperator *= (const MINT::counted_ptr< MINT::IReturnComplex > &irc)
 
FitAmpSumoperator *= (const MINT::counted_ptr< MINT::IReturnComplexForEvent< IDalitzEvent > > &ircfe)
 
FitAmpSum operator * (double r) const
 
FitAmpSum operator * (const std::complex< double > &z) const
 
FitAmpSum operator * (const MINT::counted_ptr< MINT::IReturnComplex > &irc) const
 
FitAmpSum operator * (const MINT::counted_ptr< MINT::IReturnComplexForEvent< IDalitzEvent > > &ircfe) const
 
FitAmpSumoperator= (const FitAmpSum &other)
 
FitAmpSumoperator= (const FitAmpList &other)
 
FitAmpSumoperator+= (const FitAmpSum &other)
 
FitAmpSum operator+ (const FitAmpSum &other) const
 
- Public Member Functions inherited from FitAmpList
 FitAmpList (const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpList (const DalitzEventPattern &pat, MINT::MinuitParameterSet *pset, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpList (const DalitzEventPattern &pat, const std::string &prefix, const std::string &lineshapePrefix="", const std::string &opt="")
 
 FitAmpList (const FitAmpList &other)
 
virtual MINT::MinuitParameterSetgetMPS ()
 
virtual MINT::counted_ptr< FitAmpListBaseGetCPConjugateSameFitParameters () const
 
virtual bool createAllAmps (const DalitzEventPattern &thePattern, const std::string &prefix="", const std::string &lineshapePrefix="")
 
virtual bool createAmpsFromFile ()
 
virtual ~FitAmpList ()
 
virtual void printLargestAmp (IDalitzEvent &evt, std::ostream &os=std::cout)
 
virtual void printAllAmps (std::ostream &os=std::cout) const
 
virtual void printAllAmps (IDalitzEvent &evt, std::ostream &os=std::cout)
 
virtual void printNonZeroWithValue (IDalitzEvent &evt, std::ostream &os=std::cout)
 
FitAmpListoperator *= (double r)
 
FitAmpListoperator *= (const std::complex< double > &z)
 
FitAmpListoperator *= (const MINT::counted_ptr< MINT::IReturnComplex > &irc)
 
FitAmpList operator * (double r) const
 
FitAmpList operator * (const std::complex< double > &z) const
 
FitAmpList operator * (const MINT::counted_ptr< MINT::IReturnComplex > &irc) const
 
FitAmpListoperator= (const FitAmpList &other)
 
FitAmpListoperator+= (const FitAmpList &other)
 
FitAmpList operator+ (const FitAmpList &other) const
 
- Public Member Functions inherited from FitAmpListBase
 FitAmpListBase ()
 
 FitAmpListBase (const FitAmpListBase &other)
 
 FitAmpListBase (const FitAmpListBase &other, std::string name)
 
virtual int addCopyWithSameFitParameters (const FitAmpListBase &other, double factor=1)
 
virtual int addCopyOfSubsetWithSameFitParameters (const FitAmpListBase &other, std::string name, double factor=1)
 
virtual bool addAmplitude (FitAmplitude *fa)
 
virtual int add (const FitAmpListBase &other, double factor=1)
 
virtual int addAsList (const FitAmpListBase &other, double factor=1)
 
virtual unsigned int size () const
 
virtual FitAmplitudegetAmpPtr (unsigned int i)
 
const FitAmplitudegetAmpPtr (unsigned int i) const
 
virtual bool CPConjugateSameFitParameters ()
 
virtual bool CConjugateFinalStateSameFitParameters ()
 
virtual MINT::counted_ptr< FitAmpListBaseGetCConjugateFinalStateSameFitParameters () const
 
virtual bool CConjugateInitialStateSameFitParameters ()
 
virtual MINT::counted_ptr< FitAmpListBaseGetCConjugateInitialStateSameFitParameters () const
 
virtual bool setLSameFitParameters (int L)
 
virtual MINT::counted_ptr< FitAmpListBaseGetDifferentLSameFitParameters (int L) const
 
DalitzBoxSet makeBoxes (const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, double nSigma=2)
 
DalitzBWBoxSet makeBWBoxes (const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, TRandom *rnd=gRandom)
 
void setAllAmpsTo (const std::complex< double > z)
 
virtual ~FitAmpListBase ()
 
void setEfficiency (const MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > &eff)
 
double efficiency (IDalitzEvent &evt)
 
virtual void multiply (double r)
 
virtual void multiply (const std::complex< double > &z)
 
virtual void multiply (const MINT::counted_ptr< MINT::IReturnComplex > irc)
 
virtual void multiply (MINT::counted_ptr< MINT::IReturnComplexForEvent< IDalitzEvent > > irc)
 
FitAmpListBaseoperator *= (double r)
 
FitAmpListBaseoperator *= (const std::complex< double > &z)
 
FitAmpListBaseoperator *= (const MINT::counted_ptr< MINT::IReturnComplex > &irc)
 
FitAmpListBase operator * (double r) const
 
FitAmpListBase operator * (const std::complex< double > &z) const
 
FitAmpListBase operator * (const MINT::counted_ptr< MINT::IReturnComplex > &irc) const
 
void normalizeAmps (DalitzEventList &evtList)
 
std::vector< double > normFactors (DalitzEventList &evtList)
 
void randomizeStartVals (int seed=0)
 
void randomizePhaseStartVals (int seed=0)
 
void setTag (int tag)
 
FitAmpListBaseoperator= (const FitAmpListBase &other)
 
FitAmpListBaseoperator+= (const FitAmpListBase &other)
 
FitAmpListBase operator+ (const FitAmpListBase &other) const
 
- Public Member Functions inherited from ILookLikeFitAmpSum
virtual ~ILookLikeFitAmpSum ()
 
- Public Member Functions inherited from IFastAmplitudeIntegrable
virtual ~IFastAmplitudeIntegrable ()
 
- Public Member Functions inherited from MINT::IReturnRealForEvent< IDalitzEvent >
virtual ~IReturnRealForEvent ()
 
- Public Member Functions inherited from MINT::IReturnComplexForEvent< IDalitzEvent >
virtual ~IReturnComplexForEvent ()
 

Protected Attributes

MINT::NamedParameter< int > _useAnalyticGradient
 
- Protected Attributes inherited from FitAmpList
DalitzEventPattern _pat
 
std::string _paraFName
 
MINT::MinuitParameterSet_minuitParaSet
 
std::string _opt
 
- Protected Attributes inherited from FitAmpListBase
std::vector< FitAmplitude * > _fitAmps
 
std::vector< MINT::counted_ptr< FitAmpListBase > > _fitAmpLists
 
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
 

Friends

class FitAmplitude
 

Additional Inherited Members

- Protected Member Functions inherited from FitAmpListBase
virtual void deleteAll ()
 
- Protected Member Functions inherited from MINT::IReturnRealForEvent< IDalitzEvent >
 IReturnRealForEvent ()
 
- Protected Member Functions inherited from MINT::IReturnComplexForEvent< IDalitzEvent >
 IReturnComplexForEvent ()
 

Detailed Description

Definition at line 26 of file FitAmpSum.h.

Constructor & Destructor Documentation

◆ FitAmpSum() [1/5]

FitAmpSum::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 at line 20 of file FitAmpSum.cpp.

27  : FitAmpList(pat, fname, pset, prefix, lineshapePrefix, opt)
28  , _useAnalyticGradient("useAnalyticGradient",0)
29 {
30  /*
31  //Important! Ensures everything is initialised
32  DalitzEventList eventTest;
33  eventTest.generatePhaseSpaceEvents(1,pat);
34  this->getVal(eventTest[0]);
35  */
36 }
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ FitAmpSum() [2/5]

FitAmpSum::FitAmpSum ( const DalitzEventPattern pat,
MINT::MinuitParameterSet pset,
const std::string &  prefix = "",
const std::string &  lineshapePrefix = "",
const std::string &  opt = "" 
)

Definition at line 38 of file FitAmpSum.cpp.

44  : FitAmpList(pat, pset, prefix, lineshapePrefix, opt)
45  , _useAnalyticGradient("useAnalyticGradient",0)
46 {
47 
48  // cout << "pset pointer in FitAmpSum::FitAmpSum " << pset << " = " << getMPS() << endl;
49 
50  /*
51  //Important! Ensures everything is initialised
52  DalitzEventList eventTest;
53  eventTest.generatePhaseSpaceEvents(1,pat);
54  this->getVal(eventTest[0]);
55  */
56 }
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ FitAmpSum() [3/5]

FitAmpSum::FitAmpSum ( const DalitzEventPattern pat,
const std::string &  prefix,
const std::string &  lineshapePrefix = "",
const std::string &  opt = "" 
)

Definition at line 57 of file FitAmpSum.cpp.

62  : FitAmpList(pat, prefix, lineshapePrefix, opt)
63  , _useAnalyticGradient("useAnalyticGradient",0)
64 {
65  /*
66  //Important! Ensures everything is initialised
67  DalitzEventList eventTest;
68  eventTest.generatePhaseSpaceEvents(1,pat);
69  this->getVal(eventTest[0]);
70  */
71 }
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ FitAmpSum() [4/5]

FitAmpSum::FitAmpSum ( const FitAmpSum other)

Definition at line 73 of file FitAmpSum.cpp.

78  , FitAmpList(other)
79  , _useAnalyticGradient("useAnalyticGradient",0)
80 {
81  /*
82  //Important! Ensures everything is initialised
83  DalitzEventList eventTest;
84  eventTest.generatePhaseSpaceEvents(1,_pat);
85  this->getVal(eventTest[0]);
86  */
87 }
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ FitAmpSum() [5/5]

FitAmpSum::FitAmpSum ( const FitAmpList other)

Definition at line 89 of file FitAmpSum.cpp.

94  , FitAmpList(other)
95  , _useAnalyticGradient("useAnalyticGradient",0)
96 {
97  /*
98  //Important! Ensures everything is initialised
99  DalitzEventList eventTest;
100  eventTest.generatePhaseSpaceEvents(1,_pat);
101  this->getVal(eventTest[0]);
102  */
103 }
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ ~FitAmpSum()

FitAmpSum::~FitAmpSum ( )
virtual

Definition at line 476 of file FitAmpSum.cpp.

476  {
477  bool dbThis=true;
478  if(dbThis) cout << "FitAmpSum::~FitAmpSum() " << endl;
479  deleteAll();
480  if(dbThis) cout << "FitAmpSum::~FitAmpSum() done" << endl;
481 
482 }
virtual void deleteAll()

Member Function Documentation

◆ ComplexVal()

virtual std::complex<double> FitAmpSum::ComplexVal ( IDalitzEvent evt)
inlinevirtual

Reimplemented from IFastAmplitudeIntegrable.

Definition at line 122 of file FitAmpSum.h.

122 {return getVal(evt);}
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: FitAmpSum.cpp:182

◆ getAmpSqr()

double FitAmpSum::getAmpSqr ( IDalitzEvent evt,
std::vector< std::string >  ampNames,
bool  CC = false 
)

Definition at line 214 of file FitAmpSum.cpp.

214  {
215  double dbThis=false;
216 
217  std::complex<double> sum(0);
218  if(0 == size()) createAllAmps(evt.eventPattern());
219  for(unsigned int i=0; i< this->size(); i++){
220  for (unsigned int n=0; n <ampNames.size(); n++) {
221  if(A_is_in_B(ampNames[n], this->getAmpPtr(i)->name())){
222  if(A_is_in_B("Cconj_FS", this->getAmpPtr(i)->name()) && !CC) continue;
223  if(dbThis) cout << "found amp " << this->getAmpPtr(i)->name() << endl;
224  sum += this->getAmpPtr(i)->getVal(evt);
225  }
226  }
227  }
228  std::complex<double> result(sqrt(fabs(efficiency(evt)))*sum);
229 
230  return norm(result);
231 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
std::string name() const
Definition: FitAmplitude.h:213
virtual std::complex< double > getVal(IDalitzEvent &evt)
bool A_is_in_B(const std::string &a, const std::string &b)
Definition: Utils.cpp:34
double efficiency(IDalitzEvent &evt)
virtual const DalitzEventPattern & eventPattern() const =0
virtual unsigned int size() const
virtual bool createAllAmps(const DalitzEventPattern &thePattern, const std::string &prefix="", const std::string &lineshapePrefix="")
Definition: FitAmpList.cpp:125

◆ GetCloneOfSubsetSameFitParameters()

counted_ptr< FitAmpListBase > FitAmpSum::GetCloneOfSubsetSameFitParameters ( std::string  name) const
virtual

Reimplemented from FitAmpListBase.

Definition at line 147 of file FitAmpSum.cpp.

147  {
148  // need to reform these one day...
149  // ... it all relies on the copy-constructur/=operator in FitAmpitude
150  // not copying the fit parameters, but just their pointers
151  // which will need to be reviewed.
152  //
153  bool dbThis=true;
154  if(dbThis) cout << "FitAmpSum::GetCloneOfSubsetSameFitParameters()" << endl;
155  /*
156  There'll be 'physical' copies of all Amplitudes, but the
157  FitParameters remain the same (pointers to the same
158  FitParameter Object). This is useful for the CP-con coding
159  as it is now, but perhaps a bit counter-intuitive. needs to
160  be reviewed at some point. This behaviour is defined in the
161  copy constructor of the FitAmplitude class.
162  */
163 
164  /*
165  counted_ptr<FitAmpSum>
166  newList(new FitAmpSum((IDalitzEventList*) this->getEventRecord()
167  , _paraFName.c_str(), _minuitParaSet));
168  */
169  counted_ptr<FitAmpSum> newList(new FitAmpSum(*this));
170  newList->deleteAll();
171 
172  if(dbThis) cout << "FitAmpSum::GetCloneOfSubsetSameFitParameters() made ptr" << endl;
173  newList->addCopyOfSubsetWithSameFitParameters(*this,(string) name);
174  if(dbThis) cout << "cloning subset of FitAmpSum " << newList->size() << endl;
175  return newList;
176 }
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

◆ GetCloneSameFitParameters()

counted_ptr< FitAmpListBase > FitAmpSum::GetCloneSameFitParameters ( ) const
virtual

Reimplemented from FitAmpList.

Definition at line 116 of file FitAmpSum.cpp.

116  {
117 // need to reform these one day...
118 // ... it all relies on the copy-constructur/=operator in FitAmpitude
119 // not copying the fit parameters, but just their pointers
120 // which will need to be reviewed.
121 //
122  bool dbThis=false;
123  if(dbThis) cout << "FitAmpSum::GetCloneSameFitParameters()" << endl;
124  /*
125  There'll be 'physical' copies of all Amplitudes, but the
126  FitParameters remain the same (pointers to the same
127  FitParameter Object). This is useful for the CP-con coding
128  as it is now, but perhaps a bit counter-intuitive. needs to
129  be reviewed at some point. This behaviour is defined in the
130  copy constructor of the FitAmplitude class.
131  */
132 
133  /*
134  counted_ptr<FitAmpSum>
135  newList(new FitAmpSum((IDalitzEventList*) this->getEventRecord()
136  , _paraFName.c_str(), _minuitParaSet));
137  */
138  counted_ptr<FitAmpSum> newList(new FitAmpSum(*this));
139  newList->deleteAll();
140 
141  if(dbThis) cout << "FitAmpSum::GetCloneSameFitParameters() made ptr" << endl;
142  newList->add(*this);
143  if(dbThis) cout << "cloning FitAmpSum " << newList->size() << endl;
144  return newList;
145 }
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

◆ getVal() [1/2]

std::complex< double > FitAmpSum::getVal ( IDalitzEvent evt)
virtual

Definition at line 182 of file FitAmpSum.cpp.

182  {
183  //double dbThis=false;
184 
185  std::complex<double> sum(0);
186  //if(0 == size()) createAllAmps(evt.eventPattern());
187  for(unsigned int i=0; i< this->size(); i++){
188  //if(dbThis) cout << "FitAmpSum::getVal: " << i << endl;
189  sum = (! this->getAmpPtr(i)->isZero()) ? sum + this->getAmpPtr(i)->getVal(evt) : sum;
190  //cout << sum << "," << endl;
191  }
192 // if(dbThis){
193 // cout << "sum= " << sum << endl;
194 // cout << "efficiency(evt) " << efficiency(evt) << endl;
195 // }
196  std::complex<double> result(sqrt(fabs(efficiency(evt)))*sum);
197 // if(dbThis) cout << "result " << result << endl;
198  /*
199  double resultSq = norm(result);
200  bool invalid = (! isfinite(resultSq)) || std::isnan(resultSq);
201  if(dbThis || invalid){
202  cout << "\n---------------------------" << endl;
203  cout << "sqrt(efficiency())*sum = "
204  << "sqrt(" << efficiency(evt) << ")*" << sum
205  << endl;
206  printValues(evt);
207  cout << "\n---------------------------" << endl;
208  }
209  */
210  return result;
211 }
bool isZero() const
Definition: FitAmplitude.h:98
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual std::complex< double > getVal(IDalitzEvent &evt)
double efficiency(IDalitzEvent &evt)
virtual unsigned int size() const

◆ getVal() [2/2]

std::complex< double > FitAmpSum::getVal ( IDalitzEvent evt)
virtual

Definition at line 178 of file FitAmpSum.cpp.

178  {
179  return getVal(*evt);
180 }
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: FitAmpSum.cpp:182

◆ Gradient()

void FitAmpSum::Gradient ( IDalitzEvent evt,
std::vector< double > &  grad,
MINT::MinuitParameterSet mps 
)
virtual

Reimplemented from IFastAmplitudeIntegrable.

Definition at line 233 of file FitAmpSum.cpp.

233  {
234 
235  std::complex<double> val = getVal(evt);
236  std::complex<double> valConj= conj(val);
237 
238  for (unsigned int i=0; i<mps->size(); i++) {
239  if(mps->getParPtr(i)->hidden())continue;
240 
241  string name_i= mps->getParPtr(i)->name();
242  if(name_i.find("Inco")!=std::string::npos)continue;
243 
244  if(name_i.find("_Re")!=std::string::npos){
245  if(mps->getParPtr(i)->iFixInit() && mps->getParPtr(i+1)->iFixInit()){
246  i++;
247  continue;
248  }
249  name_i.replace(name_i.find("_Re"),3,"");
250  for(unsigned int j=0; j< this->size(); j++){
251  if(A_is_in_B(name_i, this->getAmpPtr(j)->name())){
252  if(i+1 >= grad.size()){
253  cout << "WARNING in FitAmpSum::Gradient"
254  << " have to increase size of grad to avoid memory issues" << endl;
255  grad.resize(i+2);
256  }
257 
258  std::complex<double> tmp = 2.*valConj* getAmpPtr(j)->getValWithoutFitParameters(evt);
259  grad[i]= tmp.real();
260  grad[i+1]= -tmp.imag();
261  i++;
262  break;
263  }
264  }
265  }
266  // Doesn't work. Don't use!
267  /*
268  else if(name_i.find("_Amp")!=std::string::npos){
269  name_i.replace(name_i.find("_Amp"),4,"");
270 
271  for(unsigned int j=0; j<_fitAmps.size(); j++){
272  if(A_is_in_B(name_i, _fitAmps[j]->name())){
273  std::complex<double> tmp = (_fitAmps[j])->getValWithoutFitParameters(evt);
274  grad[i]= 2.*(tmp*valConj).real()/std::abs((_fitAmps[j])->AmpPhase());
275  grad[i+1]= -2.*std::arg((_fitAmps[j])->AmpPhase())*(tmp*(valConj-conj((_fitAmps[j])->getVal(evt)))).imag();
276  i++;
277  break;
278  }
279  }
280  }
281  */
282  else if(mps->getParPtr(i)->iFixInit())continue;
283  else {
284  std::cout << "FitAmpSum::Gradient() called. Sorry, I don't know how to calculate the derivative with respect to the fit parameter " << mps->getParPtr(i)->name() << " ! Please implement me or set useAnalytic Gradient to 0 in your options file. I'll crash now. " << std::endl;
285  throw "crash";
286  }
287 
288  }
289 
290 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual int iFixInit() const =0
IMinuitParameter * getParPtr(unsigned int i)
unsigned int size() const
virtual std::complex< double > getValWithoutFitParameters(IDalitzEvent &evt)
Definition: FitAmplitude.h:196
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: FitAmpSum.cpp:182
virtual const std::string & name() const =0
bool A_is_in_B(const std::string &a, const std::string &b)
Definition: Utils.cpp:34
virtual bool hidden() const =0
virtual unsigned int size() const

◆ makeBoxes()

virtual DalitzBoxSet FitAmpSum::makeBoxes ( const DalitzEventPattern pat,
double  nSigma = 2 
)
inlinevirtual

Definition at line 77 of file FitAmpSum.h.

78  {
79  return FitAmpList::makeBoxes(pat, this, nSigma);}
DalitzBoxSet makeBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, double nSigma=2)

◆ makeBWBoxes()

virtual DalitzBWBoxSet FitAmpSum::makeBWBoxes ( const DalitzEventPattern pat,
TRandom *  rnd = gRandom 
)
inlinevirtual

Implements ILookLikeFitAmpSum.

Definition at line 81 of file FitAmpSum.h.

82  {
83  return FitAmpList::makeBWBoxes(pat, this, rnd);}
DalitzBWBoxSet makeBWBoxes(const DalitzEventPattern &pat, MINT::IReturnRealForEvent< IDalitzEvent > *pdf, TRandom *rnd=gRandom)

◆ makeEventGenerator()

virtual MINT::counted_ptr<MINT::IUnweightedEventGenerator<IDalitzEvent> > FitAmpSum::makeEventGenerator ( const DalitzEventPattern pat,
TRandom *  rnd = gRandom 
)
inlinevirtual

Implements IFastAmplitudeIntegrable.

Definition at line 127 of file FitAmpSum.h.

127  {
129  ptr(new DalitzBWBoxSet(makeBWBoxes(pat, rnd)));
130  return ptr;
131  }
virtual DalitzBWBoxSet makeBWBoxes(const DalitzEventPattern &pat, TRandom *rnd=gRandom)
Definition: FitAmpSum.h:81

◆ makeFitAmpPairList()

counted_ptr< FitAmpPairList > FitAmpSum::makeFitAmpPairList ( )
virtual

Implements IFastAmplitudeIntegrable.

Definition at line 404 of file FitAmpSum.cpp.

404  {
406  for(unsigned int i=0; i < _fitAmps.size(); i++){
407  if(_fitAmps[i]->canBeIgnored()) continue;
408  for(unsigned int j=i; j < _fitAmps.size(); j++){
409  if(_fitAmps[j]->canBeIgnored()) continue;
410  // all terms within the list
411  list->addAmps( (_fitAmps[i]), (_fitAmps[j]));
412  }
413  // cross terms between list, and list-of-list
414  for(unsigned int k=0; k < _fitAmpLists.size(); k++){
415  for(unsigned int l=0; l < _fitAmpLists[k]->size(); l++){
416  if(_fitAmpLists[k]->getAmpPtr(l)->canBeIgnored()) continue;
417  list->addAmps(_fitAmps[i], _fitAmpLists[k]->getAmpPtr(l));
418  }
419  }
420  }
421 
422 
423  // Now it gets complicated. I want to leave all the
424  // terms within a list to whatever that list
425  // wants to do. But we don't want to forget cross terms
426  // between lists.
427 
428  // cross terms between list, and list-of-list
429  for(unsigned int i=1; i < _fitAmpLists.size(); i++){
430  for(unsigned int j=0; j < i; j++){
431  for(unsigned int ki = 0; ki < _fitAmpLists[i]->size(); ki++){
432  if(_fitAmpLists[i]->getAmpPtr(ki)->canBeIgnored()) continue;
433  for(unsigned int kj = 0; kj < _fitAmpLists[j]->size(); kj++){
434  if(_fitAmpLists[j]->getAmpPtr(kj)->canBeIgnored()) continue;
435  list->addAmps(_fitAmpLists[i]->getAmpPtr(ki), _fitAmpLists[j]->getAmpPtr(kj));
436  }
437  }
438  }
439  }
440 
441 
442  // finally, the terms within each list
443  // which is up to the list itself.
444  // (this is where we save a lot of space and time
445  // when it comes to the model-independent stuff
446  // where there are no internal cross terms)
447  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
448  list->append(_fitAmpLists[i]->makeFitAmpPairList());
449  }
450 
451  cout << "FitAmpSum: setting efficiency POINTER "
452  << " in integCalculator to "
453  << _efficiency.get();
454  if(0 == _efficiency.get()){
455  cout << " (0 means no pointer, 100% efficiency).";
456  }
457  cout << endl;
458 
459  list->setEfficiency(_efficiency);
460 
461  /*
462  cout << "this->size()" << this->size() << endl;
463  cout << "_fitAmpLists.size()" << _fitAmpLists.size() << endl;
464  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
465  cout << "printing list number " << i << endl;
466  _fitAmpLists[i]->print();
467  cout << endl;
468  }
469  cout << " the pair list: " << endl;
470  list->print();
471  */
472 
473  return list;
474 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual MINT::counted_ptr< FitAmpPairList > makeFitAmpPairList()
Definition: FitAmpSum.cpp:404
bool canBeIgnored() const
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
std::vector< FitAmplitude * > _fitAmps
std::vector< MINT::counted_ptr< FitAmpListBase > > _fitAmpLists
X * get() const
Definition: counted_ptr.h:123

◆ makeIntegCalculator()

counted_ptr< IntegCalculator > FitAmpSum::makeIntegCalculator ( )
virtual

Implements IFastAmplitudeIntegrable.

Definition at line 333 of file FitAmpSum.cpp.

333  {
335  for(unsigned int i=0; i < _fitAmps.size(); i++){
336  if(_fitAmps[i]->canBeIgnored()) continue;
337  for(unsigned int j=i; j < _fitAmps.size(); j++){
338  if(_fitAmps[j]->canBeIgnored()) continue;
339  // all terms within the list
340  list->addAmps( (_fitAmps[i]), (_fitAmps[j]));
341  }
342  // cross terms between list, and list-of-list
343  for(unsigned int k=0; k < _fitAmpLists.size(); k++){
344  for(unsigned int l=0; l < _fitAmpLists[k]->size(); l++){
345  if(_fitAmpLists[k]->getAmpPtr(l)->canBeIgnored()) continue;
346  list->addAmps(_fitAmps[i], _fitAmpLists[k]->getAmpPtr(l));
347  }
348  }
349  }
350 
351 
352  // Now it gets complicated. I want to leave all the
353  // terms within a list to whatever that list
354  // wants to do. But we don't want to forget cross terms
355  // between lists.
356 
357  // cross terms between list, and list-of-list
358  for(unsigned int i=1; i < _fitAmpLists.size(); i++){
359  for(unsigned int j=0; j < i; j++){
360  for(unsigned int ki = 0; ki < _fitAmpLists[i]->size(); ki++){
361  if(_fitAmpLists[i]->getAmpPtr(ki)->canBeIgnored()) continue;
362  for(unsigned int kj = 0; kj < _fitAmpLists[j]->size(); kj++){
363  if(_fitAmpLists[j]->getAmpPtr(kj)->canBeIgnored()) continue;
364  list->addAmps(_fitAmpLists[i]->getAmpPtr(ki), _fitAmpLists[j]->getAmpPtr(kj));
365  }
366  }
367  }
368  }
369 
370 
371  // finally, the terms within each list
372  // which is up to the list itself.
373  // (this is where we save a lot of space and time
374  // when it comes to the model-independent stuff
375  // where there are no internal cross terms)
376  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
377  list->append(_fitAmpLists[i]->makeIntegCalculator());
378  }
379 
380  cout << "FitAmpSum: setting efficiency POINTER "
381  << " in integCalculator to "
382  << _efficiency.get();
383  if(0 == _efficiency.get()){
384  cout << " (0 means no pointer, 100% efficiency).";
385  }
386  cout << endl;
387 
388  list->setEfficiency(_efficiency);
389 
390 
391  cout << "this->size()" << this->size() << endl;
392  cout << "_fitAmpLists.size()" << _fitAmpLists.size() << endl;
393  for(unsigned int i=0; i < _fitAmpLists.size(); i++){
394  cout << "printing list number " << i << endl;
395  _fitAmpLists[i]->print();
396  cout << endl;
397  }
398  cout << " the pair list: " << endl;
399  list->print();
400 
401  return list;
402 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
bool canBeIgnored() const
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
std::vector< FitAmplitude * > _fitAmps
std::vector< MINT::counted_ptr< FitAmpListBase > > _fitAmpLists
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()
Definition: FitAmpSum.cpp:333
virtual unsigned int size() const
X * get() const
Definition: counted_ptr.h:123

◆ makeIntegrationCalculator()

counted_ptr< IIntegrationCalculator > FitAmpSum::makeIntegrationCalculator ( )
virtual

Implements IFastAmplitudeIntegrable.

Definition at line 328 of file FitAmpSum.cpp.

328  {
330 }
virtual MINT::counted_ptr< IntegCalculator > makeIntegCalculator()
Definition: FitAmpSum.cpp:333

◆ operator *() [1/4]

FitAmpSum FitAmpSum::operator * ( double  r) const

Definition at line 511 of file FitAmpSum.cpp.

511  {
512  FitAmpSum fas(*this);
513  fas.multiply(r);
514  return fas;
515 }

◆ operator *() [2/4]

FitAmpSum FitAmpSum::operator * ( const std::complex< double > &  z) const

◆ operator *() [3/4]

FitAmpSum FitAmpSum::operator * ( const MINT::counted_ptr< MINT::IReturnComplex > &  irc) const

Definition at line 521 of file FitAmpSum.cpp.

521  {
522  FitAmpSum fas(*this);
523  fas.multiply(irc);
524  return fas;
525 }

◆ operator *() [4/4]

FitAmpSum FitAmpSum::operator * ( const MINT::counted_ptr< MINT::IReturnComplexForEvent< IDalitzEvent > > &  ircfe) const

Definition at line 526 of file FitAmpSum.cpp.

526  {
527  FitAmpSum fas(*this);
528  fas.multiply(ircfe);
529  return fas;
530 }

◆ operator *=() [1/4]

FitAmpSum & FitAmpSum::operator *= ( double  r)

Definition at line 494 of file FitAmpSum.cpp.

494  {
495  multiply(r);
496  return *this;
497 }
virtual void multiply(double r)

◆ operator *=() [2/4]

FitAmpSum& FitAmpSum::operator *= ( const std::complex< double > &  z)

◆ operator *=() [3/4]

FitAmpSum & FitAmpSum::operator *= ( const MINT::counted_ptr< MINT::IReturnComplex > &  irc)

Definition at line 502 of file FitAmpSum.cpp.

502  {
503  multiply(irc);
504  return *this;
505 }
virtual void multiply(double r)

◆ operator *=() [4/4]

FitAmpSum & FitAmpSum::operator *= ( const MINT::counted_ptr< MINT::IReturnComplexForEvent< IDalitzEvent > > &  ircfe)

Definition at line 506 of file FitAmpSum.cpp.

506  {
507  multiply(ircfe);
508  return *this;
509 }
virtual void multiply(double r)

◆ operator+()

FitAmpSum FitAmpSum::operator+ ( const FitAmpSum other) const

Definition at line 488 of file FitAmpSum.cpp.

488  {
489  FitAmpSum fas(*this);
490  fas.add(rhs);
491  return fas;
492 }

◆ operator+=()

FitAmpSum & FitAmpSum::operator+= ( const FitAmpSum other)

Definition at line 484 of file FitAmpSum.cpp.

484  {
485  add(other);
486  return *this;
487 }
virtual int add(const FitAmpListBase &other, double factor=1)

◆ operator=() [1/2]

FitAmpSum & FitAmpSum::operator= ( const FitAmpSum other)

Definition at line 105 of file FitAmpSum.cpp.

105  {
106  if(&other == this) return *this;
107  (FitAmpList)(*this) = (FitAmpList) (other);
108  return *this;
109 }
FitAmpList(const DalitzEventPattern &pat, const char *fname=0, MINT::MinuitParameterSet *pset=0, const std::string &prefix="", const std::string &lineshapePrefix="", const std::string &opt="")
Definition: FitAmpList.cpp:19

◆ operator=() [2/2]

FitAmpSum & FitAmpSum::operator= ( const FitAmpList other)

Definition at line 110 of file FitAmpSum.cpp.

110  {
111  if(&other == this) return *this;
112  (FitAmpSum)(*this) = other;
113  return *this;
114 }
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

◆ print()

void FitAmpSum::print ( std::ostream &  os = std::cout) const
virtual

Implements IFastAmplitudeIntegrable.

Definition at line 292 of file FitAmpSum.cpp.

292  {
293  bool dbThis=false;
294  os << "FitAmpSum::print " << this->size() << " amplitude components \n"
295  << "======================================================" << endl;
296 
297  for(unsigned int i=0; i< this->size(); i++){
298  if(dbThis){
299  cout << "ampPtr( " << i << " ): " << endl;
300  cout << getAmpPtr(i) << endl;
301  }
302  os << "\n\t" << getAmpPtr(i)->theBareDecay().oneLiner()
303  << endl;
304  }
305 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
DecayTree theBareDecay() const
Definition: FitAmplitude.h:166
void oneLiner(std::stringstream &seam, int generation=0) const
Definition: DDTree.h:375
virtual unsigned int size() const

◆ printNonZero()

void FitAmpSum::printNonZero ( std::ostream &  os = std::cout) const
virtual

Reimplemented from FitAmpList.

Definition at line 306 of file FitAmpSum.cpp.

306  {
307  os << "FitAmpSum::print\n====================";
308 
309  for(unsigned int i=0; i< this->size(); i++){
310  if(getAmpPtr(i)->isZero()) continue;
311  os << "\n\t" << getAmpPtr(i)->theBareDecay().oneLiner()
312  << endl;
313  }
314 
315 }
bool isZero() const
Definition: FitAmplitude.h:98
virtual FitAmplitude * getAmpPtr(unsigned int i)
DecayTree theBareDecay() const
Definition: FitAmplitude.h:166
void oneLiner(std::stringstream &seam, int generation=0) const
Definition: DDTree.h:375
virtual unsigned int size() const

◆ printValues()

void FitAmpSum::printValues ( IDalitzEvent evt,
std::ostream &  os = std::cout 
)
virtual

Definition at line 316 of file FitAmpSum.cpp.

316  {
317  os << "FitAmpSum::print\n====================";
318 
319  for(unsigned int i=0; i< this->size(); i++){
320  complex<double> val = getAmpPtr(i)->getVal(evt);
321  os << "\n\t" << getAmpPtr(i)->theBareDecay().oneLiner()
322  << val;
323  if(norm(val) > 1.e10) os << " HUGE!!!" << endl;
324  os << endl;
325  }
326 }
virtual FitAmplitude * getAmpPtr(unsigned int i)
virtual std::complex< double > getVal(IDalitzEvent &evt)
DecayTree theBareDecay() const
Definition: FitAmplitude.h:166
void oneLiner(std::stringstream &seam, int generation=0) const
Definition: DDTree.h:375
virtual unsigned int size() const

◆ Prob()

virtual double FitAmpSum::Prob ( IDalitzEvent evt)
inlinevirtual

Definition at line 100 of file FitAmpSum.h.

100  {
101  std::complex<double> res = getVal(evt);
102  return res.real()*res.real() + res.imag()*res.imag();
103  }
virtual std::complex< double > getVal(IDalitzEvent &evt)
Definition: FitAmpSum.cpp:182

◆ RealVal()

virtual double FitAmpSum::RealVal ( IDalitzEvent evt)
inlinevirtual

Implements ILookLikeFitAmpSum.

Definition at line 112 of file FitAmpSum.h.

112  {
113  return Prob(evt);
114  }
virtual double Prob(IDalitzEvent &evt)
Definition: FitAmpSum.h:100

◆ useAnalyticGradient()

virtual bool FitAmpSum::useAnalyticGradient ( )
inlinevirtual

Reimplemented from IFastAmplitudeIntegrable.

Definition at line 89 of file FitAmpSum.h.

89 {return _useAnalyticGradient;}
MINT::NamedParameter< int > _useAnalyticGradient
Definition: FitAmpSum.h:34

Friends And Related Function Documentation

◆ FitAmplitude

friend class FitAmplitude
friend

Definition at line 139 of file FitAmpSum.h.

Member Data Documentation

◆ _useAnalyticGradient

MINT::NamedParameter<int> FitAmpSum::_useAnalyticGradient
protected

Definition at line 34 of file FitAmpSum.h.


The documentation for this class was generated from the following files: