ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::CompoundLayerMaterialCreator Class Reference

LayerMaterialProperties creator for CompoundLayerMaterial (i.e. More...

#include <CompoundLayerMaterialCreator.h>

Inheritance diagram for Trk::CompoundLayerMaterialCreator:
Collaboration diagram for Trk::CompoundLayerMaterialCreator:

Public Member Functions

 CompoundLayerMaterialCreator (const std::string &, const std::string &, const IInterface *)
 Constructor.
 ~CompoundLayerMaterialCreator ()
 Destructor.
LayerMaterialPropertiescreateLayerMaterial (const LayerMaterialRecord &lmr) const
 process the material properties
LayerMaterialPropertiesconvertLayerMaterial (const LayerMaterialProperties &lmr) const
 create layer material properties from layer material properties - simply clones
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (ILayerMaterialCreator, 1, 0)
const std::string & layerMaterialName () const
 the name of the created material map

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

std::string m_layerMaterialName
std::string m_layerMaterialDirectory

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

LayerMaterialPropertiescreateCompoundLayerMaterial (const MaterialPropertiesMatrix &lmm, const BinUtility &lmbu) const
 private method that can be called by both create/convertLayerMaterial
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_fullCompoundCalculation
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
CxxUtils::CachedValue< std::string > m_layerMaterialFullName

Detailed Description

LayerMaterialProperties creator for CompoundLayerMaterial (i.e.

a composit of materials)

The convertLayerMaterial() method converts into CompoundLayerMaterial (if possible).

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 42 of file CompoundLayerMaterialCreator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CompoundLayerMaterialCreator()

Trk::CompoundLayerMaterialCreator::CompoundLayerMaterialCreator ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 23 of file CompoundLayerMaterialCreator.cxx.

24: AthAlgTool(t,n,p),
26{
27 declareInterface<Trk::ILayerMaterialCreator>(this);
28 // give the map a name
29 declareProperty("LayerMaterialName" , m_layerMaterialName);
30 declareProperty("LayerMaterialDirectory" , m_layerMaterialDirectory);
31 declareProperty("FullCompoundCalculation" , m_fullCompoundCalculation);
32}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~CompoundLayerMaterialCreator()

Trk::CompoundLayerMaterialCreator::~CompoundLayerMaterialCreator ( )
default

Destructor.

Member Function Documentation

◆ convertLayerMaterial()

Trk::LayerMaterialProperties * Trk::CompoundLayerMaterialCreator::convertLayerMaterial ( const LayerMaterialProperties & lmr) const
virtual

create layer material properties from layer material properties - simply clones

Implements Trk::ILayerMaterialCreator.

Definition at line 55 of file CompoundLayerMaterialCreator.cxx.

56{
57
58 // the return object
59 Trk::LayerMaterialProperties* bLayerMaterial = nullptr;
60 // get the binUtility of the LayerMaterialProperties
61 const Trk::BinUtility* bUtility = lmProperties.binUtility();
62 // we have a bin utility, get the matrix and fill it
63 if (bUtility){
64 // prepare the matrix
65 // nF x nS
66 size_t nBins0 = bUtility->max(0)+1;
67 size_t nBins1 = bUtility->max(1)+1;
68 // create the MaterialMatrix
69 Trk::MaterialPropertiesMatrix materialMatrix;
70 materialMatrix.reserve(nBins1);
71 // fill the matrix
72 for (size_t ibin1 = 0; ibin1 < nBins1; ++ibin1) {
73 // create the vector first
74 Trk::MaterialPropertiesVector materialVector;
75 materialVector.reserve(nBins0);
76 // loop over local 1 bins
77 for (size_t ibin0 = 0; ibin0 < nBins0; ++ibin0) {
78 // get the material from the properties and push them into the matrix (no cloning !)
79 const Trk::MaterialProperties* mProperties = lmProperties.material(ibin0,ibin1);
80 materialVector.push_back(mProperties);
81 }
82 // now pus the vector into the matrix
83 materialMatrix.push_back(materialVector);
84 }
85
86 // create the material
87 ATH_MSG_VERBOSE("Converting the MaterialPropertiesMatrix into a CompressedLayerMaterial.");
88 bLayerMaterial = createCompoundLayerMaterial(materialMatrix,*bUtility);
89
90 } else {
91 // must be homogenous material, can be transformed into a 0-bin material, would be silly though
92 ATH_MSG_DEBUG("No BinUtility provided - return a simple clone.");
93 bLayerMaterial = lmProperties.clone();
94 }
95 //
96 return bLayerMaterial;
97}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
size_t max(size_t ba=0) const
First bin maximal value.
Definition BinUtility.h:212
LayerMaterialProperties * createCompoundLayerMaterial(const MaterialPropertiesMatrix &lmm, const BinUtility &lmbu) const
private method that can be called by both create/convertLayerMaterial
virtual LayerMaterialProperties * clone() const =0
Pseudo-Constructor clone()
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
std::vector< std::vector< const MaterialProperties * > > MaterialPropertiesMatrix

◆ createCompoundLayerMaterial()

Trk::LayerMaterialProperties * Trk::CompoundLayerMaterialCreator::createCompoundLayerMaterial ( const MaterialPropertiesMatrix & lmm,
const BinUtility & lmbu ) const
private

private method that can be called by both create/convertLayerMaterial

Definition at line 99 of file CompoundLayerMaterialCreator.cxx.

100{
101
102
103 // analyse the material bins
104 double tMin = 10e10;
105 double xMin = 10e10;
106 double lMin = 10e10;
107 double aMin = 10e10;
108 double zMin = 10e10;
109 double rMin = 10e10;
110 double tMax = 0.;
111 double xMax = 0.;
112 double lMax = 0.;
113 double aMax = 0.;
114 double zMax = 0.;
115 double rMax = 0.;
116
117 // first loop to get the min/max values
118 for (const auto & mo : materialMatrix)
119 for (const auto & mi : mo) {
120 if (mi){
121 const Trk::MaterialProperties& mp = (*mi);
122 // macro defined in GeometryStatics
123 minMaxValue(tMin, tMax, mp.thickness());
124 minMaxValue(xMin, xMax, mp.x0());
125 minMaxValue(lMin, lMax, mp.l0());
126 minMaxValue(aMin, aMax, mp.averageA());
127 minMaxValue(zMin, zMax, mp.averageZ());
128 minMaxValue(rMin, rMax, mp.averageRho());
129 }
130 }
131
132 ATH_MSG_DEBUG( "Preparing the store: min/max values for t, x0, l0, a, z, rho estimated." );
133
134
135 // the bin matrices in the store
136 Trk::ValueMatrix binMatrix( lBinUtility.max(1)+1, Trk::ValueVector(lBinUtility.max(0)+1, static_cast<unsigned char>(0) ) );
137 // 255 bins, the 0 bin indicates empy
138 Trk::ValueStore tStore;
139 Trk::ValueStore xStore;
140 Trk::ValueStore lStore;
141 Trk::ValueStore aStore;
142 Trk::ValueStore zStore;
143 Trk::ValueStore rStore;
144 // set the store min, max
145 tStore.valueMin = tMin;
146 xStore.valueMin = xMin;
147 lStore.valueMin = lMin;
148 aStore.valueMin = aMin;
149 zStore.valueMin = zMin;
150 rStore.valueMin = rMin;
151 tStore.valueStep = fabs(tMin-tMax)<10e-8 ? 0. : (tMax-tMin)/double(static_cast<int>(UCHAR_MAX)-1);
152 xStore.valueStep = (xMax-xMin)/double(static_cast<int>(UCHAR_MAX)-1);
153 lStore.valueStep = (lMax-lMin)/double(static_cast<int>(UCHAR_MAX)-1);
154 aStore.valueStep = (aMax-aMin)/double(static_cast<int>(UCHAR_MAX)-1);
155 zStore.valueStep = (zMax-zMin)/double(static_cast<int>(UCHAR_MAX)-1);
156 rStore.valueStep = (rMax-rMin)/double(static_cast<int>(UCHAR_MAX)-1);
157
158 ATH_MSG_VERBOSE(" - t [ min/max/step ] = " << tMin << " / " << tMax << " / " << tStore.valueStep );
159 ATH_MSG_VERBOSE(" - x0 [ min/max/step ] = " << xMin << " / " << xMax << " / " << xStore.valueStep );
160 ATH_MSG_VERBOSE(" - l0 [ min/max/step ] = " << lMin << " / " << lMax << " / " << lStore.valueStep );
161 ATH_MSG_VERBOSE(" - a [ min/max/step ] = " << aMin << " / " << aMax << " / " << aStore.valueStep );
162 ATH_MSG_VERBOSE(" - z [ min/max/step ] = " << zMin << " / " << zMax << " / " << zStore.valueStep );
163 ATH_MSG_VERBOSE(" - rho [ min/max/step ] = " << rMin << " / " << rMax << " / " << rStore.valueStep );
164
165 // set the initally empty - thickness store can be empty
166 if (tStore.valueStep > 0.)
167 tStore.valueBinMatrix = binMatrix;
168 else
169 ATH_MSG_VERBOSE("Thickness has been estimated to be constant - matrix is not prepared.");
170 xStore.valueBinMatrix = binMatrix;
171 lStore.valueBinMatrix = binMatrix;
172 aStore.valueBinMatrix = binMatrix;
173 zStore.valueBinMatrix = binMatrix;
174 rStore.valueBinMatrix = binMatrix;
175
176 ATH_MSG_VERBOSE( "Material stores prepared, now preparing composition matrix." );
177
178 // the compound material
179 std::vector< std::vector< Trk::MaterialComposition > > compositionMatrix( lBinUtility.max(1)+1, std::vector< Trk::MaterialComposition >( lBinUtility.max(0)+1, Trk::MaterialComposition()) );
180
181 ATH_MSG_VERBOSE( "Composition matrix created." );
182
183 // second loop : assign the bins & and copy the material composition
184 size_t obin = 0;
185 for (const auto & mo : materialMatrix){
186 size_t ibin =0;
187 for (const auto & mi : mo) {
188 if (mi){
189 const Trk::MaterialProperties& mp = (*mi);
190 if (tStore.valueStep > 0.) tStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.thickness()/tStore.valueStep)+1);
191 xStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.x0()/xStore.valueStep)+1);
192 lStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.l0()/lStore.valueStep)+1);
193 aStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageA()/aStore.valueStep)+1);
194 zStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageZ()/zStore.valueStep)+1);
195 rStore.valueBinMatrix[obin][ibin] = static_cast<unsigned char>(std::lrint(mp.averageRho()/rStore.valueStep)+1);
196 // set the material composition
197 if (mp.material().composition) {
198 compositionMatrix[obin][ibin] = Trk::MaterialComposition(*(mp.material().composition));
199 ATH_MSG_VERBOSE(" - composition is copied.");
200 }
201 }
202 ++ibin;
203 }
204 ++obin;
205 }
206 ATH_MSG_VERBOSE( "Returning the new compound material." );
207
208 // now create the compound material propertis
209 return new Trk::CompoundLayerMaterial(lBinUtility, tStore, xStore, lStore, aStore, zStore, rStore, compositionMatrix, m_fullCompoundCalculation);
210
211}
#define minMaxValue(currentMin, currentMax, test)
float averageRho() const
Return the average density of the material.
float averageA() const
Return the average A of the material [gram/mole].
float averageZ() const
Returns the average Z of the material.
const Material & material() const
Return the stored Material.
float l0() const
Return the nuclear interaction length.
float x0() const
Return the radiation length.
float thickness() const
Return the thickness in mm.
MaterialComposition * composition
Definition Material.h:127
std::vector< ValueVector > ValueMatrix
std::vector< unsigned char > ValueVector

