hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
Loading...
Searching...
No Matches
TruthVertexMatch2021.h
Go to the documentation of this file.
1/*
2 * @file TruthVertexMatch2021.h
3 * @brief Truth-A' -> reconstructed-vertex matching study for 2021 displaced A'/SIMP signal MC.
4 *
5 * Step 1 (this version): replicate the PreselectAndCategorize2021 truth block that finds the
6 * true A' (or SIMP vector) and its e+e- decay, and write the truth decay vertex + kinematics
7 * to a flat tree. Step 2 (later): search the reconstructed UnconstrainedV0Vertices_KF for a
8 * vertex matching this truth vertex (matching strategy TBD).
9 *
10 * Reuses the lean EventBus/Cutflow helpers from PreselectAndCategorize.h (no preselection
11 * machinery), mirroring ClusterEfficiency2021.
12 *
13 * @author Matthew Gignac
14 * @date June 2026
15 */
16
17#ifndef __TRUTH_VERTEX_MATCH_2021_H__
18#define __TRUTH_VERTEX_MATCH_2021_H__
19
20#include <memory>
21#include <string>
22
23#include "PreselectAndCategorize.h" // EventBus, Cutflow, Processor, AnaHelpers, event classes
24#include "TruthMatchingUtils.h"
25#include "TVector3.h"
26
28 public:
29 TruthVertexMatch2021(const std::string& name, Process& process) : Processor(name, process) {}
31 virtual void configure(const ParameterSet& parameters) final;
32 virtual void initialize(TTree* tree) final;
33 virtual void setFile(TFile* out_file) final;
34 virtual bool process(IEvent* ievent) final;
35 virtual void finalize() final;
36
37 private:
39 std::unique_ptr<TTree> output_tree_;
40 Cutflow event_cf_{"event", "readout"};
41 std::shared_ptr<AnaHelpers> _ah;
42
43 std::string vtxColl_{"UnconstrainedV0Vertices_KF"};
44 std::string mcColl_{"MCParticle"};
45 std::string trkColl_{"KalmanFullTracks"};
46 // Truth-tagged 2D SVT hits (written by Tracker2DHitProcessor when recoTuple_cfg.py is run with
47 // -sh/--truthHits 1). Older/other productions won't have this branch at all, so availability is
48 // checked at runtime in initialize() -- see hasTruthHits_.
49 std::string hitColl_{"RotatedHelicalTrackHits"};
50 bool hasTruthHits_{false};
51
52 bool isData_{false};
53 bool isApSignal_{false};
54 bool isSimpSignal_{false};
55 int apPDG_{622}; // 622 displaced A', 623 prompt A'
56 int signalMomPDG_{622}; // mother PDG of the signal e+/e- (apPDG_ for A', 625 for SIMP)
57 double calTimeOffset_{0.0};
58 double vertexMatchZ_{5.0}; // |z_reco - z_truth| window [mm] for a v0 to "match" the truth vertex
59 // Optional truth e+e- invariant-mass window. For the rad (continuum) sample this slices the
60 // spectrum to a fixed mass so it is a proper mass-matched control for a given A' mass. When
61 // massSelect_ < 0 the window is disabled (all truth-signal events kept).
62 double massSelect_{-1.0}; // target true e+e- invariant mass [GeV]; <0 disables
63 double massWindow_{0.002}; // half-width of the mass window [GeV]
64 // Optional truth decay-vertex z fiducial window [mm]. Restricts the studied events to those
65 // whose A' (or VD) decays in [vtxZMin_, vtxZMax_] BEFORE evaluating any acceptance. Setting
66 // vtxZMax_ < ~50 mm keeps decays upstream of the first tracking layer.
67 double vtxZMin_{-1.0e9};
68 double vtxZMax_{1.0e9};
69 // Electron-momentum threshold [GeV] for the secondary (energetic-e-) category reported
70 // alongside the inclusive rates.
71 double eleMomCut_{0.5};
72 // Sanity cut on the electron leg's ECal cluster energy [GeV]: below this, a "matched" cluster
73 // is treated as absent. Guards against noise-level cluster matches inflating has_ele_clus.
74 double eleClusEMin_{0.2};
75 bool debug_{false};
76
77 // running counters for the terminal rate summary (printed in finalize)
78 long n_truth_{0}; // events with a truth signal (A'/VD) found
79 long n_has_v0_{0}; // ... with >=1 reconstructed v0 (no selection)
80 long n_matched_z_{0}; // ... with >=1 v0 within vertexMatchZ_ in z of the truth vertex
81 // track-based truth matching: a v0 "track-matches" when its two constituent tracks are each
82 // majority-hit truth-matched (see utils::getTruthPDG) to the true signal e-/e+, independent
83 // of where the vertex fit places z. Lets us see how much the z-window under/over-counts.
84 long n_matched_trk_{0}; // ... with >=1 v0 that is track-matched
85 long n_matched_z_and_trk_{0}; // ... with >=1 v0 that is BOTH within the z-window AND track-matched
86 long n_matched_trk_ele_{0}; // ... with >=1 v0 carrying the truth e- (no requirement on e+)
87 long n_matched_trk_pos_{0}; // ... with >=1 v0 carrying the truth e+ (no requirement on e-)
88 // ECal-cluster-aware track matching: quantifies the acceptance gained by relaxing the
89 // electron ECal-cluster requirement (the point of the singles trigger, which only needs the
90 // positron's cluster). Both counters below are subsets of n_matched_trk_ (both tracks correct).
91 long n_matched_trk_ele_clus_{0}; // ... with >=1 v0: truth e- track has a cluster (any e+)
92 long n_matched_trk_pos_clus_{0}; // ... with >=1 v0: truth e+ track has a cluster (any e-)
93 long n_matched_trk_clus_both_{0}; // ... with >=1 v0: both tracks correct AND both have clusters (strict)
94 long n_matched_trk_clus_pos_only_{0}; // ... with >=1 v0: both tracks correct AND e+ has a cluster (relaxed)
95 long n_matched_trk_clus_ele_only_{0}; // ... with >=1 v0: both tracks correct AND e- has a cluster (e+ optional)
96 // no-v0 track inventory (KalmanFullTracks, NO truth match) -> tracking vs vertexing
97 long n_novtx_both_trk_{0}; // no-v0 events with >=1 e+ AND >=1 e- track (vertexing issue)
98 long n_novtx_pos_only_{0}; // no-v0 with e+ track but no e- track
99 long n_novtx_ele_only_{0}; // no-v0 with e- track but no e+ track
100 long n_novtx_neither_{0}; // no-v0 with neither track
101 // secondary category: events whose truth electron momentum > eleMomCut_
105};
106
107#endif //__TRUTH_VERTEX_MATCH_2021_H__
Definition IEvent.h:7
description
Processor(const std::string &name, Process &process)
Class constructor.
Definition Processor.cxx:10
virtual bool process()
Process the histograms and generate analysis output.
Definition Processor.h:95
~TruthVertexMatch2021()=default
TruthVertexMatch2021(const std::string &name, Process &process)
virtual void setFile(TFile *out_file) final
Set output TFile for AnaProcessors.
std::shared_ptr< AnaHelpers > _ah
virtual bool process(IEvent *ievent) final
Process the event and put new data products into it.
virtual void initialize(TTree *tree) final
Callback for the Processor to take any necessary action when the processing of events starts,...
virtual void finalize() final
Callback for the Processor to take any necessary action when the processing of events finishes,...
virtual void configure(const ParameterSet &parameters) final
Callback for the Processor to configure itself from the given set of parameters.
std::unique_ptr< TTree > output_tree_