14 smearing-tool {smearing_file.root} {output.root}
16 The output.root file will contain a TTree of the input data
17 and the resulting smeared momentum.
22 TDirectoryFile* output_d,
23 const std::string& smearing_file,
24 const std::string& name,
25 std::function<
double()> unsmeared_sampler,
34 track.setTrackParameters(
41 for (
int i{0}; i < min_nhits-1; i++)
track.addHit(&empty_hit);
44 int nhits = min_nhits;
45 double unsmeared_momentum = 1.;
46 double smeared_momentum = 1.;
49 TTree data{name.c_str(), name.c_str()};
50 data.Branch(
"top", &top);
51 data.Branch(
"nhits", &nhits);
52 data.Branch(
"unsmeared_momentum", &unsmeared_momentum);
53 data.Branch(
"smeared_momentum", &smeared_momentum);
55 for (nhits = min_nhits; nhits < max_nhits+1; nhits++) {
56 track.addHit(&empty_hit);
57 for (
int _i{0}; _i < trials; _i++) {
58 unsmeared_momentum = unsmeared_sampler();
59 track.setMomentum(0. , 0. , unsmeared_momentum );