68 double ampSq = _amps->RealVal(evt);
77 ,
double precision=1.e-4
78 , std::string method=
"efficient" 79 , std::string fname =
"SignalIntegrationEvents.root",
bool genMoreEvents =
false 87 , _integratorSource(
"IntegratorSource", (std::string)
"old", (char*) 0)
89 , _integratorFileName(fname)
91 cout <<
" AmpsPdf with integ method " << method << endl;
92 bool nonFlat =
"efficient" == method;
93 bool generateNew = ((string)_integratorSource == (
string)
"new");
95 cout <<
"AmpsPdf uses nonFlat integration." << endl;
107 cout <<
"Using else, AmpsPdf.h from ampFit " << endl;
108 _localRnd =
new TRandom3(time(0));
115 cout <<
"not going to generate any more events" << endl;
118 _chosenGen = _fileGen;
121 this->setEventGenerator(_chosenGen);
123 cout <<
"AmpsPdf uses flat integration." << endl;
130 if(0 != _fileGen)
delete _fileGen;
131 if(0 != _sgGen)
delete _sgGen;
132 if(0 != _localRnd)
delete _localRnd;
140 time_t startTime = time(0);
145 cout <<
"pset pointer in default " << MinuitParameterSet::getDefaultSet() << endl;
146 cout <<
"pset pointer in ampsFit " << &fitMPS << endl;
148 cout <<
"sizes " << MinuitParameterSet::getDefaultSet()->
size()
149 <<
", " << fitMPS.
size() << endl;
154 ranLux.SetSeed((
int)RandomSeed);
162 bool makeIntegrators = (int) MakeIntegrators;
163 cout <<
"MakeIntegrator= " << MakeIntegrators << endl;
166 bool generateNew = (std::string) InputFileName ==
"";
168 string InputFileName1 = ((string)InputFileName) +
"_1.root";
169 string InputFileName2 = ((string)InputFileName) +
"_2.root";
170 string InputFileName3 = ((string)InputFileName) +
"_3.root";
171 string InputFileName4 = ((string)InputFileName) +
"_4.root";
172 string InputFileName5 = ((string)InputFileName) +
"_5.root";
175 , (std::string)
"SignalIntegrationEvents" 177 string SgIntegratorEventFile1 =
"Sg" + ((string)IntegratorEventFile) +
"_1.root";
178 string SgIntegratorEventFile2 =
"Sg" + ((string)IntegratorEventFile) +
"_2.root";
179 string SgIntegratorEventFile3 =
"Sg" + ((string)IntegratorEventFile) +
"_3.root";
180 string SgIntegratorEventFile4 =
"Sg" + ((string)IntegratorEventFile) +
"_4.root";
181 string SgIntegratorEventFile5 =
"Sg" + ((string)IntegratorEventFile) +
"_5.root";
183 string BgIntegratorEventFile1 =
"Bg" + ((string)IntegratorEventFile) +
"_1.root";
184 string BgIntegratorEventFile2 =
"Bg" + ((string)IntegratorEventFile) +
"_2.root";
185 string BgIntegratorEventFile3 =
"Bg" + ((string)IntegratorEventFile) +
"_3.root";
186 string BgIntegratorEventFile4 =
"Bg" + ((string)IntegratorEventFile) +
"_4.root";
187 string BgIntegratorEventFile5 =
"Bg" + ((string)IntegratorEventFile) +
"_5.root";
192 , (std::string)
"sgIntegrator" 205 cout <<
" got event pattern: " << pat << endl;
208 DalitzEventList eventList1, eventList2, eventList3, eventList4, eventList5;
210 cout <<
"1 pset pointer in default " << MinuitParameterSet::getDefaultSet() << endl;
211 cout <<
"1 pset pointer in ampsFit " << &fitMPS << endl;
213 cout <<
"1 sizes " << MinuitParameterSet::getDefaultSet()->
size()
214 <<
", " << fitMPS.
size() << endl;
217 cout <<
"reading events from file " << InputFileName1 << endl;
218 eventList1.
fromFile(InputFileName1);
219 cout <<
" I've got " << eventList1.
size() <<
" events (1)." << endl;
221 cout <<
"reading events from file " << InputFileName2 << endl;
222 eventList2.
fromFile(InputFileName2);
223 cout <<
" I've got " << eventList2.
size() <<
" events (2)." << endl;
225 cout <<
"reading events from file " << InputFileName3 << endl;
226 eventList3.
fromFile(InputFileName3);
227 cout <<
" I've got " << eventList3.
size() <<
" events (3)." << endl;
229 cout <<
"reading events from file " << InputFileName4 << endl;
230 eventList4.
fromFile(InputFileName4);
231 cout <<
" I've got " << eventList4.
size() <<
" events (4)." << endl;
233 cout <<
"reading events from file " << InputFileName5 << endl;
234 eventList5.
fromFile(InputFileName5);
235 cout <<
" I've got " << eventList5.
size() <<
" events (5)." << endl;
241 cout <<
"Generating " << Nevents <<
" signal events (1)." << endl;
243 if((
int) saveEvents)eventList1.
save(
"KKpipi_1.root");
245 cout <<
"Generating " << Nevents <<
" signal events (2)." << endl;
247 if((
int) saveEvents)eventList2.
save(
"KKpipi_2.root");
249 cout <<
"Generating " << Nevents <<
" signal events (3)." << endl;
251 if((
int) saveEvents)eventList3.
save(
"KKpipi_3.root");
253 cout <<
"Generating " << Nevents <<
" signal events (4)." << endl;
255 if((
int) saveEvents)eventList4.
save(
"KKpipi_4.root");
257 cout <<
"Generating " << Nevents <<
" signal events (5)." << endl;
259 if((
int) saveEvents)eventList4.
save(
"KKpipi_5.root");
266 cout <<
"2 pset pointer in default " << MinuitParameterSet::getDefaultSet() << endl;
267 cout <<
"2 pset pointer in ampsFit " << &fitMPS << endl;
269 cout <<
"2 sizes " << MinuitParameterSet::getDefaultSet()->
size()
270 <<
", " << fitMPS.
size() << endl;
312 , SgIntegratorEventFile1,
true, &fitMPS);
320 , SgIntegratorEventFile2,
true, &fitMPS);
325 , SgIntegratorEventFile3,
true, &fitMPS);
330 , SgIntegratorEventFile4,
true, &fitMPS);
335 , SgIntegratorEventFile5,
true, &fitMPS);
337 AmpsPdf ampsBg1(pat, &SumBg1
340 , BgIntegratorEventFile1,
true, &fitMPS);
348 , BgIntegratorEventFile2,
true, &fitMPS);
353 , BgIntegratorEventFile3,
true, &fitMPS);
358 , BgIntegratorEventFile4,
true, &fitMPS);
363 , BgIntegratorEventFile5,
true, &fitMPS);
375 cout <<
"3 pset pointer in default " << MinuitParameterSet::getDefaultSet() << endl;
376 cout <<
"3 pset pointer in ampsFit " << &fitMPS << endl;
378 cout <<
"3 sizes " << MinuitParameterSet::getDefaultSet()->
size()
379 <<
", " << fitMPS.
size() << endl;
381 if(! makeIntegrators){
384 ampsSg2.setIntegratorFileName(
"sgIntegrator2");
385 ampsSg3.setIntegratorFileName(
"sgIntegrator3");
386 ampsSg4.setIntegratorFileName(
"sgIntegrator4");
387 ampsSg5.setIntegratorFileName(
"sgIntegrator5");
390 if(! makeIntegrators){
391 ampsBg1.setIntegratorFileName(
"bgIntegrator1");
393 ampsBg2.setIntegratorFileName(
"bgIntegrator2");
394 ampsBg3.setIntegratorFileName(
"bgIntegrator3");
395 ampsBg4.setIntegratorFileName(
"bgIntegrator4");
396 ampsBg5.setIntegratorFileName(
"bgIntegrator5");
409 Neg2LL fcn1(amps1, eventList1, &fitMPS);
410 Neg2LL fcn2(amps2, eventList2, &fitMPS);
411 Neg2LL fcn3(amps3, eventList3, &fitMPS);
412 Neg2LL fcn4(amps4, eventList4, &fitMPS);
413 Neg2LL fcn5(amps5, eventList5, &fitMPS);
420 Neg2LLSum fcn(&fitMPS, &fcn1, &fcn2, &fcn3, &fcn4, &lasso);
422 Neg2LL fcn(amps1, eventList1);
425 if((
int) doNormCheck){
440 cout <<
"now saving all integrators" <<endl;
443 ampsSg2.saveIntegrator(
"sgIntegrator2");
444 ampsSg3.saveIntegrator(
"sgIntegrator3");
445 ampsSg4.saveIntegrator(
"sgIntegrator4");
446 ampsSg5.saveIntegrator(
"sgIntegrator5");
448 ampsBg1.saveIntegrator(
"sgIntegrator1");
450 ampsBg2.saveIntegrator(
"bgIntegrator2");
451 ampsBg3.saveIntegrator(
"bgIntegrator3");
452 ampsBg4.saveIntegrator(
"bgIntegrator4");
453 ampsBg5.saveIntegrator(
"bgIntegrator5");
457 cout <<
"now calling doFinalStat" << endl;
459 if((
bool) doFinalStats){
462 ampsSg2.doFinalStats(&mini);
463 ampsSg3.doFinalStats(&mini);
464 ampsSg4.doFinalStats(&mini);
465 ampsSg5.doFinalStats(&mini);
469 cout<<
"final fcn1 getVal() "<< fcn1.
getVal()<<endl;
471 cout<<
"final fcn2 getVal() "<< fcn2.
getVal()<<endl;
472 cout<<
"final fcn3 getVal() "<< fcn3.
getVal()<<endl;
473 cout<<
"final fcn4 getVal() "<< fcn4.
getVal()<<endl;
474 cout<<
"final fcn5 getVal() "<< fcn5.
getVal()<<endl;
478 cout <<
" ampFit done. Took " << (time(0) - startTime)/60.
479 <<
" min. Returning 0." << endl;
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
bool fromFile(const std::string &fname="DalitzEvents.root")
static void AutogenerateFitFile(const std::string &fname="protoFitAmplitudeFile.txt", const DalitzEventPattern &pat=DalitzEventPattern::NoPattern)
void setIntegratorFileName(const std::string &commaSeparatedList)
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
bool save(const std::string &fname="DalitzEvents.root") const
NamedParameter< std::string > _integratorSource
unsigned int size() const
void doFinalStats(MINT::Minimiser *mini=0)
void setSaveEvents(const std::string &fname="GeneratorEvents.root", const std::string &opt="RECREATE")
bool saveIntegrator(const std::string &fname) const
void printResultVsInput(std::ostream &os=std::cout) const
FromFileGenerator * _fileGen
std::string _integratorFileName
void setWeighted(bool w=true)
const std::vector< T > & getVector() const
double un_normalised_noPs(IDalitzEvent &evt)
virtual unsigned int size() const
void saveEachAmpsHistograms(const std::string &prefix) const
IFastAmplitudeIntegrable * getAmpSum()
double lambda(double x, double y, double z)
void FillEventList(DalitzEventList &evtList, int NEvents)
AmpsPdf(const DalitzEventPattern &pat, IFastAmplitudeIntegrable *amps, double precision=1.e-4, std::string method="efficient", std::string fname="SignalIntegrationEvents.root", bool genMoreEvents=false, MinuitParameterSet *mps=0)
IEventGenerator< IDalitzEvent > * _chosenGen