ATLAS Offline Software
Loading...
Searching...
No Matches
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
22Trk::BinnedLayerMaterialCreator::BinnedLayerMaterialCreator(const std::string& t, const std::string& n, const IInterface* p)
23: AthAlgTool(t,n,p),
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
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
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
size_t max(size_t ba=0) const
First bin maximal value.
Definition BinUtility.h:212
BinnedLayerMaterialCreator(const std::string &, const std::string &, const IInterface *)
Constructor.
LayerMaterialProperties * convertLayerMaterial(const LayerMaterialProperties &lmr) const
create layer material properties from layer material properties - simply clones
LayerMaterialProperties * createLayerMaterial(const LayerMaterialRecord &lmr) const
process the material properties
~BinnedLayerMaterialCreator()
Destructor.
It extends the LayerMaterialProperties base class.
This virtual base class encapsulates the logics to build pre/post/full update material for Layer stru...
virtual LayerMaterialProperties * clone() const =0
Pseudo-Constructor clone()
virtual const BinUtility * binUtility() const =0
Return the BinUtility.
virtual const MaterialProperties * material(size_t ib0, size_t ib1) const =0
Direct access via bins to the MaterialProperties.
Helper Class to record the material during the GeantinoNtupleMappingProcess.
const MaterialPropertiesMatrix & associatedLayerMaterial() const
return method for the LayerMaterial
const Trk::BinUtility * binUtility() const
return the BinUtility
Material with information about thickness of material.
MaterialProperties * clone() const
Pseudo-Constructor clone()
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
std::vector< std::vector< const MaterialProperties * > > MaterialPropertiesMatrix