MINT2
AmpsPdfFlexiFast.h
Go to the documentation of this file.
1 #ifndef __AMPSPDFFLEXIFAST_H__
2 #define __AMPSPDFFLEXIFAST_H__
3 
4 #include <TRandom3.h>
5 #include <Mint/SignalGenerator.h>
7 #include <Mint/IDalitzEvent.h>
8 #include <Mint/IEventGenerator.h>
9 #include <Mint/NamedParameter.h>
10 #include <string>
13 
14 /*
15 Seems to be a way to top up integrator events for an amplitude ...
16 */
17 
20 {
21 protected:
22  TRandom* _localRnd;
27  std::string _integratorFileName;
28 public:
30  double ampSq = _amps->RealVal(evt);
31  return ampSq;// * getEvent()->phaseSpace();
32  }
33 
34  std::complex<double> ComplexVal_un_normalised_noPs(IDalitzEvent& evt){
35  return _amps->ComplexVal(evt);
36  }
37 
41  , double precision=1.e-4
42  , std::string method="efficient"
43  , std::string fname = "SignalIntegrationEvents.root", bool genMoreEvents = false
44  )
45  : DalitzPdfBaseFlexiFastInteg(pat, 0, amps, precision, mps)
46  , _localRnd(0)
47  , _sgGen(0)
48  , _fileGen(0)
49  , _chosenGen(0)
50  , _integratorSource("IntegratorSource", (std::string) "new", (char*) 0)
51  , _integratorFileName(fname)
52  {
53  std::cout << " AmpsPdfFlexiFast with integ method " << method << std::endl;
54  bool nonFlat = "efficient" == method;
55  bool generateNew = ((std::string)_integratorSource == (std::string)"new");
56  if(nonFlat){
57  std::cout << "AmpsPdfFlexiFast uses nonFlat integration." << std::endl;
58  if(generateNew){
59  _sgGen = new SignalGenerator(pat);
61  //_sgGen->setSaveEvents(_integratorFileName);
63  }else{
64  // here, SignalGenerator is used by FromFileGenerator, to fill
65  // up missing events in case more are needed than found in the
66  // file. Since we don't know with which random seed the
67  // events in the file were generated, we supply a random
68  // number generator with randomised seed.
69  _localRnd = new TRandom3(time(0));
70  _sgGen = new SignalGenerator(pat, _localRnd);
72  _sgGen->dontSaveEvents();// saving events is done by FromFileGenerator
73  if(genMoreEvents) _fileGen = new FromFileGenerator(_integratorFileName, _sgGen);
74  else{
76  std::cout << "not going to generate any more events" << std::endl;
77  }
79  }
80  this->setEventGenerator(_chosenGen);
81  }else{
82  std::cout << "AmpsPdfFlexiFast uses flat integration." << std::endl;
83  }
84  }
85 
87 
89  if(0 != _fileGen) delete _fileGen;
90  if(0 != _sgGen) delete _sgGen;
91  if(0 != _localRnd) delete _localRnd;
92  }
93 };
94 
95 #endif
FromFileGenerator * _fileGen
IFastAmplitudeIntegrable * getAmpSum()
virtual std::complex< double > ComplexVal(IDalitzEvent &evt)
virtual double RealVal(EVENT_TYPE &evt)=0
std::string _integratorFileName
void dontSaveEvents()
void setWeighted(bool w=true)
Definition: BaseGenerator.h:62
void setEventGenerator(MINT::IEventGenerator< IDalitzEvent > *g)
SignalGenerator * _sgGen
double un_normalised_noPs(IDalitzEvent &evt)
std::complex< double > ComplexVal_un_normalised_noPs(IDalitzEvent &evt)
AmpsPdfFlexiFast(const DalitzEventPattern &pat, IFastAmplitudeIntegrable *amps, MINT::MinuitParameterSet *mps, double precision=1.e-4, std::string method="efficient", std::string fname="SignalIntegrationEvents.root", bool genMoreEvents=false)
IFastAmplitudeIntegrable * _amps
MINT::NamedParameter< std::string > _integratorSource
MINT::IEventGenerator< IDalitzEvent > * _chosenGen