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
TrackBiasingTool.h
Go to the documentation of this file.
1#pragma once
2
3//------------------//
4// C++ //
5//------------------//
6#include <iostream>
7#include <map>
8#include <memory>
9#include <random>
10#include <string>
11
12//------------------//
13// JSON //
14//------------------//
15#include "json.hpp"
16using json = nlohmann::json;
17
18//------------------//
19// hpstr //
20//------------------//
21
22#include "Track.h"
23#include "Vertex.h"
24
25class TFile;
26class TH1D;
27class TVector3;
28
30
31 public :
32
33 TrackBiasingTool(const std::string& biasingfile,
34 const std::string& tracks = "KalmanFullTracks");
35
36 double biasTrackP(const Track& track);
37
38 double getCorrection(const double& p,
39 const double tanL,
40 const int q);
41
43
44 //Update the track P with a specific scale Factor
45 void updateWithBiasP(Track& trk, double scaleFactor);
46
47 //Update the track P with scale Factors according to the internal calibration plots
48 void updateWithBiasP(Track& trk);
49
50 // Load run-keyed linear z0 calibration: z0 -= slope*|tanL| + intercept
51 // JSON format: { "14194": { "ele_top": {"slope":..,"intercept":..}, ... }, ... }
52 // Run lookup: largest key <= current run (same strategy as v0proj).
53 void loadZ0Calibration(const std::string& jsonFile);
54
55 // Set the active run; selects the calibration set with largest key <= run.
56 // Call once per event (no-op if run hasn't changed).
57 void setRun(int run);
58
59 // Apply linear z0 calibration to a track (uses charge and tanLambda sign)
61
62 void setDebug(bool debug) { debug_ = debug; }
63
64private:
65
66 std::shared_ptr<TFile> biasingfile_;
67
68 //Biasing terms
69
70 //This is per charge -1: electron +1: positron
73
74 // linear z0 calibration
75 struct Z0CalibParams { double slope{0.0}; double intercept{0.0}; };
79 std::map<int, Z0CalibSet> z0CalibByRun_; // all loaded run entries
80 Z0CalibSet z0CalibActive_; // currently selected run's params
81 bool z0CalibLoaded_{false};
82 int z0CalibCurrentRun_{-1}; // last run used in setRun()
83
84 // debug
85 bool debug_{false};
86
87};
nlohmann::json json
Class used to encapsulate track information.
Class used to encapsulate Vertex information.
Z0CalibSet z0CalibActive_
std::map< int, Z0CalibSet > z0CalibByRun_
double getCorrection(const double &p, const double tanL, const int q)
TrackBiasingTool(const std::string &biasingfile, const std::string &tracks="KalmanFullTracks")
void loadZ0Calibration(const std::string &jsonFile)
void setDebug(bool debug)
void updateWithBiasP(Track &trk, double scaleFactor)
void updateVertexWithBiasP(Vertex *vtx)
double biasTrackP(const Track &track)
void updateWithCalibrateZ0(Track &trk)
std::shared_ptr< TFile > biasingfile_
Definition Track.h:32