Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:58:04

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 DDCOND_CONDITIONSDATALOADER_H
0014 #define DDCOND_CONDITIONSDATALOADER_H
0015 
0016 // Framework include files
0017 #include "DD4hep/Conditions.h"
0018 #include "DD4hep/NamedObject.h"
0019 #include "DD4hep/ComponentProperties.h"
0020 #include "DDCond/ConditionsSlice.h"
0021 #include "DDCond/ConditionsManager.h"
0022 
0023 // C/C++ include files
0024 #include <list>
0025 #include <set>
0026 
0027 /// Namespace for the AIDA detector description toolkit
0028 namespace dd4hep {
0029 
0030   /// Namespace for implementation details of the AIDA detector description toolkit
0031   namespace cond {
0032 
0033     // Forward declarations
0034     class Entry;
0035     typedef std::list<Entry*> ConditionsStack;
0036     class ConditionsSlice;
0037     class ConditionsDescriptor;
0038 
0039     /// Interface for a generic conditions loader
0040     /** 
0041      *  Common function for all loader.
0042      *
0043      *  \author  M.Frank
0044      *  \version 1.0
0045      */
0046     class ConditionsDataLoader : public NamedObject, public PropertyConfigurable   {
0047     public:
0048       typedef std::pair<std::string, IOV> Source;
0049       typedef std::vector<Source>         Sources;
0050       typedef ConditionsDataLoader        base_t;
0051       typedef Condition::key_type         key_type;
0052 
0053       typedef std::map<key_type,Condition>                          LoadedItems;
0054       typedef std::vector<std::pair<key_type,ConditionsLoadInfo*> > RequiredItems;
0055 
0056     protected:
0057       /// Reference to main detector description object
0058       Detector&         m_detector;
0059       /// Reference to conditions manager used to queue update requests
0060       ConditionsManager m_mgr;
0061       /// Property: input data source definitions
0062       Sources           m_sources;
0063 
0064     protected:
0065       /// Queue update to manager.
0066       //Condition queueUpdate(Entry* data);
0067       /// Push update to manager.
0068       void pushUpdates();
0069 
0070     public:
0071       /// Default constructor
0072       ConditionsDataLoader(Detector& description, ConditionsManager mgr, const std::string nam);
0073       /// Default destructor
0074       virtual ~ConditionsDataLoader();
0075       /// Optional initialization for sub-classes
0076       virtual void initialize()    {}
0077       /// Access conditions manager
0078       ConditionsManager manager() const  {  return m_mgr; }
0079       /// Access to properties
0080       Property& operator[](const std::string& property_name);
0081       /// Access to properties (CONST)
0082       const Property& operator[](const std::string& property_name)  const;
0083       /// Add data source definition to loader
0084       void addSource(const std::string& source);
0085       /// Add data source definition to loader for data corresponding to a given IOV
0086       void addSource(const std::string& source, const IOV& iov);
0087 #if 0
0088       /// Load  a condition set given the conditions key according to their validity
0089       virtual size_t load_single(key_type         key,
0090                                  const IOV&       req_validity,
0091                                  RangeConditions& conditions) = 0;
0092       /// Load  a condition set given a Detector Element and the conditions name according to their validity
0093       virtual size_t load_range( key_type         key,
0094                                  const IOV&       req_validity,
0095                                  RangeConditions& conditions) = 0;
0096 #endif
0097       /// Load a number of conditions items from the persistent medium according to the required IOV
0098       virtual size_t load_many(  const IOV&       req_validity,
0099                                  RequiredItems&   work,
0100                                  LoadedItems&     loaded,
0101                                  IOV&             combined_validity) = 0;
0102     };
0103   }        /* End namespace cond         */
0104 }          /* End namespace dd4hep             */
0105 #endif // DDCOND_CONDITIONSDATALOADER_H