DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsOperators.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
15 #include <DD4hep/Printout.h>
16 #include <DD4hep/InstanceCount.h>
18 #include <DDCond/ConditionsPool.h>
21 
22 // C/C++ include files
23 #include <cstring>
24 
25 using namespace dd4hep::cond;
26 
28 size_t Operators::collectAllConditions(Detector& description, RangeConditions& conditions) {
29  ConditionsManager manager = ConditionsManager::from(description);
30  return collectAllConditions(manager, conditions);
31 }
32 
35  const auto types = manager.iovTypesUsed();
36  size_t num_conditions = 0;
37  for( auto type : types ) {
38  if ( type ) {
39  ConditionsIOVPool* pool = manager.iovPool(*type);
40  if ( pool ) {
41  for( auto& cp : pool->elements ) {
42  RangeConditions rc;
43  cp.second->select_all(rc);
44  for( auto c : rc )
45  conditions.emplace_back(c);
46  num_conditions += rc.size();
47  }
48  }
49  }
50  }
51  return num_conditions;
52 }
53 
55 size_t Operators::collectAllConditions(Detector& description, std::map<int,Condition>& conditions) {
56  ConditionsManager manager = ConditionsManager::from(description);
57  return collectAllConditions(manager, conditions);
58 }
59 
61 size_t Operators::collectAllConditions(ConditionsManager manager, std::map<int,Condition>& conditions) {
62  const auto types = manager.iovTypesUsed();
63  size_t num_conditions = 0;
64  for( auto type : types ) {
65  if ( type ) {
66  ConditionsIOVPool* pool = manager.iovPool(*type);
67  if ( pool ) {
68  for( auto& cp : pool->elements ) {
69  RangeConditions rc;
70  cp.second->select_all(rc);
71  for( auto c : rc )
72  conditions.emplace(c->hash,c);
73  num_conditions += rc.size();
74  }
75  }
76  }
77  }
78  return num_conditions;
79 }
80 
dd4hep::RangeConditions
std::vector< Condition > RangeConditions
Definition: Conditions.h:491
ConditionsInterna.h
dd4hep::cond::ConditionsIOVPool::elements
Elements elements
Container of IOV dependent conditions pools.
Definition: ConditionsIOVPool.h:46
dd4hep::cond::ConditionsManager::iovTypesUsed
const std::vector< const IOVType * > iovTypesUsed() const
Access the used/registered IOV types.
Definition: ConditionsManager.cpp:209
dd4hep::cond::ConditionsManager::iovPool
ConditionsIOVPool * iovPool(const IOVType &type) const
Access conditions multi IOV pool by iov type.
Definition: ConditionsManager.cpp:204
dd4hep::cond::ConditionsManager::from
static ConditionsManager from(T &host)
Static accessor if installed as an extension.
dd4hep::cond
Namespace for implementation details of the AIDA detector description toolkit.
Definition: ConditionsCleanup.h:23
dd4hep::cond::Operators::collectAllConditions
static size_t collectAllConditions(Detector &description, RangeConditions &conditions)
Select all condition from the conditions manager registered at the Detector object.
Definition: ConditionsOperators.cpp:28
ConditionsIOVPool.h
ConditionsOperators.h
dd4hep::cond::ConditionsManager
Manager class for condition handles.
Definition: ConditionsManager.h:46
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90
ConditionsPool.h
InstanceCount.h
dd4hep::cond::ConditionsIOVPool
Pool of conditions satisfying one IOV type (epoch, run, fill, etc)
Definition: ConditionsIOVPool.h:38
Printout.h