MINT2
FitAmpPairList.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/FitAmpPairList.h"
4 
5 #include "Mint/IDalitzEvent.h"
6 #include "Mint/FitAmplitude.h"
8 
9 #include "Mint/Minimiser.h"
10 
11 #include "Mint/Utils.h"
12 
13 #include <sys/types.h>
14 #include <sys/stat.h>
15 
16 #include <algorithm>
17 #include <vector>
18 
19 #include <iostream>
20 #include <fstream>
21 #include <iomanip>
22 
23 using namespace std;
24 using namespace MINT;
25 
26 //MINT::NamedParameter<std::string> FitAmpPairList::HistoOption("FitAmpPairList::HistoOption"
27 // , (std::string) "default");
28 
29 /*
30 FitAmpPairList::HistoOption can be set to either fast (no
31 histograms will be created or retrieved by the integrator) or slow
32 (histograms will be created or retrieved). The default option is
33 "default" and the default behaviour with FastAmplitudeIntegrator used
34 by DalitzPdfFastInteg is "slow", i.e. with histograms (the behaviour
35 is a bit more complex for the case of the
36 FlexiFastAmplitudeIntegrator, you're better off not using this option
37 there at all). Omitting the histograms saves a bit of time and
38 memory. Note that if you use this option when generating sgIntegrator
39 files (not recommended), you will also need to use it when reading
40 them. Recommended use is to use it with DalitzPdfFastInteg, when
41 reading in pre-saved integrator directories ("sgIntegrator"), in cases
42 where you don't make any plots.
43 */
44 
46  if((string)HistoOption == (string)"fast") setFast();
47  if((string)HistoOption == (string)"slow") setSlow();
48 }
49 
52  , _Nevents(0)
53  , _sum(0)
54  , _sumsq(0)
55  , _psSum(0)
56  , _psSumSq(0)
57  , _slow(true)
58  , _cov(this)
59  , _efficiency(0)
60  , HistoOption("FitAmpPairList::HistoOption", (std::string) "default")
61 {
63 }
67  , _Nevents(other._Nevents)
68  , _sum(other._sum)
69  , _sumsq(other._sumsq)
70  , _psSum(other._psSum)
71  , _psSumSq(other._psSumSq)
72  , _slow(other._slow)
73  , _cov(other._cov, this)
74  , _efficiency(other._efficiency)
75  , HistoOption("FitAmpPairList::HistoOption", (std::string) "default")
76 {
78 }
82  return ptr;
83 }
84 
86  if(0 == a1 || 0 == a2){
87  cout << "Error in FitAmpPairList::addAmps: " << a1 << ", " << a2 << endl;
88  throw "zero pointer";
89  }
90  FitAmpPair amps(*a1, *a2);
91  this->push_back(amps);
92 }
94  FitAmpPair amps(a1, a2);
95  this->push_back(amps);
96 }
97 
98 void FitAmpPairList::addEvent(IDalitzEvent* evtPtr, double weight){
99  if(0 == evtPtr) return;
100  addEvent(*evtPtr, weight);
101 }
102 
103 void FitAmpPairList::addEvent(IDalitzEvent& evt, double weight){
104  bool dbThis=false;
105  static unsigned int nZeroPs=0;
106  _Nevents++;
107  double x=0;
108  double ps = evt.phaseSpace();
109  if(ps <= 0.0){
110  if (!(nZeroPs%1000))
111  {
112  cout << "WARNING in FitAmpPairList::addToHistograms"
113  << " " << ++nZeroPs << " th"
114  << " event with phase space = " << ps << endl;
115  return; // should not happen.
116  }
117  }
118 
119  for(unsigned int i=0; i< this->size(); i++){
120  // x += this->at(i).add(evtPtr, weight*efficiency(evtPtr));
121  x += this->at(i).add(evt, weight, efficiency(&evt));
122  }
123  if(dbThis) cout << "FitAmpPairList::addEvent(): adding event" << endl;
124  //if(_cov.isValid())
126 
127  _sum += x;
128  _sumsq += x*x;
129 
130  //if(0 == evtPtr) return;
131  //double ps = evtPtr->phaseSpace();
132  _psSum += ps;
133  _psSumSq += ps*ps;
134 
135  return;
136 }
138  return addEvent(evtPtr.get(), weight);
139 }
140 
141 void FitAmpPairList::reAddEvent(IDalitzEvent& evt, double weight){
142  if(evt.phaseSpace() < 0) return;
143 
144  for(unsigned int i=0; i< this->size(); i++){
145  if( this->at(i).acceptEvents()){
146  this->at(i).reAdd(evt, weight, efficiency(&evt));
147  }
148  }
149 
150  // _cov.addLastEventFromList(); (need to do something about it)
151 
152  return;
153 }
154 //void FitAmpPairList::reAddEvent(counted_ptr<IDalitzEvent> evtPtr, double weight){
155 // return reAddEvent(evtPtr.get(), weight);
156 //}
157 
159  if(this->size() != otherList.size()) return false;
160  for(unsigned int i=0; i < this->size(); i++){
161  if(this->at(i).name() != otherList[i].name()) return false;
162  }
163  return true;
164 }
165 bool FitAmpPairList::add(const FitAmpPairList* otherListPtr){
166  if(0 != otherListPtr){
167  return add(*otherListPtr);
168  }
169  return true;
170 }
172  if(0 != otherListPtr){
173  return add(*otherListPtr);
174  }
175  return true;
176 }
177 bool FitAmpPairList::add(const FitAmpPairList& otherList){
178  if(! isCompatibleWith(otherList)){
179  cout << "ERROR in FitAmpPairList::add "
180  << "trying to add incompatible lists"
181  << endl;
182  return false;
183  }
184 
185  _Nevents += otherList._Nevents;
186  _sum += otherList._sum;
187  _sumsq += otherList._sumsq;
188  _psSum += otherList._psSum;
189  _psSumSq += otherList._psSumSq;
190 
191  _cov += otherList._cov;
192 
193  for(unsigned int i=0; i< this->size(); i++){
194  this->at(i) += otherList[i];
195  }
196 
197  return true;
198 
199 }
200 
202  return append(*otherListPtr);
203 }
204 bool FitAmpPairList::append(const FitAmpPairList* otherListPtr){
205  return append(*otherListPtr);
206 }
207 bool FitAmpPairList::append(const FitAmpPairList& otherList){
208  // WARNING: this will reset everything to zero.
209 
210  for(unsigned int i=0; i< otherList.size(); i++){
211  this->push_back(otherList[i]);
212  }
213  this->reset();
214 
215  return true;
216 
217 }
219  _Nevents=0;
220  _sum=0;
221  _sumsq=0;
222  _psSum=0;
223  _psSumSq=0;
224  _cov.reset();
227 
228  return true;
229 }
231  return _Nevents;
232 }
233 
235  double sum = 0;
236  for(unsigned int i=0; i< this->size(); i++){
237  sum += this->at(i).integral();
238  }
239  return sum;
240 }
241 
242 std::complex<double> FitAmpPairList::ComplexIntegralForTags(int tag1, int tag2) const{
243  std::complex<double> sum = 0;
244 
245  for(unsigned int i=0; i< this->size(); i++){
246  if((this->at(i).fitAmp1().getTag() == tag1) && ( this->at(i).fitAmp2().getTag() == tag2)){
247  sum += conj(this->at(i).complexVal());
248  }
249  else if((this->at(i).fitAmp1().getTag() == tag2) && ( this->at(i).fitAmp2().getTag() == tag1)){
250  sum += this->at(i).complexVal();
251  }
252  }
253  return sum;
254 }
255 
256 double FitAmpPairList::integralForMatchingPatterns(bool match, int pattern_sign) const{
257  double sum = 0;
258  for(unsigned int i=0; i< this->size(); i++){
259  if(this->at(i).hasMatchingPattern()==match){
260  if(match){
261  if(static_cast<double>(pattern_sign) * this->at(i).fitAmp1().theBareDecay().getVal() < 0 ) continue;
262  }
263  sum += this->at(i).integral();
264  }
265  }
266  return sum;
267 }
268 
269 std::complex<double> FitAmpPairList::ComplexSumForMatchingPatterns(bool match) const{
270  std::complex<double> sum = 0;
271  for(unsigned int i=0; i< this->size(); i++){
272  if(this->at(i).hasMatchingPattern()==match){
273  std::complex<double> val = this->at(i).complexVal();
274  if(this->at(i).fitAmp1().theBareDecay().getVal() > this->at(i).fitAmp2().theBareDecay().getVal() ) val = conj(val);
275  sum += val;
276  }
277  }
278  return sum;
279 }
280 
281 std::complex<double> FitAmpPairList::ComplexSum() const{ //laurenPsuedo
282  bool dbThis = false;
283  std::complex<double> sum = 0;
284  for(unsigned int i=0; i< this->size(); i++){
285  sum += this->at(i).complexVal();
286  }
287  return sum;
288  (void)dbThis;
289 }
290 
291 void FitAmpPairList::Gradient(MinuitParameterSet* mps, std::vector<double>& grad){
292 
293  for (unsigned int i=0; i<mps->size(); i++) {
294  if(mps->getParPtr(i)->hidden())continue;
295 
296  if(i+1 >= grad.size()){
297  cout << "WARNING in FitAmpPairList::Gradient:"
298  << " have to increase size of grad to avoid memory issues" << endl;
299  grad.resize(i+2);
300  }
301 
302  grad.at(i)=0; grad.at(i+1)=0;
303 
304  string name_i= mps->getParPtr(i)->name();
305  if(name_i.find("_Re")!=std::string::npos){
306  if(mps->getParPtr(i)->iFixInit() && mps->getParPtr(i+1)->iFixInit()){
307  i++;
308  continue;
309  }
310  name_i.replace(name_i.find("_Re"),3,"");
311  complex<double> sum(0);
312  for(unsigned int j=0; j< this->size(); j++){
313  if(!A_is_in_B(name_i,this->at(j).name())) continue;
314  if(A_is_in_B("Inco", name_i) != A_is_in_B("Inco",this->at(j).name()) ) continue;
315  double singleAmpCorrection= 1.;
316  if(this->at(j).isSingleAmp()) singleAmpCorrection = 2.;
317  // 2 a_j^* A_i A_j^*
318  if(A_is_in_B(name_i,this->at(j).fitAmp1().name())){
319  sum += singleAmpCorrection* this->at(j).valNoFitPars()* conj(this->at(j).fitAmp2().AmpPhase());
320  }
321  else {
322  sum += singleAmpCorrection* conj( this->at(j).valNoFitPars()* this->at(j).fitAmp1().AmpPhase() );
323  }
324 
325  }
326  grad.at(i)= sum.real();
327  grad.at(i+1)= -sum.imag();
328  i++;
329  }
330  // Doesn't work. Don't use!
331  /*
332  else if(name_i.find("_Amp")!=std::string::npos){
333  name_i.replace(name_i.find("_Amp"),4,"");
334  complex<double> sumAmp(0);
335  complex<double> sumPhase(0);
336 
337  for(unsigned int j=0; j< this->size(); j++){
338  if(!A_is_in_B(name_i,this->at(j).name())) continue;
339  double singleAmpCorrection= 1.;
340  if(this->at(j).isSingleAmp()) singleAmpCorrection = 2.;
341  // 2 a_j^* A_i A_j^*
342  if(A_is_in_B(name_i,this->at(j).fitAmp1().name())){
343  sumAmp += singleAmpCorrection*this->at(j).complexVal()/std::abs(this->at(j).fitAmp1().AmpPhase());
344  if(!this->at(j).isSingleAmp())sumPhase += this->at(j).complexVal()*std::arg(this->at(j).fitAmp1().AmpPhase());
345  }
346  else {
347  sumAmp += singleAmpCorrection*conj(this->at(j).complexVal())/std::abs(this->at(j).fitAmp2().AmpPhase());
348  if(!this->at(j).isSingleAmp())sumPhase += conj(this->at(j).complexVal())*std::arg(this->at(j).fitAmp2().AmpPhase());
349  }
350 
351  }
352  grad[i]= sumAmp.real();
353  grad[i+1]= -sumPhase.imag();
354  i++;
355  }
356  */
357  else if(mps->getParPtr(i)->iFixInit())continue;
358  else {
359  std::cout << "FitAmpPairList::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;
360  throw "crash";
361  }
362  }
363 
364 }
365 
367  , std::vector<double>& grad){
368 
369  for (unsigned int i=0; i<mps->size(); i++) {
370  if(mps->getParPtr(i)->hidden())continue;
371 
372  grad[i]=0; grad[i+1]=0;
373  string name_i= mps->getParPtr(i)->name();
374  if(name_i.find("_Re")!=std::string::npos){
375  if(mps->getParPtr(i)->iFixInit() && mps->getParPtr(i+1)->iFixInit())continue;
376  name_i.replace(name_i.find("_Re"),3,"");
377  for(unsigned int j=0; j< this->size(); j++){
378  if(!A_is_in_B(name_i,this->at(j).name())) continue;
379  if(A_is_in_B("Inco", name_i) != A_is_in_B("Inco",this->at(j).name()) ) continue;
380  if(!this->at(j).isSingleAmp()) continue;
381 
382  if(i+1 >= grad.size()){
383  cout << "WARNING in FitAmpPairList::GradientForLasso:"
384  << " have to increase size of grad to avoid memory issues" << endl;
385  grad.resize(i+2);
386  }
387 
388  double integral = this->at(j).valNoFitPars().real()/sqrt(this->at(j).integral());
389  // Re(a_j) A_j A_j^* dphi
390  grad[i]= integral * this->at(j).fitAmp1().AmpPhase().real();
391  // Im(a_j) A_j A_j^* dphi
392  grad[i+1]= integral * this->at(j).fitAmp1().AmpPhase().imag();
393  i++;
394  break;
395  }
396  }
397  else if(mps->getParPtr(i)->iFixInit())continue;
398  else {
399  std::cout << "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;
400  throw "crash";
401  }
402  }
403 
404 }
405 
407  double sum = 0;
408  for(unsigned int i=0; i< this->size(); i++){
409  if(this->at(i).isSingleAmp())sum += sqrt(this->at(i).integral());
410  }
411  return sum;
412 }
413 
415  double sum = 0;
416  for(unsigned int i=0; i< this->size(); i++){
417  if(this->at(i).isSingleAmp())sum += this->at(i).integral();
418  }
419  return sum/integral();
420 }
421 
423  double sum = 0;
424  for(unsigned int i=0; i< this->size(); i++){
425  if(!this->at(i).isSingleAmp())sum += sqrt(abs(this->at(i).integral()));
426  }
427  return sum;
428 }
429 
431  double sum = 0;
432  for(unsigned int i=0; i< this->size(); i++){
433  if(!this->at(i).isSingleAmp())sum += abs(this->at(i).integral());
434  }
435  return sum/integral();
436 }
437 
439  int n=0;
440  double norm = integral();
441  for(unsigned int i=0; i< this->size(); i++){
442  if(this->at(i).isSingleAmp()){
443  if(this->at(i).integral()/norm > threshold)n++ ;
444  }
445  }
446  return n;
447 }
448 
449 
451  // only for debug
452  if(_Nevents <= 0) return -9999;
453  return _psSum/((double) _Nevents);
454 }
455 
457  bool dbThis=false;
458  static int printouts=0;
459  static bool printedWarning=false;
460  if(_Nevents <=0)return 0;
461 
462  if(_cov.isValid()){
463  if(dbThis && printouts < 100){
464  printouts++;
465  cout << "FitAmpPairList::variance() with "
466  << _Nevents << "(" << _cov.Nevents() << ") events. Compare: "
467  << " old: " << oldVariance()
468  << " sum: " << sumOfVariances()
469  << ", new: " << _cov.getIntegralVariance()
470  << endl;
471  }
472  if(_Nevents < 10000) return oldVariance();
473  double var = _cov.getIntegralVariance();
474  if(var < 1.e-6 * oldVariance()){
475  if(dbThis) cout << "returning OLD variance " << var << endl;
476  // (if var is tiny, it usually means something went wrong)
477  return oldVariance();
478  }
479  if(dbThis) cout << "returning new variance " << var << endl;
480  return var;
481  }else{
482  if(! printedWarning){
483  cout << "WARNING in FitAmpPairList::variance()"
484  << " ignoring correlations because _cov is invalid."
485  << " (I'll print this only once)"
486  << endl;
487  printedWarning=true;
488  }
489  return sumOfVariances();
490  }
491 }
492 
494  double sum=0;
495  for(unsigned int i=0; i < this->size(); i++){
496  sum += this->at(i).variance();
497  }
498  return sum;
499 }
501  // this does not (yet) take into account
502  // that the variance changes with the
503  // fit paramters.
504  bool dbThis=false;
505  if(0 == _Nevents) return -9999.0;
506 
507  double dN = (double) _Nevents;
508 
509  double mean = _sum/dN;
510  double meansq = _sumsq/dN;
511  double v = (meansq - mean*mean)/dN;
512  double sf=1.0;
513  if(0 != integral()){
514  sf = integral()/mean;
515  v *= sf*sf;
516  // this construct allows for a scaling factor (such as _weightSum)
517  // in the integral.
518  }
519  if(dbThis){
520  cout << "FitAmpPairList::oldVariance() "
521  << " N = " << dN
522  << " sum = " << _sum
523  << " sumsq = " << _sumsq
524  << " sf " << sf
525  << " v " << v << endl;
526  }
527  return v;
528 }
530  if(0 == _efficiency) return 1;
531  if(0 == evtPtr) return 0;
532  return _efficiency->RealVal(*evtPtr);
533 }
535  _efficiency=eff;
536 }
539 }
542 }
544  DalitzHistoSet sum;
545  for(unsigned int i=0; i< this->size(); i++){
546  sum += this->at(i).histoSetRe();
547  }
548  return sum;
549 }
551  DalitzHistoSet sum;
552  for(unsigned int i=0; i< this->size(); i++){
553  sum += this->at(i).histoSetIm();
554  }
555  return sum;
556 }
557 
558 void FitAmpPairList::saveEachAmpsHistograms(const std::string& prefix) const{
559  DalitzHistoSet sum;
560  int counter=0;
561  for(unsigned int i=0; i< this->size(); i++){
562  if(this->at(i).isSingleAmp()){
563  counter++;
564  std::string name = prefix + "_" + anythingToString(counter) + ".root";
565  DalitzHistoSet hs(this->at(i).histoSet());
566  std::string title = this->at(i).fitAmp1().name();
567  hs.setTitle(title);
568  cout << "FitAmpPairList::saveEachAmpsHistograms: "
569  << "saving " << title << " as " << name << endl;
570  hs.save(name);
571  }
572  }
573  return;
574 }
575 
576 std::vector<DalitzHistoSet> FitAmpPairList::GetEachAmpsHistograms(){
577  std::vector<DalitzHistoSet> HistoSet;
578  DalitzHistoSet sum;
579  int counter=0;
580  for(unsigned int i=0; i< this->size(); i++){
581  if(this->at(i).isSingleAmp()){
582  counter++;
583  std::string name = anythingToString(counter) + ".root";
584  double frac = this->at(i).integral()/integral();
585  DalitzHistoSet hs(this->at(i).histoSet());
586  std::string title = this->at(i).fitAmp1().name();
587  hs.setTitle(title);
588  cout << "FitAmpPairList::saveEachAmpsHistograms: "
589  << "saving " << title << " as " << name << endl;
590  hs.scale(frac/hs.integral());
591  HistoSet.push_back(hs);
592  }
593  }
594  return HistoSet;
595 }
596 
598  DalitzHistoSet sum;
599  for(unsigned int i=0; i< this->size(); i++){
600  if(!this->at(i).isSingleAmp())sum += this->at(i).histoSet();
601  }
602  sum /= integral();
603  // if(_Nevents > 0) sum /= (double) _Nevents;
604  // above two lines normalise this to 1.
605 
606  return sum;
607 }
608 
609 void FitAmpPairList::saveInterferenceHistograms(const std::string& prefix) const{
610  DalitzHistoSet sum;
611  int counter=0;
612  for(unsigned int i=0; i< this->size(); i++){
613  if(!this->at(i).isSingleAmp()){
614  counter++;
615  std::string name = prefix + "_" + anythingToString(counter) + ".root";
616  DalitzHistoSet hs(this->at(i).histoSet());
617  std::string title = this->at(i).name();
618  hs.setTitle(title);
619  cout << "FitAmpPairList::saveEachAmpsHistograms: "
620  << "saving " << title << " as " << name << endl;
621  hs.save(name);
622  }
623  }
624  return;
625 }
626 
627 std::vector<DalitzHistoSet> FitAmpPairList::GetInterferenceHistograms(){
628  std::vector<DalitzHistoSet> HistoSet;
629  DalitzHistoSet sum;
630  int counter=0;
631  for(unsigned int i=0; i< this->size(); i++){
632  if(!this->at(i).isSingleAmp()){
633  counter++;
634  std::string name = anythingToString(counter) + ".root";
635  double frac = this->at(i).integral()/integral();
636  DalitzHistoSet hs(this->at(i).histoSet());
637  std::string title = this->at(i).name();
638  hs.setTitle(title);
639  cout << "FitAmpPairList::saveEachAmpsHistograms: "
640  << "saving " << title << " as " << name << endl;
641  hs.scale(frac/hs.integral());
642  HistoSet.push_back(hs);
643  }
644  }
645  return HistoSet;
646 }
647 
648 
649 //Add Plot of eveything on top of each other here
650 //Get EachAmpHistograms
651 // Can we from there get the ROOT histograms?
652 
654  bool dbThis=true;
655  if(dbThis) cout << "FitAmpPairList::doFinalStats() called" << endl;
656  makeAndStoreFractions(mini);
657 }
658 
659 
661 
662  if(this->empty()) return 0;
663 
666 
667  cout << "\n============================================"
668  << "============================================"
669  << "\n Amplitude Fractions";
670 
671  double norm = integral();
672 
673  if(norm <= 0){
674  cout << "ERROR in FitAmpPairList::makeAndStoreFractions()"
675  << " integral = " << integral()
676  << " won't do fractions."
677  << endl;
678  return false;
679  }
680 
681  for(unsigned int i=0; i < this->size(); i++){
682  double frac = this->at(i).integral()/norm;
683  string name;
684  if(this->at(i).isSingleAmp()){
685  name = this->at(i).fitAmp1().name();
686  }else{
687 // name = this->at(i).name();
688  name = this->at(i).fitAmp1().name() + "_x_" + this->at(i).fitAmp2().name();
689  }
690  FitFraction f(name, frac);
691 
692  if(this->at(i).isSingleAmp()){
693  this->at(i).fitAmp1().setFraction(frac);
695  }else{
697  }
698  }
699 
700  cout << "filled FitFractionLists" << endl;
701  FitFractionList interferenceFractionsSorted(_interferenceFractions);
702  interferenceFractionsSorted.sortByMagnitudeDecending();
703 
704  cout << "================================================="
705  << "\n================================================="
706  << "\n FRACTIONS:"
707  << "\n ^^^^^^^^^^" << endl;
708  cout << _singleAmpFractions << endl;
709  cout << "================================================="
710  << "\n================================================="
711  << "\n Interference terms (sorted by size)"
712  << "\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
713  cout << interferenceFractionsSorted << endl;
714  cout << "================================================="
715  << "\n=================================================" << endl;
716 
717  cout << "\n\n\t X-check: total sum of all terms"
718  << " (amplitude fractions + interference terms): "
721 
722  return true;
723 }
724 
725 
726 bool FitAmpPairList::makeAndStoreFractions(const std::string& fname
727  , const std::string& fnameROOT
728  , Minimiser* mini
729  ){
730  bool dbThis=true;
731 
734 
735  if(this->empty()) return 0;
737  if(0 != mini){
738  if(mini->parSet() != this->at(0).fitAmp1().FitAmpPhase().p1().parSet()){
739  cout << "ERROR in FitAmpPairList::makeAndStoreFractions"
740  << "\n Minuit parameter set and fit parameters incompatible"
741  << endl;
742  }else{
743  cout << "getting minuitCov" << endl;
744  TMatrixTSym<double> minuitCov(mini->covMatrixFull());
745  cout << "got minuitCov" << endl;
747  fc(new FitAmpPairFitCovariance(this, minuitCov));
748  fcov = fc;
749  cout << "got fcov" << endl;
750  }
751  }
752 
753  bool printFitErrors = (fcov != 0 && fcov->isValid());
754 
755  cout << "\n============================================"
756  << "============================================"
757  << "\n Amplitude Fractions";
758  if(0 != fcov) cout << " +/- fit error ";
759  cout << " +/- integration error "
760  << endl;
761  double norm = integral();
762  if(norm <= 0){
763  cout << "ERROR in FitAmpPairList::makeAndStoreFractions()"
764  << " integral = " << integral()
765  << " won't do fractions."
766  << endl;
767  return false;
768  }
769 
770  for(unsigned int i=0; i < this->size(); i++){
771  double frac = this->at(i).integral()/norm;
772  string name;
773  if(this->at(i).isSingleAmp()){
774  name = this->at(i).fitAmp1().name();
775  }else{
776  name = this->at(i).name();
777  }
778  FitFraction f(name, frac);
779  if(printFitErrors){
780  f.sigmaFit() = fcov->getFractionError(i);
781  }
782  if(_cov.isValid()){
784  }
785 
786  if(this->at(i).isSingleAmp()){
787  this->at(i).fitAmp1().setFraction(frac);
789  }else{
791  }
792  }
793 
794  if(dbThis)cout << "filled FitFractionLists" << endl;
795  if(printFitErrors){
798  }
799  if(_cov.isValid()){
801  }
802 
803  if(dbThis) cout << "... now including errors" << endl;
804  if(dbThis)cout << " sorting" << endl;
806  if(dbThis)cout << "sorted" << endl;
807 
808  cout << "================================================="
809  << "\n================================================="
810  << "\n FRACTIONS:"
811  << "\n ^^^^^^^^^^" << endl;
812  cout << _singleAmpFractions << endl;
813  cout << "================================================="
814  << "\n================================================="
815  << "\n Interference terms (sorted by size)"
816  << "\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
817  cout << _interferenceFractions << endl;
818  cout << "================================================="
819  << "\n=================================================" << endl;
820 
821  cout << "\n\n\t X-check: total sum of all terms"
822  << " (amplitude fractions + interference terms): "
825  cout << endl;
826  ofstream os(fname.c_str(),std::ofstream::trunc);
827 // if(os){
828 // os << _singleAmpFractions << endl;
829 // os << _interferenceFractions << endl;
830 // os.close();
831 // }
833  if(!os)return true;
834  os << "\\begin{tabular}{l r}" << "\n";
835  os << "\\hline" << "\n";
836  os << "\\hline" << "\n";
837  os << "Decay channel & Fraction [$\\%$] \\\\" << "\n";
838  os << "\\hline" << "\n";
839 
840  for(unsigned int i=0; i < this->size(); i++){
841  double frac = this->at(i).integral()/norm;
842  TString name;
843  if(this->at(i).isSingleAmp()) name = this->at(i).fitAmp1().name();
844  else continue;
845  FitFraction f((string)name, frac);
846  double frac_err = fcov->getFractionError(i);
847 
848  name.ReplaceAll("->"," \\to ");
849  name.ReplaceAll("Bs0","B_s");
850  name.ReplaceAll("Ds","D_s");
851  name.ReplaceAll("pi","\\pi");
852  name.ReplaceAll("rho","\\rho");
853  name.ReplaceAll("sigma10","\\sigma");
854  name.ReplaceAll("GS","");
855  name.ReplaceAll("SBW","");
856  name.ReplaceAll("RhoOmega","");
857  name.ReplaceAll("GLass","");
858  name.ReplaceAll("Lass","");
859  name.ReplaceAll("Bugg","");
860  name.ReplaceAll("Flatte","");
861  name.ReplaceAll("+","^+");
862  name.ReplaceAll("-","^-");
863  name.ReplaceAll("*","^*");
864  name.ReplaceAll(")0",")^0");
865  name.ReplaceAll(","," \\, ");
866  name.ReplaceAll("NonResS0( \\to D_s^- \\, \\pi^+)","( D_s^- \\, \\pi^+)_{S}");
867  name.ReplaceAll("NonResV0( \\to D_s^- \\, \\pi^+)","( D_s^- \\, \\pi^+)_{P}");
868  name.ReplaceAll("NonResS0( \\to D_s^- \\, K^+)","( D_s^- \\, K^+)_{S}");
869  name.ReplaceAll("NonResV0( \\to D_s^- \\, K^+)","( D_s^- \\, K^+)_{P}");
870 
871  os << std::fixed << std::setprecision(2) << "$" << name << "$ & " << frac * 100. << " $\\pm$ " << frac_err * 100. << " \\\\" << "\n";
872  }
873  os << " \\hline" << "\n";
874  os << " Sum & " << std::fixed << std::setprecision(2) << _singleAmpFractions.sum().frac() * 100. << " $\\pm$ " << fcov->getFractionSumError() * 100. << " \\\\" << "\n";
875  os << "\\hline" << "\n";
876  os << "\\hline" << "\n";
877  os << "\\end{tabular}" << "\n";
878  os.close();
879 
880  TFile* paraFile = new TFile((fnameROOT).c_str(), "RECREATE");
881  TTree* tree = new TTree("fractions","fractions");
882 
883  for(unsigned int i=0; i < this->size(); i++){
884  double frac = this->at(i).integral()/norm;
885  TString name;
886  if(this->at(i).isSingleAmp())name = TString(this->at(i).fitAmp1().name());
887  else name = TString(this->at(i).name());
888  FitFraction f((string)name, frac);
889 
890  name.ReplaceAll("A(","");
891  name.ReplaceAll("fit","");
892  name.ReplaceAll("[","_");
893  name.ReplaceAll("]","_");
894  name.ReplaceAll("(","_");
895  name.ReplaceAll(")","_");
896  name.ReplaceAll("->","_");
897  name.ReplaceAll("+","p");
898  name.ReplaceAll("-","m");
899  name.ReplaceAll("*","s");
900  name.ReplaceAll(",","");
901  name.ReplaceAll("GS","");
902  name.ReplaceAll("GLass","");
903  name.ReplaceAll("Lass","");
904  name.ReplaceAll("RhoOmega","");
905  name.ReplaceAll("Bugg","");
906  name.ReplaceAll("Flatte","");
907 
908  if(0 != tree){
909  double val = frac;
910  if(!this->at(i).isSingleAmp()) name = "int_" + name;
911  TBranch* Bra_val = tree->Branch( ((string)name).c_str(), &val, ((string)(name+"/D")).c_str());
912  if(0 != Bra_val) Bra_val->Fill();
913  }
914  }
915  double val = _singleAmpFractions.sum().frac();
916  TBranch* Bra_val = tree->Branch( "Sum", &val, "Sum/D");
917  if(0 != Bra_val) Bra_val->Fill();
918 
919  if(0 != tree) tree->Fill();
920 
921  tree->Write();
922  paraFile->Close();
923  delete paraFile;
924 
925  return true;
926 }
927 
928 
929 
930 /*
931 bool FitAmpPairList::makeAndStoreFractions(const std::string& fname, const std::string& fnameROOT, Minimiser* mini ){
932  bool dbThis=true;
933  //return 0;
934  if(this->empty()) return 0;
935 
936  NamedParameter<string> OutputDir("OutputDir", (std::string) "", (char*) 0);
937 
938  counted_ptr<FitAmpPairFitCovariance> fcov(0);
939  if(0 != mini){
940  if(mini->parSet() != this->at(0].fitAmp1().FitAmpPhase().p1().parSet()){
941  cout << "ERROR in FitAmpPairList::makeAndStoreFractions"
942  << "\n Minuit parameter set and fit parameters incompatible"
943  << endl;
944  }else{
945  counted_ptr<FitAmpPairFitCovariance>
946  fc(new FitAmpPairFitCovariance(this, mini->covMatrixFull()));
947  fcov = fc;
948  }
949  }
950 
951  // return 0;
952 
953  bool printFitErrors = (fcov != 0 && fcov->isValid());
954 
955  cout << "\n============================================"
956  << "============================================"
957  << "\n Amplitude Fractions";
958  if(0 != fcov) cout << " +/- fit error ";
959  cout << " +/- integration error "
960  << endl;
961  double norm = integral();
962  if(norm <= 0){
963  cout << "ERROR in FitAmpPairList::makeAndStoreFractions()"
964  << " integral = " << integral()
965  << " won't do fractions."
966  << endl;
967  return false;
968  }
969 
970  TFile* paraFile = new TFile(((string)OutputDir + fnameROOT).c_str(), "RECREATE");
971  // if(0 != paraFile) paraFile->cd();
972  TTree* tree = new TTree("fractions","fractions");
973  int counter = 0;
974 
975  for(unsigned int i=0; i < this->size(); i++){
976  double frac = this->at(i).integral()/norm;
977  string name;
978  if(this->at(i).isSingleAmp()){
979  name = this->at(i).fitAmp1().name();
980  }else{
981  name = this->at(i).name();
982  }
983  FitFraction f(name, frac);
984  if(printFitErrors){
985  f.sigmaFit() = fcov->getFractionError(i);
986  }
987  if(_cov.isValid()){
988  f.sigmaInteg() = _cov.getFractionError(i);
989  }
990 
991  if(0 != tree && this->at(i).isSingleAmp()){
992  counter++;
993  double val = frac;
994  double diff = (frac-this->at(i).fitAmp1().getFraction());
995  double sigma = -9999;
996  if(0 != fcov && fcov->isValid()) sigma = fcov->getFractionError(i);
997  double pull = -9999;
998  if(sigma > 0) pull = diff/sigma;
999  std::string name_val = anythingToString((int)counter) + "_val";
1000  std::string name_pull = anythingToString((int)counter) + "_pull";
1001  std::string name_diff = anythingToString((int)counter) + "_diff";
1002 
1003  TBranch* Bra_val = tree->Branch( name_val.c_str(), &val, (name_val+"/D").c_str());
1004  TBranch* Bra_pull = tree->Branch( name_pull.c_str(), &pull, (name_pull+"/D").c_str());
1005  TBranch* Bra_diff = tree->Branch( name_diff.c_str(), &diff, (name_diff+"/D").c_str());
1006  if(0 != Bra_pull) Bra_pull->Fill();
1007  if(0 != Bra_diff) Bra_diff->Fill();
1008  if(0 != Bra_val) Bra_val->Fill();
1009  // tree->Fill();
1010  //this->at(i).fitAmp1().setFraction(frac);
1011  _singleAmpFractions.add(f);
1012  }else{
1013  _interferenceFractions.add(f);
1014  }
1015  }
1016 
1017  if(0 != tree) tree->Fill();
1018 
1019  if(dbThis)cout << "filled FitFractionLists" << endl;
1020  if(printFitErrors){
1021  _singleAmpFractions.setSumFitError(fcov->getFractionSumError());
1022  _interferenceFractions.setSumFitError(fcov->getInterferenceFracSumError());
1023  }
1024  if(_cov.isValid()){
1025  _singleAmpFractions.setSumIntegError(_cov.getFractionSumError());
1026  }
1027 
1028  if(dbThis) cout << "... now including errors" << endl;
1029  if(dbThis)cout << " sorting" << endl;
1030  _interferenceFractions.sortByMagnitudeDecending();
1031  if(dbThis)cout << "sorted" << endl;
1032 
1033  cout << "================================================="
1034  << "\n================================================="
1035  << "\n FRACTIONS:"
1036  << "\n ^^^^^^^^^^" << endl;
1037  cout << _singleAmpFractions << endl;
1038  cout << "================================================="
1039  << "\n================================================="
1040  << "\n Interference terms (sorted by size)"
1041  << "\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
1042  cout << _interferenceFractions << endl;
1043  cout << "================================================="
1044  << "\n=================================================" << endl;
1045 
1046  cout << "\n\n\t X-check: total sum of all terms"
1047  << " (amplitude fractions + interference terms): "
1048  << _singleAmpFractions.sum().frac()
1049  + _interferenceFractions.sum().frac();
1050  cout << endl;
1051  ofstream os(((string) OutputDir + fname).c_str());
1052  if(os){
1053  os << _singleAmpFractions << endl;
1054  os << _interferenceFractions << endl;
1055  os.close();
1056  }
1057 
1058  tree->Write();
1059  //paraFile->Close();
1060  //delete paraFile;
1061 
1062  return true;
1063 }
1064 */
1065 
1066 
1068  bool ErrorProportionalToSqrtTarget = true;
1069  double norm = integral();
1070  if(norm <= 0){
1071  cout << "ERROR in FitAmpPairList::getFractionChi2()"
1072  << " integral = " << integral()
1073  << " won't do fractions. Returning " << 9999.0e30
1074  << endl;
1075  return 9999.0e30;
1076  }
1077 
1078  double canonicalError=0.001;
1079 
1080  int counter=0;
1081  double sum=0;
1082  for(unsigned int i=0; i < this->size(); i++){
1083  if(this->at(i).isSingleAmp()){
1084  counter++;
1085  double frac = this->at(i).integral()/norm;
1086  double target_f = this->at(i).fitAmp1().getFraction();
1087  //if(i < 10){
1088  //cout << "(" << frac << " - " << target_f << ")" << endl;
1089  //}
1090  double dfs=(frac - target_f)/canonicalError;
1091  if(ErrorProportionalToSqrtTarget && target_f > 0) dfs /= sqrt(0.01*target_f);
1092  sum += dfs*dfs;
1093  }
1094  }
1095  return sum;
1096 }
1097 
1098 
1099 std::string FitAmpPairList::dirName() const{
1100  return "FitAmpPairList";
1101 }
1102 bool FitAmpPairList::save(const std::string& asSubdirOf) const{
1103  bool sc=true;
1104  makeDirectory(asSubdirOf);
1105  ofstream os((asSubdirOf +"/"+ dirName() + "values.txt").c_str());
1106  os << "N " << _Nevents << endl;
1107  os << "sum " << setprecision(20) << _sum << endl;
1108  os << "sumsq " << setprecision(20) << _sumsq << endl;
1109  os << "psSum " << setprecision(20) << _psSum << endl;
1110  os << "psSumSq " << setprecision(20) << _psSumSq << endl;
1111  os.close();
1112 
1113  for(unsigned int i=0; i < this->size(); i++){
1114  sc &= this->at(i).save(asSubdirOf +"/"+ dirName());
1115  }
1116  if(_cov.isValid()){
1117  _cov.save(asSubdirOf + "/" + dirName());
1118  }else{
1119  cout << "WARNING IN FitAmpPairList::save(" << asSubdirOf
1120  << "): invalid _cov" << endl;
1121  }
1122 
1123  return sc;
1124 }
1125 bool FitAmpPairList::retrieve(const std::string& asSubdirOf){
1126  bool sc=true;
1127  bool verbose=true;
1128  if(verbose){
1129  cout << "FitAmpPairList::retrieve: reading from "
1130  << asSubdirOf << endl;
1131  }
1132 
1133  struct stat buf;
1134  if(stat(asSubdirOf.c_str(), &buf) != 0){
1135  if(verbose) cout << "FitAmpPairList::retrieve: " << asSubdirOf
1136  << " does not exist" << endl;
1137  return false;
1138  }
1139 
1140  ifstream is((asSubdirOf +"/"+ dirName() + "values.txt").c_str());
1141  std::string dummy;
1142  is >> dummy >> _Nevents;
1143  is >> dummy >> _sum;
1144  is >> dummy >> _sumsq;
1145  is >> dummy >> _psSum;
1146  is >> dummy >> _psSumSq;
1147  is.close();
1148  for(unsigned int i=0; i < this->size(); i++){
1149  sc &= this->at(i).retrieve(asSubdirOf +"/"+ dirName());
1150  }
1151  _cov.retrieve(asSubdirOf + "/" + dirName());
1152  return sc;
1153 }
1154 
1155 bool FitAmpPairList::makeDirectory(const std::string& asSubdirOf)const{
1156  /*
1157  A mode is created from or'd permission bit masks defined
1158  in <sys/stat.h>:
1159  #define S_IRWXU 0000700 RWX mask for owner
1160  #define S_IRUSR 0000400 R for owner
1161  #define S_IWUSR 0000200 W for owner
1162  #define S_IXUSR 0000100 X for owner
1163 
1164  #define S_IRWXG 0000070 RWX mask for group
1165  #define S_IRGRP 0000040 R for group
1166  #define S_IWGRP 0000020 W for group
1167  #define S_IXGRP 0000010 X for group
1168 
1169  #define S_IRWXO 0000007 RWX mask for other
1170  #define S_IROTH 0000004 R for other
1171  #define S_IWOTH 0000002 W for other
1172  #define S_IXOTH 0000001 X for other
1173 
1174  #define S_ISUID 0004000 set user id on execution
1175  #define S_ISGID 0002000 set group id on execution
1176  #define S_ISVTX 0001000 save swapped text even after use
1177  */
1178 
1179  mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO
1180  | S_ISUID | S_ISGID;
1181  // see above for meaning. I want everybody to be allowed to read/write/exec.
1182  // Not sure about the last two bits.
1183 
1184  int zeroForSuccess = 0;
1185  zeroForSuccess |= mkdir( (asSubdirOf ).c_str(), mode );
1186  zeroForSuccess |= mkdir( (asSubdirOf + "/" + dirName() ).c_str(), mode );
1187  return (0 == zeroForSuccess);
1188 }
1189 
1190 void FitAmpPairList::print(std::ostream& os) const{
1191  os << "FitAmpPairList with " << this->size() << " FitAmpPairs:";
1192  for(unsigned int i=0; i < this->size(); i++){
1193  os << "\n\t" << i << ") " << this->at(i);
1194  }
1195 }
1196 
1198  for(unsigned int i=0; i < this->size(); i++){
1199  if (this->at(i).needToReIntegrate() ) return true;
1200  }
1201  return false;
1202 }
1204  for(unsigned int i=0; i < this->size(); i++){
1205  this->at(i).startIntegration();
1206  }
1207 }
1209  for(unsigned int i=0; i < this->size(); i++){
1210  if( this->at(i).needToReIntegrate() ) this->at(i).startReIntegration();
1211  }
1212 }
1214  for(unsigned int i=0; i < this->size(); i++){
1215  this->at(i).startReIntegration();
1216  }
1217 }
1219  for(unsigned int i=0; i < this->size(); i++){
1220  this->at(i).endIntegration();
1221  }
1222 }
1223 
1225  _slow=true;
1226  for(unsigned int i=0; i < this->size(); i++){
1227  this->at(i).setSlow();
1228  }
1229 }
1231  _slow=false;
1232  for(unsigned int i=0; i < this->size(); i++){
1233  this->at(i).setFast();
1234  }
1235 }
1236 
1238  this->add(other);
1239  return *this;
1240 }
1242  FitAmpPairList returnVal(*this);
1243  returnVal.add(other);
1244  return returnVal;
1245 }
1246 
1247 std::ostream& operator<<(std::ostream& os, const FitAmpPairList& fap){
1248  fap.print(os);
1249  return os;
1250 }
1251 
1252 /*
1253 double FitAmpPairList::variance() const{
1254  double sum = 0;
1255  for(unsigned int i=0; i< this->size(); i++){
1256  sum += this->at(i).variance();
1257  }
1258  return sum;
1259 }
1260 */
1261 
1262 /*
1263 double FitAmpPairList::variance() const{
1264  double sumReSquared = 0;
1265  double sumImSquared = 0;
1266  double sumImRe = 0;
1267 
1268  for(unsigned int i=0; i< this->size(); i++){
1269  sumReSquared += this->at(i).ReSquared();
1270  sumImSquared += this->at(i).ImSquared();
1271  sumImRe += this->at(i).ImRe();
1272  }
1273  double sumsq = sumReSquared + sumImSquared - 2.0*sumImRe;
1274 
1275  double meansq = sumsq/((double)_Nevents);
1276 
1277  double mean = integral();
1278 
1279  double var = (meansq - mean*mean)/((double)_Nevents);
1280 
1281  return var;
1282 }
1283 */
1284 
1285 //
std::complex< double > AmpPhase() const
Definition: FitAmplitude.h:153
TMatrixTSym< double > covMatrixFull()
Definition: Minimiser.cpp:525
void setSumFitError(double sfe)
bool acceptEvents() const
Definition: FitAmpPair.cpp:520
virtual double getFractionChi2() const
virtual FitParameter & p1()=0
virtual bool append(const FitAmpPairList &otherListPtr)
void startIntegration()
Definition: FitAmpPair.cpp:511
FitFractionList _singleAmpFractions
const MinuitParameterSet * parSet() const
Definition: Minimiser.h:63
void push_back(const FitAmpPair &c)
FitAmpPairList & operator+=(const FitAmpPairList &other)
void scale(double sf)
void startForcedReIntegration()
virtual double phaseSpace() const =0
std::complex< double > ComplexIntegralForTags(int tag1, int tag2) const
void setSumIntegError(double sie)
std::string name() const
Definition: FitAmplitude.h:213
virtual int iFixInit() const =0
std::complex< double > complexVal() const
Definition: FitAmpPair.h:126
bool add(const FitAmpPair &other)
Definition: FitAmpPair.cpp:110
double integral() const
Definition: FitAmpPair.cpp:476
virtual void addAmps(FitAmplitude *a1, FitAmplitude *a2)
DalitzHistoSet histoSet() const
Definition: FitAmpPair.h:151
IMinuitParameter * getParPtr(unsigned int i)
virtual void reAddEvent(IDalitzEvent &evt, double weight=1)
virtual double RealVal(EVENT_TYPE &evt)=0
std::vector< DalitzHistoSet > GetEachAmpsHistograms()
virtual void GradientForLasso(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
unsigned int size() const
double variance() const
Definition: FitAmpPair.cpp:574
bool retrieve(const std::string &asSubdirOf=".")
Definition: FitAmpPair.cpp:218
std::ostream & operator<<(std::ostream &os, const FitAmpPairList &fap)
void saveEachAmpsHistograms(const std::string &prefix) const
double & sigmaFit()
Definition: FitFraction.h:24
DecayTree theBareDecay() const
Definition: FitAmplitude.h:166
virtual const std::string & name() const =0
FitAmpPairCovariance _cov
const ValueType & getVal() const
Definition: DDTree.h:102
virtual void doFinalStats(MINT::Minimiser *min=0)
FitAmplitude & fitAmp2()
Definition: FitAmpPair.h:160
DalitzHistoSet histoSetRe() const
Definition: FitAmpPair.cpp:529
virtual double oldVariance() const
virtual double variance() const
MINT::FitComplex & FitAmpPhase()
Definition: FitAmplitude.h:147
double & sigmaInteg()
Definition: FitFraction.h:27
std::vector< DalitzHistoSet > GetInterferenceHistograms()
double integralForMatchingPatterns(bool match, int pattern_sign) const
FitAmplitude & fitAmp1()
Definition: FitAmpPair.h:153
bool A_is_in_B(const std::string &a, const std::string &b)
Definition: Utils.cpp:34
double getFraction() const
Definition: FitAmplitude.h:124
bool isCompatibleWith(const FitAmpPairList &other) const
bool hasMatchingPattern() const
Definition: FitAmpPair.cpp:594
FitAmpPairList operator+(const FitAmpPairList &other) const
DalitzHistoSet histoSetIm() const
Definition: FitAmpPair.cpp:551
void add(const FitFraction &f)
std::complex< double > ComplexSumForMatchingPatterns(bool match) const
virtual bool add(const FitAmpPairList &otherList)
void setEfficiency(MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > eff)
double phaseSpaceIntegral() const
double & frac()
Definition: FitFraction.h:21
void setFraction(double fr)
Definition: FitAmplitude.h:121
MINT::counted_ptr< MINT::IReturnRealForEvent< IDalitzEvent > > _efficiency
bool needToReIntegrate() const
FitAmpPair & at(unsigned int i)
virtual double integral() const
void setTitle(const std::string &title)
virtual bool hidden() const =0
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)
double sumOfFitFractions()
virtual bool save(const std::string &asSubdirOf=".") const
bool needToReIntegrate() const
Definition: FitAmpPair.cpp:500
const FitFraction & sum() const
MINT::counted_ptr< IIntegrationCalculator > clone_IIntegrationCalculator() const
virtual void Gradient(MINT::MinuitParameterSet *mps, std::vector< double > &grad)
bool retrieve(const std::string &fromDirectory=".")
std::string anythingToString(const T &anything)
Definition: Utils.h:62
void setFast()
Definition: FitAmpPair.h:177
double integral() const
virtual const MinuitParameterSet * parSet() const
Definition: FitParameter.h:115
virtual DalitzHistoSet un_normalised_histoSetIm() const
void startReIntegration()
Definition: FitAmpPair.cpp:507
double efficiency(IDalitzEvent *evtPtr)
void endIntegration()
Definition: FitAmpPair.cpp:515
bool isSingleAmp() const
Definition: FitAmpPair.cpp:590
void saveInterferenceHistograms(const std::string &prefix) const
void sortByMagnitudeDecending()
DalitzHistoSet interferenceHistoSet() const
double getTag() const
Definition: FitAmplitude.h:132
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
bool save(const std::string &filename="DalitzHistos.root") const
double absSumOfSqrtInterferenceFractions()
std::complex< double > valNoFitPars() const
Definition: FitAmpPair.cpp:447
virtual bool retrieve(const std::string &asSubdirOf=".")
FitFractionList _interferenceFractions
double absSumOfInterferenceFractions()
const std::string & name() const
Definition: FitAmpPair.cpp:605
virtual void print(std::ostream &os=std::cout) const
X * get() const
Definition: counted_ptr.h:123
void setSlow()
Definition: FitAmpPair.h:176
bool save(const std::string &asSubdirOf=".") const
double reAdd(IDalitzEvent &evt, double weight=1, double efficiency=1)
Definition: FitAmpPair.cpp:389
bool save(const std::string &asSubdirOf=".") const
Definition: FitAmpPair.cpp:206