Back to home page

EIC code displayed by LXR

 
 

    


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

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_DIGIINPUTACTION_H
0014 #define DDDIGI_DIGIINPUTACTION_H
0015 
0016 /// Framework include files
0017 #include <DDDigi/DigiEventAction.h>
0018 
0019 /// C/C++ include files
0020 #include <limits>
0021 
0022 /// Namespace for the AIDA detector description toolkit
0023 namespace dd4hep {
0024 
0025   /// Namespace for the Digitization part of the AIDA detector description toolkit
0026   namespace digi {
0027 
0028     // Forward declarations
0029     class DigiInputAction;
0030 
0031     /// Base class for input actions to the digitization
0032     /**
0033      *
0034      *  \author  M.Frank
0035      *  \version 1.0
0036      *  \ingroup DD4HEP_DIGITIZATION
0037      */
0038     class DigiInputAction : public DigiEventAction {
0039     public:
0040       enum { INPUT_START = -1  };
0041       enum { NO_MASK     = 0x0 };
0042       /// Most probably need some minimum cutoff:
0043       static constexpr double epsilon = std::numeric_limits<double>::epsilon();
0044 
0045       /// Input source base
0046       class input_source   {
0047       public:
0048     /// Event counter for current file
0049     int event_count  { 0 };
0050       };
0051 
0052       /// Event frame base
0053       class event_frame   {
0054       public:
0055       };
0056 
0057     protected:
0058       /// Property: Input data specification
0059       std::vector<std::string> m_input_sources { };
0060       /// Property: Container names to be loaded
0061       std::vector<std::string> m_objects_enabled  { };
0062       /// Property: Container names to be ignored for loading
0063       std::vector<std::string> m_objects_disabled  { };
0064       /// Property: Option to specify event section in the input data (tree, table etc.)
0065       std::string              m_input_section { "EVENT" };
0066       /// Property: Input data segment name
0067       std::string              m_input_segment { "inputs" };
0068       /// Property: Mask to flag input source items
0069       int                      m_input_mask    { NO_MASK };
0070       /// Property: Number of events to be read by file
0071       int                      m_events_per_file { -1 };
0072       /// Property: Loop on inputs and restart at end
0073       bool                     m_input_rescan { true };
0074       /// Property: generate raw input history records to Digi store
0075       bool                     m_keep_raw       { true };
0076       
0077     protected:
0078       /// Define standard assignments and constructors
0079       DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiInputAction);
0080 
0081     public:
0082       /// Standard constructor
0083       DigiInputAction(const kernel_t& kernel, const std::string& nam);
0084       /// Default destructor
0085       virtual ~DigiInputAction();
0086 
0087       /// Access to container names containing data
0088       const std::vector<std::string>& inputs()  const   {
0089     return m_input_sources;
0090       }
0091       /// Access to container names containing data
0092       const std::string& input_segment()  const   {
0093     return m_input_segment;
0094       }
0095       /// Access to container names containing data
0096       int input_mask()  const   {
0097     return m_input_mask;
0098       }
0099       /// Access to input section name containing the event data
0100       const std::string& input_section()  const   {
0101     return m_input_section;
0102       }
0103       /// Access to container names containing data
0104       const std::vector<std::string>& objects_enabled()  const   {
0105     return m_objects_enabled;
0106       }
0107       /// Access to container names containing data
0108       const std::vector<std::string>& objects_disabled()  const   {
0109     return m_objects_disabled;
0110       }
0111       /// Check if the number of events per file is reached
0112       bool fileLimitReached(input_source& source)   const;
0113       /// Callback when a new file is opened
0114       virtual void onOpenFile(input_source& source);
0115       /// Callback when a new event is processed
0116       virtual void onProcessEvent(input_source& source, event_frame& frame);
0117 
0118       /// Check if a event object should be loaded: Default YES unless inhibited by selection or veto
0119       bool object_loading_is_enabled(const std::string& nam)  const;
0120 
0121       /// Callback to read event input
0122       virtual void execute(context_t& context)  const override;
0123     };
0124   }    // End namespace digi
0125 }      // End namespace dd4hep
0126 #endif // DDDIGI_DIGIINPUTACTION_H