Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:29

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 // Framework include files
0015 #include <DDCond/ConditionsPool.h>
0016 #include <DDCond/ConditionsManagerObject.h>
0017 #include <DD4hep/Printout.h>
0018 #include <DD4hep/InstanceCount.h>
0019 #include <DD4hep/detail/Handle.inl>
0020 #include <DD4hep/ConditionsPrinter.h>
0021 #include <DD4hep/detail/ConditionsInterna.h>
0022 
0023 using namespace dd4hep::cond;
0024 
0025 DD4HEP_INSTANTIATE_HANDLE_NAMED(UpdatePool);
0026 DD4HEP_INSTANTIATE_HANDLE_NAMED(ConditionsPool);
0027 
0028 /// Default constructor
0029 ConditionsPool::ConditionsPool(ConditionsManager mgr, IOV* i)
0030   : NamedObject(), m_manager(mgr), iov(i), age_value(AGE_NONE)
0031 {
0032   InstanceCount::increment(this);
0033 }
0034 
0035 /// Default destructor
0036 ConditionsPool::~ConditionsPool()   {
0037   // Should, but cannot clear here, since clear is a virtual overload.
0038   InstanceCount::decrement(this);
0039 }
0040 
0041 /// Print pool basics
0042 void ConditionsPool::print()   const  {
0043   printout(INFO,"ConditionsPool","+++ Conditions for pool with IOV: %-32s age:%3d [%4d entries]",
0044            GetName(), age_value, size());
0045 }
0046 
0047 /// Print pool basics
0048 void ConditionsPool::print(const std::string& opt)   const  {
0049   printout(INFO,"ConditionsPool","+++ %s Conditions for pool with IOV: %-32s age:%3d [%4d entries]",
0050            opt.c_str(), GetName(), age_value, size());
0051   if ( opt == "*" || opt == "ALL" )   {
0052     ConditionsPrinter printer(0);
0053     RangeConditions   range;
0054     printer.summary    = false;
0055     printer.lineLength = 132;
0056     const_cast<ConditionsPool*>(this)->select_all(range);
0057     for( auto c : range )
0058       printer(c);
0059   }
0060 }
0061 
0062 /// Listener invocation when a condition is registered to the cache
0063 void ConditionsPool::onRegister(Condition condition)   {
0064   m_manager.ptr()->onRegister(condition);
0065 }
0066 
0067 /// Listener invocation when a condition is deregistered from the cache
0068 void ConditionsPool::onRemove(Condition condition)   {
0069   m_manager.ptr()->onRemove(condition);
0070 }
0071 
0072 /// Default constructor
0073 UpdatePool::UpdatePool(ConditionsManager mgr, IOV* i) : ConditionsPool(mgr, i)
0074 {
0075 }
0076 
0077 /// Default destructor
0078 UpdatePool::~UpdatePool()   {
0079 }
0080 
0081 /// Default constructor
0082 UserPool::UserPool(ConditionsManager mgr)
0083   : m_iov(0), m_manager(mgr)
0084 {
0085   InstanceCount::increment(this);
0086 }
0087 
0088 /// Default destructor.
0089 UserPool::~UserPool()   {
0090   InstanceCount::decrement(this);
0091 }