MINT2
MakePreIntegratedAmplitudes.cpp
Go to the documentation of this file.
2 
3 #include "Mint/SignalGenerator.h"
5 
7 #include "Mint/FitAmpSum.h"
8 
9 #include <iostream>
10 
11 using namespace std;
12 using namespace MINT;
13 
16  , const std::string& opt
17  , double prec
18  , const std::string& integEventsFname
19  , const std::string& generateEventsIfNeeded
20  , const std::string& fnamePrefix
21  , TRandom* rnd
22  )
23  : _pat(pat)
24  , _opt(opt)
25  , _prec(prec)
26  , _fname("noName")
27  , _eventsFname(integEventsFname)
28  , _generateEventsIfNeeded("DoGenerate" == generateEventsIfNeeded)
29  , _rnd(rnd)
30 {
31  makeFname(fnamePrefix);
32  if("" == _eventsFname) makeEventsFname();
33 }
34 
35 const std::string&
37 makeFname(const std::string& prefix){
38 
39  if(_pat.empty()){
40  _fname = prefix + "noPattern";
41  return _fname;
42  }
43  std::string name = _pat[0].name();
44  if(includeCPCon()){
45  DecayTreeItem antiMum = _pat[0];
46  antiMum.antiThis();
47  name += "_" + antiMum.name();
48  }
49  name += "_to_";
50  if(_pat.size() < 2){
51  _fname = prefix + name;
52  return _fname;
53  }
54  for(unsigned int i=1; i < _pat.size(); i++){
55  name += _pat[i].name();
56  }
57  _fname = prefix + name;
58  return _fname;
59 }
60 
61 const std::string&
64  return _eventsFname;
65 }
66 std::string
68  return "IntegEvents" + _fname + ".root";
69 }
71  // return false; // for now.
72  return (_pat[0].props()->charge() == "0" && _pat[0].hasDistinctAnti());
73 }
74 
76 
77  FitAmpSum fitAmps(_pat, "", _opt);
78  if(includeCPCon()){
79  DalitzEventPattern antiPat = _pat;
80  antiPat[0].antiThis();
81  FitAmpSum antiFa(antiPat, _opt);
82  fitAmps.add(antiFa);
83  }
84  fitAmps.setAllAmpsTo(std::complex<double>(1,0));
85 
86  counted_ptr<SignalGenerator> genSgPtr(0);
88  cout << "MakePreIntegratedAmplitudes::doit()"
89  << " will generate events if I don't find enough in file "
90  << eventsFname()
91  << " to reach precision " << _prec
92  << endl;
94  genSgPtr = ptr;
95  }else{
96  cout << "MakePreIntegratedAmplitudes::doit()"
97  << " will NOT generate my own events "
98  << " even if I don't find enough in file "
99  << eventsFname()
100  << " to reach precision " << _prec
101  << endl;
102  }
103  FromFileGenerator ffg(eventsFname(), genSgPtr.get());
104  FastAmplitudeIntegrator integ(_pat, &fitAmps, &ffg, _rnd, _prec);
105  integ.save(fname());
106 
107  cout << "Saved integration result for " << _pat
108  << " in this file: "
109  << fname()
110  << endl;
111  return true;
112 }
const std::string & fname() const
virtual int add(const FitAmpListBase &other, double factor=1)
std::string name() const
MakePreIntegratedAmplitudes(const DalitzEventPattern &pat, const std::string &opt, double prec, const std::string &integEventsFname="", const std::string &fnamePrefix="", const std::string &generateEventsIfNeeded="DoGenerate", TRandom *rnd=gRandom)
const std::string & eventsFname() const
unsigned int size() const
const std::string & makeFname(const std::string &prefix)
std::string name() const
void setAllAmpsTo(const std::complex< double > z)
X * get() const
Definition: counted_ptr.h:123