13 inFileLocation(conf.getParameter<
std::
string>(
"InFileLocation")),
15 maxEvents(conf.getUntrackedParameter<unsigned>(
"MaxEvents", 0)),
16 samples(conf.getParameter<unsigned>(
"Samples")),
17 nbins(conf.getParameter<unsigned>(
"NBins")),
18 lowBin(conf.getParameter<double>(
"LowBin")),
19 highBin(conf.getParameter<double>(
"HighBin")),
20 vMethods(conf.getParameter<
std::
vector<
int> >(
"Methods")),
26 Book book(
"la_ensemble");
27 TChain*
const chain =
new TChain(
"la_ensemble");
36 laff.
fill(chain, book);
55 for (
auto const&
summary : ensemble.second)
58 const std::pair<std::pair<float, float>, std::pair<float, float> >
line =
66 std::regex
format(
".*(T[IO]B)_layer(\\d)([as])_(.*)");
67 if (std::regex_match(ensemble.first,
format)) {
68 const bool TIB =
"TIB" == std::regex_replace(ensemble.first,
format,
"\\1");
69 const bool stereo =
"s" == std::regex_replace(ensemble.first,
format,
"\\3");
70 const unsigned layer = std::stoul(std::regex_replace(ensemble.first,
format,
"\\2"));
71 label = std::regex_replace(ensemble.first,
format,
"\\4");
82 <<
"# Best Fit Line: " <<
line.first.first <<
"(" <<
line.first.second <<
") + x* " <<
line.second.first
83 <<
"(" <<
line.second.second <<
")" << std::endl
84 <<
"# Pull (average sigma of (x_measure-x_truth)/e_measure): " << pull << std::endl
85 <<
"LA_Calibration( METHOD_XXXXX , xxx, " <<
line.second.first <<
", " <<
line.first.first <<
", " << pull
92 TFile
file((
Prefix +
"sampleFits.root").c_str(),
"RECREATE");
96 hist->second->Write();
101 TFile
file((
Prefix +
"ensembleFits.root").c_str(),
"RECREATE");
103 hist->second->Write();
110 file << cal.first << std::endl <<
"\t slopes(";
111 for (
float i : cal.second.slopes)
113 file <<
")" << std::endl <<
"\t offsets(";
114 for (
float i : cal.second.offsets)
116 file <<
")" << std::endl <<
"\t pulls(";
117 for (
float i : cal.second.pulls)
119 file <<
")" << std::endl;
std::map< std::string, MethodCalibrations > calibrations
static unsigned layer_index(bool TIB, bool stereo, unsigned layer)
static void fit(Book &book)
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
void summarize_ensembles(Book &) const
std::vector< int > vMethods
static std::pair< std::pair< float, float >, std::pair< float, float > > offset_slope(const std::vector< EnsembleSummary > &)
void write_calibrations() const
const TrackerTopology * tTopo_
static std::map< std::string, std::vector< EnsembleSummary > > ensemble_summary(const Book &)
const std::string inFileLocation
constexpr std::array< uint8_t, layerIndexSize > layer
void write_ensembles_text(const Book &)
const std::vector< std::string > inputFiles
iterator begin(string_t re=".*")
bool getData(T &iHolder) const
void write_samples_plots(const Book &) const
~EnsembleCalibrationLA() override
EnsembleCalibrationLA(const edm::ParameterSet &)
void fill(TTree *, Book &) const
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
static float pull(const std::vector< EnsembleSummary > &)
void write_ensembles_plots(const Book &) const
void beginRun(const edm::Run &, const edm::EventSetup &) override
void endRun(const edm::Run &, const edm::EventSetup &) override
iterator end(string_t re=".*")