CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventAction.cc
Go to the documentation of this file.
7 
8 #include <fstream>
9 
10 using std::cout;
11 using std::endl;
12 
14  RunManager* rm,
15  SimTrackManager* iManager)
16  : m_runManager(rm),
17  m_trackManager(iManager),
18  m_stopFile(p.getParameter<std::string>("StopFile")),
19  m_debug(p.getUntrackedParameter<bool>("debug",false))
20 {
21  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
22 }
23 
25 
26 void EventAction::BeginOfEventAction(const G4Event * anEvent)
27 {
28  if (std::ifstream(m_stopFile.c_str()))
29  {
30  cout << "BeginOfEventAction: termination signal received at event "
31  << anEvent->GetEventID() << endl;
32  //RunManager::instance()->abortRun(true);
33  m_runManager->abortRun(true);
34  }
35 
37  BeginOfEvent e(anEvent);
39 
40 }
41 
42 void EventAction::EndOfEventAction(const G4Event * anEvent)
43 {
44  if (std::ifstream(m_stopFile.c_str()))
45  {
46  cout << "EndOfEventAction: termination signal received at event "
47  << anEvent->GetEventID() << endl;
48  //RunManager::instance()->abortRun(true);
49  m_runManager->abortRun(this);
50  }
51  if (anEvent->GetNumberOfPrimaryVertex()==0)
52  {
53  cout << " EndOfEventAction: event " << anEvent->GetEventID()
54  << " must have failed (no G4PrimaryVertices found) and will be skipped " << endl;
55  return;
56  }
57 
58  // m_trackManager->storeTracks(RunManager::instance()->simEvent());
60  // dispatch now end of event, and only then delete tracks...
61  EndOfEvent e(anEvent);
63 
66 
67 }
68 
69 void EventAction::addTrack(TrackWithHistory* iTrack, bool inHistory, bool withAncestor)
70 {
71  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
72 }
73 
74 void EventAction::addTkCaloStateInfo(uint32_t t,std::pair< math::XYZVectorD ,math::XYZTLorentzVectorD> p)
75 {
77 }
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
T getParameter(std::string const &) const
std::string m_stopFile
Definition: EventAction.h:50
RunManager * m_runManager
Definition: EventAction.h:48
void abortRun(bool softAbort=false)
Definition: RunManager.cc:470
void addTkCaloStateInfo(uint32_t t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > p)
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:44
void EndOfEventAction(const G4Event *evt)
Definition: EventAction.cc:42
void cleanTkCaloStateInfoMap()
void BeginOfEventAction(const G4Event *evt)
Definition: EventAction.cc:26
string rm
Definition: submit.py:76
void storeTracks(G4SimEvent *simEvent)
EventAction(const edm::ParameterSet &ps, RunManager *, SimTrackManager *)
Definition: EventAction.cc:13
SimTrackManager * m_trackManager
Definition: EventAction.h:49
G4SimEvent * simEvent()
Definition: RunManager.h:69
tuple cout
Definition: gather_cfg.py:121
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.cc:69
void setCollapsePrimaryVertices(bool iSet)
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:43
void addTkCaloStateInfo(uint32_t t, std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > p)
Definition: EventAction.cc:74