ATLAS Offline Software
BinnedLayerMaterialCreator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // BinnedLayerMaterialCreator.cxx, (c) ATLAS Detector software
8 
9 // STL
10 #include <sstream>
11 // Trk include
18 
19 
20 
21 // constructor
22 Trk::BinnedLayerMaterialCreator::BinnedLayerMaterialCreator(const std::string& t, const std::string& n, const IInterface* p)
23 : AthAlgTool(t,n,p),
24  m_compressedMaterialThickness(1.)
25 {
26  declareInterface<Trk::ILayerMaterialCreator>(this);
27 
28  // give the map a name
29  declareProperty("LayerMaterialName" , m_layerMaterialName);
30  declareProperty("LayerMaterialDirectory" , m_layerMaterialDirectory);
31  // setup for compressed layer creation
32  declareProperty("MaterialThickness" , m_compressedMaterialThickness);
33 
34 }
35 
36 // destructor
38 = default;
39 
40 
42 {
43  // get the material matrix and copy
45  // this method creates a compressed representation of the BinnedLayerMaterial
46  const Trk::BinUtility* cbinutil = lmr.binUtility();
47  // create the compressed material
48  return new Trk::BinnedLayerMaterial(*cbinutil,mpm);
49 }
50 
52 {
53  // the return object
54  Trk::LayerMaterialProperties* bLayerMaterial = nullptr;
55  // get the binUtility of the LayerMaterialProperties
56  const Trk::BinUtility* bUtility = lmProperties.binUtility();
57  // we have a bin utility, get the matrix and fill it
58  if (bUtility){
59  // prepare the matrix
60  // nF x nS
61  size_t nBins0 = bUtility->max(0)+1;
62  size_t nBins1 = bUtility->max(1)+1;
63  // create the MaterialMatrix
64  Trk::MaterialPropertiesMatrix materialMatrix;
65  materialMatrix.reserve(nBins1);
66  // fill the matrix
67  for (size_t ibin1 = 0; ibin1 < nBins1; ++ibin1) {
68  // create the vector first
69  Trk::MaterialPropertiesVector materialVector;
70  materialVector.reserve(nBins0);
71  // loop over local 1 bins
72  for (size_t ibin0 = 0; ibin0 < nBins0; ++ibin0) {
73  // get the material from the properties and push them as clones for the BinnedLayerMaterial
74  const Trk::MaterialProperties* mProperties = lmProperties.material(ibin0,ibin1) ? lmProperties.material(ibin0,ibin1)->clone() : nullptr;
75  materialVector.push_back(mProperties);
76  }
77  // now pus the vector into the matrix
78  materialMatrix.push_back(materialVector);
79  }
80 
81 
82  } else {
83  // must be homogenous material, can be transformed into a 0-bin material, would be silly though
84  bLayerMaterial = lmProperties.clone();
85  }
86  //
87  return bLayerMaterial;
88 }
89 
90 
Trk::BinnedLayerMaterialCreator::~BinnedLayerMaterialCreator
~BinnedLayerMaterialCreator()
Destructor.
Trk::BinnedLayerMaterialCreator::m_compressedMaterialThickness
double m_compressedMaterialThickness
Definition: BinnedLayerMaterialCreator.h:52
BinnedLayerMaterialCreator.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
MaterialProperties.h
Trk::BinUtility::max
size_t max(size_t ba=0) const
First bin maximal value.
Definition: BinUtility.h:215
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::ILayerMaterialCreator::m_layerMaterialDirectory
std::string m_layerMaterialDirectory
Definition: ILayerMaterialCreator.h:56
BinUtility.h
Trk::LayerMaterialProperties::material
virtual const MaterialProperties * material(size_t ib0, size_t ib1) const =0
Direct access via bins to the MaterialProperties.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::BinnedLayerMaterialCreator::createLayerMaterial
LayerMaterialProperties * createLayerMaterial(const LayerMaterialRecord &lmr) const
process the material properties
Definition: BinnedLayerMaterialCreator.cxx:41
Trk::ILayerMaterialCreator::m_layerMaterialName
std::string m_layerMaterialName
Definition: ILayerMaterialCreator.h:55
Trk::MaterialPropertiesVector
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
Definition: MaterialProperties.h:133
Trk::LayerMaterialRecord::associatedLayerMaterial
const MaterialPropertiesMatrix & associatedLayerMaterial() const
return method for the LayerMaterial
Definition: LayerMaterialRecord.h:129
Trk::LayerMaterialRecord::binUtility
const Trk::BinUtility * binUtility() const
return the BinUtility
Definition: LayerMaterialRecord.h:138
LayerMaterialRecord.h
beamspotman.n
n
Definition: beamspotman.py:731
Trk::LayerMaterialProperties
Definition: LayerMaterialProperties.h:62
Trk::MaterialProperties::clone
MaterialProperties * clone() const
Pseudo-Constructor clone()
Definition: MaterialProperties.cxx:33
Trk::BinnedLayerMaterialCreator::BinnedLayerMaterialCreator
BinnedLayerMaterialCreator(const std::string &, const std::string &, const IInterface *)
Constructor.
Definition: BinnedLayerMaterialCreator.cxx:22
BinnedLayerMaterial.h
Trk::BinnedLayerMaterial
Definition: BinnedLayerMaterial.h:33
Trk::LayerMaterialProperties::binUtility
virtual const BinUtility * binUtility() const =0
Return the BinUtility.
Trk::BinnedLayerMaterialCreator::convertLayerMaterial
LayerMaterialProperties * convertLayerMaterial(const LayerMaterialProperties &lmr) const
create layer material properties from layer material properties - simply clones
Definition: BinnedLayerMaterialCreator.cxx:51
Trk::BinUtility
Definition: BinUtility.h:39
Trk::LayerMaterialRecord
Definition: LayerMaterialRecord.h:42
Trk::MaterialPropertiesMatrix
std::vector< std::vector< const MaterialProperties * > > MaterialPropertiesMatrix
Definition: ILayerMaterialAnalyser.h:23
Trk::MaterialProperties
Definition: MaterialProperties.h:40
Trk::LayerMaterialProperties::clone
virtual LayerMaterialProperties * clone() const =0
Pseudo-Constructor clone()
AthAlgTool
Definition: AthAlgTool.h:26
LayerMaterialProperties.h