ATLAS Offline Software
ActsMaterialStepConverterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // ATHENA
8 #include "GaudiKernel/EventContext.h"
9 
10 // PACKAGE
12 
13 // Tracking
15 
16 // ACTS
17 #include "Acts/Material/MaterialSlab.hpp"
18 
19 // STL
20 #include <iostream>
21 #include <memory>
22 
24  const IInterface* parent)
25  : base_class(type, name, parent)
26 {
27 }
28 
31 {
32  ATH_MSG_INFO(name() << " initializing");
33 
34  return StatusCode::SUCCESS;
35 }
36 
37 
40 {
42  std::vector<Acts::MaterialInteraction> nStep;
43  Acts::RecordedMaterial recorded;
44  double sum_X0 = 0;
45  double sum_L0 = 0;
46 
47  // check you are working with the correct dataset, otherwise write out a warning
48  // for mapping geantinos must be produced from (0, 0, 0), hence expecting z being very small!
49  double deltaZ = colStep.back()->hitZ() - colStep.front()->hitZ();
50  double deltaR = colStep.back()->hitR() - colStep.front()->hitR();
51  double vertexZ = colStep.front()->hitZ() - (deltaZ/deltaR)*colStep.front()->hitR();
52  if (std::abs(vertexZ)>s_tolerance)
53  ATH_MSG_WARNING("z-vertex position larger than expected for material mapping. Check the beamspot config used for production of material steps!");
54 
55  Acts::Vector3 v_pos{0, 0, 0};
56  Acts::Vector3 v_imp{colStep.back()->hitX(), colStep.back()->hitY(), colStep.back()->hitZ()};
57  v_imp = v_imp.normalized();
58 
59  for(auto const step: colStep) {
60  Acts::Vector3 pos{step->hitX(), step->hitY(), step->hitZ()};
61  Acts::MaterialSlab matProp(Acts::Material::fromMassDensity(step->x0(), step->l0(), step->A(), step->Z(), (step->rho() * Acts::UnitConstants::g) ),step->steplength());
62  Acts::MaterialInteraction interaction;
63  interaction.position = pos;
64  interaction.direction = Acts::Vector3(pos.x(), pos.y(), pos.z());
65  interaction.direction = interaction.direction.normalized();
66  interaction.materialSlab = matProp;
67  sum_X0 += step->steplengthInX0();
68  sum_L0 += step->steplengthInL0();
69  nStep.push_back(interaction);
70  }
71 
72  recorded.materialInX0 = sum_X0;
73  recorded.materialInL0 = sum_L0;
74  recorded.materialInteractions = nStep;
75 
76  mTrack = std::make_pair(std::make_pair(v_pos, v_imp), recorded);
77 
78  return mTrack;
79 
80 }
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ActsMaterialStepConverterTool.h
Acts::RecordedMaterialTrack
std::pair< std::pair< Acts::Vector3, Acts::Vector3 >, RecordedMaterial > RecordedMaterialTrack
Recorded material track.
Definition: ActsExtrapolationAlg.cxx:43
ActsMaterialStepConverterTool::convertToMaterialTrack
virtual const Acts::RecordedMaterialTrack convertToMaterialTrack(const Trk::MaterialStepCollection &colStep) const override
Definition: ActsMaterialStepConverterTool.cxx:39
Base_Fragment.recorded
list recorded
if USE_PDG_VALUES = True, load PDG value of sin2thetaW and particle masses/widths from parameter dict...
Definition: GeneratorFilters/share/common/Base_Fragment.py:55
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IActsTrackingGeometrySvc.h
DataVector::front
const T * front() const
Access the first element in the collection as an rvalue.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ActsMaterialStepConverterTool::s_tolerance
static constexpr double s_tolerance
Definition: ActsMaterialStepConverterTool.h:30
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsMaterialStepConverterTool::initialize
virtual StatusCode initialize() override
Definition: ActsMaterialStepConverterTool.cxx:30
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArCellBinning.step
step
Definition: LArCellBinning.py:158
makeComparison.deltaZ
int deltaZ
Definition: makeComparison.py:46
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
ActsMaterialStepConverterTool::ActsMaterialStepConverterTool
ActsMaterialStepConverterTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ActsMaterialStepConverterTool.cxx:23
MaterialStep.h