19 #include <TStopwatch.h> 34 using std::ostringstream;
36 using namespace genie;
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: ";
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);
281 for(
int istep = 0; istep < nsteps; istep++) {
283 ostringstream keystream;
284 keystream <<
"Module-" << istep;
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 ) ) ;
Cross Section Calculation Interface.
virtual void Copy(const GHepRecord &record)
GHepRecordHistory fRecHistory
event record history
THE MAIN GENIE PROJECT NAMESPACE
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
TBits * fFiltUnphysMask
mask for allowing unphysical events to pass through (if requested)
const InteractionListGeneratorI * IntListGenerator(void) const
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
Defines the EventGeneratorI interface.
bool FastForward(void) const
void ProcessEventRecord(GHepRecord *event_rec) const
vector< double > * fEVGTime
module timing info
#define BLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending no additional information.
TStopwatch * fWatch
stopwatch for module timing
void Configure(const Registry &config)
GENIE-defined C++ exceptions.
GVldContext * fVldContext
validity context
void PurgeRecentHistory(int start_step)
int ReturnStep(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
static unsigned int NFlags(void)
virtual bool Accept(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
virtual void Configure(const Registry &config)
void AddSnapshot(int step, GHepRecord *r)
virtual void ResetRecord(void)
A singleton class to manage all named GHepVirtualLists.
static GHepVirtualListFolder * Instance(void)
Misc GENIE control constants.
virtual const AlgId & Id(void) const
Get algorithm ID.
A registry. Provides the container for algorithm configuration parameters.
bool StepBack(void) const
vector< const EventRecordVisitorI * > * fEVGModuleVec
list of modules
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f='*')
static const unsigned int kMaxEVGThreadExceptions
int AddLowRegistry(Registry *rp, bool owns=true)
add registry with lowest priority, also update ownership
const GVldContext & ValidityContext(void) const
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const XSecAlgorithmI * CrossSectionAlg(void) const
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
GENIE's GHEP MC event record.
const InteractionListGeneratorI * fIntListGen
generates list of handled interactions
Root of GENIE utility namespaces.
cet::coded_exception< error, detail::translate > exception
Validity Context for an Event Generator.
static AlgConfigPool * Instance()
void Decode(string encoded_values)
const XSecAlgorithmI * fXSecModel
xsec model for events handled by thread
const Algorithm * SubAlg(const RgKey ®istry_key) const