ATLAS Offline Software
Loading...
Searching...
No Matches
GeoMaterialConverter.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// GeoMaterialConverter.cxx, (c) ATLAS Detector software
8
9// Trk
11// GeoModelKernel
12#include "GeoModelKernel/GeoElement.h"
13#include "GeoModelKernel/GeoMaterial.h"
14#include "GeoModelKernel/Units.h"
15namespace {
16 constexpr double s_densityCnvFactor = 1. / GeoModelKernelUnits::gram;
17}
19 // get the obvious things
20 float x0 = gm->getRadLength();
21 float l0 = gm->getIntLength();
22 float rho = gm->getDensity() * s_densityCnvFactor;
23 // float dEdX = gm->getDeDxMin();
24 float A = 0.;
25 float Z = 0.;
26 // get the number of elements that build the material
27 int numberOfElements = gm->getNumElements();
28 // loop over the elements
29 for (int iEl = 0; iEl < numberOfElements; iEl++) {
30 const GeoElement* geoEl = gm->getElement(iEl);
31 float fraction = gm->getFraction(iEl);
32 A += fraction * (geoEl->getA() / (GeoModelKernelUnits::gram));
33 Z += fraction * (geoEl->getZ());
34 }
35 // return the result
36 return {x0, l0, A, Z, rho};
37}
38
39bool Trk::GeoMaterialConverter::dummy_material(const GeoMaterial* mat) {
40
41 bool dummyMat = false;
42
43 const std::string& matName = mat->getName();
44
45 if (matName == "special::Ether")
46 dummyMat = true;
47 if (matName == "WorldLog:Air")
48 dummyMat = true;
49 if (matName == "std::Air")
50 dummyMat = true;
51 if (matName == "Air")
52 dummyMat = true;
53
54 return dummyMat;
55}
static bool dummy_material(const GeoMaterial *)
hardcoded dummy materials : TODO : find generic criterium ( density ?
static Material convert(const GeoMaterial *gm)
Single conversion , input type GeoMaterial - output type Trk::MaterialProperties.
A common object to be contained by.
Definition Material.h:117
hold the test vectors and ease the comparison