Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:51

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 EXAMPLES_CONDITIONS_SRC_CONDITIONSTEST_H
0014 #define EXAMPLES_CONDITIONS_SRC_CONDITIONSTEST_H
0015 
0016 // Framework include files
0017 #include "DD4hep/Detector.h"
0018 #include "DD4hep/Printout.h"
0019 #include "DD4hep/Conditions.h"
0020 #include "DD4hep/ConditionsMap.h"
0021 #include "DD4hep/DetFactoryHelper.h"
0022 #include "DD4hep/detail/ConditionsInterna.h"
0023 #include "DD4hep/ConditionsProcessor.h"
0024 
0025 #include "DDCond/ConditionsIOVPool.h"
0026 #include "DDCond/ConditionsManager.h"
0027 
0028 
0029 /// Namespace for the AIDA detector description toolkit
0030 namespace dd4hep {
0031 
0032   /// Namespace for implementation details of the AIDA detector description toolkit
0033   namespace ConditionExamples {
0034 
0035     using namespace cond;
0036 
0037     struct TestEnv {
0038       Detector& description;
0039       DetElement detector;
0040       ConditionsManager manager;
0041       Handle<ConditionsDataLoader> loader;
0042       const IOVType* epoch;
0043       const IOVType* run;
0044 
0045       TestEnv(Detector& _description, const std::string& detector_name);
0046       /// Find daughter element of the detector object
0047       DetElement daughter(const std::string& sub_path)  const;
0048 
0049       void add_xml_data_source(const std::string& file, const std::string& iov);
0050       static void dump_detector_element(DetElement elt, ConditionsMap& map);
0051       static void dump_conditions_tree(DetElement elt, ConditionsMap& map);
0052     };
0053 
0054     template <typename T> void print_condition(Condition condition);
0055     template <typename T> void print_bound_value(Condition condition, const char* norm=0);
0056     template <typename T> void print_conditions(const RangeConditions& rc);
0057     void check_discrete_condition(Condition c, const IOV& iov);
0058 
0059     template<typename T> const T& access_val(Condition c)   {
0060       if ( !c->is_bound() )   {
0061         c.bind<T>();
0062       }
0063       return c.get<T>();
0064     }
0065   }
0066 }
0067 #endif // EXAMPLES_CONDITIONS_SRC_CONDITIONSTEST_H