SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
EventSourceManager.hh
Go to the documentation of this file.
1 #ifndef SLIC_EVENTSOURCEMANAGER_HH_
2 #define SLIC_EVENTSOURCEMANAGER_HH_ 1
3 
4 // SLIC
5 #include "Module.hh"
6 #include "EventSource.hh"
8 #include "GPSEventSource.hh"
10 #include "GeneratorMessenger.hh"
11 #include "Singleton.hh"
12 
13 // Geant4
14 #include "G4VPrimaryGenerator.hh"
15 #include "G4GeneralParticleSource.hh"
16 #include "G4ParticleGun.hh"
17 #include "G4UnitsTable.hh"
18 
19 namespace slic {
20 
25 class EventSourceManager: public Module, public Singleton<EventSourceManager> {
26 
27  public:
28 
32  enum ESourceType {
34  };
35 
36  public:
37 
41  virtual ~EventSourceManager();
42 
47 
48  public:
49 
54  void setSourceType(ESourceType est);
55 
60  void setSourceType(const std::string& s);
61 
67 
73  ESourceType getSourceTypeFromFileExtension(const std::string& ext);
74 
79  const std::string& getCurrentSourceName();
80 
85  const std::string& getSourceNameFromType(ESourceType egt) const;
86 
92  ESourceType getSourceTypeFromName(const std::string& name) const;
93 
98  const std::string& getFilename();
99 
104  void setFilename(const std::string& fileName);
105 
109  void setupEventSource();
110 
115 
120  void setSkipEvents(unsigned int n);
121 
126  unsigned int getSkipEvents();
127 
131  void dumpCurrentEvent();
132 
137 
142  int getNumEventsGenerated();
143 
147  void incrNumEventsGenerated();
148 
153  void generate(G4Event* event);
154 
159  void setEventSource(EventSource* eventSource);
160 
165 
171 
177 
182  void setupEventSource(ESourceType sourceType);
183 
188  void setupEventSource(const std::string& sourceType);
189 
194  void beginEvent(const G4Event* event);
195 
200  void endEvent(const G4Event* event);
201 
206  void beginRun(const G4Run* run);
207 
212  void endRun(const G4Run* run);
213 
218  bool isEOF();
219 
224  bool isNewSource();
225 
230  bool isNewSource(ESourceType est);
231 
236  bool isNewFilename();
237 
242  bool isFileSource();
243 
249 
254  G4GeneralParticleSource* getGPS();
255 
260  G4ParticleGun* getParticleGun();
261 
268  }
269 
274  void setLorentzTransformationAngle(const G4double angle);
275 
280  void setZSmearing(const G4double zSmear) {
281  m_zSmearingParam = zSmear;
282  G4cout << "Set m_zSmearingParam = " << m_zSmearingParam << G4endl;
283  }
284 
289  G4double getZSmearing() {
290  return m_zSmearingParam;
291  }
292 
293  void enablePrintEvent(G4bool enable) {
294  m_enablePrintEvent = enable;
295  }
296 
297  public:
298 
299  void generateNextEvent(G4Event* evt);
300 
301  private:
302 
305 
308 
311 
312  // filename
313  std::string m_filename;
316 
318  int m_ngen;
319 
321  unsigned int m_nskip;
322 
325 
326  // gen strings
327  static std::string STDHEP;
328  static std::string LCIO;
329  static std::string GPS;
330  static std::string PARTICLE_GUN;
331  static std::string LHE;
332  static std::string UNKNOWN;
333 
336 
339 
342 
344 
345 };
346 }
347 
348 #endif
This singleton is responsible for managing physics event sources.
static std::string PARTICLE_GUN
void endRun(const G4Run *run)
const std::string & getCurrentSourceName()
const std::string & getSourceNameFromType(ESourceType egt) const
void setFilename(const std::string &fileName)
void enablePrintEvent(G4bool enable)
ESourceType getSourceTypeFromName(const std::string &name) const
const std::string & getFilename()
void setLorentzTransformationAngle(const G4double angle)
void setZSmearing(const G4double zSmear)
GeneratorMessenger * m_messenger
void generateNextEvent(G4Event *evt)
G4GeneralParticleSource * getGPS()
void setEventSource(EventSource *eventSource)
G4ParticleGun * getParticleGun()
void beginRun(const G4Run *run)
ESourceType getSourceTypeFromFileExtension(const std::string &ext)
EventSource * createEventSource(ESourceType st)
void beginEvent(const G4Event *event)
void generate(G4Event *event)
void endEvent(const G4Event *event)
void setSkipEvents(unsigned int n)
EventSourceWithInputFile * getFileSource()
void setSourceType(ESourceType est)
An EventSource with an associated input file, such as StdHep or LCIO event files.
The virtual base class for a physics event source such as a StdHep file.
Definition: EventSource.hh:19
Geant4 commands related to event generation.
Base class for slic code modules that provides common functionality, such as logging to an output str...
Definition: Module.hh:25
@ name
Definition: LogStream.hh:26