GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gMakeSplinesDM.cxx File Reference
#include <cassert>
#include <cstdlib>
#include <string>
#include <vector>
#include <TSystem.h>
#include "Framework/Algorithm/AlgConfigPool.h"
#include "Framework/Conventions/GBuild.h"
#include "Framework/EventGen/GEVGDriver.h"
#include "Framework/Interaction/Interaction.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/Numerical/RandomGen.h"
#include "Framework/ParticleData/PDGCodeList.h"
#include "Framework/ParticleData/PDGCodes.h"
#include "Framework/ParticleData/PDGLibrary.h"
#include "Framework/Utils/RunOpt.h"
#include "Framework/Utils/AppInit.h"
#include "Framework/Utils/StringUtils.h"
#include "Framework/Utils/PrintUtils.h"
#include "Framework/Utils/XSecSplineList.h"
#include "Framework/Utils/CmdLnArgParser.h"
Include dependency graph for gMakeSplinesDM.cxx:

Go to the source code of this file.

Functions

void GetCommandLineArgs (int argc, char **argv)
 
void PrintSyntax (void)
 
PDGCodeListGetTargetCodes (void)
 
int main (int argc, char **argv)
 

Variables

string gOptTgtPdgCodeList = ""
 
string gOptGeomFilename = ""
 
int gOptNKnots = -1
 
double gOptMaxE = -1.
 
vector< double > gOptDMMasses
 
vector< double > gOptMedRatios
 
vector< double > gOptZpCouplings
 
bool gOptNoCopy = false
 
long int gOptRanSeed = -1
 
string gOptInpXSecFile = ""
 
string gOptOutXSecFile = ""
 

Function Documentation

void GetCommandLineArgs ( int  argc,
char **  argv 
)
PDGCodeList* GetTargetCodes ( void  )
int main ( int  argc,
char **  argv 
)

Definition at line 153 of file gMakeSplinesDM.cxx.

References genie::PDGLibrary::AddDarkMatter(), genie::RunOpt::BuildTune(), genie::AlgConfigPool::CommonList(), genie::GEVGDriver::Configure(), genie::GEVGDriver::CreateSplines(), GetCommandLineArgs(), GetTargetCodes(), gOptDMMasses, gOptInpXSecFile, gOptMaxE, gOptMedRatios, gOptNKnots, gOptNoCopy, gOptOutXSecFile, gOptRanSeed, gOptZpCouplings, genie::RunOpt::Instance(), genie::PDGLibrary::Instance(), genie::AlgConfigPool::Instance(), genie::XSecSplineList::Instance(), genie::kPdgDarkMatter, genie::Registry::Lock(), LOG, genie::utils::app_init::MesgThresholds(), pFATAL, pINFO, PrintSyntax(), genie::utils::app_init::RandGen(), genie::PDGLibrary::ReloadDBase(), genie::XSecSplineList::SaveAsXml(), genie::Registry::Set(), genie::GEVGDriver::SetEventGeneratorList(), genie::Registry::UnLock(), and genie::utils::app_init::XSecTable().

