44 double thickness,
const BinUtility* binutils,
double minfraction,
48 m_bins0(binutils ? (binutils->
max(0) + 1) : 1),
49 m_bins1(binutils && binutils->dimensions() > 1 ? (binutils->
max(1) + 1)
63 const auto zeroedVectorDbl = std::vector<double>(
m_bins0, 0.);
64 const auto zeroedVectorUInt = std::vector<unsigned int>(
m_bins0, 0);
65 const auto zeroedVectorVector3D = std::vector<Amg::Vector3D>(
m_bins0,
m_pos);
66 using Element_t = std::map<unsigned int, double>;
67 const auto zeroedVectorElements =
68 std::vector<Element_t>(
m_bins0, Element_t());
69 for (
int ibin = 0; ibin <
m_bins1; ++ibin) {
71 m_run_pos.push_back(zeroedVectorVector3D);
73 m_run_s.push_back(zeroedVectorDbl);
76 m_run_a.push_back(zeroedVectorDbl);
77 m_run_z.push_back(zeroedVectorDbl);
166 m_rho += mat.rho * s;
167 m_a += mat.A * s * mat.rho;
168 m_z += mat.Z * s * mat.rho;
174 for (
auto& it : (*mComposition)) {
213 hitPosition, hitPosition));
235 double nef = eIter.second * corrFactorInv /
m_s_in_l0;
246 double eventNorm = 1. / double(
m_run_events[rBin1][rBin0]);
250 double a =
m_run_a[rBin1][rBin0] * eventNorm;
251 double z =
m_run_z[rBin1][rBin0] * eventNorm;
252 double rho =
m_run_rho[rBin1][rBin0] * eventNorm;
265 hitPosition,
m_run_s[rBin1][rBin0] * eventNorm, x0, l0,
a,
z, rho,
282 return fullHitMaterial;
288 for (
int ibin1 = 0; ibin1 <
m_bins1; ++ibin1) {
293 for (
int ibin0 = 0; ibin0 <
m_bins0; ++ibin0) {
297 double eventNorm = 1. / double(
m_run_events[ibin1][ibin0]);
301 m_run_a[ibin1][ibin0] *= eventNorm;
302 m_run_z[ibin1][ibin0] *= eventNorm;
316 if (recordElements) {
318 double preTotalFraction = 0.;
319 std::map<unsigned int, double> binElements =
321 for (
auto& peIter : binElements) {
323 peIter.second *= eventNorm;
324 preTotalFraction += peIter.second;
327 std::map<double, unsigned int> probabilityOrdered;
328 double totalFraction = 0.;
329 for (
auto& eIter : binElements) {
331 double eFraction = eIter.second / preTotalFraction;
333 probabilityOrdered[eIter.second] = eIter.first;
334 totalFraction += eIter.second;
337 std::vector<Trk::ElementFraction> elementFractions;
338 elementFractions.reserve(binElements.size());
339 for (
auto& poEl : probabilityOrdered) {
340 double fracEl = poEl.first / totalFraction;
341 unsigned int fracEluChar = fracEl * UCHAR_MAX;
342 elementFractions.emplace_back(poEl.second, fracEluChar);
345 std::reverse(elementFractions.begin(), elementFractions.end());
355 matVector.push_back(binMaterial);
362 Trk::MaterialPropertiesMatrix::iterator matMatrixIter =
364 Trk::MaterialPropertiesMatrix::iterator matMatrixIterEnd =
366 for (; matMatrixIter != matMatrixIterEnd; ++matMatrixIter) {
368 std::vector<const Trk::MaterialProperties*>::iterator matIter =
369 (*matMatrixIter).begin();
370 std::vector<const Trk::MaterialProperties*>::iterator matIterEnd =
371 (*matMatrixIter).end();
372 for (; matIter != matIterEnd; ++matIter)
delete (*matIter);
382 Trk::MaterialPropertiesMatrix::const_iterator matMatrixIter =
383 materialMatrix.begin();
384 Trk::MaterialPropertiesMatrix::const_iterator matMatrixIterEnd =
385 materialMatrix.end();
386 for (; matMatrixIter != matMatrixIterEnd; ++matMatrixIter) {
389 std::vector<const Trk::MaterialProperties*>::const_iterator matIter =
390 (*matMatrixIter).begin();
391 std::vector<const Trk::MaterialProperties*>::const_iterator matIterEnd =
392 (*matMatrixIter).end();
393 for (; matIter != matIterEnd; ++matIter) {
395 matProp.push_back(((*matIter) ? (*matIter)->clone() :
nullptr));
#define uchar2uint(uchar)
#define uchar2dfrac(uchar)
It is used in the Mapping process ( using MaterialSteps ), the validation and recostruction ( using M...
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
BinUtility * clone() const
Implizit Constructor.
Helper Class to record the material during the GeantinoNtupleMappingProcess.
int m_bins1
number of bins in coordinate 2
std::vector< std::vector< unsigned int > > m_run_events
LayerMaterialRecord()
Default Constructor.
std::vector< std::vector< double > > m_run_s_in_x0
double m_layerThickness
record the layerThickness
std::vector< std::vector< double > > m_run_s
LayerMaterialRecord & operator=(const LayerMaterialRecord &lmr)
Assignment operator.
std::map< unsigned int, double > m_elements
Amg::Vector3D m_pos
event related information
std::vector< std::vector< double > > m_run_a
MaterialAssociationType m_assoc
type of hit association
void finalizeRun(bool recordElements=true)
finalize the Run
AssociatedMaterial * finalizeEvent(const Trk::Layer &lay, bool fullHit=false)
finalize the Event
std::vector< std::vector< Amg::Vector3D > > m_run_pos
MaterialPropertiesMatrix m_associatedLayerMaterial
clear the material -> calls delete
BinUtility * m_binUtility
record the BinnedArray
std::vector< std::vector< std::map< unsigned int, double > > > m_run_elements
the final material properties
void clearMaterial()
copy from another vector
void associateGeantinoHit(const Amg::Vector3D &pos, double s, const Trk::Material &mat)
adding the information about the Geantino hit
void copyMaterial(const MaterialPropertiesMatrix &mat)
~LayerMaterialRecord()
Destructor.
void associateEmptyHit(const Amg::Vector3D &pos)
adding the information about an empty hit scaling- particle crossed layer, but no mapping information
std::vector< std::vector< double > > m_run_s_in_l0
std::vector< std::vector< double > > m_run_z
double m_minFraction
minimum element fraction to be recorded
int m_bins0
number of bins in coordinate 1
std::vector< std::vector< double > > m_run_rho
Base Class for a Detector Layer in the Tracking realm.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
Material with information about thickness of material.
A common object to be contained by.
virtual double pathCorrection(const Amg::Vector3D &pos, const Amg::Vector3D &mom) const
the pathCorrection for derived classes with thickness - it reflects if the direction projection is po...
std::string find(const std::string &s)
return a remapped string
Definition of ATLAS Math & Geometry primitives (Amg)
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ z
global position (cartesian)
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
std::vector< std::vector< const MaterialProperties * > > MaterialPropertiesMatrix
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.