Public Member Functions | Private Attributes | Friends | List of all members
genie::GHepRecordHistory Class Reference

Holds the history of the GHEP event record as it being modified by the processing steps of an event generation thread. The event record history can be used to step back in the generation sequence if a processing step is to be re-run (this the GENIE event generation framework equivalent of an 'Undo') More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01a/Linux64bit+3.10-2.17-e19-debug/GENIE-Generator/src/Framework/GHEP/GHepRecordHistory.h"

Inheritance diagram for genie::GHepRecordHistory:

Public Member Functions

 GHepRecordHistory ()
 
 GHepRecordHistory (const GHepRecordHistory &history)
 
 ~GHepRecordHistory ()
 
void AddSnapshot (int step, GHepRecord *r)
 
void PurgeHistory (void)
 
void PurgeRecentHistory (int start_step)
 
void ReadFlags (void)
 
void Copy (const GHepRecordHistory &history)
 
void Print (ostream &stream) const
 

Private Attributes

bool fEnabledFull
 keep the full GHEP record history More...
 
bool fEnabledBootstrapStep
 keep only the record that bootsrapped the generation cycle More...
 

Friends

ostream & operator<< (ostream &stream, const GHepRecordHistory &history)
 

Detailed Description

Holds the history of the GHEP event record as it being modified by the processing steps of an event generation thread. The event record history can be used to step back in the generation sequence if a processing step is to be re-run (this the GENIE event generation framework equivalent of an 'Undo')

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

September 23, 2005

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 41 of file GHepRecordHistory.h.

Constructor & Destructor Documentation

GHepRecordHistory::GHepRecordHistory ( )

Definition at line 38 of file GHepRecordHistory.cxx.

References ReadFlags().

38  :
39 map<int, GHepRecord*>()
40 {
41  this->ReadFlags();
42 }
GHepRecordHistory::GHepRecordHistory ( const GHepRecordHistory history)

Definition at line 44 of file GHepRecordHistory.cxx.

References Copy(), and ReadFlags().

44  :
45 map<int, GHepRecord*>()
46 {
47  this->Copy(history);
48  this->ReadFlags();
49 }
void Copy(const GHepRecordHistory &history)
GHepRecordHistory::~GHepRecordHistory ( )

Definition at line 51 of file GHepRecordHistory.cxx.

References PurgeHistory().

52 {
53  this->PurgeHistory();
54 }

Member Function Documentation

void GHepRecordHistory::AddSnapshot ( int  step,
GHepRecord r 
)

Definition at line 56 of file GHepRecordHistory.cxx.

References confusionMatrixTree::count, fEnabledBootstrapStep, fEnabledFull, add_attributes::insert(), LOG, pNOTICE, pWARN, train_latest_snapshot::snapshot, and fillBadChanDBTables::step.

Referenced by Copy(), and genie::EventGenerator::ProcessEventRecord().

57 {
58 // Adds a GHepRecord 'snapshot' at the history buffer
59 
60  bool go_on = (fEnabledFull || (fEnabledBootstrapStep && step==-1));
61  if(!go_on) return;
62 
63  if(!record) {
64  LOG("GHEP", pWARN)
65  << "Input GHEP record snapshot is null. Is not added at history record";
66  return;
67  }
68 
69  if( this->count(step) == 0 ) {
70 
71  LOG("GHEP", pNOTICE)
72  << "Adding GHEP snapshot for processing step: " << step;
73 
74  GHepRecord * snapshot = new GHepRecord(*record);
75  this->insert( map<int, GHepRecord*>::value_type(step,snapshot));
76 
77  } else {
78  // If you have already stepped back and reprocessing, then you should
79  // have purged the 'recent' history (corresponing to 'after the return
80  // processing step')
81  LOG("GHEP", pWARN)
82  << "GHEP snapshot for processing step: " << step << " already exists!";
83  }
84 }
bool fEnabledBootstrapStep
keep only the record that bootsrapped the generation cycle
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pWARN
Definition: Messenger.h:61
def insert(astring, substr, pos, overwrite=True)
bool fEnabledFull
keep the full GHEP record history
#define pNOTICE
Definition: Messenger.h:62
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
void GHepRecordHistory::Copy ( const GHepRecordHistory history)

Definition at line 143 of file GHepRecordHistory.cxx.

References AddSnapshot(), PurgeHistory(), and fillBadChanDBTables::step.

Referenced by GHepRecordHistory().

144 {
145  this->PurgeHistory();
146 
147  GHepRecordHistory::const_iterator history_iter;
148  for(history_iter = history.begin();
149  history_iter != history.end(); ++history_iter) {
150 
151  unsigned int step = history_iter->first;
152  GHepRecord * record = history_iter->second;
153 
154  this->AddSnapshot(step, record);
155  }
156 }
void AddSnapshot(int step, GHepRecord *r)
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
void GHepRecordHistory::Print ( ostream &  stream) const

Definition at line 158 of file GHepRecordHistory.cxx.

References febshutoff_auto::end, allTimeWatchdog::endl, gen_hdf5record::size, and fillBadChanDBTables::step.

Referenced by genie::operator<<().

