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_DIGISTOREDUMP_H
0014 #define DDDIGI_DIGISTOREDUMP_H
0015 
0016 /// Framework include files
0017 #include <DDDigi/DigiEventAction.h>
0018 
0019 /// C/C++ include files
0020 #include <mutex>
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 DigiEvent;
0030     class DataSegment;
0031 
0032     /// Default base class for all Digitizer actions and derivates thereof.
0033     /**
0034      *  This is a utility class supporting properties, output and access to
0035      *  event and run objects through the context.
0036      *
0037      *  \author  M.Frank
0038      *  \version 1.0
0039      *  \ingroup DD4HEP_DIGITIZATION
0040      */
0041     class DigiStoreDump : public DigiEventAction   {
0042     protected:
0043       /// Property: Flag to check history record
0044       bool m_dump_history     { false };
0045       /// Property: Data segments to be dumped
0046       std::vector<std::string>        m_segments   { };
0047       std::vector<std::string>        m_containers { };
0048       std::vector<int>                m_masks      { };
0049       std::vector<Key::itemkey_type>  m_container_items { };
0050 
0051       using records_t = std::vector<std::string>;
0052 
0053     protected:
0054       /// Define standard assignments and constructors
0055       DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiStoreDump);
0056 
0057       /// Default destructor
0058       virtual ~DigiStoreDump();
0059 
0060       template <typename T> std::string data_header(Key key, const std::string& tag, const T& data)  const;
0061       template <typename T> records_t dump_history(context_t& context, Key key, const T& container)  const;
0062       template <typename T> records_t dump_history(context_t& context, Key key, const T& item, std::size_t seq_no)  const;
0063       template <typename T> records_t dump_deposit_history(context_t& context, Key container_key, const T& container)  const;
0064 
0065       records_t
0066     dump_particle_history(context_t& context, Key container_key, const ParticleMapping& container)  const;
0067 
0068       /// Dump hit container
0069       void dump_headers(const std::string& tag, const DigiEvent& event, const DataSegment& segment)  const;
0070 
0071       /// Dump hit container
0072       void dump_history(context_t& context, const std::string& tag, const DigiEvent& event, const DataSegment& cont)  const;
0073 
0074       /// Initialize the action
0075       virtual void initialize();
0076       
0077     public:
0078       /// Standard constructor
0079       DigiStoreDump(const DigiKernel& kernel, const std::string& nam);
0080       /// Main functional callback
0081       virtual void execute(context_t& context)  const;
0082     };
0083   }    // End namespace digi
0084 }      // End namespace dd4hep
0085 #endif // DDDIGI_DIGISTOREDUMP_H