MINT2
Eff4piSymmetric.cpp
Go to the documentation of this file.
1 
2 #include "Mint/Eff4piSymmetric.h"
4 
5 using namespace std;
6 using namespace MINT;
7 
9  , const DalitzEventPattern& pat
11  : _order(order)
12  , _pat(pat)
13  , _pset(pset)
14 {
15  init();
16 }
17 
19  bool success = true;
20  success &= setCentreAndTypicalVal();
21  success &= makeTerms();
22  success &= makeSijTijVectors();
23  return success;
24 }
26  // cout << "Hello from Eff4piSymmetric::init()" << endl;
27  for(int i=0; i <= _order; i++){
28  _tTerms.push_back(symMultiPolyTerm(2,i));
29  _sTerms.push_back(symMultiPolyTerm(3,i));
30  }
31 
32  double initVal = 1; // make 1st one 1, all others 0
33  for(int thisOrder = 0; thisOrder <= _order; thisOrder++){
34  for(int tord = 0; tord <= thisOrder; tord++){
35  int sord = thisOrder - tord;
36  symMultiPolyTerm& tTermsTord(_tTerms[tord]);
37  symMultiPolyTerm& sTermsSord(_sTerms[sord]);
38 
39  double guessError = 1.0/(10*pow(3.0, thisOrder));
40 
41  for(unsigned int ti = 0; ti < tTermsTord.size(); ti++){
42  for(unsigned int si = 0; si < sTermsSord.size(); si++){
44  ptr(new ProdWithFitParameter(tTermsTord[ti], sTermsSord[si]
45  , "a"
46  , initVal
47  , guessError
48  , _pset
49  )
50  );
51  _allTerms.push_back(ptr);
52  initVal=0; // make 1st one 1, all others 0
53  }
54 
55  }
56  }
57  }
58  return true;
59 }
60 
62  _t01_ctr = (_pat.sijMax(2,3,4) + _pat.sijMin(2,3,4) ) / 2.0;
63  _s12_ctr = (_pat.sijMax(1,2) + _pat.sijMin(1,2) ) / 2.0;
64  _s23_ctr = (_pat.sijMax(2,3) + _pat.sijMin(2,3) ) / 2.0;
65  _s34_ctr = (_pat.sijMax(3,4) + _pat.sijMin(3,4) ) / 2.0;
66  _t40_ctr = (_pat.sijMax(1,2,3) + _pat.sijMin(1,2,3) ) / 2.0;
67 
68  _t01_del = fabs(_pat.sijMax(2,3,4) - _pat.sijMin(2,3,4) ) / 2.0;
69  _s12_del = fabs(_pat.sijMax(1,2) - _pat.sijMin(1,2) ) / 2.0;
70  _s23_del = fabs(_pat.sijMax(2,3) - _pat.sijMin(2,3) ) / 2.0;
71  _s34_del = fabs(_pat.sijMax(3,4) - _pat.sijMin(3,4) ) / 2.0;
72  _t40_del = fabs(_pat.sijMax(1,2,3) - _pat.sijMin(1,2,3) ) / 2.0;
73 
75  return true;
76 }
77 
78 void Eff4piSymmetric::printCentreAndTypicalVal(std::ostream& os) const{
79  os << "Eff4piSymmetric: Centre: "
80  << _t01_ctr << ", " << _s12_ctr
81  << ", " << _s23_ctr << ", " << _s34_ctr
82  << ", " << _t40_ctr
83  << endl;
84  os << "... and widths: "
85  << _t01_del << ", " << _s12_del
86  << ", " << _s23_del << ", " << _s34_del
87  << ", " << _t40_del
88  << endl;
89 
90 }
91 
93  _tijVec.push_back(&_t01);
94  _tijVec.push_back(&_t40);
95 
96  _sijVec.push_back(&_s12);
97  _sijVec.push_back(&_s23);
98  _sijVec.push_back(&_s34);
99 
100  return true;
101 }
102 
103 void Eff4piSymmetric::print(std::ostream& os) const{
104  for(unsigned int i=0; i < _allTerms.size(); i++){
105  if(0 != i) os << "\n\t + ";
106  os << *(_allTerms[i]);
107  }
108 }
109 
110 double Eff4piSymmetric::getVal( double t01, double s12, double s23
111  , double s34, double t40) const{
112  _t01 = (t01 - _t01_ctr)/_t01_del;
113  _s12 = (s12 - _s12_ctr)/_s12_del;
114  _s23 = (s23 - _s23_ctr)/_s23_del;
115  _s34 = (s34 - _s34_ctr)/_s34_del;
116  _t40 = (t40 - _t40_ctr)/_t40_del;
117 
119 }
120 double Eff4piSymmetric::getVal(const IDalitzEvent& evt) const{
121 
122  _t01 = (evt.t(0,1) - _t01_ctr)/_t01_del;
123  _s12 = (evt.s(1,2) - _s12_ctr)/_s12_del;
124  _s23 = (evt.s(2,3) - _s23_ctr)/_s23_del;
125  _s34 = (evt.s(3,4) - _s34_ctr)/_s34_del;
126  _t40 = (evt.t(4,0) - _t40_ctr)/_t40_del;
127 
128  // cout << "extracted sij" << endl;
130 }
131 
133  double sum=0;
134  for(unsigned int i=0; i < _allTerms.size(); i++){
135  sum += (_allTerms[i])->getVal(_tijVec, _sijVec);
136  }
137  return sum;
138 }
139 
141  // cout << "Hello from Eff4piSymmetric::RealVal()" << endl;
142  return this->getVal(evt);
143 }
144 
146  if(0 != _allTerms.size()) _allTerms[0]->fp()->fix();
147 }
148 
151  , const symPolyTerm& p2
152  , const std::string& prefix
153  , double initValue
154  , double guessError
155  , MinuitParameterSet* pset)
156  : _t1(p1)
157  , _t2(p2)
158  , _prefix(prefix)
159  , _pset(pset)
160 {
161  makeFitParameter(initValue, guessError);
162 }
163 
164 
165 std::string Eff4piSymmetric::
167  return _prefix + "_" + _t1.name() + "_" + _t2.name();
168 }
169 
171 ProdWithFitParameter::makeFitParameter(double initValue, double guessError){
173  fp(new FitParameter(name()
174  , 0
175  , initValue, guessError, 0, 0
176  , _pset, NamedParameterBase::QUIET)
177  );
178  _fp = fp;
179  return true;
180 }
181 
183 ProdWithFitParameter::print(std::ostream& os) const{
184  os << "(" << _fp->name() << ")*(" << _t1 << ") * (" << _t2 << ")";
185 }
186 
187 
188 double Eff4piSymmetric::
189 ProdWithFitParameter::getVal(const std::vector<double* >& t1_coords
190  , const std::vector<double* >& t2_coords
191  ) const{
192 
193  return ((double) (*_fp)) * _t1.eval(t1_coords) * _t2.eval(t2_coords);
194 }
195 
196 
197 std::ostream& operator<<(std::ostream& os
199  pwfp.print(os);
200  return os;
201 }
202 
203 std::ostream& operator<<(std::ostream& os
204  , const Eff4piSymmetric& e4pi){
205  e4pi.print(os);
206  return os;
207 }
208 
double sijMax(const MINT::PolymorphVector< int > &indices) const
virtual double getVal(double t01, double s12, double s23, double s34, double t40) const
std::vector< double * > _sijVec
virtual double t(unsigned int i, unsigned int j) const =0
virtual double RealVal(IDalitzEvent &evt)
ProdWithFitParameter(const symPolyTerm &p1, const symPolyTerm &p2, const std::string &prefix, double initValue, double guessError, MINT::MinuitParameterSet *pset=0)
double getVal(const std::vector< double * > &t1_coords, const std::vector< double * > &t2_coords) const
std::vector< double * > _tijVec
std::vector< symMultiPolyTerm > _sTerms
std::vector< MINT::counted_ptr< ProdWithFitParameter > > _allTerms
DalitzEventPattern _pat
double sijMin(const MINT::PolymorphVector< int > &indices) const
std::vector< symMultiPolyTerm > _tTerms
void print(std::ostream &os=std::cout) const
virtual double getValFromSavedCoordinates() const
void print(std::ostream &os=std::cout) const
Eff4piSymmetric(int order, const DalitzEventPattern &pat, MINT::MinuitParameterSet *pset=0)
unsigned int size() const
std::ostream & operator<<(std::ostream &os, const Eff4piSymmetric::ProdWithFitParameter &pwfp)
bool makeFitParameter(double initVal, double guessError)
virtual double s(unsigned int i, unsigned int j) const =0
MINT::MinuitParameterSet * _pset
bool setCentreAndTypicalVal()
void printCentreAndTypicalVal(std::ostream &os=std::cout) const