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  // soft abort run
49  m_runManager->abortRun(true);
50  }
51  if (anEvent->GetNumberOfPrimaryVertex()==0)
52  {
53  cout << " EndOfEventAction: event " << anEvent->GetEventID()
54  << " must have failed (no G4PrimaryVertices found) and will be skipped "
55  << endl;
56  return;
57  }
58 
59  // m_trackManager->storeTracks(RunManager::instance()->simEvent());
61  // dispatch now end of event, and only then delete tracks...
62  EndOfEvent e(anEvent);
64 
67 
68 }
69 
70 void EventAction::addTrack(TrackWithHistory* iTrack, bool inHistory, bool withAncestor)
71 {
72  m_trackManager->addTrack(iTrack, inHistory, withAncestor);
73 }
74 
75 void EventAction::addTkCaloStateInfo(uint32_t t,const std::pair< math::XYZVectorD,
77 {
79 }
80 
82 {
84 }
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
T getParameter(std::string const &) const
std::string m_stopFile
Definition: EventAction.h:52
RunManager * m_runManager
Definition: EventAction.h:50
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:15
void abortRun(bool softAbort=false)
Definition: RunManager.cc:484
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:46
void EndOfEventAction(const G4Event *evt)
Definition: EventAction.cc:42
void cleanTkCaloStateInfoMap()
void abortEvent()
Definition: RunManager.cc:375
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
void BeginOfEventAction(const G4Event *evt)
Definition: EventAction.cc:26
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Definition: Vector3D.h:9
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:51
G4SimEvent * simEvent()
Definition: RunManager.h:70
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:75
void abortEvent()
Definition: EventAction.cc:81
tuple cout
Definition: gather_cfg.py:121
void addTrack(TrackWithHistory *iTrack, bool inHistory, bool withAncestor)
Definition: EventAction.cc:70
void setCollapsePrimaryVertices(bool iSet)
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:45