19#include <TStopwatch.h>
34using std::ostringstream;
66 LOG(
"EventGenerator",
pNOTICE) <<
"Generating Event...";
69 LOG(
"EventGenerator",
pNOTICE) <<
"Clearing the GHepVirtualListFolder";
79 unsigned int nexceptions = 0;
84 string mesgh =
"Event generation thread: " + this->
Id().
Key() +
85 " -> Running module: ";
89 vector<const EventRecordVisitorI *>::const_iterator miter;
96 string mesg = mesgh + visitor->
Id().
Key();
101 <<
"Fast Forward flag was set - Skipping processing step!";
110 (*fEVGTime)[istep] =
fWatch->CpuTime();
115 <<
"An exception was thrown and caught by EventGenerator!";
122 <<
") of EVGThreadExceptions/thread. Aborting";
123 LOG(
"EventGenerator",
pFATAL) <<
"Event : \n" << *event_rec ;
136 bool accept = event_rec->
Accept();
139 <<
"An unphysical event was generated and was accepted by the user";
143 <<
"An unphysical event was generated and was rejected";
159 <<
"Return at processing step " << rstep;
160 advance(miter, rstep-istep-1);
166 <<
"Restoring GHEP as it was just before the return step";
171 event_rec->
Copy(*snapshot);
182 <<
"The EventRecord was visited by all EventRecordVisitors";
184 LOG(
"EventGenerator",
pINFO) <<
"** Event generation timing info **";
191 <<
"module " << visitor->
Id().
Key() <<
" -> ~"
192 << TMath::Max(0.,(*
fEVGTime)[istep++]) <<
" s";
194 LOG(
"EventGenerator",
pNOTICE) <<
"Done generating event!";
239 if (gSystem->Getenv(
"GUNPHYSMASK")) {
241 const char * bitfield = gSystem->Getenv(
"GUNPHYSMASK");
244 bool flag = (bitfield[i]==
'1');
261 LOG(
"EventGenerator",
pDEBUG) <<
"Loading the generator validity context";
263 string encoded_vld_context ;
264 GetParam(
"VldContext", encoded_vld_context ) ;
268 LOG(
"EventGenerator",
pDEBUG) <<
"Loading the event generation modules";
274 <<
"EventGenerator configuration declares null visitor list!";
278 fEVGModuleVec =
new vector<const EventRecordVisitorI *> (nsteps);
279 fEVGTime =
new vector<double>(nsteps);
281 for(
int istep = 0; istep < nsteps; istep++) {
283 ostringstream keystream;
284 keystream <<
"Module-" << istep;
285 RgKey key = keystream.str();
291 <<
" -- Loading module " << istep <<
" : " << temp_alg ;
296 (*fEVGModuleVec)[istep] = visitor;
297 (*fEVGTime)[istep] = 0;
301 RgKey ikey =
"ILstGen";
305 <<
" -- Loading the interaction list generator: " << ialg;
315 <<
" -- Loading the cross section model: " << xalg;
318 this ->
SubAlg( xkey ) ) ;
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
#define BLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending no additional information.
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
static AlgConfigPool * Instance()
int AddLowRegistry(Registry *rp, bool owns=true)
add registry with lowest priority, also update ownership
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
const Algorithm * SubAlg(const RgKey ®istry_key) const
virtual const AlgId & Id(void) const
Get algorithm ID.
const XSecAlgorithmI * CrossSectionAlg(void) const
const GVldContext & ValidityContext(void) const
TStopwatch * fWatch
stopwatch for module timing
vector< const EventRecordVisitorI * > * fEVGModuleVec
list of modules
TBits * fFiltUnphysMask
mask for allowing unphysical events to pass through (if requested)
GHepRecordHistory fRecHistory
event record history
const XSecAlgorithmI * fXSecModel
xsec model for events handled by thread
void ProcessEventRecord(GHepRecord *event_rec) const
void Configure(const Registry &config)
const InteractionListGeneratorI * IntListGenerator(void) const
vector< double > * fEVGTime
module timing info
const InteractionListGeneratorI * fIntListGen
generates list of handled interactions
GVldContext * fVldContext
validity context
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
static unsigned int NFlags(void)
GENIE's GHEP MC event record.
virtual void ResetRecord(void)
virtual bool Accept(void) const
virtual void Copy(const GHepRecord &record)
A singleton class to manage all named GHepVirtualLists.
static GHepVirtualListFolder * Instance(void)
Validity Context for an Event Generator.
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
A registry. Provides the container for algorithm configuration parameters.
Cross Section Calculation Interface.
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
int ReturnStep(void) const
bool FastForward(void) const
bool StepBack(void) const
Misc GENIE control constants.
static const unsigned int kMaxEVGThreadExceptions
GENIE-defined C++ exceptions.
Simple functions for loading and reading nucleus dependent keys from config files.
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f=' *')
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE