00001 #ifndef SimG4Core_EventAction_H 00002 #define SimG4Core_EventAction_H 00003 00004 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00005 00006 #include "SimG4Core/Application/interface/G4SimEvent.h" 00007 #include "SimG4Core/Application/interface/SimTrackManager.h" 00008 #include "SimG4Core/Notification/interface/TrackWithHistory.h" 00009 #include "SimG4Core/Notification/interface/TrackContainer.h" 00010 #include "SimG4Core/Notification/interface/SimActivityRegistry.h" 00011 00012 #include "G4UserEventAction.hh" 00013 00014 #include "CLHEP/Vector/LorentzVector.h" 00015 #include "CLHEP/Vector/ThreeVector.h" 00016 00017 #include <vector> 00018 #include <map> 00019 00020 class RunManager; 00021 class BeginOfEvent; 00022 class EndOfEvent; 00023 00024 class EventAction: public G4UserEventAction 00025 { 00026 public: 00027 00028 EventAction(const edm::ParameterSet& ps, 00029 RunManager*, 00030 SimTrackManager*); 00031 ~EventAction(); 00032 00033 void BeginOfEventAction(const G4Event * evt); 00034 void EndOfEventAction(const G4Event * evt); 00035 00036 void abortEvent(); 00037 00038 const TrackContainer * trackContainer() const { 00039 return m_trackManager->trackContainer(); 00040 } 00041 void addTrack(TrackWithHistory* iTrack, bool inHistory, bool withAncestor); 00042 void addTkCaloStateInfo(uint32_t t,const std::pair<math::XYZVectorD,math::XYZTLorentzVectorD>& p); 00043 void prepareForNewPrimary() { m_trackManager->cleanTracksWithHistory(); } 00044 00045 SimActivityRegistry::BeginOfEventSignal m_beginOfEventSignal; 00046 SimActivityRegistry::EndOfEventSignal m_endOfEventSignal; 00047 00048 private: 00049 //does not own the manager 00050 RunManager* m_runManager; 00051 SimTrackManager* m_trackManager; 00052 std::string m_stopFile; 00053 bool m_debug; 00054 }; 00055 00056 #endif 00057 00058 00059