CMS 3D CMS Logo

EventAction.cc
Go to the documentation of this file.
8 
10 
11 #include <fstream>
12 #include "Randomize.hh"
13 
16  SimTrackManager* iManager,
18  : m_runInterface(rm),
19  m_trackManager(iManager),
20  m_SteppingVerbose(sv),
21  m_stopFile(p.getParameter<std::string>("StopFile")),
22  m_printRandom(p.getParameter<bool>("PrintRandomSeed")),
23  m_debug(p.getUntrackedParameter<bool>("debug", false)) {
24  m_trackManager->setCollapsePrimaryVertices(p.getParameter<bool>("CollapsePrimaryVertices"));
25 }
26 
28 
29 void EventAction::BeginOfEventAction(const G4Event* anEvent) {
31 
32  BeginOfEvent e(anEvent);
34 
35  if (m_printRandom) {
36  edm::LogVerbatim("SimG4CoreApplication")
37  << "BeginOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
38  }
39 
40  if (nullptr != m_SteppingVerbose) {
42  }
43 }
44 
45 void EventAction::EndOfEventAction(const G4Event* anEvent) {
46  if (m_printRandom) {
47  edm::LogVerbatim("SimG4CoreApplication")
48  << " EndOfEvent " << anEvent->GetEventID() << " Random number: " << G4UniformRand();
49  }
50  if (!m_stopFile.empty() && std::ifstream(m_stopFile.c_str())) {
51  edm::LogWarning("SimG4CoreApplication")
52  << "EndOfEventAction: termination signal received at event " << anEvent->GetEventID();
53  // soft abort run
54  m_runInterface->abortRun(true);
55  }
56  if (anEvent->GetNumberOfPrimaryVertex() == 0) {
57  edm::LogWarning("SimG4CoreApplication") << "EndOfEventAction: event " << anEvent->GetEventID()
58  << " must have failed (no G4PrimaryVertices found) and will be skipped ";
59  return;
60  }
61 
63 
64  // dispatch now end of event, and only then delete tracks...
65  EndOfEvent e(anEvent);
67 
70 }
71 
72 void EventAction::addTkCaloStateInfo(uint32_t t, const std::pair<math::XYZVectorD, math::XYZTLorentzVectorD>& p) {
74 }
75 
SimTrackManager
Definition: SimTrackManager.h:35
EventAction::~EventAction
~EventAction() override
Definition: EventAction.cc:27
electrons_cff.bool
bool
Definition: electrons_cff.py:366
MessageLogger.h
SimTrackManager::storeTracks
void storeTracks(G4SimEvent *simEvent)
Definition: SimTrackManager.cc:91
SimTrackManager::reset
void reset()
Definition: SimTrackManager.cc:44
funct::false
false
Definition: Factorize.h:29
EventAction::m_beginOfEventSignal
SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal
Definition: EventAction.h:46
EventAction::m_endOfEventSignal
SimActivityRegistry::EndOfEventSignal m_endOfEventSignal
Definition: EventAction.h:47
SimRunInterface::abortRun
void abortRun(bool softAbort)
Definition: SimRunInterface.cc:60
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
EventAction::BeginOfEventAction
void BeginOfEventAction(const G4Event *evt) override
Definition: EventAction.cc:29
EventAction::m_runInterface
SimRunInterface * m_runInterface
Definition: EventAction.h:50
EventAction.h
CMSSteppingVerbose
Definition: CMSSteppingVerbose.h:25
EndOfEvent.h
SimTrackManager::setCollapsePrimaryVertices
void setCollapsePrimaryVertices(bool iSet)
Definition: SimTrackManager.h:83
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EventAction::m_printRandom
bool m_printRandom
Definition: EventAction.h:54
G4SimVertex.h
G4SimTrack.h
pfDeepBoostedJetPreprocessParams_cfi.sv
sv
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:352
SimTrackManager::deleteTracks
void deleteTracks()
Definition: SimTrackManager.cc:62
submit.rm
rm
Definition: submit.py:77
SimTrackManager::addTkCaloStateInfo
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: SimTrackManager.h:75
EndOfEvent
Definition: EndOfEvent.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SimTrackManager::cleanTkCaloStateInfoMap
void cleanTkCaloStateInfoMap()
Definition: SimTrackManager.cc:197
EventAction::m_SteppingVerbose
CMSSteppingVerbose * m_SteppingVerbose
Definition: EventAction.h:52
BeginOfEvent.h
BeginOfEvent
Definition: BeginOfEvent.h:6
EventAction::abortEvent
void abortEvent()
Definition: EventAction.cc:76
EventAction::EndOfEventAction
void EndOfEventAction(const G4Event *evt) override
Definition: EventAction.cc:45
SimRunInterface::abortEvent
void abortEvent()
Definition: SimRunInterface.cc:54
EventAction::m_trackManager
SimTrackManager * m_trackManager
Definition: EventAction.h:51
std
Definition: JetResolutionObject.h:76
CMSSteppingVerbose.h
EventAction::addTkCaloStateInfo
void addTkCaloStateInfo(uint32_t t, const std::pair< math::XYZVectorD, math::XYZTLorentzVectorD > &p)
Definition: EventAction.cc:72
SimRunInterface.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
SimRunInterface::simEvent
G4SimEvent * simEvent()
Definition: SimRunInterface.cc:66
CMSSteppingVerbose::BeginOfEvent
void BeginOfEvent(const G4Event *)
Definition: CMSSteppingVerbose.cc:34
EventAction::EventAction
EventAction(const edm::ParameterSet &ps, SimRunInterface *, SimTrackManager *, CMSSteppingVerbose *)
Definition: EventAction.cc:14
EventAction::m_stopFile
std::string m_stopFile
Definition: EventAction.h:53
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
SimRunInterface
Definition: SimRunInterface.h:17