ATLAS Offline Software
Loading...
Searching...
No Matches
HIEventSelectionToolRun3.cxx File Reference
#include "HIEventUtils/HIEventSelectionToolRun3.h"
#include <fstream>
#include <nlohmann/json.hpp>
#include "PathResolver/PathResolver.h"
Include dependency graph for HIEventSelectionToolRun3.cxx:

Go to the source code of this file.

Macros

#define ENUMDEF(_N)
#define ENUMDEF(_N)
#define ENUMDEF(_N)

Functions

std::unique_ptr< TH1D > loadHist (const std::string &file)

Variables

static const double MeV = 1.
static const double GeV = 1e3
static const double TeV = 1e6

Macro Definition Documentation

◆ ENUMDEF [1/3]

#define ENUMDEF ( _N)
Value:
case HI::SelectionMask::_N: \
return #_N;

◆ ENUMDEF [2/3]

#define ENUMDEF ( _N)
Value:
case PileupVariation::_N: \
return #_N;

◆ ENUMDEF [3/3]

#define ENUMDEF ( _N)
Value:
case IonDataType::_N: \
return #_N;

Function Documentation

◆ loadHist()

std::unique_ptr< TH1D > loadHist ( const std::string & file)

Definition at line 76 of file HIEventSelectionToolRun3.cxx.

76 {
77 const std::string path =
78 PathResolver::find_file(std::string("HIEventUtils/") + file, "DATAPATH");
79 std::ifstream i(path);
80 if (not i) {
81 throw std::runtime_error(path + " does nto exist");
82 }
83
84 nlohmann::json j;
85 i >> j;
86 i.close();
87
88 const size_t nbins = j.at("fNbins").get<size_t>();
89
90 auto h = std::make_unique<TH1D>(j.at("fName").get<std::string>().c_str(),
91 j.at("fTitle").get<std::string>().c_str(),
92 nbins, j.at("fXmin").get<double>(),
93 j.at("fXmax").get<double>());
94 const std::vector<double> bins = j.at("fArray").get<std::vector<double>>();
95 if (bins.size() != j.at("fNbins").get<size_t>() + 2) {
96 throw std::runtime_error(
97 "Histogram " + j.at("fName").get<std::string>() +
98 " has inconsistent number of bins and fNbins (should +2) value " +
99 std::to_string(bins.size()) + " and " + std::to_string(nbins));
100 }
101
102 for (size_t bin = 0; bin < nbins + 2; bin++) {
103 h->SetBinContent(bin, bins[bin]);
104 }
105 h->SetDirectory(0);
106 return h;
107}
static const std::vector< std::string > bins
Header file for AthHistogramAlgorithm.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
path
python interpreter configuration --------------------------------------—
Definition athena.py:130
TFile * file

Variable Documentation

◆ GeV

const double GeV = 1e3
static

Definition at line 73 of file HIEventSelectionToolRun3.cxx.

◆ MeV

const double MeV = 1.
static

Definition at line 72 of file HIEventSelectionToolRun3.cxx.

◆ TeV

const double TeV = 1e6
static

Definition at line 74 of file HIEventSelectionToolRun3.cxx.