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.h
Go to the documentation of this file.
1#pragma once
2
3//------------------//
4// C++ //
5//------------------//
6#include <map>
7#include <memory>
8#include <string>
9#include <vector>
10
11//------------------//
12// JSON //
13//------------------//
14#include "json.hpp"
15
16//------------------//
17// hpstr //
18//------------------//
19#include "MCParticle.h"
21#include "Track.h"
22#include "TrackBiasingTool.h"
23#include "TrackSmearingTool.h"
24#include "Vertex.h"
25
52 public:
53 struct Options {
54 bool isData{false};
55 int seed{42};
56 bool doSmearing{false};
58 bool debug{false};
59 };
60
62 struct Result {
63 double pScale{1.0};
64 double pSmear{1.0};
65 double pRatio() const { return pScale * pSmear; }
66 };
67
68 TrackCorrector(const std::string& cfgFile, const Options& opts);
69
71 void beginEvent(int run, const std::vector<MCParticle*>* mcParticles = nullptr);
72
77 std::vector<Result> correct(const std::vector<Track*>& tracks, const std::vector<int>& charges = {});
78
80 bool updatesVertex() const { return updatesVertex_; }
81
86 static void correctVertex(Vertex* vtx, double r1, double r2);
87
88 bool hasSmearing() const { return smearing_ != nullptr; }
89 bool smearsOmega() const { return smearOmega_; }
90 bool hasMomentumScale() const { return momentumScale_ != nullptr; }
91
92 void printConfig() const;
93
94 private:
95 std::string resolvePath(const std::string& path) const;
96 std::string dataOrMc(const nlohmann::json& block) const;
97
98 std::string cfgFile_;
100 int run_{-1};
101
102 std::map<std::string, double> trackOffsets_;
103
104 std::string z0OffsetFile_;
105 nlohmann::json z0OffsetFits_;
107 double eleZ0Offset_{0.}, posZ0Offset_{0.};
108
109 std::string z0CalibFile_;
110 std::shared_ptr<TrackBiasingTool> z0Calib_;
111
112 std::shared_ptr<RunScaleCorrectionTool> momentumScale_;
113
114 std::shared_ptr<TrackSmearingTool> smearing_;
115 bool smearOmega_{false};
116 bool smearZ0_{true};
117 bool applySmearing_{false};
118
119 bool updatesVertex_{false};
120};
Class used to encapsulate information about a mc particle.
Class used to encapsulate track information.
Class used to encapsulate Vertex information.
void beginEvent(int run, const std::vector< MCParticle * > *mcParticles=nullptr)
std::string z0OffsetFile_
std::vector< Result > correct(const std::vector< Track * > &tracks, const std::vector< int > &charges={})
std::shared_ptr< TrackSmearingTool > smearing_
std::shared_ptr< RunScaleCorrectionTool > momentumScale_
std::string dataOrMc(const nlohmann::json &block) const
std::string z0CalibFile_
bool updatesVertex() const
bool smearsOmega() const
std::string resolvePath(const std::string &path) const
nlohmann::json z0OffsetFits_
std::string cfgFile_
bool hasSmearing() const
void printConfig() const
bool applySmearing_
smearing configured, MC, and Options::doSmearing
bool hasMomentumScale() const
std::map< std::string, double > trackOffsets_
std::shared_ptr< TrackBiasingTool > z0Calib_
static void correctVertex(Vertex *vtx, double r1, double r2)
TrackCorrector(const std::string &cfgFile, const Options &opts)
bool doSmearing
MC Gaussian smearing on/off for this job.
int requireTruthMatch
-1: use the JSON value; 0/1: override it
double pSmear
smearing step (MC)
double pScale
momentumScale step (data)