154 {
155  // Parse command line arguments
156  GetCommandLineArgs(argc,argv);
157 
158  if ( ! RunOpt::Instance()->Tune() ) {
159  LOG("gmkspl", pFATAL) << " No TuneId in RunOption";
160  exit(-1);
161  }
162  RunOpt::Instance()->BuildTune();
163 
164  for (vector<double>::iterator mass = gOptDMMasses.begin(); mass != gOptDMMasses.end(); ++mass) {
165  for (vector<double>::iterator ratio = gOptMedRatios.begin(); ratio != gOptMedRatios.end(); ++ratio) {
166  for (vector<double>::iterator coup = gOptZpCouplings.begin(); coup != gOptZpCouplings.end(); ++coup) {
167  // Add dark matter to the table
168  PDGLibrary::Instance()->ReloadDBase();
169  PDGLibrary::Instance()->AddDarkMatter(*mass,*ratio);
170  if (*coup > 0.) {
171  Registry * r = AlgConfigPool::Instance()->CommonList("Param", "BoostedDarkMatter");
172  r->UnLock();
173  r->Set("ZpCoupling", *coup);
174  r->Lock();
175  }
176 
177 
178  // throw on NaNs and Infs...
179 #if defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT)
180  feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
181 #endif
182 
183  // Init
184  utils::app_init::MesgThresholds(RunOpt::Instance()->MesgThresholdFiles());
187 
188  // Get list of neutrinos and nuclear targets
189 
190  // PDGCodeList * neutrinos = GetNeutrinoCodes();
191  PDGCodeList * targets = GetTargetCodes();
192 
193  if(!targets || targets->size() == 0 ) {
194  LOG("gmkspl_dm", pFATAL) << "Empty target PDG code list";
195  PrintSyntax();
196  exit(3);
197  }
198 
199  LOG("gmkspl_dm", pINFO) << "Targets: " << *targets;
200 
201  // Loop over all possible input init states and ask the GEVGDriver
202  // to build splines for all the interactions that its loaded list
203  // of event generators can generate.
204 
205  // PDGCodeList::const_iterator nuiter;
206  PDGCodeList::const_iterator tgtiter;
207  // for(nuiter = neutrinos->begin(); nuiter != neutrinos->end(); ++nuiter) {
208  for(tgtiter = targets->begin(); tgtiter != targets->end(); ++tgtiter) {
209  int dmpdgc = kPdgDarkMatter;
210  int tgtpdgc = *tgtiter;
211  InitialState init_state(tgtpdgc, dmpdgc);
212  GEVGDriver driver;
213  driver.SetEventGeneratorList(RunOpt::Instance()->EventGeneratorList());
214  driver.Configure(init_state);
216  }
217  delete targets;
218  }
219  }
220  }
221  // }
222 
223  // Save the splines at the requested XML file
224  XSecSplineList * xspl = XSecSplineList::Instance();
225  bool save_init = !gOptNoCopy;
226  xspl->SaveAsXml(gOptOutXSecFile, save_init);
227 
228 
229  return 0;
230 }
void RandGen(long int seed)
Definition: AppInit.cxx:30
PDGCodeList * GetTargetCodes(void)
void XSecTable(string inpfile, bool require_table)
Definition: AppInit.cxx:38
int gOptNKnots
#define pFATAL
Definition: Messenger.h:56
const int kPdgDarkMatter
Definition: PDGCodes.h:218
vector< double > gOptDMMasses
A list of PDG codes.
Definition: PDGCodeList.h:32
string gOptOutXSecFile
string gOptInpXSecFile
Definition: gAtmoEvGen.cxx:313
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void SetEventGeneratorList(string listname)
Definition: GEVGDriver.cxx:348
vector< double > gOptMedRatios
vector< double > gOptZpCouplings
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:54
#define pINFO
Definition: Messenger.h:62
void Lock(void)
locks the registry
Definition: Registry.cxx:148
void SaveAsXml(const string &filename, bool save_init=true) const
void UnLock(void)
unlocks the registry (doesn&#39;t unlock items)
Definition: Registry.cxx:153
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:137
double gOptMaxE
A vector of EventGeneratorI objects.
void CreateSplines(int nknots=-1, double emax=-1, bool inLogE=true)
Definition: GEVGDriver.cxx:577
void MesgThresholds(string inpfile)
Definition: AppInit.cxx:99
void GetCommandLineArgs(int argc, char **argv)
Definition: gAtmoEvGen.cxx:563
bool gOptNoCopy
List of cross section vs energy splines.
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
void PrintSyntax(void)
Initial State information.
Definition: InitialState.h:48
long int gOptRanSeed
Definition: gAtmoEvGen.cxx:312
void PrintSyntax ( void  )

Variable Documentation

vector<double> gOptDMMasses

Definition at line 144 of file gMakeSplinesDM.cxx.

Referenced by main().

string gOptGeomFilename = ""

Definition at line 141 of file gMakeSplinesDM.cxx.

string gOptInpXSecFile = ""

Definition at line 149 of file gMakeSplinesDM.cxx.

double gOptMaxE = -1.

Definition at line 143 of file gMakeSplinesDM.cxx.

vector<double> gOptMedRatios

Definition at line 145 of file gMakeSplinesDM.cxx.

Referenced by main().

int gOptNKnots = -1

Definition at line 142 of file gMakeSplinesDM.cxx.

bool gOptNoCopy = false

Definition at line 147 of file gMakeSplinesDM.cxx.

string gOptOutXSecFile = ""

Definition at line 150 of file gMakeSplinesDM.cxx.

long int gOptRanSeed = -1

Definition at line 148 of file gMakeSplinesDM.cxx.

string gOptTgtPdgCodeList = ""

Definition at line 140 of file gMakeSplinesDM.cxx.

vector<double> gOptZpCouplings

Definition at line 146 of file gMakeSplinesDM.cxx.

Referenced by main().