ATLAS Offline Software
SurfaceBoundSet.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef ACTSGEOUTILS_SURFACEBOUNDSET_H
5 #define ACTSGEOUTILS_SURFACEBOUNDSET_H
6 
7 #include "ActsGeoUtils/Defs.h"
8 #ifndef SIMULATIONBASE
9 #include "Acts/Surfaces/SurfaceBounds.hpp"
10 
11 namespace ActsTrk {
12  /* If multiple surfaces in the geometry share the same dimensions, the SurfaceBoundSet provides a convenient way
13  * to create only one surface bound object in memory and parse it to the individual Surfaces.
14  */
15 
16  template <class BoundType> class SurfaceBoundSet {
17  public:
18  SurfaceBoundSet() = default;
20  template<class... argList> std::shared_ptr<BoundType> make_bounds(argList... args) {
21  return (*m_store.insert(std::make_shared<BoundType>(args...)).first);
22  }
23  size_t size() const { return m_store.size() ;}
24  private:
30  struct BoundComparer {
31  bool operator()(const std::shared_ptr<BoundType>& a,
32  const std::shared_ptr<BoundType>& b) const {
33  if (a->type() != b->type()) {
34  return static_cast<int>(a->type()) < static_cast<int>(b->type());
35  }
36  const std::vector<double> avalues{a->values()};
37  const std::vector<double> bvalues{b->values()};
38  std::size_t size = avalues.size();
39  for(std::size_t i=0; i<size-1; ++i) {
40  if(std::abs(avalues[i]- bvalues[i]) > std::numeric_limits<double>::epsilon()){
41  return avalues[i] < bvalues[i];
42  }
43  }
44  return avalues[size-1] < bvalues[size-1];
45  }
46  };
47  std::set<std::shared_ptr<BoundType>, BoundComparer> m_store{};
48  };
49 }
50 #endif
51 #endif
ActsTrk::SurfaceBoundSet::BoundComparer
: Comparison struct to construct sets of Acts::Surface bounds with unique elements.
Definition: SurfaceBoundSet.h:30
Defs.h
lumiFormat.i
int i
Definition: lumiFormat.py:85
ActsTrk::SurfaceBoundSet::make_bounds
std::shared_ptr< BoundType > make_bounds(argList... args)
Factory method to create new SurfaceBounds.
Definition: SurfaceBoundSet.h:20
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
DeMoScan.first
bool first
Definition: DeMoScan.py:536
ActsTrk::SurfaceBoundSet::SurfaceBoundSet
SurfaceBoundSet()=default
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
ActsTrk::SurfaceBoundSet::BoundComparer::operator()
bool operator()(const std::shared_ptr< BoundType > &a, const std::shared_ptr< BoundType > &b) const
Definition: SurfaceBoundSet.h:31
ActsTrk::SurfaceBoundSet::size
size_t size() const
Definition: SurfaceBoundSet.h:23
ActsTrk::SurfaceBoundSet::m_store
std::set< std::shared_ptr< BoundType >, BoundComparer > m_store
Definition: SurfaceBoundSet.h:47
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80