1#include "Tracking/Sim/PropagatorStepWriter.h"
4#include <Acts/Geometry/GeometryIdentifier.hpp>
5#include <Acts/Geometry/TrackingVolume.hpp>
6#include <Acts/Propagator/ConstrainedStep.hpp>
7#include <Acts/Surfaces/Surface.hpp>
9#include "Acts/Geometry/DetectorElementBase.hpp"
10#include "Framework/Exception/Exception.h"
20 : m_cfg_(cfg), m_output_file_(cfg.root_file_) {
22 EXCEPTION_RAISE(
"InvalidArgument",
"Missing tree name");
36 "TTree from RootPropagationStepsWriter");
74bool PropagatorStepWriter::writeSteps(
76 const std::vector<PropagationSteps>& stepCollection,
77 const std::vector<ldmx::Measurement>& measurements,
78 const Acts::Vector3& start_pos,
const Acts::Vector3& start_mom) {
97 for (
auto& meas : measurements) {
98 m_hit_x_.push_back(meas.getGlobalPosition()[0]);
99 m_hit_y_.push_back(meas.getGlobalPosition()[1]);
100 m_hit_z_.push_back(meas.getGlobalPosition()[2]);
103 for (
unsigned int i = 0; i < 3; i++) {
109 for (
auto& steps : stepCollection) {
129 for (
auto& step : steps) {
132 Acts::GeometryIdentifier::Value boundary_id = 0;
133 Acts::GeometryIdentifier::Value layer_id = 0;
134 Acts::GeometryIdentifier::Value approach_id = 0;
135 Acts::GeometryIdentifier::Value sensitive_id = 0;
138 auto geo_id = step.surface->geometryId();
140 boundary_id = geo_id.boundary();
141 layer_id = geo_id.layer();
142 approach_id = geo_id.approach();
143 sensitive_id = geo_id.sensitive();
158 m_x_.push_back(step.position.x());
159 m_y_.push_back(step.position.y());
160 m_z_.push_back(step.position.z());
161 auto direction = step.momentum.normalized();
162 m_dx_.push_back(direction.x());
163 m_dy_.push_back(direction.y());
164 m_dz_.push_back(direction.z());
168 double accuracy = step.stepSize.accuracy();
169 double actor = step.stepSize.value(Acts::ConstrainedStep::actor);
170 double aborter = step.stepSize.value(Acts::ConstrainedStep::aborter);
171 double user = step.stepSize.value(Acts::ConstrainedStep::user);
172 double act2 = actor * actor;
173 double acc2 = accuracy * accuracy;
174 double abo2 = aborter * aborter;
175 double usr2 = user * user;
178 if (act2 < acc2 && act2 < abo2 && act2 < usr2) {
180 }
else if (acc2 < abo2 && acc2 < usr2) {
182 }
else if (abo2 < usr2) {
Implements an event buffer system for storing event data.
std::vector< float > m_dx_
global direction x_
PropagatorStepWriter(const Config &cfg)
Constructor with.
std::vector< float > m_x_
global x_
std::vector< float > m_start_mom_
start momentum of the particle propagated
std::vector< float > m_start_pos_
start position of the particle propagated
TFile * m_output_file_
the output file name
std::vector< float > m_hit_x_
hit location X
std::vector< float > m_z_
global z_
int m_event_nr_
the event number of
std::vector< float > m_y_
global y_
std::mutex m_write_mutex_
protect multi-threaded writes
std::vector< float > m_step_usr_
user
std::vector< float > m_step_abt_
aborter
TTree * m_output_tree_
the output tree
std::vector< float > m_hit_y_
hit location Y
std::vector< float > m_hit_z_
hit location Z
std::vector< int > m_approach_id_
surface identifier
Config m_cfg_
the configuration object
std::vector< int > m_sensitive_id_
surface identifier
std::vector< float > m_dz_
global direction z_
std::vector< float > m_dy_
global direction y_
std::vector< float > m_step_act_
actor check
std::vector< int > m_boundary_id_
boundary identifier
std::vector< int > m_layer_id_
layer identifier if
std::vector< float > m_step_acc_
accuracy
std::vector< int > m_step_type_
step type
The measurement calibrator can be a function or a class/struct able to retrieve the sim hits containe...
std::string tree_name_
name of the output tree
std::string file_mode_
file access mode
std::string file_path_
path of the output file
TFile * root_file_
common root file