31 :
WriterT(cfg.collection,
"RootPropagationStepsWriter", level),
33 m_outputFile(cfg.rootFile) {
36 throw std::invalid_argument(
"Missing input collection");
38 throw std::invalid_argument(
"Missing tree name");
45 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath);
51 "TTree from RootPropagationStepsWriter");
53 throw std::bad_alloc();
79 if (m_outputFile !=
nullptr) {
80 m_outputFile->Close();
87 m_outputTree->Write();
89 if (
m_cfg.rootFile ==
nullptr) {
90 m_outputFile->Close();
94 <<
m_cfg.filePath <<
"'");
101 const std::vector<PropagationSteps>& stepCollection) {
103 std::lock_guard<std::mutex> lock(m_writeMutex);
109 for (
auto&
steps : stepCollection) {
112 m_boundaryID.clear();
114 m_approachID.clear();
115 m_sensitiveID.clear();
128 m_nStepTrials.clear();
132 const auto& geoID =
step.geoID;
133 m_sensitiveID.push_back(geoID.sensitive());
134 m_approachID.push_back(geoID.approach());
135 m_layerID.push_back(geoID.layer());
136 m_boundaryID.push_back(geoID.boundary());
137 m_volumeID.push_back(geoID.volume());
141 if (
step.surface->surfaceMaterial() !=
nullptr) {
145 m_material.push_back(material);
148 m_x.push_back(
step.position.x());
149 m_y.push_back(
step.position.y());
150 m_z.push_back(
step.position.z());
151 auto direction =
step.momentum.normalized();
152 m_dx.push_back(direction.x());
153 m_dy.push_back(direction.y());
154 m_dz.push_back(direction.z());
156 double accuracy =
step.stepSize.accuracy();
160 double actAbs = std::abs(actor);
161 double accAbs = std::abs(accuracy);
162 double aboAbs = std::abs(aborter);
163 double usrAbs = std::abs(user);
166 if (actAbs < accAbs && actAbs < aboAbs && actAbs < usrAbs) {
167 m_step_type.push_back(0);
168 }
else if (accAbs < aboAbs && accAbs < usrAbs) {
169 m_step_type.push_back(1);
170 }
else if (aboAbs < usrAbs) {
171 m_step_type.push_back(2);
173 m_step_type.push_back(3);
177 m_step_acc.push_back(Acts::clampValue<float>(accuracy));
178 m_step_act.push_back(Acts::clampValue<float>(actor));
179 m_step_abt.push_back(Acts::clampValue<float>(aborter));
180 m_step_usr.push_back(Acts::clampValue<float>(user));
183 m_nStepTrials.push_back(
step.stepSize.nStepTrials);
185 m_outputTree->Fill();