159 {
160  stream << "\n ****** Printing GHEP record history"
161  << " [depth: " << this->size() << "]" << endl;
162 
163  GHepRecordHistory::const_iterator history_iter;
164  for(history_iter = this->begin();
165  history_iter != this->end(); ++history_iter) {
166 
167  unsigned int step = history_iter->first;
168  GHepRecord * record = history_iter->second;
169 
170  stream << "\n[After processing step = " << step << "] :";
171 
172  if(!record) {
173  stream
174  << "** ERR: No history record available for this processing step!";
175  } else {
176  stream << *record;
177  }
178  }
179 }
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
void GHepRecordHistory::PurgeHistory ( void  )

Definition at line 86 of file GHepRecordHistory.cxx.

References clear, febshutoff_auto::end, LOG, pINFO, pNOTICE, and fillBadChanDBTables::step.

Referenced by Copy(), genie::EventGenerator::ProcessEventRecord(), PurgeRecentHistory(), and ~GHepRecordHistory().

87 {
88  LOG("GHEP", pNOTICE) << "Purging GHEP history buffer";
89 
90  GHepRecordHistory::iterator history_iter;
91  for(history_iter = this->begin();
92  history_iter != this->end(); ++history_iter) {
93 
94  int step = history_iter->first;
95  LOG("GHEP", pINFO)
96  << "Deleting GHEP snapshot for processing step: " << step;
97 
98  GHepRecord * record = history_iter->second;
99  if(record) {
100  delete record;
101  record = 0;
102  }
103  }
104  this->clear();
105 }
vector< vector< double > > clear
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
#define pNOTICE
Definition: Messenger.h:62
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
void GHepRecordHistory::PurgeRecentHistory ( int  start_step)

Definition at line 107 of file GHepRecordHistory.cxx.

References febshutoff_auto::end, LOG, pINFO, pNOTICE, PurgeHistory(), pWARN, and fillBadChanDBTables::step.

Referenced by genie::EventGenerator::ProcessEventRecord().

108 {
109 // Snapshots are added to the history record *after* each processing step
110 // (marked 0,1,2,...). A special snapshot corresponding to the event record
111 // before any processing step is added with key = -1.
112 // Therefore GHepRecordHistory keys should be: -1,0,1,2,3,...
113 
114  LOG("GHEP", pNOTICE)
115  << "Purging recent GHEP history buffer (processing step >= "
116  << start_step << ")";
117 
118  if(start_step < -1) {
119  LOG("GHEP", pWARN)
120  << "Invalid starting step: " << start_step << " - Ignoring";
121  return;
122  }
123 
124  if(start_step == -1) {
125  // delete everything
126  this->PurgeHistory();
127  return;
128  }
129 
130  GHepRecordHistory::iterator history_iter;
131  for(history_iter = this->begin();
132  history_iter != this->end(); ++history_iter) {
133 
134  if(history_iter->first >= start_step) {
135  int step = history_iter->first;
136  LOG("GHEP", pINFO)
137  << "Deleting GHEP snapshot for processing step: " << step;
138  this->erase(history_iter);
139  }
140  }
141 }
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
#define pWARN
Definition: Messenger.h:61
#define pNOTICE
Definition: Messenger.h:62
void GHepRecordHistory::ReadFlags ( void  )

Definition at line 181 of file GHepRecordHistory.cxx.

References genie::utils::print::BoolAsYNString(), fEnabledBootstrapStep, fEnabledFull, LOG, pINFO, and string.

Referenced by GHepRecordHistory().

182 {
183  if (gSystem->Getenv("GHEPHISTENABLE")) {
184 
185  string envvar = string(gSystem->Getenv("GHEPHISTENABLE"));
186 
187  fEnabledFull = (envvar=="FULL") ? true:false;
188  fEnabledBootstrapStep = (envvar=="BOOTSTRAP") ? true:false;
189 
190  } else {
191  // set defaults
192  fEnabledFull = false;
193  fEnabledBootstrapStep = true;
194  }
195 
196  LOG("GHEP", pINFO) << "GHEP History Flags: ";
197  LOG("GHEP", pINFO) << " - Keep Full History: "
199  LOG("GHEP", pINFO) << " - Keep Bootstrap Record Only: "
201 }
bool fEnabledBootstrapStep
keep only the record that bootsrapped the generation cycle
string BoolAsYNString(bool b)
Definition: PrintUtils.cxx:115
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
bool fEnabledFull
keep the full GHEP record history
enum BeamMode string

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const GHepRecordHistory history 
)
friend

Definition at line 31 of file GHepRecordHistory.cxx.

32  {
33  history.Print(stream);
34  return stream;
35  }
void Print(ostream &stream) const

Member Data Documentation

bool genie::GHepRecordHistory::fEnabledBootstrapStep
private

keep only the record that bootsrapped the generation cycle

Definition at line 62 of file GHepRecordHistory.h.

Referenced by AddSnapshot(), and ReadFlags().

bool genie::GHepRecordHistory::fEnabledFull
private

keep the full GHEP record history

Definition at line 61 of file GHepRecordHistory.h.

Referenced by AddSnapshot(), and ReadFlags().


The documentation for this class was generated from the following files: