Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:49

0001 //==============================================================================
0002 //  AIDA Detector description implementation for LHCb
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   Markus Frank
0011 //  \date     2018-03-08
0012 //  \version  1.0
0013 //
0014 //==============================================================================
0015 #ifndef DE_CTORS_DEFAULT
0016 #pragma error("This header should never be included directly. Inlcude Detector/DetectorElement.h instead!")
0017 #endif
0018 
0019 #ifndef DETECTOR_DESTATIC_H
0020 #define DETECTOR_DESTATIC_H
0021 
0022 /// Framework include files
0023 #include "Detector/DetectorElement.h"
0024 
0025 /// gaudi namespace declaration
0026 namespace gaudi   {
0027 
0028   /// gaudi::detail namespace declaration
0029   namespace detail   {
0030 
0031     /// Forward declarations
0032     class DeStaticObject;
0033 
0034     /// Base class for static DetectorElement data
0035     /**
0036      *  The static data support all requests to a generic detector element
0037      *  if no time-dependent information is required. The time dependent
0038      *  information is stored in the IOV dependent part of the detector element.
0039      *
0040      *  Note:
0041      *  1) When populating the child chache it is the USER's responsibility
0042      *     To use ConditionsMaps with appropriate IOVs!
0043      *  2) The child chache may ONLY be populated while the condition is not
0044      *     active ie. during creation/initialization time. Otherwise
0045      *     MT races occur!
0046      *
0047      *  \author  Markus Frank
0048      *  \date    2018-03-08
0049      *  \version  1.0
0050      */
0051     class DeStaticObject : public detail::ConditionObject  {
0052       DE_CONDITIONS_TYPEDEFS;
0053 
0054     public:
0055       /// Helper to initialize the basic information
0056       DeStaticObject* fill_info(DetElement de, Catalog* cat);
0057         
0058     public: 
0059       /// Standard constructors and assignment
0060       DE_CTORS_DEFAULT(DeStaticObject);
0061 
0062       /// Initialization of sub-classes. May only be called while the condition is NOT active
0063       virtual void initialize();
0064       
0065       /// Printout method to stdout
0066       virtual void print(int indent, int flags)  const;
0067 
0068       /// Fill the child cache. May only be called while the condition is NOT active
0069       void fillCache(ConditionsMap& m);
0070 
0071       /// Access daughter elements: Static part
0072       DeStaticObject* child(DetElement de)  const;
0073 
0074       /** Simplification accessors. Do not check validity here   */
0075       /// Access parameters directory
0076       const ParameterMap::Parameters& params()  const;
0077       
0078       /// Access single parameter
0079       const ParameterMap::Parameter& parameter(const std::string& nam, bool throw_if_not_present=true)   const;
0080 
0081       /// Type dependent accessor to a named parameter
0082       template <typename T> T param(const std::string& nam, bool throw_if_not_present=true)   const
0083       {  return parameters.parameter(nam,throw_if_not_present).template get<T>();     }
0084 
0085     public:
0086       /// Cache of static information of the children.
0087       std::map<DetElement,DeStaticObject*> childCache;
0088       /// Pointer to parent
0089       DeStaticObject*      parent = 0;
0090       /// The dd4hep detector element reference of this gaudi detector element
0091       DetElement           detector;
0092       /// Reference to the geometry information of this gaudi detector element
0093       PlacedVolume         geometry;
0094       /// The parameter map of this detector element
0095       ParameterMap         parameters;
0096       /// Detector element Class ID
0097       int                  clsID = 0;
0098       /// Initialization flags to steer actions
0099       unsigned short       de_flags = 0;
0100       unsigned short       de_user  = 0;
0101       /// Item key
0102       itemkey_type         key = 0;
0103 
0104       /// Not really necessary and no code should depend on it, but helps for debugging!
0105       Catalog*             catalog = 0;
0106     };
0107   }    // End namespace detail
0108 
0109   /// Handle definition to an instance of a handle to static detector element data
0110   /**
0111    *  This object defines the behaviour of the objects's data.
0112    *  We implement here only the behaviour of the object specific
0113    *  stuff. The geometry interactions are then combined with this
0114    *  implementation and the specialized detector element
0115    *  DetectorElementStatic<TYPE> to the real data accessor.
0116    *  The DetectorElementStatic<TYPE> by non-virtual inheritance
0117    *  automatically exposes the specific stuff here.
0118    *
0119    *  See the corresponding typedef below.
0120    *
0121    *  Note: in this class the is no big deal of specialization!
0122    *        this for the time being is only for illustration about the mechanism.
0123    *
0124    *  \author  Markus Frank
0125    *  \date    2018-03-08
0126    *  \version  1.0
0127    */
0128   class DeStaticElement : public dd4hep::Handle<detail::DeStaticObject>  {
0129     DE_CONDITIONS_TYPEDEFS;
0130     /// This is needed by the DetectorElement<TYPE> to properly forward requests.
0131     typedef detail::DeStaticObject static_t;
0132   public:
0133     /// Standard handle assignments and constructors
0134     DE_CTORS_HANDLE(DeStaticElement,Base);
0135   };
0136 
0137 }      // End namespace gaudi
0138 #endif // DETECTOR_DESTATIC_H