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_DIGIOUTPUTACTION_H
0014 #define DDDIGI_DIGIOUTPUTACTION_H
0015 
0016 /// Framework include files
0017 #include <DDDigi/DigiContainerProcessor.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 DigiOutputAction;
0027 
0028     /// Base class for output actions to the digitization
0029     /**
0030      *
0031      *  \author  M.Frank
0032      *  \version 1.0
0033      *  \ingroup DD4HEP_DIGITIZATION
0034      */
0035     class DigiOutputAction : public DigiContainerSequenceAction {
0036     public:
0037     protected:
0038       /// Property: Processor type to manage containers
0039       std::string                        m_processor_type  { };
0040       /// Property: Container / data type mapping
0041       std::map<std::string, std::string> m_containers  { };
0042       /// Property: Output data specification
0043       std::string                        m_output { };
0044       /// Property: Create stream names with sequence numbers
0045       bool                               m_sequence_streams  {  true };
0046 
0047       /// Total numbe rof events to be processed
0048       long num_events  { -1 };
0049       /// Running event counter
0050       long event_count {  0 };
0051       /// Stream sequence counter
0052       long fseq_count  {  0 };
0053 
0054     protected:
0055       /// Define standard assignments and constructors
0056       DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiOutputAction);
0057 
0058       /// Default destructor
0059       virtual ~DigiOutputAction();
0060 
0061     public:
0062       /// Standard constructor
0063       DigiOutputAction(const kernel_t& kernel, const std::string& nam);
0064 
0065       /// Initialization callback
0066       virtual void initialize()  override;
0067 
0068       /// Finalization callback
0069       virtual void finalize()  override;
0070 
0071       /// Check for valid output stream
0072       virtual bool have_output()  const = 0;
0073 
0074       /// Open new output stream
0075       virtual void open_output() const = 0;
0076 
0077       /// Close current output stream
0078       virtual void close_output() const = 0;
0079 
0080       /// Commit event data to output stream
0081       virtual void commit_output() const = 0;
0082 
0083       /// Create new output stream name
0084       virtual std::string next_stream_name();
0085 
0086       /// Adopt new parallel worker
0087       virtual void adopt_processor(DigiContainerProcessor* action,
0088                                    const std::string& container)  override;
0089 
0090       /// Adopt new parallel worker acting on multiple containers
0091       virtual void adopt_processor(DigiContainerProcessor* action,
0092                                    const std::vector<std::string>& containers)  override;
0093 
0094       /// Callback to read event output
0095       virtual void execute(context_t& context)  const override;
0096     };
0097   }    // End namespace digi
0098 }      // End namespace dd4hep
0099 #endif // DDDIGI_DIGIOUTPUTACTION_H