GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions | Variables
gEvGenDM.cxx File Reference
#include <cstdlib>
#include <cassert>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <TFile.h>
#include <TTree.h>
#include <TSystem.h>
#include <TVector3.h>
#include <TH1.h>
#include <TF1.h>
#include "Framework/Algorithm/AlgConfigPool.h"
#include "Framework/Conventions/XmlParserStatus.h"
#include "Framework/Conventions/GBuild.h"
#include "Framework/Conventions/Controls.h"
#include "Framework/Conventions/Constants.h"
#include "Framework/Conventions/Units.h"
#include "Framework/EventGen/EventRecord.h"
#include "Framework/EventGen/GFluxI.h"
#include "Framework/EventGen/GEVGDriver.h"
#include "Framework/EventGen/GMCJDriver.h"
#include "Framework/EventGen/GMCJMonitor.h"
#include "Framework/Interaction/Interaction.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/Ntuple/NtpWriter.h"
#include "Framework/Ntuple/NtpMCFormat.h"
#include "Framework/Numerical/RandomGen.h"
#include "Framework/Numerical/Spline.h"
#include "Framework/ParticleData/PDGCodes.h"
#include "Framework/ParticleData/PDGLibrary.h"
#include "Framework/ParticleData/PDGUtils.h"
#include "Framework/Utils/AppInit.h"
#include "Framework/Utils/RunOpt.h"
#include "Framework/Utils/XSecSplineList.h"
#include "Framework/Utils/StringUtils.h"
#include "Framework/Utils/PrintUtils.h"
#include "Framework/Utils/SystemUtils.h"
#include "Framework/Utils/CmdLnArgParser.h"
Include dependency graph for gEvGenDM.cxx:

Go to the source code of this file.

Functions

void GetCommandLineArgs (int argc, char **argv)
 
void Initialize (void)
 
void PrintSyntax (void)
 
bool CheckUnitarityLimit (void)
 
void GenerateEventsAtFixedInitState (void)
 
int main (int argc, char **argv)
 

Variables

int kDefOptNevents = 0
 
NtpMCFormat_t kDefOptNtpFormat = kNFGHEP
 
Long_t kDefOptRunNu = 0
 
int gOptNevents
 
double gOptDMEnergy
 
double gOptDMEnergyRange
 
double gOptDMMass
 
double gOptZpCoupling
 
map< int, double > gOptTgtMix
 
double gOptMedRatio
 
Long_t gOptRunNu
 
string gOptFlux
 
bool gOptWeighted
 
bool gOptUsingFluxOrTgtMix = false
 
long int gOptRanSeed
 
string gOptInpXSecFile
 
string gOptOutFileName
 
string gOptStatFileName
 

Function Documentation

bool CheckUnitarityLimit ( void  )

Definition at line 876 of file gEvGenDM.cxx.

References genie::units::cm2, genie::AlgConfigPool::CommonList(), genie::Registry::Get(), gOptDMEnergy, gOptDMMass, gOptMedRatio, genie::AlgConfigPool::Instance(), genie::constants::kNucleonMass, genie::constants::kPi, LOG, and pWARN.

877 {
878  // Before generating the events, perform a simple sanity check
879  // We estimate the leading divergent piece of the cross-section
880  // We make sure it does not exceed the unitarity limit
881  double gzp;
882  Registry * r = AlgConfigPool::Instance()->CommonList("Param", "BoostedDarkMatter");
883  r->Get("ZpCoupling", gzp);
884  double gzp4 = TMath::Power(gzp,4);
885  double Mzp = gOptMedRatio * gOptDMMass;
886  double Mzp2 = Mzp*Mzp;
887  // The leading, forward-dominated piece is the same for both DM models
888  double xsec_est = gzp4 / (4. * kPi * Mzp2);
889  double ml = gOptDMMass;
890  double ml2 = ml*ml;
891  double M = kNucleonMass;
892  double M2 = M*M;
893  double Ed = gOptDMEnergy;
894  double Ed2 = Ed*Ed;
895  double pcm2 = M2 * (Ed2 - ml2) / (ml2 + M2 + 2.*M*Ed);
896  double xsec_lim = kPi / pcm2;
897  bool unitary = xsec_lim > xsec_est;
898  if (!unitary) {
899  LOG("gevgen_dm", pWARN)
900  << "Estimated a cross-section " << xsec_est/cm2 << " cm^2";
901  LOG("gevgen_dm", pWARN)
902  << "Unitarity limit set to " << xsec_lim/cm2 << " cm^2";
903  }
904  return unitary;
905 }
double gOptDMMass
Definition: gEvGenDM.cxx:221
static const double kNucleonMass
double gOptMedRatio
Definition: gEvGenDM.cxx:224
double gOptDMEnergy
Definition: gEvGenDM.cxx:219
void Get(RgKey key, const RegistryItemI *&item) const
Definition: Registry.cxx:325
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double cm2
Definition: Units.h:69
#define pWARN
Definition: Messenger.h:60
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
void GenerateEventsAtFixedInitState ( void  )
void GetCommandLineArgs ( int  argc,
char **  argv 
)
void Initialize ( void  )
int main ( int  argc,
char **  argv 
)

