41 for (
auto& bdt : m_BDT) {
43 bdt.reader = std::make_unique<TMVA::Reader>(
"!Color:!Silent");
45 bdt.reader->AddVariable(
"m_delta_z", &bdt.delta_z);
46 bdt.reader->AddVariable(
"m_z_sigma", &bdt.z_sigma);
47 bdt.reader->AddVariable(
"m_q_over_p", &bdt.q_over_p);
48 bdt.reader->AddVariable(
"m_q_over_p_sigma", &bdt.q_over_p_sigma);
49 bdt.reader->AddVariable(
"m_delta_z_resunits", &bdt.delta_z_resunits);
50 bdt.reader->AddVariable(
"m_cluster_sumpt2", &bdt.cluster_sumpt2);
51 bdt.reader->AddVariable(
"m_d0", &bdt.d0);
52 bdt.reader->AddVariable(
"m_d0_sigma", &bdt.d0_sigma);
54 const std::string weightFile {
58 bdt.reader->BookMVA(
"BDT", weightFile);
61 return StatusCode::SUCCESS;
77 for (
const auto vx : *primVxCont) {
81 std::vector<const xAOD::TrackParticle*> hgtdTracks {
85 std::vector<HGTD::Cluster<const xAOD::TrackParticle*>> trackClusters {
94 if (HS_cluster.getEntries().size() > 0) {
98 vxTime(*vx) = HS_cluster.getValues().at(0);
99 vxTimeRes(*vx) = HS_cluster.getSigmas().at(0);
118 return StatusCode::SUCCESS;
121 std::vector<const xAOD::TrackParticle*>
124 double min_trk_pt)
const {
126 std::vector<const xAOD::TrackParticle*> good_tracks { };
128 for (
const auto trk : *tracks) {
129 if (std::abs(trk->eta()) < 2.4 || std::abs(trk->eta()) > 4.0) {
137 good_tracks.push_back(trk);
146 double min_trk_pt,
const double significance_cut)
const {
148 if (
track->pt() < min_trk_pt || std::abs(
track->eta()) > 4.0) {
152 const double vx_z {
vertex->z() };
153 const double vx_z_variance {
vertex->covariancePosition()(2, 2) };
155 const double trk_z {
track->vz() +
track->z0() };
156 const double trk_z_variance {
track->definingParametersCovMatrix()(1, 1) };
158 if (std::abs(trk_z - vx_z) / std::sqrt(trk_z_variance + vx_z_variance)
159 < significance_cut) {
166 std::vector<HGTD::Cluster<const xAOD::TrackParticle*>>
168 const EventContext& ctx,
169 const std::vector<const xAOD::TrackParticle*>& tracks,
170 double cluster_distance)
const {
184 for (
const auto&
track : tracks) {
186 if (trackValidTime(*
track)) {
187 double time { trackTime(*
track) };
188 double timeResolution { trackTimeResolution(*
track) };
191 {time}, {timeResolution},
track);
193 collection.addCluster(cluster);
197 collection.updateDistanceCut(cluster_distance);
200 return collection.getClusters();
204 const EventContext& ctx,
209 float max_BDT_score { -1.0f };
211 for (
const auto& cluster :
clusters) {
214 if (cluster.getEntries().size() < 3) {
220 if (cluster_score >
m_bdt_cutvalue && cluster_score > max_BDT_score) {
222 max_BDT_score = cluster_score;
223 HS_cluster = cluster;
233 const EventContext& ctx,
237 std::pair<float, float> cluster_z {
getZOfCluster(cluster) };
239 std::pair<float, float> cluster_d0 {
getDOfCluster(cluster) };
240 double vertex_z_variance {
vertex->covariancePosition()(2, 2) };
242 auto& bdt { *m_BDT.get(ctx) };
244 bdt.delta_z = cluster_z.first -
vertex->z();
245 bdt.z_sigma = cluster_z.second;
246 bdt.q_over_p = cluster_oneover_p.first;
247 bdt.q_over_p_sigma = cluster_oneover_p.second;
248 bdt.d0 = cluster_d0.first;
249 bdt.d0_sigma = cluster_d0.second;
251 bdt.delta_z_resunits = (cluster_z.first -
vertex->z()) /
252 std::sqrt(
std::pow(cluster_z.second, 2.0) + vertex_z_variance);
254 return bdt.reader->EvaluateMVA(
"BDT");
260 std::vector<const xAOD::TrackParticle*> tracks { cluster.
getEntries() };
263 float denom { 0.0f };
265 for (
const auto&
track : tracks) {
269 static_cast<float>(
track->definingParametersCovMatrix()(1, 1))
272 num +=
z0 / z0_variance;
273 denom += 1.0f / z0_variance;
277 float avg_z0_sigma = std::sqrt(1.0
f /
denom);
279 return {avg_z0, avg_z0_sigma};
285 std::vector<const xAOD::TrackParticle*> tracks { cluster.
getEntries() };
288 float denom { 0.0f };
290 for (
const auto&
track : tracks) {
292 float one_over_p { std::abs(
track->qOverP()) };
293 float one_over_p_variance {
294 static_cast<float>(
track->definingParametersCovMatrix()(4, 4))
297 num += one_over_p / one_over_p_variance;
298 denom += 1.0f / one_over_p_variance;
302 float avg_oneover_p_sigma = std::sqrt(1.0
f /
denom);
304 return {avg_oneover_p, avg_oneover_p_sigma};
310 std::vector<const xAOD::TrackParticle*> tracks { cluster.
getEntries() };
313 float denom { 0.0f };
315 for (
const auto&
track : tracks) {
319 static_cast<float>(
track->definingParametersCovMatrix()(0, 0))
322 num +=
d0 / d0_variance;
323 denom += 1.0f / d0_variance;
327 float avg_z0_sigma = std::sqrt(1.0
f /
denom);
329 return {avg_z0, avg_z0_sigma};
335 std::vector<const xAOD::TrackParticle*> tracks { cluster.
getEntries() };
337 float sumpt2 { 0.0f };
339 for (
const auto&
track : tracks) {