Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:12:38

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_NOISE_DIGISUBDETECTORSEQUENCE_H
0014 #define DDDIGI_NOISE_DIGISUBDETECTORSEQUENCE_H
0015 
0016 // Framework include files
0017 #include <DDDigi/DigiActionSequence.h>
0018 #include <DDDigi/DigiSegmentation.h>
0019 #include <DD4hep/DetElement.h>
0020 #include <DD4hep/Any.h>
0021 
0022 /// C/C++ include files
0023 #include <functional>
0024 #include <map>
0025 
0026 class TClass;
0027 
0028 /// Namespace for the AIDA detector description toolkit
0029 namespace dd4hep {
0030 
0031   class CartesianGridXY;
0032   class CartesianGridXYZ;
0033   
0034   /// Namespace for the Digitization part of the AIDA detector description toolkit
0035   namespace digi {
0036 
0037     // Forward declarations
0038     class DigiCellData;
0039     class DigiCellScanner;
0040     class DigiEventAction;
0041     class DigiSubdetectorSequence;
0042 
0043     /// Concrete implementation of the Digitization event action sequence
0044     /**
0045      *
0046      *  \author  M.Frank
0047      *  \version 1.0
0048      *  \ingroup DD4HEP_DIGITIZATION
0049      */
0050     class DigiSubdetectorSequence : public DigiActionSequence {
0051     protected:
0052       class Context  {
0053       public:
0054         DetElement detector;
0055         VolumeID   detector_id;
0056         VolumeID   reverse_id;
0057         VolumeID   detector_mask;
0058         std::shared_ptr<DigiCellScanner> scanner;
0059         Context(DetElement de, VolumeID vid, VolumeID rid, VolumeID mask)
0060           : detector(de), detector_id(vid), reverse_id(rid), detector_mask(mask) {}
0061         Context() = delete;
0062         Context(Context&& copy) = default;
0063         Context(const Context& copy) = default;
0064         Context& operator=(Context&& copy) = default;
0065         Context& operator=(const Context& copy) = default;
0066       };
0067 
0068       typedef std::map<std::pair<const TClass*,Segmentation>, std::shared_ptr<DigiCellScanner> > Scanners;
0069       std::string                    m_detectorName;
0070       std::string                    m_segmentName;
0071       SensitiveDetector              m_sensDet;
0072       DetElement                     m_detector;
0073       IDDescriptor                   m_idDesc;
0074       Segmentation                   m_segmentation;
0075       std::map<DetElement, VolumeID> m_parallelDet;
0076       std::map<VolumeID, Context>    m_parallelVid;
0077       Scanners                       m_scanners;
0078 
0079       std::function<void(DigiContext& context, const DigiCellScanner&, const DigiCellData&)> m_cellHandler;
0080 
0081     protected:
0082       /// Define standard assignments and constructors
0083       DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiSubdetectorSequence);
0084 
0085       /// Access subdetector from the detector description
0086       DetElement subdetector(const std::string& name)   const;
0087       
0088       /// Access sensitive detector from the detector description
0089       SensitiveDetector sensitiveDetector(const std::string& nam)   const;
0090 
0091       typedef PlacedVolume::VolIDs             VolIDs;
0092 
0093       void process_cell(DigiContext&           context,
0094                         const DigiCellScanner& scanner,
0095                         const DigiCellData&    data)  const;
0096       void scan_detector(DetElement de, VolumeID vid, VolumeID mask);
0097       void scan_sensitive(PlacedVolume pv, VolumeID vid, VolumeID mask);
0098       void process_context(DigiContext& context, const Context& c, PlacedVolume pv, VolumeID vid, VolumeID mask)   const;
0099       
0100     public:
0101       /// Standard constructor
0102       DigiSubdetectorSequence(const DigiKernel& kernel, const std::string& nam);
0103       /// Default destructor
0104       virtual ~DigiSubdetectorSequence();
0105       /// Iniitalize subdetector sequencer
0106       virtual void initialize();
0107       /// Begin-of-event callback
0108       virtual void execute(DigiContext& context)  const override;
0109     };
0110 
0111   }    // End namespace digi
0112 }      // End namespace dd4hep
0113 #endif // DDDIGI_NOISE_DIGISUBDETECTORSEQUENCE_H