DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConditionsOperators.cpp
Go to the documentation of this file.
1 // $Id$
2 //==========================================================================
3 // AIDA Detector description implementation for LCD
4 //--------------------------------------------------------------------------
5 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
6 // All rights reserved.
7 //
8 // For the licensing terms see $DD4hepINSTALL/LICENSE.
9 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
10 //
11 // Author : M.Frank
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include "DD4hep/Printout.h"
17 #include "DD4hep/InstanceCount.h"
22 #include "DDCond/ConditionsPool.h"
24 
25 using namespace std;
26 using namespace DD4hep;
27 using namespace DD4hep::Conditions;
29 
31 size_t Operators::collectAllConditions(LCDD& lcdd, RangeConditions& conditions) {
32  ConditionsManager manager = ConditionsManager::from(lcdd);
33  return collectAllConditions(manager, conditions);
34 }
35 
37 size_t Operators::collectAllConditions(ConditionsManager manager, RangeConditions& conditions) {
38  typedef vector<const IOVType*> _T;
40  const _T types = manager.iovTypesUsed();
41  size_t num_conditions = 0;
42  for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) {
43  const IOVType* type = *i;
44  if ( type ) {
45  ConditionsIOVPool* pool = manager.iovPool(*type);
46  if ( pool ) {
47  const _E& e = pool->elements;
48  for (_E::const_iterator j=e.begin(); j != e.end(); ++j) {
49  ConditionsPool* cp = (*j).second;
50  RangeConditions rc;
51  cp->select_all(rc);
52  for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)
53  conditions.push_back(*ic);
54  num_conditions += rc.size();
55  }
56  }
57  }
58  }
59  return num_conditions;
60 }
61 
63 size_t Operators::collectAllConditions(LCDD& lcdd, std::map<int,Condition>& conditions) {
64  ConditionsManager manager = ConditionsManager::from(lcdd);
65  return collectAllConditions(manager, conditions);
66 }
67 
69 size_t Operators::collectAllConditions(ConditionsManager manager, std::map<int,Condition>& conditions) {
70  typedef vector<const IOVType*> _T;
72  const _T types = manager.iovTypesUsed();
73  size_t num_conditions = 0;
74  for( _T::const_iterator i = types.begin(); i != types.end(); ++i ) {
75  const IOVType* type = *i;
76  if ( type ) {
77  ConditionsIOVPool* pool = manager.iovPool(*type);
78  if ( pool ) {
79  const _E& e = pool->elements;
80  for (_E::const_iterator j=e.begin(); j != e.end(); ++j) {
81  ConditionsPool* cp = (*j).second;
82  RangeConditions rc;
83  cp->select_all(rc);
84  for(RangeConditions::const_iterator ic=rc.begin(); ic!=rc.end(); ++ic)
85  conditions.insert(make_pair((*ic)->hash,*ic));
86  num_conditions += rc.size();
87  }
88  }
89  }
90  }
91  return num_conditions;
92 }
93 
virtual void select_all(RangeConditions &result)=0
Select all conditions contained.
Elements elements
Container of IOV dependent conditions pools.
#define _E(x)
Definition: XMLElements.cpp:46
return e
Definition: Volumes.cpp:297
Manager class for condition handles.
std::map< IOV::Key, Element > Elements
Class describing the interval of validty type.
Definition: IOV.h:33
Class implementing the conditions collection for a given IOV type.
Pool of conditions satisfying one IOV type (epoch, run, fill, etc)
std::vector< Condition > RangeConditions
Definition: Conditions.h:359
The main interface to the DD4hep detector description package.
Definition: LCDD.h:82
ConditionsIOVPool * iovPool(const IOVType &type) const
Access conditions multi IOV pool by iov type.
static const char * _T(const std::string &s)
const std::vector< const IOVType * > iovTypesUsed() const
Access the used/registered IOV types.