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
TrackCorrector Class Reference

#include <TrackCorrector.h>

Classes

struct  Options
struct  Result

Public Member Functions

 TrackCorrector (const std::string &cfgFile, const Options &opts)
void beginEvent (int run, const std::vector< MCParticle * > *mcParticles=nullptr)
std::vector< Result > correct (const std::vector< Track * > &tracks, const std::vector< int > &charges={})
bool updatesVertex () const
bool hasSmearing () const
bool smearsOmega () const
bool hasMomentumScale () const
void printConfig () const

Static Public Member Functions

static void correctVertex (Vertex *vtx, double r1, double r2)

Private Member Functions

std::string resolvePath (const std::string &path) const
std::string dataOrMc (const nlohmann::json &block) const

Private Attributes

std::string cfgFile_
Options opts_
int run_ {-1}
std::map< std::string, double > trackOffsets_
std::string z0OffsetFile_
nlohmann::json z0OffsetFits_
int z0OffsetRun_ {-1}
double eleZ0Offset_ {0.}
double posZ0Offset_ {0.}
std::string z0CalibFile_
std::shared_ptr< TrackBiasingTool > z0Calib_
std::shared_ptr< RunScaleCorrectionTool > momentumScale_
std::shared_ptr< TrackSmearingTool > smearing_
bool smearOmega_ {false}
bool smearZ0_ {true}
bool applySmearing_ {false}
 smearing configured, MC, and Options::doSmearing
bool updatesVertex_ {false}

Detailed Description

One entry point for the track corrections a processor applies: it owns the individual tools and runs them in a fixed order, configured by a single JSON.

JSON keys (all optional; a missing or empty key switches that step off). Relative paths are resolved against $HPSTR_BASE.

"trackOffsets": file with constant offsets {"track_z0": x, "track_time": t} "z0Offset": {"data": file, "mc": file} per-run v0-projection z0 means (elez0_mean / posz0_mean); the closest run at or below the event's run is used "z0Calib": {"data": file, "mc": file} linear z0 calibration, z0 -= slope*tanL + intercept "momentumScale": {"runScale": file, "meanCorr": file, "meanCorrVariable": ""} data only; see RunScaleCorrectionTool "smearing": {"cfg": file, "smearingFactor": 1.0, "smearOmega": true, "variable": "tanLambda", "requireTruthMatch": false, "smearZ0": true, "trackCollection": "KalmanFullTracks"} MC only, and only when Options::doSmearing is set

Order, each step applied to all tracks before the next: trackOffsets, z0Offset, z0Calib, momentumScale (data), z0 smearing (MC), momentum smearing (MC).

Per-job settings (data/MC, seed, whether to smear, truth-match override) are not in the JSON; the processor passes them in Options.

Definition at line 51 of file TrackCorrector.h.

Constructor & Destructor Documentation

◆ TrackCorrector()

TrackCorrector ( const std::string & cfgFile,
const Options & opts )

Definition at line 36 of file TrackCorrector.cxx.

Member Function Documentation

◆ beginEvent()

void beginEvent ( int run,
const std::vector< MCParticle * > * mcParticles = nullptr )

Call once per event, before correct().

Definition at line 105 of file TrackCorrector.cxx.

◆ correct()

std::vector< TrackCorrector::Result > correct ( const std::vector< Track * > & tracks,
const std::vector< int > & charges = {} )

Correct the tracks in place. charges gives each track's charge sign, used to pick the electron or positron z0 offset; if empty, Track::getCharge() is used.

Definition at line 128 of file TrackCorrector.cxx.

◆ correctVertex()

void correctVertex ( Vertex * vtx,
double r1,
double r2 )
static

Scale the vertex momenta p1, p2 by the tracks' momentum ratios and the invariant mass by sqrt(r1 * r2), as TrackSmearingTool::updateVertexWithSmearP.

Definition at line 160 of file TrackCorrector.cxx.

◆ dataOrMc()

std::string dataOrMc ( const nlohmann::json & block) const
private

Definition at line 30 of file TrackCorrector.cxx.

◆ hasMomentumScale()

bool hasMomentumScale ( ) const
inline

Definition at line 90 of file TrackCorrector.h.

◆ hasSmearing()

bool hasSmearing ( ) const
inline

Definition at line 88 of file TrackCorrector.h.

◆ printConfig()

void printConfig ( ) const

Definition at line 166 of file TrackCorrector.cxx.

◆ resolvePath()

std::string resolvePath ( const std::string & path) const
private

Definition at line 23 of file TrackCorrector.cxx.

◆ smearsOmega()

bool smearsOmega ( ) const
inline

Definition at line 89 of file TrackCorrector.h.

◆ updatesVertex()

bool updatesVertex ( ) const
inline

True if correctVertex() should be called after correct() for vertex tracks.

Definition at line 80 of file TrackCorrector.h.

Member Data Documentation

◆ applySmearing_

bool applySmearing_ {false}
private

smearing configured, MC, and Options::doSmearing

Definition at line 117 of file TrackCorrector.h.

◆ cfgFile_

std::string cfgFile_
private

Definition at line 98 of file TrackCorrector.h.

◆ eleZ0Offset_

double eleZ0Offset_ {0.}
private

Definition at line 107 of file TrackCorrector.h.

◆ momentumScale_

std::shared_ptr<RunScaleCorrectionTool> momentumScale_
private

Definition at line 112 of file TrackCorrector.h.

◆ opts_

Options opts_
private

Definition at line 99 of file TrackCorrector.h.

◆ posZ0Offset_

double posZ0Offset_ {0.}
private

Definition at line 107 of file TrackCorrector.h.

◆ run_

int run_ {-1}
private

Definition at line 100 of file TrackCorrector.h.

◆ smearing_

std::shared_ptr<TrackSmearingTool> smearing_
private

Definition at line 114 of file TrackCorrector.h.

◆ smearOmega_

bool smearOmega_ {false}
private

Definition at line 115 of file TrackCorrector.h.

◆ smearZ0_

bool smearZ0_ {true}
private

Definition at line 116 of file TrackCorrector.h.

◆ trackOffsets_

std::map<std::string, double> trackOffsets_
private

Definition at line 102 of file TrackCorrector.h.

◆ updatesVertex_

bool updatesVertex_ {false}
private

Definition at line 119 of file TrackCorrector.h.

◆ z0Calib_

std::shared_ptr<TrackBiasingTool> z0Calib_
private

Definition at line 110 of file TrackCorrector.h.

◆ z0CalibFile_

std::string z0CalibFile_
private

Definition at line 109 of file TrackCorrector.h.

◆ z0OffsetFile_

std::string z0OffsetFile_
private

Definition at line 104 of file TrackCorrector.h.

◆ z0OffsetFits_

nlohmann::json z0OffsetFits_
private

Definition at line 105 of file TrackCorrector.h.

◆ z0OffsetRun_

int z0OffsetRun_ {-1}
private

Definition at line 106 of file TrackCorrector.h.


The documentation for this class was generated from the following files: