Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:32:43

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 //
0014 // NOTE:
0015 //
0016 // This is an internal include file. It should only be included to 
0017 // instantiate code. Otherwise the Detector include file should be
0018 // sufficient for all practical purposes.
0019 //
0020 //==========================================================================
0021 #ifndef DD4HEP_DETAIL_DETECTORINTERNA_H
0022 #define DD4HEP_DETAIL_DETECTORINTERNA_H
0023 
0024 // Framework include files
0025 #include <DD4hep/Callback.h>
0026 #include <DD4hep/NamedObject.h>
0027 #include <DD4hep/World.h>
0028 #include <DD4hep/Objects.h>
0029 #include <DD4hep/DetElement.h>
0030 #include <DD4hep/Alignments.h>
0031 #include <DD4hep/Conditions.h>
0032 #include <DD4hep/Segmentations.h>
0033 #include <DD4hep/ObjectExtensions.h>
0034 
0035 // ROOT include files
0036 #include <TGeoMatrix.h>
0037 
0038 /// Namespace for the AIDA detector description toolkit
0039 namespace dd4hep {
0040 
0041   class WorldObject;
0042   class DetElementObject;
0043   class SensitiveDetectorObject;
0044   class VolumeManager_Populator;
0045     
0046   /// Data class with properties of sensitive detectors
0047   /**
0048    *
0049    *  \author  M.Frank
0050    *  \version 1.0
0051    *
0052    *  \ingroup DD4HEP        \ingroup DD4HEP_CORE
0053    */
0054   class SensitiveDetectorObject: public NamedObject, public ObjectExtensions {
0055   public:
0056     unsigned int magic;
0057     int          verbose;
0058     int          combineHits;
0059     double       ecut;
0060     Readout      readout;
0061     Region       region;
0062     LimitSet     limits;
0063     std::string  hitsCollection;
0064 
0065     /// Default constructor
0066     SensitiveDetectorObject();
0067     /// Initializing constructor
0068     SensitiveDetectorObject(const std::string& nam);
0069     /// Internal object destructor: release extension object(s)
0070     virtual ~SensitiveDetectorObject();
0071   };
0072 
0073   /// Data class with properties of a detector element
0074   /**
0075    *
0076    *  \author  M.Frank
0077    *  \version 1.0
0078    *
0079    *  \ingroup DD4HEP        \ingroup DD4HEP_CORE
0080    */
0081   class DetElementObject : public NamedObject, public ObjectExtensions {
0082   public:
0083     // Type definitions.
0084     // The full namespace declaration is required by cint....
0085     typedef std::pair<Callback,unsigned long>    UpdateCall;
0086     typedef std::vector<UpdateCall>              UpdateCallbacks;
0087 
0088     enum DetFlags {
0089       HAVE_WORLD_TRAFO        = 1<<0,
0090       HAVE_PARENT_TRAFO       = 1<<1,
0091       HAVE_REFERENCE_TRAFO    = 1<<2,
0092       HAVE_SENSITIVE_DETECTOR = 1<<29,
0093       IS_TOP_LEVEL_DETECTOR   = 1<<30,
0094       HAVE_OTHER              = 1<<31
0095     };
0096 
0097     /// Magic number to ensure data integrity
0098     unsigned int        magic;
0099     /// Flag to remember internally calculated quatities
0100     unsigned int        flag;
0101     /// Unique integer identifier of the detector instance
0102     int                 id;
0103     /// Flag to process hits
0104     int                 combineHits;
0105     /// Flag to encode detector types
0106     unsigned int        typeFlag;
0107     /// Hierarchical level within the detector description
0108     int                 level;
0109     /// Access hash key of this detector element (Only valid once geometry is closed!)
0110     unsigned int        key;
0111     /// Full path to this detector element. May be invalid
0112     std::string         path;
0113     /// The path to the placement of the detector element (if placed)
0114     std::string         placementPath;
0115 
0116     /// The subdetector placement corresponding to the ideal detector element's volume
0117     PlacedVolume        idealPlace;
0118     /// The subdetector placement corresponding to the actual detector element's volume
0119     PlacedVolume        placement;
0120     /// The cached VolumeID of this subdetector element
0121     /**  Please note:
0122      *  These values are set when populating the volume manager.
0123      *  There are restrictions: e.g. only sensitive subdetectors are present.
0124      */
0125     VolumeID             volumeID;
0126     /// Reference to the parent element
0127     World                privateWorld;
0128     /// Reference to the parent element
0129     DetElement           parent;
0130     /// The array of children
0131     DetElement::Children children;
0132     /// Placeholder for structure with update callbacks
0133     UpdateCallbacks      updateCalls;  //! Not ROOT persistent
0134 
0135     //@{ Additional information set externally to facilitate the processing of event data */
0136     /// Basic ideal/nominal detector element alignment entry
0137     AlignmentCondition  nominal;
0138     /// Basic detector element alignment entry containing the survey data
0139     AlignmentCondition  survey;
0140 
0141     /// Global alignment data
0142     Ref_t               global_alignment;
0143     //@}
0144 
0145   private:
0146     friend class VolumeManager_Populator;
0147 
0148   private:
0149     //@{ Private methods used internally by the object itself. */
0150     /// Resolve the world object. Internal use ONLY.
0151     World i_access_world();
0152 
0153   public:
0154     //@{ Public methods to ease the usage of the data. */
0155     /// Initializing constructor
0156     DetElementObject(const std::string& nam, int ident);
0157     /// Default constructor
0158     DetElementObject();
0159     /// Internal object destructor: release extension object(s)
0160     virtual ~DetElementObject();
0161     /// Deep object copy to replicate DetElement trees e.g. for reflection
0162     virtual DetElementObject* clone(int new_id, int flag) const;
0163     /// Access to the world object. Only possible once the geometry is closed.
0164     World world()
0165     {  return privateWorld.isValid() ? privateWorld : i_access_world(); }
0166     //@}
0167     /// Remove callback from object
0168     void removeAtUpdate(unsigned int type, void* pointer);
0169     /// Trigger update callbacks
0170     void update(unsigned int tags, void* param);
0171     /// Revalidate the caches
0172     void revalidate();
0173     /// Reflect all volumes in a DetElement sub-tree and re-attach the placements
0174     std::pair<DetElement,Volume> reflect(const std::string& new_name, int new_id, SensitiveDetector sd);
0175   };
0176 
0177   /// Data class with properties of a detector element
0178   /**
0179    *
0180    *  \author  M.Frank
0181    *  \version 1.0
0182    *
0183    *  \ingroup DD4HEP        \ingroup DD4HEP_CORE
0184    */
0185   class WorldObject: public DetElementObject {
0186   public:
0187     /// Reference to the Detector instance object
0188     Detector* description; //! Not persistent in ROOT
0189 
0190   public:
0191     //@{ Public methods to ease the usage of the data. */
0192     /// Default constructor
0193     WorldObject();
0194 #ifndef __CINT__
0195     /// Initializing constructor
0196     WorldObject(Detector& description, const std::string& nam);
0197 #endif
0198     /// Internal object destructor: release extension object(s)
0199     virtual ~WorldObject();
0200   };
0201 
0202   /// Default constructor
0203   inline WorldObject::WorldObject() : DetElementObject(), description(0)      {
0204   }
0205 
0206 }         /* End namespace dd4hep                   */
0207 #endif // DD4HEP_DETAIL_DETECTORINTERNA_H