DD4hep  1.31.0
Detector Description Toolkit for High Energy Physics
Manager_Type1.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
16 
17 #include <DD4hep/Detector.h>
18 #include <DD4hep/World.h>
19 #include <DD4hep/Errors.h>
20 #include <DD4hep/Plugins.h>
21 #include <DD4hep/Printout.h>
22 #include <DD4hep/Factories.h>
23 #include <DD4hep/InstanceCount.h>
24 #include <DD4hep/PluginCreators.h>
26 #include <DD4hep/detail/Handle.inl>
29 
30 #include <DDCond/ConditionsPool.h>
31 #include <DDCond/ConditionsEntry.h>
36 
37 using namespace dd4hep::cond;
38 
41 
43 
44 static void* ddcond_create_manager_instance(dd4hep::Detector& description, int, char**) {
45  return (ConditionsManagerObject*)new Manager_Type1(description);
46 }
47 DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_ConditionsManager_Type1,ddcond_create_manager_instance)
48 
49 #define NO_AGE 0
50 
51 namespace {
52  struct Range {};
53  struct Discrete {};
54 
55  int s_debug = dd4hep::INFO;
56 
58  template <typename T> const dd4hep::IOVType* check_iov_type(const Manager_Type1* o, const dd4hep::IOV* iov);
59 
61  template <> const dd4hep::IOVType* check_iov_type<void>(const Manager_Type1* o, const dd4hep::IOV* iov) {
62  if ( iov ) {
63  const dd4hep::IOVType* typ = iov->iovType ? iov->iovType : o->iovType(iov->type);
64  if ( typ ) {
65  if ( iov->type == typ->type ) {
66  if ( typ->type < o->m_rawPool.size() ) {
67  if ( o->m_rawPool[typ->type] != 0 ) {
68  return typ;
69  }
70  }
71  }
72  }
73  }
74  return 0;
75  }
76 
78  template <> const dd4hep::IOVType* check_iov_type<Discrete>(const Manager_Type1* o, const dd4hep::IOV* iov) {
79  const dd4hep::IOVType* typ = check_iov_type<void>(o,iov);
80  if ( typ && !iov->has_range() ) return typ;
81  return 0;
82  }
83 #if 0
84  template <> const dd4hep::IOVType* check_iov_type<Range>(const Manager_Type1* o, const dd4hep::IOV* iov) {
86  const dd4hep::IOVType* typ = check_iov_type<void>(o,iov);
87  if ( typ && iov->has_range() ) return typ;
88  return 0;
89  }
90 #endif
91  template <typename T> void __check_values__(const Manager_Type1* o, dd4hep::Condition::key_type key, const dd4hep::IOV* iov)
93  {
94  if ( !iov ) {
95  dd4hep::except("ConditionsMgr","+++ Invalid IOV to access condition: %16llX. [Null-reference]",key);
96  }
97  const dd4hep::IOVType* typ = check_iov_type<T>(o,iov);
98  if ( !typ ) {
99  // Severe: We have an unknown IOV type. This is not allowed,
100  // because we do not known hot to handle it.....
101  dd4hep::except("ConditionsMgr","+++ Invalid IOV type [%d] to access condition: %16llX.",
102  iov->type, key);
103  }
104  }
105 
107  bool is_range_complete(const dd4hep::IOV& iov, const RC& conditions) {
108  if ( !conditions.empty() ) {
109  // We need to check if the entire range is covered.
110  // For every key.second we must find a key.first, which is at least as big
111  dd4hep::IOV::Key test=iov.keyData;
112  // The range may be returned unordered. Hence,
113  // we have to try to match at most conditions.size() times until we really know
114  for( std::size_t j = 0; j < conditions.size(); ++j ) {
115  for(const auto& cond : conditions ) {
116  const dd4hep::IOV::Key& k = cond->iov->key();
117  if ( k.first <= test.first+1 && k.second >= test.first ) test.first = k.second;
118  if ( k.first+1 <= test.second && k.second >= test.second ) test.second = k.first;
119  //printout(INFO,"Test","IOV: %ld,%ld --> %ld,%ld",k.first,k.second, test.first, test.second);
120  if ( test.first >= test.second ) return true;
121  }
122  if ( test.first <= iov.keyData.first && test.second >= iov.keyData.second ) return false;
123  }
124  }
125  return false;
126  }
127 
128  template <typename PMF>
129  void __callListeners(const Manager_Type1::Listeners& listeners, PMF pmf, dd4hep::Condition& cond) {
130  for(const auto& listener : listeners )
131  (listener.first->*pmf)(cond, listener.second);
132  }
133 }
134 
137  : ConditionsManagerObject(description_instance), ObjectExtensions(typeid(Manager_Type1)),
138  m_updateLock(), m_poolLock(), m_updatePool(), m_rawPool(), m_locked(0)
139 {
141  declareProperty("MaxIOVTypes", m_maxIOVTypes=32);
142  declareProperty("PoolType", m_poolType = "");
143  declareProperty("UpdatePoolType", m_updateType = "DD4hep_ConditionsLinearUpdatePool");
144  declareProperty("UserPoolType", m_userType = "DD4hep_ConditionsMapUserPool");
145  declareProperty("LoaderType", m_loaderType = "DD4hep_Conditions_multi_Loader");
146  m_iovTypes.resize(m_maxIOVTypes,IOVType());
147  m_rawPool.resize(m_maxIOVTypes,0);
148 }
149 
152  for_each(m_rawPool.begin(), m_rawPool.end(), detail::DestroyObject<ConditionsIOVPool*>());
154 }
155 
157  if ( !m_updatePool.get() ) {
158  std::string typ = m_loaderType;
159  const void* argv_loader[] = {"ConditionsDataLoader", this, 0};
160  const void* argv_pool[] = {this, 0, 0};
161  m_loader.reset(createPlugin<ConditionsDataLoader>(typ,m_detDesc,2,argv_loader));
162  m_updatePool.reset(createPlugin<UpdatePool>(m_updateType,m_detDesc,2,argv_pool));
163  if ( !m_updatePool.get() ) {
164  except("ConditionsMgr","+++ The update pool of type %s cannot be created. [%s]",
165  m_updateType.c_str(),Errors::noSys().c_str());
166  }
167  Ref_t ref(m_updatePool.get());
168  ref->SetName("updates");
169  ref->SetTitle("updates");
170  }
171 }
172 
174 std::pair<bool, const dd4hep::IOVType*>
175 Manager_Type1::registerIOVType(std::size_t iov_index, const std::string& iov_name) {
176  if ( iov_index<m_iovTypes.size() ) {
177  IOVType& typ = m_iovTypes[iov_index];
178  bool eq_type = typ.type == iov_index;
179  bool eq_name = typ.name == iov_name;
180  if ( eq_type && eq_name ) {
181  return { false, &typ };
182  }
183  else if ( typ.type != 0 && eq_type && !eq_name ) {
184  except("ConditionsMgr","Cannot register IOV %s. Type %d already in use!",
185  iov_name.c_str(), iov_index);
186  }
187  typ.name = iov_name;
188  typ.type = iov_index;
189  m_rawPool[typ.type] = new ConditionsIOVPool(&typ);
190  return { true, &typ };
191  }
192  except("ConditionsMgr","Cannot register IOV section %d of type %d. Value out of bounds: [%d,%d]",
193  iov_name.c_str(), iov_index, 0, int(m_iovTypes.size()));
194  return { false, nullptr };
195 }
196 
198 const dd4hep::IOVType* Manager_Type1::iovType (size_t iov_index) const {
199  if ( iov_index<m_iovTypes.size() ) {
200  const IOVType& typ = m_iovTypes[iov_index];
201  if ( typ.type == iov_index ) return &typ;
202  }
203  except("ConditionsMgr","Request to access an unregistered IOV type: %d.", iov_index);
204  return 0;
205 }
206 
208 const dd4hep::IOVType* Manager_Type1::iovType (const std::string& iov_name) const {
209  for( const auto& i : m_iovTypes )
210  if ( i.name == iov_name ) return &i;
211  except("ConditionsMgr","Request to access an unregistered IOV type: %s.", iov_name.c_str());
212  return 0;
213 }
214 
217  // IOV read and checked. Now register it, but always locked!
218  ConditionsIOVPool* pool = m_rawPool[typ.type];
220  if ( !pool ) {
221  m_rawPool[typ.type] = pool = new ConditionsIOVPool(&typ);
222  }
223  ConditionsIOVPool::Elements::const_iterator i = pool->elements.find(key);
224  if ( i != pool->elements.end() ) {
225  return (*i).second.get();
226  }
227  IOV* iov = new IOV(&typ);
228  iov->type = typ.type;
229  iov->keyData = key;
230  const void* argv_pool[] = {this, iov, 0};
231  std::shared_ptr<ConditionsPool> cond_pool(createPlugin<ConditionsPool>(m_poolType,m_detDesc,2,argv_pool));
232  pool->elements.emplace(key,cond_pool);
233  printout(INFO,"ConditionsMgr","Created IOV Pool for:%s",iov->str().c_str());
234  return cond_pool.get();
235 }
236 
239  return m_rawPool[iov_type.type];
240 }
241 
244  if ( cond.isValid() ) {
245  cond->iov = pool.iov;
246  cond->setFlag(Condition::ACTIVE);
247  pool.insert(cond);
248 #if !defined(DD4HEP_MINIMAL_CONDITIONS) && defined(DD4HEP_CONDITIONS_HAVE_NAME)
249  printout(DEBUG,"ConditionsMgr","Register condition %016lX %s [%s] IOV:%s",
250  cond.key(), cond.name(), cond->address.c_str(), pool.iov->str().c_str());
251 #elif defined(DD4HEP_CONDITIONS_HAVE_NAME)
252  printout(DEBUG,"ConditionsMgr","Register condition %016lX %s IOV:%s",
253  cond.key(), cond.name(), pool.iov->str().c_str());
254 #else
255  printout(DEBUG,"ConditionsMgr","Register condition %016lX IOV:%s",
256  cond.key(), pool.iov->str().c_str());
257 #endif
258  if ( !m_onRegister.empty() ) {
260  }
261  return true;
262  }
263  else if ( !cond.isValid() )
264  except("ConditionsMgr","+++ Invalid condition objects may not be registered. [%s]",
265  Errors::invalidArg().c_str());
266  return false;
267 }
268 
270 std::size_t Manager_Type1::blockRegister(ConditionsPool& pool, const std::vector<Condition>& cond) const {
271  std::size_t result = 0;
272  for(auto c : cond) {
273  if ( c.isValid() ) {
274  c->iov = pool.iov;
275  c->setFlag(Condition::ACTIVE);
276  pool.insert(c);
277  if ( !m_onRegister.empty() ) {
279  }
280  ++result;
281  continue;
282  }
283  except("ConditionsMgr",
284  "+++ Invalid condition objects may not be registered. [%s]",
285  Errors::invalidArg().c_str());
286  }
287  return result;
288 }
289 
293  if ( e ) {
295  Condition condition(e->name,e->type);
296  Condition::Object* c = condition.ptr();
297  c->value = e->value;
298 #if !defined(DD4HEP_MINIMAL_CONDITIONS)
299  c->comment = "----";
300  c->address = "----";
301  c->validity = e->validity;
302 #endif
303  c->iov = p->iov;
305  p->insert(c);
306  if ( s_debug > INFO ) {
307 #if defined(DD4HEP_MINIMAL_CONDITIONS)
309  printout(INFO,"Conditions","+++ Loaded condition: %s %08X.%08X to %s",
310  e->detector.path().c_str(), key.values.det_key, key.values.item_key,
311  c->value.c_str());
312 #else
313  printout(INFO,"Conditions","+++ Loaded condition: %s.%s to %s [%s] V: %s",
314  e->detector.path().c_str(), c->name.c_str(),
315  c->value.c_str(), c->type.c_str(), c->validity.c_str());
316 #endif
317  }
318  return c;
319  }
320  return Condition();
321 }
322 
325  std::unique_ptr<UserPool>& up)
326 {
327  const IOVType* typ = check_iov_type<Discrete>(this, &req_iov);
328  if ( typ ) {
329  ConditionsIOVPool* pool = m_rawPool[typ->type];
330  if ( 0 == up.get() ) {
331  const void* argv[] = {this, pool, 0};
332  UserPool* p = createPlugin<UserPool>(m_userType,m_detDesc,2,argv);
333  up.reset(p);
334  }
335  return;
336  }
337  // Invalid IOV type. Throw exception
338  except("ConditionsMgr","+++ Unknown IOV type requested to enable conditions. [%s]",
339  Errors::invalidArg().c_str());
340 }
341 
344  m_cleaner.reset(cleaner);
345 }
346 
348 int Manager_Type1::clean(const IOVType* typ, int max_age) {
349  int count = 0;
351  ConditionsIOVPool* pool = m_rawPool[typ->type];
352  if ( pool ) {
353  count += pool->clean(max_age);
354  }
355  return count;
356 }
357 
359 std::pair<int,int> Manager_Type1::clean(const ConditionsCleanup& cleaner) {
360  std::pair<int,int> count(0,0);
361  for( TypedConditionPool::iterator i=m_rawPool.begin(); i != m_rawPool.end(); ++i) {
362  ConditionsIOVPool* p = *i;
363  if ( p && cleaner(*p) ) {
364  ++count.first;
365  count.second += p->clean(cleaner);
366  }
367  }
368  return count;
369 }
370 
372 std::pair<int,int> Manager_Type1::clear() {
373  std::pair<int,int> count(0,0);
374  for( TypedConditionPool::iterator i=m_rawPool.begin(); i != m_rawPool.end(); ++i) {
375  ConditionsIOVPool* p = *i;
376  if ( p ) {
377  ++count.first;
378  count.second += p->clean(0);
379  }
380  }
381  return count;
382 }
383 
386  Updates entries; {
388  m_updatePool->popEntries(entries);
389  }
390  // Lock global pool so that no other updates happen in the meanwhile
391  // which could kill the pool's containers
393  for(const auto& iov_iter : entries ) {
394  const UpdatePool::ConditionEntries& ents = iov_iter.second;
395  if ( !ents.empty() ) {
396  for(Condition c : ents ) {
397  c->setFlag(Condition::ACTIVE);
398  except("ConditionsMgr",
399  "+++ We should never end up here [%s]. FIXME!!!!",
400  c.str(0).c_str());
401  //c->pool->insert(c);
402  }
403  }
404  }
405 }
406 
409  const IOV& req_validity,
410  RangeConditions& conditions) {
411  {
412  ConditionsIOVPool* p = 0;
413  dd4hep_lock_t locked_action(m_poolLock);
414  p = m_rawPool[req_validity.type]; // Existence already checked by caller!
415  p->select(key, req_validity, conditions);
416  }
417  {
418  dd4hep_lock_t locked_action(m_updateLock);
419  m_updatePool->select_range(key, req_validity, conditions);
420  }
421  return !conditions.empty();
422 }
423 
426  const IOV& req_validity,
427  RangeConditions& conditions)
428 {
429  {
430  ConditionsIOVPool* p = 0;
431  dd4hep_lock_t locked_action(m_poolLock);
432  p = m_rawPool[req_validity.type]; // Existence alread checked by caller!
433  p->selectRange(key, req_validity, conditions);
434  }
435  {
436  dd4hep_lock_t locked_action(m_updateLock);
437  m_updatePool->select_range(key, req_validity, conditions);
438  }
439  return is_range_complete(req_validity,conditions);
440 }
441 #if 0
442 Condition
444 Manager_Type1::get(Condition::key_type key, const IOV& iov)
445 {
446  RC conditions;
447  __check_values__<Discrete>(this, key, &iov);
448  bool rc = select(key, iov, conditions);
449  if ( !rc ) {
450  dd4hep_lock_t locked_load(m_updateLock);
451  m_loader->load_single(key, iov, conditions);
452  }
453  if ( conditions.size() == 1 ) {
454  conditions[0]->flags |= Condition::ACTIVE;
455  return conditions[0];
456  }
457  else if ( conditions.empty() ) {
458  except("ConditionsMgr","+++ Condition %16llX for the requested IOV %s do not exist.",
459  key, iov.str().c_str());
460  }
461  else if ( conditions.size() > 1 ) {
462  RC::const_iterator start = conditions.begin();
463  Condition first = *start;
464  printout(ERROR,"ConditionsMgr","+++ Condition %s [%16llX] is ambiguous for IOV %s:",
465  first.name(), key, iov.str().c_str());
466  for(RC::const_iterator i=start; i!=conditions.end(); ++i) {
467  Condition c = *i;
468  printout(ERROR,"ConditionsMgr","+++ %s [%s] = %s",
469  c.name(), c->iov->str().c_str(), c->value.c_str());
470  }
471  except("ConditionsMgr","+++ Condition %s [%16llX] is ambiguous for IOV %s:",
472  first.name(), key, iov.str().c_str());
473  }
474  return Condition();
475 }
476 
479 Manager_Type1::getRange(Condition::key_type key, const IOV& iov)
480 {
481  RC conditions;
482  __check_values__<Range>(this, key, &iov);
483  bool rc = select_range(key, iov, conditions);
484  if ( rc ) {
485  return conditions;
486  }
487  else {
488  dd4hep_lock_t locked_load(m_updateLock);
489  m_loader->load_range(key, iov, conditions);
490  if ( conditions.empty() ) {
491  except("ConditionsMgr","+++ Conditions %16llX for IOV %s do not exist.",
492  key, iov.str().c_str());
493  }
494  conditions.clear();
495  }
496  rc = select_range(key, iov, conditions);
497  if ( !rc ) {
498  except("ConditionsMgr","+++ Conditions %16llX for IOV %s do not exist.",
499  key, iov.str().c_str());
500  }
501  return conditions;
502 }
503 #endif
504 
508 {
509  __get_checked_pool(req_iov, slice.pool);
511  pushUpdates();
513  Result res = slice.pool->prepare(req_iov, slice, ctx);
515  if ( m_cleaner.get() ) {
516  this->clean(*m_cleaner);
517  }
518  return res;
519 }
520 
524  __get_checked_pool(req_iov, slice.pool);
526  pushUpdates();
528  Result res = slice.pool->load(req_iov, slice, ctx);
529  return res;
530 }
531 
535  Result res = slice.pool->compute(req_iov, slice, ctx);
537  if ( m_cleaner.get() ) {
538  this->clean(*m_cleaner);
539  }
540  return res;
541 }
542 
544 std::unique_ptr<UserPool> Manager_Type1::createUserPool(const IOVType* iovT) const {
545  if ( iovT ) {
546  ConditionsIOVPool* p = m_rawPool[iovT->type];
547  const void* argv[] = {this, p, 0};
548  std::unique_ptr<UserPool> pool(createPlugin<UserPool>(m_userType,m_detDesc,2,argv));
549  return pool;
550  }
551  // Invalid IOV type. Throw exception
552  except("ConditionsMgr","+++ Unknown IOV type requested to enable conditions. [%s]",
553  Errors::invalidArg().c_str());
554  return std::unique_ptr<UserPool>();
555 }
556 
dd4hep::detail::ConditionObject::value
std::string value
Condition value (in string form)
Definition: ConditionsInterna.h:71
dd4hep::DetElement::path
const std::string & path() const
Path of the detector element (not necessarily identical to placement path!)
Definition: DetElement.cpp:158
dd4hep::RangeConditions
std::vector< Condition > RangeConditions
Definition: Conditions.h:491
dd4hep::cond::Manager_Type1::m_userType
std::string m_userType
Property: UserPool constructor type (default: DD4hep_ConditionsLinearUserPool)
Definition: Manager_Type1.h:62
dd4hep::IOVType::name
std::string name
String name.
Definition: IOV.h:43
cond
AlignmentCondition::Object * cond
Definition: AlignmentsCalculator.cpp:68
dd4hep::cond::Manager_Type1::iovType
virtual const IOVType * iovType(size_t iov_index) const final
Access IOV by its type.
Definition: Manager_Type1.cpp:198
Manager_Type1.h
dd4hep::PropertyConfigurable::declareProperty
void declareProperty(const std::string &nam, T &val)
Declare property.
Definition: ComponentProperties.h:288
dd4hep::cond::Manager_Type1::initialize
void initialize()
Access to managed pool of typed conditions indexed by IOV-type and IOV key.
Definition: Manager_Type1.cpp:156
dd4hep::detail::ConditionObject::hash
Condition::key_type hash
Hash value of the name.
Definition: ConditionsInterna.h:85
ConditionsCleanup.h
dd4hep::cond::UpdatePool::ConditionEntries
std::vector< Condition > ConditionEntries
Definition: ConditionsPool.h:112
dd4hep::cond::Manager_Type1::m_poolType
std::string m_poolType
Property: ConditionsPool constructor type (default: empty. MUST BE SET!)
Definition: Manager_Type1.h:58
ConditionsInterna.h
dd4hep::ObjectExtensions
Implementation of an object supporting arbitrary user extensions.
Definition: ObjectExtensions.h:33
Detector.h
dd4hep::cond::Manager_Type1::load
virtual Result load(const IOV &required_validity, ConditionsSlice &slice, ConditionUpdateUserContext *ctxt=0) final
Load all updates to the clients with the defined IOV (1rst step of prepare)
Definition: Manager_Type1.cpp:523
dd4hep::cond::ConditionsManagerObject::m_loader
Loader m_loader
Reference to the data loader userd by this instance.
Definition: ConditionsManagerObject.h:70
dd4hep::cond::Manager_Type1::m_updateType
std::string m_updateType
Property: UpdatePool constructor type (default: DD4hep_ConditionsLinearUpdatePool)
Definition: Manager_Type1.h:60
ConditionsDataLoader.h
World.h
dd4hep::cond::Manager_Type1::createUserPool
virtual std::unique_ptr< UserPool > createUserPool(const IOVType *iovT) const
Create empty user pool object.
Definition: Manager_Type1.cpp:544
dd4hep::Handle< NamedObject >
DetectorInterna.h
dd4hep::cond::ConditionsPool::insert
virtual bool insert(Condition cond)=0
Register a new condition to this pool.
dd4hep::IOV::str
std::string str() const
Create string representation of the IOV.
Definition: IOV.cpp:141
dd4hep::cond::Manager_Type1::compute
virtual Result compute(const IOV &required_validity, ConditionsSlice &slice, ConditionUpdateUserContext *ctxt=0) final
Compute all derived conditions with the defined IOV (2nd step of prepare)
Definition: Manager_Type1.cpp:534
dd4hep::IOV::Key
std::pair< Key_value_type, Key_value_type > Key
Definition: IOV.h:74
dd4hep::InstanceCount::increment
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
dd4hep::detail::ConditionObject::address
std::string address
Condition address.
Definition: ConditionsInterna.h:76
dd4hep::cond::ConditionsIOVPool::elements
Elements elements
Container of IOV dependent conditions pools.
Definition: ConditionsIOVPool.h:46
dd4hep::cond::ConditionsIOVPool::clean
int clean(int max_age)
Remove all key based pools with an age beyon the minimum age.
Definition: ConditionsIOVPool.cpp:93
dd4hep::cond::Manager_Type1::clear
virtual std::pair< int, int > clear() final
Full cleanup of all managed conditions.
Definition: Manager_Type1.cpp:372
ConditionsManager.h
Factories.h
dd4hep::cond::ConditionUpdateUserContext
ConditionUpdateUserContext class used by the derived conditions calculation mechanism.
Definition: ConditionDerived.h:49
dd4hep::ConditionKey::KeyMaker
Helper union to interprete conditions keys.
Definition: Conditions.h:295
dd4hep::cond::ConditionsManagerObject::m_onRegister
Listeners m_onRegister
Conditions listeners on registration of new conditions.
Definition: ConditionsManagerObject.h:66
dd4hep::cond::Manager_Type1
The data class behind a conditions manager handle.
Definition: Manager_Type1.h:47
dd4hep::IOVType
Class describing the interval of validty type.
Definition: IOV.h:37
dd4hep::cond::Entry::value
std::string value
The actual conditions data.
Definition: ConditionsEntry.h:41
dd4hep::NamedObject::SetName
void SetName(const char *nam)
Set name (used by Handle)
Definition: NamedObject.h:62
RC
dd4hep::RangeConditions RC
Definition: Manager_Type1.cpp:40
dd4hep::cond::Manager_Type1::__get_checked_pool
void __get_checked_pool(const IOV &required_validity, std::unique_ptr< UserPool > &user_pool)
Register a set of new managed condition for an IOV range. Called by __load_immediate.
Definition: Manager_Type1.cpp:324
dd4hep::cond::Manager_Type1::m_cleaner
std::unique_ptr< ConditionsCleanup > m_cleaner
Reference to the default conditions cleanup object (if registered)
Definition: Manager_Type1.h:77
entries
Entries entries
Definition: AlignmentsCalculator.cpp:81
dd4hep::Errors::invalidArg
std::string invalidArg()
System error string for EINVAL. Sets errno accordingly.
ConditionsEntry.h
dd4hep::cond::ConditionsManagerObject
Basic conditions manager implementation.
Definition: ConditionsManagerObject.h:54
dd4hep::Condition
Main condition object handle.
Definition: Conditions.h:51
dd4hep::cond
Namespace for implementation details of the AIDA detector description toolkit.
Definition: ConditionsCleanup.h:23
dd4hep::IOV
Class describing the interval of validty.
Definition: IOV.h:67
dd4hep::dd4hep_lock_t
Do-nothing compatibility std::unique_ptr emulation for cxx-98.
Definition: Mutex.h:43
dd4hep::cond::ConditionsPool
Class implementing the conditions collection for a given IOV type.
Definition: ConditionsPool.h:54
dd4hep::InstanceCount::decrement
static void decrement(T *)
Decrement count according to type information.
Definition: InstanceCount.h:102
dd4hep::IOV::keyData
Key keyData
IOV key (if second==first, discrete, otherwise range)
Definition: IOV.h:82
dd4hep::cond::Manager_Type1::m_rawPool
TypedConditionPool m_rawPool
Managed pool of typed conditions indexed by IOV-type and IOV key.
Definition: Manager_Type1.h:81
DECLARE_DD4HEP_CONSTRUCTOR
#define DECLARE_DD4HEP_CONSTRUCTOR(name, func)
Definition: Factories.h:291
dd4hep::cond::ConditionsPool::iov
IOV * iov
The IOV of the conditions hosted.
Definition: ConditionsPool.h:65
dd4hep::cond::Entry::detector
DetElement detector
Reference to the detector element.
Definition: ConditionsEntry.h:39
dd4hep::NamedObject::SetTitle
void SetTitle(const char *tit)
Set Title (used by Handle)
Definition: NamedObject.h:66
Plugins.h
dd4hep::cond::Manager_Type1::m_poolLock
dd4hep_mutex_t m_poolLock
Lock to protect the pool of all known conditions.
Definition: Manager_Type1.h:73
Errors.h
dd4hep::cond::ConditionsIOVPool::select
size_t select(Condition::key_type key, const IOV &req_validity, RangeConditions &result)
Retrieve a condition set given the key according to their validity.
Definition: ConditionsIOVPool.cpp:41
dd4hep::IOV::has_range
bool has_range() const
Check if the IOV corresponds to a range.
Definition: IOV.h:111
ConditionsIOVPool.h
dd4hep::cond::Manager_Type1::__queue_update
Condition __queue_update(cond::Entry *data)
Definition: Manager_Type1.cpp:292
dd4hep::Errors::noSys
std::string noSys()
System error string for ENOSYS. Sets errno accordingly.
dd4hep::cond::Manager_Type1::Manager_Type1
Manager_Type1(Detector &description)
Standard constructor.
Definition: Manager_Type1.cpp:136
dd4hep::detail::ConditionObject::comment
std::string comment
Comment string.
Definition: ConditionsInterna.h:78
dd4hep::cond::Manager_Type1::m_iovTypes
std::vector< IOVType > m_iovTypes
Collection of IOV types managed.
Definition: Manager_Type1.h:67
dd4hep::cond::ConditionsManagerObject::m_detDesc
Detector & m_detDesc
Reference to main detector description object.
Definition: ConditionsManagerObject.h:64
dd4hep::detail::ConditionObject::validity
std::string validity
Condition validity (in string form)
Definition: ConditionsInterna.h:74
dd4hep::cond::Manager_Type1::prepare
virtual Result prepare(const IOV &req_iov, ConditionsSlice &slice, ConditionUpdateUserContext *ctxt) final
Prepare all updates for the given keys to the clients with the defined IOV.
Definition: Manager_Type1.cpp:507
ConditionsListener.h
dd4hep::Condition::key_type
unsigned long long int key_type
Forward definition of the key type.
Definition: Conditions.h:54
dd4hep::cond::Entry::validity
std::string validity
The validity string to be interpreted by the updating engine.
Definition: ConditionsEntry.h:43
dd4hep::cond::ConditionsManagerObject::registerIOV
ConditionsPool * registerIOV(const std::string &data)
Register IOV using new string data.
Definition: ConditionsManager.cpp:143
dd4hep::detail::ConditionObject
The data class behind a conditions handle.
Definition: ConditionsInterna.h:68
dd4hep::IOV::type
unsigned int type
IOV buffer type: Must be a bitmap!
Definition: IOV.h:86
dd4hep::cond::UserPool
Interface for conditions pool optimized to host conditions updates.
Definition: ConditionsPool.h:134
dd4hep::cond::Manager_Type1::m_maxIOVTypes
int m_maxIOVTypes
Property: maximal number of IOV types to be handled.
Definition: Manager_Type1.h:56
dd4hep::cond::ConditionsSlice::pool
std::unique_ptr< UserPool > pool
Reference to the user pool managing all conditions of this slice.
Definition: ConditionsSlice.h:107
key
unsigned char key
Definition: AlignmentsCalculator.cpp:69
dd4hep::cond::ConditionsManager::Result
Result of a prepare call to the conditions manager.
Definition: ConditionsManager.h:59
DD4HEP_INSTANTIATE_HANDLE_NAMED
DD4HEP_INSTANTIATE_HANDLE_NAMED(Manager_Type1)
dd4hep::cond::Manager_Type1::adoptCleanup
virtual void adoptCleanup(ConditionsCleanup *cleaner) final
Adopt cleanup handler. If a handler is registered, it is invoked at every "prepare" step.
Definition: Manager_Type1.cpp:343
dd4hep::cond::ConditionsCleanup
Base class to handle conditions cleanups.
Definition: ConditionsCleanup.h:32
dd4hep::cond::Manager_Type1::~Manager_Type1
virtual ~Manager_Type1()
Default destructor.
Definition: Manager_Type1.cpp:151
dd4hep::cond::Manager_Type1::registerUnlocked
virtual bool registerUnlocked(ConditionsPool &pool, Condition cond) final
Register new condition with the conditions store. Unlocked version, not multi-threaded.
Definition: Manager_Type1.cpp:243
dd4hep::Handle::ptr
T * ptr() const
Access to the held object.
Definition: Handle.h:153
dd4hep::cond::Manager_Type1::m_updatePool
std::unique_ptr< UpdatePool > m_updatePool
Reference to update conditions pool.
Definition: Manager_Type1.h:75
dd4hep::cond::Manager_Type1::clean
virtual int clean(const IOVType *typ, int max_age) final
Clean conditions, which are above the age limit.
Definition: Manager_Type1.cpp:348
dd4hep::IOV::iovType
const IOVType * iovType
Reference to IOV type.
Definition: IOV.h:80
Updates
UpdatePool::UpdateEntries Updates
Definition: Manager_Type1.cpp:39
dd4hep::cond::ConditionsListener::onRegisterCondition
virtual void onRegisterCondition(Condition, void *)
ConditionsListener dummy implementation: onRegister new condition.
Definition: ConditionsListener.h:50
dd4hep::cond::Manager_Type1::m_updateLock
dd4hep_mutex_t m_updateLock
Lock to protect the update/delayed conditions pool.
Definition: Manager_Type1.h:71
dd4hep::ConditionKey::KeyMaker::hash
Condition::key_type hash
Definition: Conditions.h:296
dd4hep::cond::Manager_Type1::m_loaderType
std::string m_loaderType
Property: Conditions loader type (default: "multi" -> DD4hep_Conditions_multi_Loader)
Definition: Manager_Type1.h:64
dd4hep::cond::ConditionsManagerObject::Listeners
std::set< Listener > Listeners
Definition: ConditionsManagerObject.h:58
dd4hep::cond::Manager_Type1::select
bool select(key_type key, const IOV &req_validity, RangeConditions &conditions)
Retrieve a condition set given a Detector Element and the conditions name according to their validity...
Definition: Manager_Type1.cpp:408
dd4hep::cond::Manager_Type1::blockRegister
virtual size_t blockRegister(ConditionsPool &pool, const std::vector< Condition > &cond) const final
Register a whole block of conditions with identical IOV.
Definition: Manager_Type1.cpp:270
dd4hep::cond::UpdatePool::UpdateEntries
std::map< const IOV *, ConditionEntries > UpdateEntries
Update container specification.
Definition: ConditionsPool.h:114
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
dd4hep::Condition::ACTIVE
@ ACTIVE
Definition: Conditions.h:77
ConditionsPool.h
dd4hep::NamedObject::name
std::string name
The object name.
Definition: NamedObject.h:33
dd4hep::cond::Manager_Type1::registerIOVType
virtual std::pair< bool, const IOVType * > registerIOVType(size_t iov_index, const std::string &iov_name) final
Register new IOV type if it does not (yet) exist.
Definition: Manager_Type1.cpp:175
dd4hep::NamedObject::type
std::string type
The object type.
Definition: NamedObject.h:35
dd4hep::cond::Manager_Type1::iovPool
virtual ConditionsIOVPool * iovPool(const IOVType &type) const final
Access conditions multi IOV pool by iov type.
Definition: Manager_Type1.cpp:238
InstanceCount.h
dd4hep::IOVType::type
unsigned int type
integer identifier used internally
Definition: IOV.h:41
dd4hep::detail::ConditionObject::iov
const IOV * iov
Interval of validity.
Definition: ConditionsInterna.h:83
dd4hep::cond::ConditionsIOVPool
Pool of conditions satisfying one IOV type (epoch, run, fill, etc)
Definition: ConditionsIOVPool.h:38
dd4hep::cond::Manager_Type1::registerIOV
virtual ConditionsPool * registerIOV(const IOVType &typ, IOV::Key key) final
Register IOV with type and key.
Definition: Manager_Type1.cpp:216
Printout.h
dd4hep::cond::ConditionsIOVPool::selectRange
size_t selectRange(Condition::key_type key, const IOV &req_validity, RangeConditions &result)
Retrieve a condition set given the key according to their validity.
Definition: ConditionsIOVPool.cpp:56
PluginCreators.h
dd4hep::cond::Manager_Type1::select_range
bool select_range(key_type key, const IOV &req_validity, RangeConditions &conditions)
Retrieve a condition set given a Detector Element and the conditions name according to their validity...
Definition: Manager_Type1.cpp:425
dd4hep::cond::Manager_Type1::pushUpdates
virtual void pushUpdates() final
Push all pending updates to the conditions store.
Definition: Manager_Type1.cpp:385
dd4hep::cond::ConditionsSlice
Conditions slice object. Defines which conditions should be loaded by the ConditionsManager.
Definition: ConditionsSlice.h:53
dd4hep::cond::Entry
The intermediate conditions data used to populate the DetElement conditions.
Definition: ConditionsEntry.h:36