Definition at line 235 of file gEvGenDM.cxx.

References genie::PDGLibrary::AddDarkMatter(), genie::AlgConfigPool::CommonList(), GenerateEventsAtFixedInitState(), GetCommandLineArgs(), gOptDMMass, gOptMedRatio, gOptUsingFluxOrTgtMix, gOptZpCoupling, Initialize(), genie::PDGLibrary::Instance(), genie::AlgConfigPool::Instance(), genie::Registry::Lock(), LOG, pERROR, genie::Registry::Set(), and genie::Registry::UnLock().

236 {
237  GetCommandLineArgs(argc,argv);
238  PDGLibrary::Instance()->AddDarkMatter(gOptDMMass,gOptMedRatio);
239  if (gOptZpCoupling > 0.) {
240  Registry * r = AlgConfigPool::Instance()->CommonList("Param", "BoostedDarkMatter");
241  r->UnLock();
242  r->Set("ZpCoupling", gOptZpCoupling);
243  r->Lock();
244  }
245  Initialize();
246 
247 
248  // throw on NaNs and Infs...
249 #if defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT)
250  feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
251 #endif
252  //
253  // Generate dark matter events
254  //
255 
257 #ifdef __CAN_GENERATE_EVENTS_USING_A_FLUX_OR_TGTMIX__
258  GenerateEventsUsingFluxOrTgtMix();
259 #else
260  LOG("gevgen_dm", pERROR)
261  << "\n To be able to generate dark matter events from a flux and/or a target mix"
262  << "\n you need to add the following config options at your GENIE installation:"
263  << "\n --enable-flux-drivers --enable-geom-drivers \n" ;
264 #endif
265  } else {
267  }
268  return 0;
269 }
#define pERROR
Definition: Messenger.h:59
double gOptDMMass
Definition: gEvGenDM.cxx:221
double gOptMedRatio
Definition: gEvGenDM.cxx:224
double gOptZpCoupling
Definition: gEvGenDM.cxx:222
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
void Initialize(void)
void Lock(void)
locks the registry
Definition: Registry.cxx:148
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
bool gOptUsingFluxOrTgtMix
Definition: gEvGen.cxx:238
void GenerateEventsAtFixedInitState(void)
Definition: gEvGen.cxx:293
void GetCommandLineArgs(int argc, char **argv)
Definition: gAtmoEvGen.cxx:563
void Set(RgIMapPair entry)
Definition: Registry.cxx:267
void PrintSyntax ( void  )

Variable Documentation

double gOptDMEnergy

Definition at line 219 of file gEvGenDM.cxx.

Referenced by CheckUnitarityLimit().

double gOptDMEnergyRange

Definition at line 220 of file gEvGenDM.cxx.

double gOptDMMass

Definition at line 221 of file gEvGenDM.cxx.

Referenced by CheckUnitarityLimit(), and main().

string gOptFlux

Definition at line 226 of file gEvGenDM.cxx.

string gOptInpXSecFile

Definition at line 230 of file gEvGenDM.cxx.

double gOptMedRatio

Definition at line 224 of file gEvGenDM.cxx.

Referenced by CheckUnitarityLimit(), and main().

int gOptNevents

Definition at line 218 of file gEvGenDM.cxx.

string gOptOutFileName

Definition at line 231 of file gEvGenDM.cxx.

long int gOptRanSeed

Definition at line 229 of file gEvGenDM.cxx.

Long_t gOptRunNu

Definition at line 225 of file gEvGenDM.cxx.

string gOptStatFileName

Definition at line 232 of file gEvGenDM.cxx.

map<int,double> gOptTgtMix

Definition at line 223 of file gEvGenDM.cxx.

bool gOptUsingFluxOrTgtMix = false

Definition at line 228 of file gEvGenDM.cxx.

bool gOptWeighted

Definition at line 227 of file gEvGenDM.cxx.

double gOptZpCoupling

Definition at line 222 of file gEvGenDM.cxx.

Referenced by main().

int kDefOptNevents = 0

Definition at line 213 of file gEvGenDM.cxx.

NtpMCFormat_t kDefOptNtpFormat = kNFGHEP

Definition at line 214 of file gEvGenDM.cxx.

Long_t kDefOptRunNu = 0

Definition at line 215 of file gEvGenDM.cxx.