Back to home page

EIC code displayed by LXR

 
 

    


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

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_PERSISTENCY_SRC_PERSISTENCYSETUP_H
0014 #define EXAMPLES_PERSISTENCY_SRC_PERSISTENCYSETUP_H
0015 
0016 #include "DD4hep/Detector.h"
0017 #include "DD4hep/Printout.h"
0018 #include "DD4hep/Primitives.h"
0019 #include "DD4hep/Conditions.h"
0020 #include "DD4hep/Alignments.h"
0021 #include "DD4hep/Grammar.h"
0022 #include "DD4hep/AlignmentData.h"
0023 #include "DD4hep/detail/AlignmentsInterna.h"
0024 #include "DD4hep/detail/ConditionsInterna.h"
0025 
0026 /// Namespace for the AIDA detector description toolkit
0027 namespace dd4hep {
0028 
0029   /// Namespace for persistency examples
0030   namespace PersistencyExamples {
0031 
0032     template<typename T> Condition make_condition(const std::string& name, T val)   {
0033       Condition cond("Test#"+name, name);
0034       T& value   = cond.bind<T>();
0035       value      = val;
0036       cond->hash = ConditionKey(detail::hash32("TestCondition"),name).hash;
0037       return cond;
0038     }
0039 
0040     /// Print conditions object
0041     int printCondition(Condition cond);
0042 
0043     class PersistencyIO   {
0044     public:
0045       /// Default constructor
0046       PersistencyIO();
0047       /// Default destructor
0048       virtual ~PersistencyIO();
0049       /// Generic object write method
0050       int write(const std::string& fname, const std::string& title, const std::type_info& typ, const void* object);
0051       /// Object write method
0052       template <typename T> int write(const std::string& fname, const std::string& title, const T& object)
0053       {
0054         return write(fname, title, typeid(T), &object);
0055       }
0056       
0057     };
0058     
0059   }       /* End namespace persistencyexamples            */
0060 }         /* End namespace dd4hep                         */
0061 
0062 #endif // EXAMPLES_PERSISTENCY_SRC_PERSISTENCYSETUP_H