◆ createLayerMaterial()

Trk::LayerMaterialProperties * Trk::CompoundLayerMaterialCreator::createLayerMaterial ( const LayerMaterialRecord & lmr) const
virtual

process the material properties

Implements Trk::ILayerMaterialCreator.

Definition at line 39 of file CompoundLayerMaterialCreator.cxx.

40{
41 // get the material matrix
42 const Trk::MaterialPropertiesMatrix& materialMatrix = lmr.associatedLayerMaterial();
43 // get the bin untility
44 const Trk::BinUtility* binUtility = lmr.binUtility();
45 // if there's no bin utility - bail out
46 if (!binUtility){
47 ATH_MSG_WARNING( "No BinUtility given - Bailing out." );
48 return nullptr;
49 } else
50 ATH_MSG_DEBUG( "BinUtility provided, creating binned array in dimensions " << binUtility->max(0)+1 << " x " << binUtility->max(1)+1 );
51 // return the created compound material
52 return createCompoundLayerMaterial(materialMatrix,*binUtility);
53}
#define ATH_MSG_WARNING(x)

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ DeclareInterfaceID()

Trk::ILayerMaterialCreator::DeclareInterfaceID ( ILayerMaterialCreator ,
1 ,
0  )
inherited

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ layerMaterialName()

const std::string & Trk::ILayerMaterialCreator::layerMaterialName ( ) const
inlineinherited

the name of the created material map

Definition at line 47 of file ILayerMaterialCreator.h.

47 {
48 if (!m_layerMaterialFullName.isValid()) {
50 }
51 return *m_layerMaterialFullName.ptr();
52 }
CxxUtils::CachedValue< std::string > m_layerMaterialFullName

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fullCompoundCalculation

bool Trk::CompoundLayerMaterialCreator::m_fullCompoundCalculation
private

Definition at line 61 of file CompoundLayerMaterialCreator.h.

◆ m_layerMaterialDirectory

std::string Trk::ILayerMaterialCreator::m_layerMaterialDirectory
protectedinherited

Definition at line 56 of file ILayerMaterialCreator.h.

◆ m_layerMaterialFullName

CxxUtils::CachedValue<std::string> Trk::ILayerMaterialCreator::m_layerMaterialFullName
privateinherited

Definition at line 59 of file ILayerMaterialCreator.h.

◆ m_layerMaterialName

std::string Trk::ILayerMaterialCreator::m_layerMaterialName
protectedinherited

Definition at line 55 of file ILayerMaterialCreator.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: