MINT2
calculateHadronicParameters.cpp
Go to the documentation of this file.
2 #include <Mint/NamedParameter.h>
4 #include <Mint/DalitzEvent.h>
6 #include <TRandom3.h>
7 #include <Mint/FitAmpSum.h>
8 #include <iostream>
9 #include <fstream>
10 #include <ctime>
11 
13 using namespace std ;
14 
15 int calculateHadronicParameters(const string& config = string()) {
16  if(config.size() > 0){
17  cout << "Using config file " << config << endl ;
19  }
20 
21  NamedParameter<int> EventPattern("Event Pattern", 421, -321, 211, 211, -211);
22  DalitzEventPattern pat(EventPattern.getVector());
23  DalitzEventPattern cpPat(pat) ;
24  cpPat[0].antiThis() ;
25 
26  HadronicParameters::ModelPtr model(new FitAmpSum(pat)) ;
27  HadronicParameters::ModelPtr cpmodel(new FitAmpSum(cpPat)) ;
28 
29  TRandom3 ranLux;
30  NamedParameter<int> RandomSeed("RandomSeed", 0);
31  ranLux.SetSeed((int)RandomSeed);
32  gRandom = &ranLux;
33 
34  NamedParameter<int> nBinsPhase("nBinsPhase", 8) ;
35 
36  NamedParameter<string> binningType("binning_type", string("model"), (char*)0) ;
38  if(string(binningType) == string("model3body"))
39  binning = HadronicParameters::BinningPtr(new HadronicParameters::ModelBinning3Body(model, cpmodel, nBinsPhase)) ;
40  else
41  binning = HadronicParameters::BinningPtr(new HadronicParameters::ModelPhaseBinning(model, cpmodel, nBinsPhase)) ;
42 
43  HadronicParameters pars(binning) ;
44 
45  NamedParameter<int> Nevents("Nevents", 10000);
46  cout << "Calculating parameters with random seed " << int(RandomSeed) << " for "
47  << int(Nevents) << " events." << endl ;
48  int startTime(time(0)) ;
49  pars.add(pat, ranLux, int(Nevents)) ;
50  int endTime(time(0)) ;
51  cout << "Finished calculating. Took " << (endTime - startTime) << " s, "
52  << float(endTime - startTime)/Nevents << " s/event." << endl ;
53 
54  pars.normalise() ;
55 
56  NamedParameter<string> parsName("parsName", string("hadronicPars"), (char*)0) ;
57  cout << "Calculated parameters:" << endl ;
58  pars.Print(string(parsName)) ;
59 
60  NamedParameter<string> outputFile("outputFile", string("hadronicParameters.txt"), (char*)0) ;
61  pars.write(parsName, outputFile) ;
62 
63  return 0 ;
64 }
65 
66 int main(int argc, char** argv) {
67  if(argc > 1)
68  return calculateHadronicParameters(string(argv[1])) ;
70 }
void Print(const std::string &, std::ostream &os=std::cout) const
Print the parameters.
int main(int argc, char **argv)
Class for determining if an event lives in a +ve or -ve bin.
static bool setDefaultInputFile(const std::string &fname)
Phase binning class for 3-body decays using the line s13=s23 to determine favoured/suppressed.
std::pair< double, double > normalise(double norm=1., double normBar=1.)
Normalise the parameters.
void add(IDalitzEvent &, double weight=1.)
Add a DalitzEvent.
const std::vector< T > & getVector() const
void write(const std::string &, const std::string &) const
Write to a file.
int calculateHadronicParameters(const string &config=string())
MINT::counted_ptr< PhaseBinningBase > BinningPtr
Pointer to the binning scheme.