DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
AlignmentsCalculator.h
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 #ifndef DD4HEP_ALIGNMENTSCALCULATOR_H
14 #define DD4HEP_ALIGNMENTSCALCULATOR_H
15 
16 // Framework include files
17 #include <DD4hep/Alignments.h>
18 #include <DD4hep/AlignmentData.h>
19 #include <DD4hep/ConditionsMap.h>
20 
22 namespace dd4hep {
23 
25  namespace cond { class ConditionUpdateContext; }
26 
28  namespace align {
29 
31 
37  public:
38 
40 
45  class Result {
46  public:
47  size_t computed = 0;
48  size_t missing = 0;
49  size_t multiply = 0;
50  Result() = default;
52  Result(const Result& result) = default;
54  Result& operator =(const Result& result) = default;
56  Result& operator +=(const Result& result);
58  Result& operator -=(const Result& result);
60  size_t total() const { return computed+missing; }
61  };
62 
64 
69  class PathOrdering {
70  public:
71  bool operator()(const DetElement& a, const DetElement& b) const
72  { return a.path() < b.path(); }
73  };
74 
75  typedef std::map<DetElement,const Delta*,PathOrdering> OrderedDeltas;
76  typedef std::map<Condition::key_type,DetElement> ExtractContext;
77 
79 
97  class Scanner {
98  public:
104  IOV* iov = 0;
105  public:
107  Scanner() = delete;
115  Scanner(Scanner&& copy) = delete;
117  Scanner(const Scanner& copy) = delete;
119  ~Scanner() = default;
123  Scanner& operator=(const Scanner& copy) = delete;
125  int operator()(DetElement de, int) const;
126  };
127 
128  public:
129 
131  AlignmentsCalculator() = default;
137  Result compute(const std::map<DetElement, Delta>& deltas,
138  ConditionsMap& alignments) const;
140  Result compute(const std::map<DetElement, const Delta*>& deltas,
141  ConditionsMap& alignments) const;
143  Result compute(const OrderedDeltas& deltas, ConditionsMap& alignments) const;
144 
147  OrderedDeltas& deltas,
148  IOV* effective_iov=0) const;
150  size_t extract_deltas(DetElement start,
152  OrderedDeltas& deltas,
153  IOV* effective_iov=0) const;
155 
162  ExtractContext& extract_context,
163  OrderedDeltas& deltas,
164  IOV* effective_iov=0) const;
165 
167 
170  size_t extract_deltas(DetElement start,
172  ExtractContext& extract_context,
173  OrderedDeltas& deltas,
174  IOV* effective_iov=0) const;
175  };
176 
180  multiply += result.multiply;
181  computed += result.computed;
182  missing += result.missing;
183  return *this;
184  }
188  multiply -= result.multiply;
189  computed -= result.computed;
190  missing -= result.missing;
191  return *this;
192  }
193 
194  } /* End namespace align */
195 } /* End namespace dd4hep */
196 #endif // DD4HEP_ALIGNMENTSCALCULATOR_H
dd4hep::align::AlignmentsCalculator::PathOrdering::operator()
bool operator()(const DetElement &a, const DetElement &b) const
Definition: AlignmentsCalculator.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::align::AlignmentsCalculator::Scanner::Scanner
Scanner()=delete
Default constructor.
dd4hep::align::AlignmentsCalculator::Scanner::operator=
Scanner & operator=(const Scanner &copy)=delete
Assignment operator.
cond
AlignmentCondition::Object * cond
Definition: AlignmentsCalculator.cpp:68
dd4hep::align::AlignmentsCalculator::Result::total
size_t total() const
Summed counters.
Definition: AlignmentsCalculator.h:60
dd4hep::align::AlignmentsCalculator::Result::Result
Result(const Result &result)=default
Copy constructor.
dd4hep::align::AlignmentsCalculator::OrderedDeltas
std::map< DetElement, const Delta *, PathOrdering > OrderedDeltas
Definition: AlignmentsCalculator.h:75
dd4hep::align::AlignmentsCalculator::extract_deltas
size_t extract_deltas(cond::ConditionUpdateContext &context, OrderedDeltas &deltas, IOV *effective_iov=0) const
Helper: Extract all Delta-conditions from the conditions map.
Definition: AlignmentsCalculator.cpp:309
Alignments.h
dd4hep::align::AlignmentsCalculator::Scanner::Scanner
Scanner(cond::ConditionUpdateContext &m, OrderedDeltas &&p)=delete
Default move constructor is disabled.
dd4hep::align::AlignmentsCalculator::Result::Result
Result()=default
dd4hep::align::AlignmentsCalculator::Scanner::context
cond::ConditionUpdateContext & context
Reference to the user pool taking into account IOV intersections.
Definition: AlignmentsCalculator.h:100
dd4hep::align::AlignmentsCalculator::Result::missing
size_t missing
Definition: AlignmentsCalculator.h:48
dd4hep::align::AlignmentsCalculator::Scanner::iov
IOV * iov
Resulting IOV.
Definition: AlignmentsCalculator.h:104
dd4hep::align::AlignmentsCalculator::Scanner
Scanner to find all alignment deltas in the detector hierarchy.
Definition: AlignmentsCalculator.h:97
dd4hep::align::AlignmentsCalculator::Scanner::operator=
Scanner & operator=(Scanner &&copy)=delete
Assignment operator.
dd4hep::align::AlignmentsCalculator::Result::multiply
size_t multiply
Definition: AlignmentsCalculator.h:49
dd4hep::align::AlignmentsCalculator::AlignmentsCalculator
AlignmentsCalculator()=default
Default constructor.
dd4hep::align::AlignmentsCalculator::AlignmentsCalculator
AlignmentsCalculator(const AlignmentsCalculator &copy)=delete
Copy constructor.
dd4hep::align::AlignmentsCalculator::Scanner::~Scanner
~Scanner()=default
Default destructor.
dd4hep::align::AlignmentsCalculator::Result::operator=
Result & operator=(const Result &result)=default
Assignment operator.
dd4hep::IOV
Class describing the interval of validty.
Definition: IOV.h:67
dd4hep::align::AlignmentsCalculator::Result::operator-=
Result & operator-=(const Result &result)
Subtract results.
Definition: AlignmentsCalculator.h:187
dd4hep::align::AlignmentsCalculator::Scanner::Scanner
Scanner(cond::ConditionUpdateContext &m, OrderedDeltas &d)
Initializing constructor.
Definition: AlignmentsCalculator.h:109
dd4hep::align::AlignmentsCalculator::Scanner::Scanner
Scanner(cond::ConditionUpdateContext &m, OrderedDeltas &d, IOV *i)
Initializing constructor with IOV specification.
Definition: AlignmentsCalculator.h:111
dd4hep::DetElement
Handle class describing a detector element.
Definition: DetElement.h:188
dd4hep::align::AlignmentsCalculator::Result::operator+=
Result & operator+=(const Result &result)
Add results.
Definition: AlignmentsCalculator.h:179
dd4hep::align::AlignmentsCalculator::Scanner::Scanner
Scanner(const Scanner &copy)=delete
Copy constructor.
dd4hep::align::AlignmentsCalculator::Result
Object encapsulating the result of a computation call to the alignments calculator.
Definition: AlignmentsCalculator.h:45
dd4hep::align::AlignmentsCalculator::Scanner::operator()
int operator()(DetElement de, int) const
Callback to output alignments information.
Definition: AlignmentsCalculator.cpp:109
dd4hep::align::AlignmentsCalculator::ExtractContext
std::map< Condition::key_type, DetElement > ExtractContext
Definition: AlignmentsCalculator.h:76
dd4hep::align::AlignmentsCalculator::Scanner::Scanner
Scanner(Scanner &&copy)=delete
R-value copy from a temporary.
ConditionsMap.h
dd4hep::align::AlignmentsCalculator::Scanner::deltas
OrderedDeltas & deltas
Collection container.
Definition: AlignmentsCalculator.h:102
dd4hep::align::AlignmentsCalculator::operator=
AlignmentsCalculator & operator=(const AlignmentsCalculator &mgr)=delete
Assignment operator.
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::align::AlignmentsCalculator::Result::computed
size_t computed
Definition: AlignmentsCalculator.h:47
dd4hep::detail::tools::copy
void copy(Alignment from, Alignment to)
Copy alignment object from source object.
Definition: AlignmentTools.cpp:43
dd4hep::align::AlignmentsCalculator::compute
Result compute(const std::map< DetElement, Delta > &deltas, ConditionsMap &alignments) const
Compute all alignment conditions of the internal dependency list.
Definition: AlignmentsCalculator.cpp:218
dd4hep::align::AlignmentsCalculator::PathOrdering
Functor for path ordered maps as they are needed for the calculator.
Definition: AlignmentsCalculator.h:69
dd4hep::cond::ConditionUpdateContext
ConditionUpdateContext class used by the derived conditions calculation mechanism.
Definition: ConditionDerived.h:136
AlignmentData.h
dd4hep::ConditionsMap
ConditionsMap class.
Definition: ConditionsMap.h:59
dd4hep::align::AlignmentsCalculator
Alignment calculator instance to handle alignment dependencies.
Definition: AlignmentsCalculator.h:36