Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:20

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DDDIGI_DIGIACTIONSEQUENCE_H
0014 #define DDDIGI_DIGIACTIONSEQUENCE_H
0015 
0016 // Framework include files
0017 #include <DD4hep/Callback.h>
0018 #include <DDDigi/DigiSynchronize.h>
0019 
0020 /// Namespace for the AIDA detector description toolkit
0021 namespace dd4hep {
0022 
0023   /// Namespace for the Digitization part of the AIDA detector description toolkit
0024   namespace digi {
0025 
0026     // Forward declarations
0027     class DigiEventAction;
0028     class DigiActionSequence;
0029 
0030     /// Concrete implementation of the Digitization event action sequence
0031     /**
0032      * The sequence dispatches the callbacks to all registered DigiAction 
0033      * members and all registered callbacks.
0034      *
0035      * Note Multi-Threading issue:
0036      * Neither callbacks not the action list is protected against multiple 
0037      * threads calling the Digi callbacks!
0038      * These must be protected in the user actions themselves.
0039      *
0040      *  \author  M.Frank
0041      *  \version 1.0
0042      *  \ingroup DD4HEP_DIGITIZATION
0043      */
0044     class DigiActionSequence : public DigiSynchronize {
0045     protected:
0046       /// Callback sequence before the digitization modules execute
0047       CallbackSequence   m_begin;
0048       /// Callback sequence after the digitization modules executed
0049       CallbackSequence   m_end;
0050 
0051     protected:
0052       /// Define standard assignments and constructors
0053       DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiActionSequence);
0054 
0055     public:
0056       /// Standard constructor
0057       DigiActionSequence(const kernel_t& kernel, const std::string& nam);
0058       /// Default destructor
0059       virtual ~DigiActionSequence();
0060       /// Adopt a new action as part of the sequence. Sequence takes ownership.
0061       virtual void adopt(DigiEventAction* action)  override;
0062       /// Register external listener callbacks before starting the sequence
0063       template <typename Q, typename T>
0064       void begin(Q* p, void (T::*f)(context_t* context)) {
0065         m_begin.add(p, f);
0066       }
0067       /// Register external listener callbacks after finishing the sequence
0068       template <typename Q, typename T>
0069       void end(Q* p, void (T::*f)(context_t* context))  {
0070         m_end.add(p, f);
0071       }
0072       /// Begin-of-event callback
0073       virtual void execute(context_t& context)  const override;
0074     };
0075 
0076     /// Definitiaon of the sequential action sequence
0077     /** Definitiaon of the sequential action sequence
0078      *
0079      *  \author  M.Frank
0080      *  \version 1.0
0081      *  \ingroup DD4HEP_DIGITIZATION
0082      */
0083     class DigiSequentialActionSequence : public DigiActionSequence {
0084     public:
0085       /// Standard constructor
0086       DigiSequentialActionSequence(const kernel_t& kernel, const std::string& nam);
0087       /// Default destructor
0088       virtual ~DigiSequentialActionSequence();
0089     };
0090 
0091     /// Definitiaon of the parallel action sequence
0092     /** Definitiaon of the parallel action sequence
0093      *
0094      *  \author  M.Frank
0095      *  \version 1.0
0096      *  \ingroup DD4HEP_DIGITIZATION
0097      */
0098     class DigiParallelActionSequence : public DigiActionSequence {
0099     public:
0100       /// Standard constructor
0101       DigiParallelActionSequence(const kernel_t& kernel, const std::string& nam);
0102       /// Default destructor
0103       virtual ~DigiParallelActionSequence();
0104     };
0105 
0106   }    // End namespace digi
0107 }      // End namespace dd4hep
0108 #endif // DDDIGI_DIGIACTIONSEQUENCE_H