DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
ConditionsProcessor.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 includes
15 #include <DD4hep/Printout.h>
18 
19 using namespace dd4hep;
20 using namespace dd4hep::cond;
21 
22 
24 template <typename T>
26  struct Collector : public Condition::Processor {
28  T& container;
30  Collector(DetElement d, T& c) : det(d), container(c) {}
32  virtual int process(Condition c) const override { insert_item(container, det, c); return 1; }
33  };
34  if ( de.isValid() ) {
35  mapping.scan(de, ConditionsMap::FIRST_ITEM, ConditionsMap::LAST_ITEM, Collector(de,conditions));
36  return (int)conditions.size();
37  }
38  except("Conditions","Cannot process conditions of an invalid detector element");
39  return 0;
40 }
41 
42 
44 namespace dd4hep {
45 
47  namespace cond {
48 
49  //template class ConditionsCollector<ConditionsMap>;
55 
59  } /* End namespace cond */
60 } /* End namespace dd4hep */
cond
AlignmentCondition::Object * cond
Definition: AlignmentsCalculator.cpp:68
dd4hep::ConditionsMap::scan
virtual void scan(const Condition::Processor &processor) const =0
Interface to scan data content of the conditions mapping.
dd4hep::Handle::isValid
bool isValid() const
Check the validity of the object held by the handle.
Definition: Handle.h:128
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::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::insert_item
void insert_item(std::vector< T > &c, Q, const T &d)
Definition: ContainerHelpers.h:37
dd4hep::ConditionsMap::FIRST_ITEM
@ FIRST_ITEM
Definition: ConditionsMap.h:62
dd4hep::cond::ConditionsCollector::operator()
virtual int operator()(DetElement de, int level=0) const final
Callback to output conditions information.
Definition: ConditionsProcessor.cpp:25
dd4hep::cond::ConditionsCollector
Generic condition collector keyed by detector elements.
Definition: ConditionsProcessor.h:118
dd4hep::ConditionsMap::LAST_ITEM
@ LAST_ITEM
Definition: ConditionsMap.h:63
mapping
ConditionsMap & mapping
Definition: AlignmentsCalculator.cpp:82
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
det
DetElement::Object * det
Definition: AlignmentsCalculator.cpp:66
ContainerHelpers.h
dd4hep::Condition::Processor
Abstract base for processing callbacks to conditions objects.
Definition: Conditions.h:112
Printout.h
ConditionsProcessor.h