GenerateEvent.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 HEPfit Collaboration
3  * All rights reserved.
4  *
5  * For the licensing terms see doc/COPYING.
6  */
7 
8 #include "GenerateEvent.h"
9 #include <TSystem.h>
10 #include <TMath.h>
11 #include <TRandom3.h>
12 #include <iomanip>
13 
15  const std::string& ModelConf_i,
16  const std::string& OutDirName_i,
17  const std::string& JobTag_i,
18  const bool noMC_i)
19 : myInputParser(ModelF, ThObsF)
20 {
21  outputTerm = 0;
22  ModelConf = ModelConf_i;
23  JobTag = JobTag_i;
24  if (OutDirName_i != ""){
25  OutDirName = "GeneratedEvents/" + OutDirName_i + JobTag;
26  OldOutDirName = ("GeneratedEvents/DELETED/" + OutDirName_i + JobTag);
27  ObsDirName = OutDirName + "/Observables";
28  ParsDirName = OutDirName + "/Parameters";
29  CGODirName = OutDirName + "/CGO";
30  SMDebugDirName = OutDirName + "/SMDebug";
31  SUSYDebugDirName = OutDirName + "/SUSYDebug";
32  outputTerm = 1;
33  }
34  noMC = noMC_i;
35 
36 #ifdef _MPI
37  MPI_Comm_rank(MPI_COMM_WORLD,&rank);
38  MPI_Comm_size(MPI_COMM_WORLD,&procnum);
39  MPI_Get_processor_name(processorName,&nameLen);
40 #else
41  rank = 0;
42  procnum = 1;
43 #endif
44 }
45 
47 {
48 }
49 
50 void GenerateEvent::generate(int unsigned nIteration_i, int seed, bool weight_i)
51 {
52  weight = weight_i;
53  if (!noMC)
54  throw std::runtime_error("\nGenerateEvent::generate():\n--noMC was not specified as an argument.\nPlease do so for running in Generate Event mode.\n");
55  nIteration = nIteration_i;
56  if (nIteration == 0) outputTerm = 0;
57  int it_comp = 0;
58  int rem_iteration = nIteration + 1;
59  int itno = 0;
60 #ifdef _MPI
61  gRandom->SetSeed(seed * (/*(unsigned)time(NULL)*/ seed + rank * procnum + nameLen));
62 #else
63  gRandom->SetSeed(seed);
64 #endif
65 
66  try {
67  /* initialize model and set model parameters */
68  initModel();
69 
70  /* define parameter distributions */
72 
73  /* create directory structure and necessary files */
74  if (rank == 0) createDirectories();
75 
76  /* memory allocation for MPI */
77  sendbuff = new double[buffersize];
78  sendbuff_w = new double[buffersize];
79  sendbuff_int = new int[1];
80  if( rank == 0 ){
81  buff = new double*[procnum];
82  buff[0]=new double[procnum * buffersize];
83  for(int i = 1; i < procnum; i++) buff[i] = buff[i - 1] + buffersize;
84 
85  buff_w = new double*[procnum];
86  buff_w[0]=new double[procnum * buffersize];
87  for(int i = 1; i < procnum; i++) buff_w[i] = buff_w[i - 1] + buffersize;
88  } else {
89  buff = new double*[1];
90  buff[0] = new double[1];
91  buff_w = new double*[1];
92  buff_w[0] = new double[1];
93  }
94  buff_int = new int*[procnum];
95  buff_int[0]=new int[procnum];
96  for(int i = 1; i < procnum; i++) buff_int[i] = buff_int[i - 1] + 1;
97 
98  /* computation of observables */
99  while (rem_iteration > 0) {
100  itno = rank + nIteration - rem_iteration + 1;
101  if (rank < rem_iteration){
102  generateRandomEvent(itno);
103  for (boost::ptr_vector<Observable>::iterator it = Obs.begin(); it < Obs.end(); it++) {
104  if (it->getObsType().compare("HiggsObservable") != 0) {
105  sendbuff[positionID] = it->computeTheoryValue();
106  if (weight && it->getDistr().compare("noweight") != 0) sendbuff_w[positionID] = it->computeWeight();
107  else sendbuff_w[positionID] = 0.;
108  positionID++;
109  } else {
110  double hw = it->computeWeight();
111  std::vector<double> theoryValues;
112  it->getTheoryValues(theoryValues);
113  for (int j = 0; j < it->getNTheoryValues() + 1 + it->getNChannels(); j++) {
114  sendbuff[positionID] = theoryValues.at(j);
115  if (weight) sendbuff_w[positionID] = hw;
116  positionID++;
117  }
118  }
119  }
120  for (std::vector<CorrelatedGaussianObservables>::iterator it1 = CGO.begin(); it1 < CGO.end(); it1++) {
121  std::vector<Observable> ObsInCGO = it1->getObs();
122  for (std::vector<Observable>::iterator it2 = ObsInCGO.begin(); it2 < ObsInCGO.end(); it2++) {
123  sendbuff[positionID] = it2->computeTheoryValue();
124  if (weight && it2->getDistr().compare("noweight") != 0) sendbuff_w[positionID] = it1->computeWeight();
125  else sendbuff_w[positionID] = 0.;
126  positionID++;
127  }
128  }
129  sendbuff_int[0] = rank + 1;
130  } else {
131  for (int i = 0; i < buffersize; i++){
132  sendbuff[i] = 0.;
133  sendbuff_w[i] = 0.;
134  }
135  sendbuff_int[0] = 0;
136  }
137 
138 #ifdef _MPI
139  MPI::COMM_WORLD.Gather(sendbuff, buffersize, MPI::DOUBLE, buff[0], buffersize, MPI::DOUBLE, 0);
140  if (weight) MPI::COMM_WORLD.Gather(sendbuff_w, buffersize, MPI::DOUBLE, buff_w[0], buffersize, MPI::DOUBLE, 0);
141  MPI::COMM_WORLD.Allgather(sendbuff_int, 1, MPI::INT, buff_int[0], 1, MPI::INT);
142 #else
143  buff[0] = sendbuff;
144  buff_w[0] = sendbuff_w;
145  buff_int[0] = sendbuff_int;
146 #endif
147 
148  /* output generation */
149  if (rank == 0) {
150  itno = nIteration - rem_iteration + 1;
151  for (int iproc = 0; iproc < procnum; iproc++) {
152  positionID = 0;
153  if (buff_int[iproc][0] != 0) {
154  for (std::vector<ModelParameter>::iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++) {
155  if (outputTerm == 1) (*ParsOut[it->getname()]) << buff[iproc][positionID] << std::endl;
156  positionID++;
157  }
158  if (outputTerm == 0 && itno != 0) std::cout << "\nEvent No.: " << itno++ << std::endl;
159  else if (outputTerm == 0 && itno++ == 0) std::cout << "\nThe central event is: " << std::endl;
160  if (outputTerm == 0 && Obs.size() > 0) std::cout << "\nObservables: \n" << std::endl;
161  for (boost::ptr_vector<Observable>::iterator it = Obs.begin(); it < Obs.end(); it++) {
162  if (it->getObsType().compare("HiggsObservable") != 0) {
163  if (outputTerm == 0) {
164  if (weight && it->getDistr().compare("noweight") != 0) std::cout << it->getName() << " = " << buff[iproc][positionID] << " (weight: " << buff_w[iproc][positionID] << ")" << std::endl;
165  else std::cout << it->getName() << " = " << buff[iproc][positionID] << std::endl;
166  positionID++;
167  } else {
168  if (weight && it->getDistr().compare("noweight") != 0) (*ObsOut[it->getName()]) << buff[iproc][positionID] << "\t" << buff_w[iproc][positionID] << std::endl;
169  else (*ObsOut[it->getName()]) << buff[iproc][positionID] << std::endl;
170  positionID++;
171  }
172  } else {
173  if (outputTerm == 0) {
174  if (weight) std::cout << "\n" << it->getName() << " :" << " (weight: " << buff_w[iproc][positionID] << ")" << std::endl;
175  else std::cout << "\n" << it->getName() << " :" << std::endl;
176  for (int i = 0; i < it->getNTheoryValues(); i++) {
177  std::cout << " sigma(" << i + 1 << ") = " << buff[iproc][positionID] << std::endl;
178  positionID++;
179  }
180  std::cout << " BR = " << buff[iproc][positionID] << std::endl;
181  positionID++;
182  for (int i = it->getNTheoryValues() + 1; i < it->getNTheoryValues() + 1 + it->getNChannels(); i++) {
183  std::cout << " mu(" << i - (it->getNTheoryValues() + 1) + 1 << ") = " << buff[iproc][positionID] << std::endl;
184  positionID++;
185  }
186  } else {
187  for (int i = 0; i < it->getNTheoryValues(); i++) {
188  (*ObsOut[it->getName()]) << std::setw(10) << std::left << buff[iproc][positionID];
189  positionID++;
190  }
191  (*ObsOut[it->getName()]) << std::setw(10) << std::left << buff[iproc][positionID];
192  positionID++;
193  for (int i = it->getNTheoryValues() + 1; i < it->getNTheoryValues() + 1 + it->getNChannels(); i++) {
194  (*ObsOut[it->getName()]) << std::setw(10) << std::left << buff[iproc][positionID];
195  positionID++;
196  }
197  if (weight) (*ObsOut[it->getName()]) << std::setw(10) << std::left << buff_w[iproc][positionID - 1];
198  (*ObsOut[it->getName()]) << std::endl;
199  }
200  }
201  }
202  if (outputTerm == 0 && CGO.size() > 0) std::cout << "\nCorrelated Gaussian Observables: \n" << std::endl;
203  for (std::vector<CorrelatedGaussianObservables>::iterator it1 = CGO.begin(); it1 < CGO.end(); it1++) {
204  if (outputTerm == 0) {
205  if (weight && !(it1->isPrediction())) std::cout << it1->getName() << ": (weight: " << buff_w[iproc][positionID] << ")" << std::endl;
206  else std::cout << it1->getName() << std::endl;
207  }
208  std::vector<Observable> ObsInCGO = it1->getObs();
209  for (std::vector<Observable>::iterator it2 = ObsInCGO.begin(); it2 < ObsInCGO.end(); it2++) {
210  if (outputTerm == 0) {
211  if (weight && it2->getDistr().compare("noweight") != 0) std::cout << it2->getName() << " = " << buff[iproc][positionID] << std::endl;
212  else std::cout << it2->getName() << " = " << buff[iproc][positionID] << std::endl;
213  positionID++;
214  } else {
215  if (weight && it2->getDistr().compare("noweight") != 0) (*CGOOut[it1->getName()]) << buff[iproc][positionID] << "\t";
216  else (*CGOOut[it1->getName()]) << buff[iproc][positionID] << "\t";
217  positionID++;
218  }
219  }
220  if (outputTerm == 0) std::cout << std::endl;
221  else (*CGOOut[it1->getName()]) << buff_w[iproc][positionID - 1] << std::endl;
222  }
223  }
224  }
225  }
226 
227  /* computation of remaining iterations */
228  it_comp = 0;
229  for(int iproc = 0; iproc < procnum; iproc++){
230  it_comp = std::max(it_comp, buff_int[iproc][0]);
231  }
232  rem_iteration -= it_comp;
233  }
234 
235  /* closing of output streams */
236  if (outputTerm == 1 && rank == 0){
237  for (std::vector<ModelParameter>::iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++) {
238  ParsOut[it->getname()]->close();
239  }
240  for (boost::ptr_vector<Observable>::iterator it = Obs.begin(); it < Obs.end(); it++){
241  ObsOut[it->getName()]->close();
242  }
243  for (std::vector<CorrelatedGaussianObservables>::iterator it1 = CGO.begin(); it1 < CGO.end(); it1++){
244  CGOOut[it1->getName()]->close();
245  }
246  summary << "Events\t" << nIteration << "\n";
247  summary.close();
248  std::cout << "Output written to: " << OutDirName << "\n" << std::endl;
249  } else {
250  if (rank == 0) std::cout << std::endl;
251  }
252  return;
253  } catch (std::string message) {
254  std::cerr << message << std::endl;
255  exit(EXIT_FAILURE);
256  }
257  delete buff[0];
258  delete [] buff;
259  delete [] sendbuff;
260 
261  delete buff_w[0];
262  delete [] buff_w;
263  delete [] sendbuff_w;
264 
265  delete buff_int[0];
266  delete [] buff_int;
267  delete [] sendbuff_int;
268 }
269 
271 {
272  if (nIteration > 0 && outputTerm == 1){
273  FileStat_t info;
274  if (gSystem->GetPathInfo("GeneratedEvents", info) != 0) {
275  gSystem->MakeDirectory("GeneratedEvents");
276  }
277  if (gSystem->GetPathInfo("GeneratedEvents/DELETED", info) != 0) {
278  gSystem->MakeDirectory("GeneratedEvents/DELETED");
279  }
280  if (gSystem->GetPathInfo(OutDirName.c_str(), info) == 0){
281  if (gSystem->GetPathInfo(OldOutDirName.c_str(), info) == 0){
282  gSystem->Exec(("rm -rf " + OldOutDirName).c_str());
283  std::cout << "\nWARNING: Removed " << OldOutDirName << std::endl;
284  }
285  gSystem->Exec(("mv -f " + OutDirName + " " + "GeneratedEvents/DELETED/").c_str());
286  std::cout << "WARNING: " << OutDirName << " exists!\nWARNING: " << OutDirName <<" moved to " << OldOutDirName << "\n"<< std::endl;
287  }
288  gSystem->MakeDirectory(OutDirName.c_str());
289  gSystem->MakeDirectory(ObsDirName.c_str());
290  gSystem->MakeDirectory(CGODirName.c_str());
291  gSystem->MakeDirectory(ParsDirName.c_str());
292 
293  if (outputTerm == 1){
294  summary.open((OutDirName + "/Summary.txt").c_str(), std::ios::out);
295  summary << "Model\t" << ModelName << "\n";
296  }
297 
298  for (std::vector<ModelParameter>::iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++) {
299  ParsOut[it->getname()] = boost::make_shared<std::ofstream>((ParsDirName + "/" + it->getname() + ".txt").c_str(), std::ios::out);
300  summary << "Parameter\t" << it->getname() << "\n";
301  }
302 
303  for (boost::ptr_vector<Observable>::iterator it = Obs.begin(); it < Obs.end(); it++) {
304  ObsOut[it->getName()] = boost::make_shared<std::ofstream>((ObsDirName + "/" + it->getName() + ".txt").c_str(), std::ios::out);
305  if (outputTerm != 0 && it->getObsType().compare("HiggsObservable") == 0) {
306  for (int i = 0; i < it->getNTheoryValues(); i++) (*ObsOut[it->getName()]) << std::setw(6) << std::left << "sigma(" << std::setw(1) << i << std::setw(3) << std::left <<")";
307  (*ObsOut[it->getName()]) << std::setw(10) << std::left << "BR";
308  for (int i = it->getNTheoryValues() + 1; i < it->getNTheoryValues() + 1 + it->getNChannels(); i++) (*ObsOut[it->getName()]) << std::setw(3) << std::left << "mu(" << std::setw(1) << i << std::setw(6) << std::left << ")";
309  if (weight) (*ObsOut[it->getName()]) << std::setw(10) << std::left << "weight";
310  (*ObsOut[it->getName()]) << std::endl;
311  }
312  summary << "Observable\t" << it->getName() << "\n";
313  }
314  for (std::vector<CorrelatedGaussianObservables>::iterator it = CGO.begin(); it < CGO.end(); it++){
315  CGOOut[it->getName()] = boost::make_shared<std::ofstream>((CGODirName + "/" + it->getName() + ".txt").c_str(), std::ios::out);
316  summary << "CGO\t" << it->getName() << "\n";
317  }
318 
319  std::cout << "\nRunning in Event Generation mode... \nWARNING: The output should not be used for any statistical analysis. \n Neither randomness or completness of the sample is gauranteed!!\n" << std::endl;
320  } else if(nIteration > 0 && outputTerm == 0) {
321  std::cout << "\nRunning in Event Generation mode... \nWARNING: Output being sent to terminal, no data written to disk!! \nWARNING: The output should not be used for any statistical analysis. \n Neither randomness or completness of the sample is gauranteed!!\n" << std::endl;
322  } else {
323  std::cout.precision(10);
324  std::cout << std::endl << "Running in Single Event mode...\nNo data will be written to disk!\n" << std::endl;
325  }
326 }
327 
331  if (Obs.size() == 0 && CGO.size() == 0) {
332  if (rank == 0) throw std::runtime_error("\nGenerateEvent::generate(): No observables or correlated Gaussian observables defined in " + ModelConf +" file\n");
333  else sleep (2);
334  }
335  std::map<std::string, double> DP;
336  for (std::vector<ModelParameter>::iterator it = ModPars.begin(); it < ModPars.end(); it++) {
337  if (it->IsCorrelated()) {
338  for (unsigned int i = 0; i < CGP.size(); i++) {
339  if (CGP[i].getName().compare(it->getCgp_name()) == 0) {
340  std::string index = it->getname().substr(CGP[i].getName().size());
341  long int lindex = strtol(index.c_str(), NULL, 10);
342  if (lindex > 0) DP[CGP[i].getPar(lindex - 1).getname()] = CGP[i].getPar(lindex - 1).getave();
343  else {
344  std::stringstream out;
345  out << it->getname();
346  throw std::runtime_error("MonteCarlo::Run(): " + out.str() + "seems to be part of a CorrelatedGaussianParameters object, but I couldn't find the corresponding object");
347  }
348  }
349  }
350  } else DP[it->getname()] = it->getave();
351 
352  if (it->geterrg() > 0. || it->geterrf() > 0.) ModParsVar.push_back(*it);
353  }
354  if (!myInputParser.getModel()->Init(DP)) {
355  if (rank == 0) throw std::runtime_error("\nERROR: Model cannot be initialization");
356  else sleep(2);
357  }
358 
359  buffersize = ModParsVar.size();
360  for (std::vector<CorrelatedGaussianObservables>::iterator it = CGO.begin(); it < CGO.end(); it++){
361  buffersize += it->getObs().size();
362  }
363  for (boost::ptr_vector<Observable>::iterator it = Obs.begin(); it < Obs.end(); it++) {
364  if (it->getObsType().compare("HiggsObservable") == 0) {
365  buffersize += it->getNTheoryValues() + 1 + it->getNChannels();
366  } else {
367  buffersize += 1;
368  }
369  }
370 }
371 
373 {
374  if (outputTerm == 0 && rank == 0) std::cout << "\nParameters varied in Event Generation:" << std::endl;
375  for (std::vector<ModelParameter>::const_iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++) {
376  if (it->IsCorrelated()) {
377  for (unsigned int i = 0; i < CGP.size(); i++) {
378  if (CGP[i].getName().compare(it->getCgp_name()) == 0) {
379  std::string index = it->getname().substr(CGP[i].getName().size());
380  long int lindex = strtol(index.c_str(), NULL, 10);
381  if (lindex > 0) {
382  if (outputTerm == 0 && rank == 0) std::cout << CGP[i].getPar(lindex - 1).getname() << ", ";
383  } else {
384  std::stringstream out;
385  out << it->getname();
386  throw std::runtime_error("MonteCarlo::Run(): " + out.str() + "seems to be part of a CorrelatedGaussianParameters object, but I couldn't find the corresponding object");
387  }
388  }
389  }
390  } else if (outputTerm == 0 && rank == 0) std::cout << it->getname() << ", "; //<< k << std::endl;
391  if (it->geterrf() == 0. && it->geterrg() != 0.){
392  DDist[it->getname()] = new TF1(it->getname().c_str(),
393  "1./sqrt(2.*TMath::Pi())/[1] * exp(-(x-[0])*(x-[0])/2./[1]/[1])",
394  it->getmin(),it->getmax());
395  DDist[it->getname()]->SetParameter(0, it->getave());
396  DDist[it->getname()]->SetParameter(1, it->geterrg());
397  }
398  else if (it->geterrg() == 0. && it->geterrf() != 0.){
399  DDist[it->getname()] = new TF1(it->getname().c_str(),
400  "1/([1]-[0])",
401  it->getmin(), it->getmax());
402  DDist[it->getname()]->SetParameter(0,it->getmin());
403  DDist[it->getname()]->SetParameter(1,it->getmax());
404  }
405  else {
406  DDist[it->getname()] = new TF1(it->getname().c_str(),
407  "(TMath::Erf((x-[0]+[2])/sqrt(2.)/[1])-TMath::Erf((x-[0]-[2])/sqrt(2.)/[1]))/4./[2]",
408  it->getmin(), it->getmax());
409  DDist[it->getname()]->SetParameter(0, it->getave());
410  DDist[it->getname()]->SetParameter(1, it->geterrg());
411  DDist[it->getname()]->SetParameter(2, it->geterrf());
412  }
413  }
414  if (outputTerm == 0) std::cout << std::endl;
415 }
416 
418 {
419  positionID = 0;
420 
421  std::vector<double> vec(ModParsVar.size(),0.);
422  for (unsigned int i=0; i< vec.size();i++){
423  if (iterationNo == 0) vec[i] = ModParsVar[i].getave();
424  else vec[i] = DDist[ModParsVar[i].getname()]->GetRandom();
425  }
426 
428  for (std::vector<ModelParameter>::const_iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++){
429  if (it->IsCorrelated()) {
430  for (unsigned int i = 0; i < CGP.size(); i++) {
431  if (CGP[i].getName().compare(it->getCgp_name()) == 0) {
432  std::string index = it->getname().substr(CGP[i].getName().size());
433  long int lindex = strtol(index.c_str(), NULL, 10);
434  if (lindex > 0) {
435  sendbuff[positionID] = DPars[CGP[i].getPar(lindex - 1).getname()];
436  sendbuff_w[positionID] = DPars[CGP[i].getPar(lindex - 1).getname()];
437  positionID++;
438  }
439  else {
440  std::stringstream out;
441  out << it->getname();
442  throw std::runtime_error("MonteCarlo::Run(): " + out.str() + "seems to be part of a CorrelatedGaussianParameters object, but I couldn't find the corresponding object");
443  }
444  }
445  }
446  } else {
447  sendbuff[positionID] = DPars[it->getname()];
448  sendbuff_w[positionID] = DPars[it->getname()];
449  positionID++;
450  }
451  }
452  Mod->Update(DPars);
453 }
454 
455 void GenerateEvent::setDParsFromParameters(const std::vector<double>& parameters, std::map<std::string,double>& DPars_i)
456 {
457  std::map<std::string, std::vector<double> > cgpmap;
458 
459  unsigned int k = 0;
460  for (std::vector<ModelParameter>::const_iterator it = ModParsVar.begin(); it < ModParsVar.end(); it++){
461 
462  if (it->IsCorrelated()) {
463  std::string index = it->getname().substr(it->getCgp_name().size());
464  unsigned long int lindex = strtol(index.c_str(),NULL,10);
465  if (lindex - 1 == cgpmap[it->getCgp_name()].size()) cgpmap[it->getCgp_name()].push_back(parameters[k]);
466  else {
467  std::stringstream out;
468  out << it->getname() << " " << lindex;
469  throw std::runtime_error("GenerateEvent::setDParsFromParameters(): " + out.str() + "seems to be a CorrelatedGaussianParameters object but the corresponding parameters are missing or not in the right order");
470  }
471 
472  } else DPars_i[it->getname()] = parameters[k];
473  k++;
474  }
475 
476  for (unsigned int j = 0; j < CGP.size(); j++) {
477  std::vector<double> current = cgpmap.at(CGP[j].getName());
478  if (current.size() != CGP[j].getPars().size()) {
479  std::stringstream out;
480  out << CGP[j].getName();
481  throw std::runtime_error("GenerateEvent::setDParsFromParameters(): " + out.str() + " appears to be represented in cgpmap with a wrong size");
482  }
483 
484  std::vector<double> porig = CGP[j].getOrigParsValue(current);
485 
486  for(unsigned int l = 0; l < porig.size(); l++) {
487  DPars_i[CGP[j].getPar(l).getname()] = porig[l];
488  }
489  }
490 }
491 
492 void GenerateEvent::addCustomObservableType(const std::string name, boost::function<Observable*() > funct){
494 }
std::string ObsDirName
String for the name of the observables output directory.
virtual bool Update(const std::map< std::string, double > &DPars)=0
The update method for the model.
std::string ReadParameters(const std::string filename_i, const int rank, std::vector< ModelParameter > &ModelPars, boost::ptr_vector< Observable > &Observables, std::vector< Observable2D > &Observables2D, std::vector< CorrelatedGaussianObservables > &CGO, std::vector< CorrelatedGaussianParameters > &CGP)
The member that parses the Observable2D directives from SomeModel.conf file.
Definition: InputParser.cpp:28
std::map< std::string, double > DPars
Map of parameters to be passed to Model().
bool outputTerm
Flag to specify output stream storage.
std::string ModelConf
String for the name of the SomeModel.conf file.
std::vector< Observable2D > Obs2D
Vector for the Observables2D defined in SomeModel.conf.
void generate(int unsigned nIteration_i, int seed=0, bool weight_i=false)
The method used to generate events and format output.
double ** buff_w
A class for.
Definition: ModelFactory.h:25
std::ofstream summary
void generateRandomEvent(int iterationNo)
This member generates random numbers for the parameters being varied in the model. The first set is always the central value of the parameter.
GenerateEvent(ModelFactory &ModelF, ThObsFactory &ThObsF, const std::string &ModelConf_i, const std::string &OutDirName_i, const std::string &JobTag_i, const bool noMC_i)
Constructor.
void defineParameterDistributions()
The parameter distributions as specified in SomeModel.conf is defined here.
A class for.
Definition: ThObsFactory.h:26
double ** buff
std::string CGODirName
String for the name of the Correlated Gaussian Observables output directory.
std::string JobTag
String for the optional JobTag argument to be passes to the executable.
std::vector< CorrelatedGaussianParameters > CGP
vector for the Correlated Gaussian Parameters defined in SomeModel.conf.
double * sendbuff
std::string SUSYDebugDirName
String for the name of the Correlated Gaussian Observables output directory.
InputParser myInputParser
An oject of the InputParser() class.
std::map< std::string, boost::shared_ptr< std::ofstream > > ParsOut
Map of output stream for parameters.
std::vector< ModelParameter > ModPars
Vector for the model parameters defined in SomeModel.conf.
void addCustomObservableType(const std::string name, boost::function< Observable *() > funct)
boost::ptr_vector< Observable > Obs
Vector for the observables defined in SomeModel.conf.
std::string OutDirName
String for the name of the output directory.
A class for observables.
Definition: Observable.h:28
std::string OldOutDirName
String for the name of the backup output directory.
virtual bool Init(const std::map< std::string, double > &DPars)
A method to initialize the model parameters.
std::string ModelName
std::vector< CorrelatedGaussianObservables > CGO
vector for the Correlated Gaussian Observables defined in SomeModel.conf.
void setDParsFromParameters(const std::vector< double > &parameters, std::map< std::string, double > &DPars_i)
void addCustomObservableType(const std::string name, boost::function< Observable *() > funct)
std::string ParsDirName
String for the name of the parameters output directory.
Model * Mod
Name of the model as defined in SomeModel.conf.
bool noMC
Flag to initiate noMC mode.
std::map< std::string, boost::shared_ptr< std::ofstream > > ObsOut
Map of output stream for observables.
std::vector< ModelParameter > ModParsVar
Vector for the model parameters varied in SomeModel.conf.
void createDirectories()
double * sendbuff_w
std::map< std::string, TF1 * > DDist
Map of parameter distributions.
std::map< std::string, boost::shared_ptr< std::ofstream > > CGOOut
Map of output stream for corellated Gaussian observables.
virtual ~GenerateEvent()
The default destructor.
StandardModel * getModel() const
A get method to access the pointer to the object of the StandardModel class.
Definition: InputParser.h:110
std::string SMDebugDirName
String for the name of the observables output directory.