Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-03-19 06:07:42

0001 #ifndef SimG4Core_Notification_SimActivityRegistry_h
0002 #define SimG4Core_Notification_SimActivityRegistry_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Notification
0006 // Class  :     SimActivityRegistry
0007 //
0008 /**\class SimActivityRegistry SimActivityRegistry.h SimG4Core/Notification/interface/SimActivityRegistry.h
0009 
0010  Description: Holds the various signals emitted in the simulation framework
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Sun Nov 13 11:43:40 EST 2005
0019 //
0020 
0021 // user include files
0022 #include "SimG4Core/Notification/interface/Signaler.h"
0023 
0024 // forward declarations
0025 class BeginOfJob;
0026 class BeginOfRun;
0027 class BeginOfEvent;
0028 class BeginOfTrack;
0029 class BeginOfStep;
0030 class EndOfRun;
0031 class EndOfEvent;
0032 class EndOfTrack;
0033 class DDDWorld;
0034 class G4Step;
0035 
0036 #define SAR_CONNECT_METHOD(signal) \
0037   void connect(Observer<const signal*>* iObject) { watch##signal(iObject); }
0038 
0039 class SimActivityRegistry {
0040 public:
0041   SimActivityRegistry() {}
0042   //virtual ~SimActivityRegistry();
0043 
0044   typedef sim_act::Signaler<BeginOfJob> BeginOfJobSignal;
0045   BeginOfJobSignal beginOfJobSignal_;
0046   void watchBeginOfJob(const BeginOfJobSignal::slot_type& iSlot) { beginOfJobSignal_.connect(iSlot); }
0047   SAR_CONNECT_METHOD(BeginOfJob)
0048 
0049   typedef sim_act::Signaler<DDDWorld> DDDWorldSignal;
0050   DDDWorldSignal dddWorldSignal_;
0051   void watchDDDWorld(const DDDWorldSignal::slot_type& iSlot) { dddWorldSignal_.connect(iSlot); }
0052   SAR_CONNECT_METHOD(DDDWorld)
0053 
0054   typedef sim_act::Signaler<BeginOfRun> BeginOfRunSignal;
0055   BeginOfRunSignal beginOfRunSignal_;
0056   void watchBeginOfRun(const BeginOfRunSignal::slot_type& iSlot) { beginOfRunSignal_.connect(iSlot); }
0057   SAR_CONNECT_METHOD(BeginOfRun)
0058 
0059   typedef sim_act::Signaler<BeginOfEvent> BeginOfEventSignal;
0060   BeginOfEventSignal beginOfEventSignal_;
0061   void watchBeginOfEvent(const BeginOfEventSignal::slot_type& iSlot) { beginOfEventSignal_.connect(iSlot); }
0062   SAR_CONNECT_METHOD(BeginOfEvent)
0063 
0064   typedef sim_act::Signaler<BeginOfTrack> BeginOfTrackSignal;
0065   BeginOfTrackSignal beginOfTrackSignal_;
0066   void watchBeginOfTrack(const BeginOfTrackSignal::slot_type& iSlot) { beginOfTrackSignal_.connect(iSlot); }
0067   SAR_CONNECT_METHOD(BeginOfTrack)
0068 
0069   typedef sim_act::Signaler<G4Step> G4StepSignal;
0070   G4StepSignal g4StepSignal_;
0071   void watchG4Step(const G4StepSignal::slot_type& iSlot) { g4StepSignal_.connect(iSlot); }
0072   SAR_CONNECT_METHOD(G4Step)
0073 
0074   typedef sim_act::Signaler<EndOfRun> EndOfRunSignal;
0075   EndOfRunSignal endOfRunSignal_;
0076   void watchEndOfRun(const EndOfRunSignal::slot_type& iSlot) { endOfRunSignal_.connect(iSlot); }
0077   SAR_CONNECT_METHOD(EndOfRun)
0078 
0079   typedef sim_act::Signaler<EndOfEvent> EndOfEventSignal;
0080   EndOfEventSignal endOfEventSignal_;
0081   void watchEndOfEvent(const EndOfEventSignal::slot_type& iSlot) { endOfEventSignal_.connect(iSlot); }
0082   SAR_CONNECT_METHOD(EndOfEvent)
0083 
0084   typedef sim_act::Signaler<EndOfTrack> EndOfTrackSignal;
0085   EndOfTrackSignal endOfTrackSignal_;
0086   void watchEndOfTrack(const EndOfTrackSignal::slot_type& iSlot) { endOfTrackSignal_.connect(iSlot); }
0087   SAR_CONNECT_METHOD(EndOfTrack)
0088 
0089   ///forwards our signals to slots connected to iOther
0090   void connect(SimActivityRegistry& iOther);
0091 
0092   // stop default
0093   SimActivityRegistry(const SimActivityRegistry&) = delete;
0094   const SimActivityRegistry& operator=(const SimActivityRegistry&) = delete;
0095 };
0096 
0097 #endif