24 time_t startTime = time(0);
28 ranLux.SetSeed((
int)RandomSeed);
46 double width = 1./lifetime ;
48 double deltam = x * width ;
50 double deltagamma = y * width * 2. ;
57 NamedParameter<string> efficiencyFile(
"efficiencyFile",
string(
"/home/ppe/n/nmchugh/SummerProject/DaVinciDev_v44r10p1/AGammaD0Tohhpi0/scripts/mint/h_efficiency.root")) ;
65 TH1F* h_efficiency = NULL ;
67 if((
bool)addExpEffects){
68 TFile* eff_infile = TFile::Open( ((
string) efficiencyFile).c_str() ) ;
69 eff_infile->GetObject(((
string) h_efficiencyName).c_str(), h_efficiency) ;
74 cout <<
" got event pattern: " << pat << endl;
76 unique_ptr<TimeDependentGenerator> timedepgen ;
78 int startinit(time(0)) ;
80 width, deltam, deltagamma, qoverp, phi, &ranLux,
81 h_efficiency, resWidth, (
bool)addExpEffects, sEfficiency)) ;
82 cout <<
"Initialise TimeDependentGenerator took " << time(0) - startinit <<
" s" << endl ;
89 TNtupleD* evttuple = (TNtupleD*)gDirectory->Get(
"DalitzEventList") ;
90 TTree* ntuple =
new TTree(
"TimeEventList",
"TimeEventList") ;
91 evttuple->AddFriend(ntuple) ;
93 double decaytime(0.) ;
94 double smeareddecaytime(0.) ;
95 TBranch* tagbranch = ntuple->Branch(
"tag", &tag,
"tag/I") ;
96 TBranch* decaytimebranch = ntuple->Branch(
"decaytime", &decaytime,
"decaytime/D") ;
97 TBranch* smeareddecaytimebranch = ntuple->Branch(
"smeareddecaytime", &smeareddecaytime,
"smeareddecaytime/D") ;
99 cout <<
"Generating " << Nevents <<
" signal events (1)." << endl;
100 int startTimeGen(time(0)) ;
101 for(
int i = 0 ; i < Nevents ; ++i){
104 cout <<
"Generating candidate " << i <<
" (" << (time(0)-startTimeGen)/
float(i)
105 <<
" s per candidate)" << endl ;
110 evt = timedepgen->generate_event(s13, s23) ;
112 evt = timedepgen->generate_event() ;
118 if(ranLux.Rndm() > 0.5){
124 double _decaytime = ranLux.Exp(lifetime) ;
131 eventList1.
Add(*evt) ;
139 cout <<
"Generator efficiency: " << timedepgen->get_gen_efficiency() << endl ;
140 cout <<
"Generator scale: " << timedepgen->get_scale() << endl ;
143 cout <<
"Save data" << endl ;
147 cout <<
"Save Dalitz plots." << endl ;
149 datH.
save(
"plotsFromEventList.root");
151 cout <<
" genTimeDependent done. Took " << (time(0) - startTime)/60.
152 <<
" min. Returning 0." << endl;
156 TFile fplots(
"plotsVsTime.root",
"recreate") ;
157 unsigned nbins = 1000 ;
161 for(
int tag = -1 ; tag < 2 ; tag += 2){
163 std::ostringstream tagstr ;
165 TH1F pdf = timedepgen->draw_pdf_vs_time(evt, nbins, tmin, tmax,
166 "pdf_vs_time_tag" + tagstr.str()) ;
167 TH1F env = timedepgen->draw_envelope_vs_time(evt, nbins, tmin, tmax,
168 "env_vs_time_tag" + tagstr.str()) ;
static void AutogenerateFitFile(const std::string &fname="protoFitAmplitudeFile.txt", const DalitzEventPattern &pat=DalitzEventPattern::NoPattern)
virtual MINT::counted_ptr< IDalitzEvent > newEvent()
virtual void setValueInVector(unsigned int i, double value)
virtual bool Add(const DalitzEvent &evt)
const std::vector< T > & getVector() const
virtual double getValueFromVector(unsigned int i) const =0
DalitzHistoSet histoSet() const
virtual void setValueInVector(unsigned int i, double value)=0
bool save(const std::string &filename="DalitzHistos.root") const