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
PreselectAndCategorize2021.h
Go to the documentation of this file.
1/*
2 * @file PreselectAndCategorize.h
3 * @author Sarah Gaiser adapting Tom Eichlersmith's PreselectAndCategorize
4 * @date Apr 2025
5 */
6
7#ifndef __PRESELECT_AND_CATEGORIZE_2021_H__
8#define __PRESELECT_AND_CATEGORIZE_2021_H__
9
10#include <sstream>
11#include <string>
12#include <set>
13
14
15#include "Math/Vector4D.h"
17#include "TMath.h"
18#include "TSData.h"
19#include "TrackBiasingTool.h"
20#include "TrackCorrector.h"
21#include "TrackSmearingTool.h"
22#include "TruthMatchingUtils.h"
23#include "TrackTools.h"
24
26 public:
29 virtual void configure(const ParameterSet& parameters) final;
30 virtual void initialize(TTree* tree) final;
31 virtual void setFile(TFile* out_file) final;
32 virtual bool process(IEvent* ievent) final;
33 virtual void finalize() final;
34
35 private:
36 std::string trkColl_{"KalmanFullTracks"};
37 // std::string hitColl_{"SiClustersOnTrack"};
38 // Track corrections: one TrackCorrector JSON; the per-job settings below stay parameters.
39 std::string trackCorrectionsCfg_{""}; // TrackCorrector JSON ("" = no track corrections)
40 std::shared_ptr<TrackCorrector> corrector_;
41 int smearingSeed_{42}; // configurable seed (default 42 for backward compat)
42 bool doSmearing_{true}; // MC smearing on/off for this job
43 int requireTruthMatch_{-1}; // require truth match for smearing; -1 = use the JSON value
44 bool isSimpSignal_{false};
45 bool isApSignal_{false};
46 int apPDG_{622}; // PDG code for A': 622 for displaced, 623 for prompt
47 bool debug_{false}; // debug output for smearing validation
48 bool disablePreselection_{false}; // if true, skip all vertex-level cuts
49 bool disableTimingCuts_{false}; // if true, skip all track/cluster timing cuts
50 bool disableVertexChi2Cut_{false}; // if true, skip the vertex chi2 cut
51 bool requireSingleVertex_{true}; // if true (default), veto events with >=2 preselected
52 // vertices; if false, keep the event and select the
53 // preselected vertex with the lowest vertex chi2 instead
54 bool useVertexMomentum_{true}; // if true, replace each particle's track momentum with the
55 // vertex-fitted momentum (P1/P2); if false, keep the
56 // standalone track-fit momentum
57 int minHits_{10}; // default minimum number of 2D tracker hits; fallback for both tracks
58 int eleMinHits_{10}; // minimum number of 2D tracker hits required for the electron track
59 int posMinHits_{10}; // minimum number of 2D tracker hits required for the positron track
60 std::string triggerSelection_{"singles2"}; // which trigger to require: "singles2" (default,
61 // singles2||singles3) or "pairs" (OR of all pair triggers)
62 double psumCut_{-1.0}; // minimum psum (|p_{e-} + p_{e+}|) [GeV]; filtering disabled when < 0
63 double beamE_{3.74}; // beam energy [GeV] used for recoil inference
64 double thetaBeamMrad_{30.5}; // beam angle [mrad] used for recoil inference
65 std::vector<double> determine_time_cuts(bool isData, int runNumber);
66 std::vector<double> time_cuts_{6.9, 5.2, 9.0};
67
68 // Diagnostics for the requireSingleVertex_=false best-chi2 selection: filled whenever an
69 // event has >=2 preselected vertices, regardless of whether requireSingleVertex_ would have
70 // vetoed it, so the effect of relaxing the veto can be studied even with it left enabled.
71 std::unique_ptr<TH1F> multivtx_chosen_chi2_h_; // chi2 of the vertex that would be chosen
72 std::unique_ptr<TH1F> multivtx_discarded_chi2_h_; // chi2 of every other preselected vertex
73
74 // Inferred recoil-electron angle relative to the beam direction, in mrad.
75 // The recoil 3-momentum is reconstructed from momentum conservation:
76 // p_recoil = p_beam - p_ele - p_pos
77 // and theta_R is the angle between p_recoil and the beam direction.
78 double calculate_theta_R(const TVector3& ele_mom, const TVector3& pos_mom) const;
79
80 bool saveAllTracks_{false}; // if true, save all tracks in the event
81 bool calcMultiTrackVars_{false}; // if true, calculate event-level variables (min_dTanlambda, etc.)
82
83 // Minimum 2D tracker hits for all_preselected_tracks.
84 // Negative (default) means follow the preselection
86
87 int input_entry_{-1};
88
89 Track createInferredTrack(Vertex* vtx, Track* ele_track, Track* pos_track);
90
91 bool isQualityTrack(Track* trk, const Particle& pos) const;
92 void calculatePairwiseQuantities(const std::vector<Track*>& all_tracks, Particle& ele, Particle& pos);
93};
94
95#endif //__PRESELECT_AND_CATEGORIZE_2021_H__
Class used to decode TS words.
Definition IEvent.h:7
description
double calculate_theta_R(const TVector3 &ele_mom, const TVector3 &pos_mom) const
std::unique_ptr< TH1F > multivtx_discarded_chi2_h_
~PreselectAndCategorize2021()=default
std::shared_ptr< TrackCorrector > corrector_
virtual void setFile(TFile *out_file) final
Set output TFile for AnaProcessors.
void calculatePairwiseQuantities(const std::vector< Track * > &all_tracks, Particle &ele, Particle &pos)
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,...
bool isQualityTrack(Track *trk, const Particle &pos) const
virtual void configure(const ParameterSet &parameters) final
Callback for the Processor to configure itself from the given set of parameters.
Track createInferredTrack(Vertex *vtx, Track *ele_track, Track *pos_track)
PreselectAndCategorize2021(const std::string &name, Process &process)
std::unique_ptr< TH1F > multivtx_chosen_chi2_h_
std::vector< double > determine_time_cuts(bool isData, int runNumber)
PreselectAndCategorize(const std::string &name, Process &process)
virtual bool process()
Process the histograms and generate analysis output.
Definition Processor.h:95
Definition Track.h:32