|
||||
File indexing completed on 2025-01-18 09:14:55
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 DD4HEP_DDDIGI_DIGITESTACTION_H 0014 #define DD4HEP_DDDIGI_DIGITESTACTION_H 0015 0016 // Framework include files 0017 #include "DDDigi/DigiEventAction.h" 0018 0019 /// Namespace for the AIDA detector description toolkit 0020 namespace dd4hep { 0021 0022 /// Namespace for the Digitization part of the AIDA detector description toolkit 0023 namespace digi { 0024 0025 // Forward declarations 0026 class DigiAction; 0027 class DigiTestAction; 0028 0029 /// Class which applies random noise hits of a given amplitude 0030 /** 0031 * Class which applies random noise hits of a given amplitude 0032 * to a segmented sensitive element. 0033 * 0034 * \author M.Frank 0035 * \version 1.0 0036 * \ingroup DD4HEP_DIGITIZATION 0037 */ 0038 class DigiTestAction : public DigiEventAction { 0039 protected: 0040 /// Sleep period to fake execution [milliseconds] 0041 int m_sleep = 0; 0042 protected: 0043 /// Define standard assignments and constructors 0044 DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiTestAction); 0045 0046 public: 0047 /// Standard constructor 0048 DigiTestAction(const DigiKernel& kernel, const std::string& nam); 0049 /// Default destructor 0050 virtual ~DigiTestAction(); 0051 /// Callback to read event input 0052 virtual void execute(DigiContext& context) const override; 0053 }; 0054 0055 } // End namespace digi 0056 } // End namespace dd4hep 0057 #endif // DD4HEP_DDDIGI_DIGITESTACTION_H 0058 0059 //========================================================================== 0060 // AIDA Detector description implementation 0061 //-------------------------------------------------------------------------- 0062 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) 0063 // All rights reserved. 0064 // 0065 // For the licensing terms see $DD4hepINSTALL/LICENSE. 0066 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS. 0067 // 0068 // Author : M.Frank 0069 // 0070 //========================================================================== 0071 0072 // Framework include files 0073 #include "DD4hep/Printout.h" 0074 #include "DD4hep/InstanceCount.h" 0075 #include "DDDigi/DigiFactories.h" 0076 //#include "DDDigi/DigiTestAction.h" 0077 0078 // C/C++ include files 0079 0080 #ifdef __APPLE__ 0081 static void noop(int) {} 0082 #define usleep(x) noop(x) 0083 #endif 0084 0085 using namespace std; 0086 using namespace dd4hep::digi; 0087 0088 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiTestAction) 0089 0090 /// Standard constructor 0091 DigiTestAction::DigiTestAction(const DigiKernel& kernel, const string& nam) 0092 : DigiEventAction(kernel, nam) 0093 { 0094 declareProperty("sleep", m_sleep = 0); 0095 InstanceCount::increment(this); 0096 } 0097 0098 /// Default destructor 0099 DigiTestAction::~DigiTestAction() { 0100 InstanceCount::decrement(this); 0101 } 0102 0103 /// Pre-track action callback 0104 void DigiTestAction::execute(DigiContext& context) const { 0105 debug("+++ Event: %8d (DigiTestAction) %d msec", 0106 context.event->eventNumber, m_sleep); 0107 if ( m_sleep > 0 ) ::usleep(1000*m_sleep); 0108 }
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |