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)
24{
25 declareInterface<Trk::ILayerMaterialCreator>(this);
26
27 // give the map a name
28 declareProperty("LayerMaterialName" , m_layerMaterialName);
29 declareProperty("LayerMaterialDirectory" , m_layerMaterialDirectory);
30}
31
32
34{
35 // get the material matrix and copy
37 // this method creates a compressed representation of the BinnedLayerMaterial
38 const Trk::BinUtility* cbinutil = lmr.binUtility();
39 // create the compressed material
40 return new Trk::BinnedLayerMaterial(*cbinutil,mpm);
41}
42
44{
45 // the return object
46 Trk::LayerMaterialProperties* bLayerMaterial = nullptr;
47 // get the binUtility of the LayerMaterialProperties
48 const Trk::BinUtility* bUtility = lmProperties.binUtility();
49 // we have a bin utility, get the matrix and fill it
50 if (bUtility){
51 // prepare the matrix
52 // nF x nS
53 size_t nBins0 = bUtility->max(0)+1;
54 size_t nBins1 = bUtility->max(1)+1;
55 // create the MaterialMatrix
56 Trk::MaterialPropertiesMatrix materialMatrix;
57 materialMatrix.reserve(nBins1);
58 // fill the matrix
59 for (size_t ibin1 = 0; ibin1 < nBins1; ++ibin1) {
60 // create the vector first
61 Trk::MaterialPropertiesVector materialVector;
62 materialVector.reserve(nBins0);
63 // loop over local 1 bins
64 for (size_t ibin0 = 0; ibin0 < nBins0; ++ibin0) {
65 // get the material from the properties and push them as clones for the BinnedLayerMaterial
66 const Trk::MaterialProperties* mProperties = lmProperties.material(ibin0,ibin1) ? lmProperties.material(ibin0,ibin1)->clone() : nullptr;
67 materialVector.push_back(mProperties);
68 }
69 // now pus the vector into the matrix
70 materialMatrix.push_back(materialVector);
71 }
72
73
74 } else {
75 // must be homogenous material, can be transformed into a 0-bin material, would be silly though
76 bLayerMaterial = lmProperties.clone();
77 }
78 //
79 return bLayerMaterial;
80}
81
82
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
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