8 #include <boost/lexical_cast.hpp> 15 inFileLocation(conf.getParameter<
std::
string>(
"InFileLocation")),
17 maxEvents(conf.getUntrackedParameter<unsigned>(
"MaxEvents", 0)),
18 samples(conf.getParameter<unsigned>(
"Samples")),
19 nbins(conf.getParameter<unsigned>(
"NBins")),
20 lowBin(conf.getParameter<double>(
"LowBin")),
21 highBin(conf.getParameter<double>(
"HighBin")),
22 vMethods(conf.getParameter<
std::vector<
int> >(
"Methods")) {}
25 Book book(
"la_ensemble");
26 TChain*
const chain =
new TChain(
"la_ensemble");
35 laff.
fill(chain, book);
54 for (
auto const&
summary : ensemble.second)
57 const std::pair<std::pair<float, float>, std::pair<float, float> >
line =
65 boost::regex
format(
".*(T[IO]B)_layer(\\d)([as])_(.*)");
66 if (boost::regex_match(ensemble.first, format)) {
67 const bool TIB =
"TIB" == boost::regex_replace(ensemble.first, format,
"\\1");
68 const bool stereo =
"s" == boost::regex_replace(ensemble.first, format,
"\\3");
69 const unsigned layer = boost::lexical_cast<
unsigned>(boost::regex_replace(ensemble.first, format,
"\\2"));
70 label = boost::regex_replace(ensemble.first, format,
"\\4");
81 <<
"# Best Fit Line: " << line.first.first <<
"(" << line.first.second <<
") + x* " << line.second.first
82 <<
"(" << line.second.second <<
")" << std::endl
83 <<
"# Pull (average sigma of (x_measure-x_truth)/e_measure): " << pull << std::endl
84 <<
"LA_Calibration( METHOD_XXXXX , xxx, " << line.second.first <<
", " << line.first.first <<
", " << pull
91 TFile
file((
Prefix +
"sampleFits.root").c_str(),
"RECREATE");
95 hist->second->Write();
100 TFile
file((
Prefix +
"ensembleFits.root").c_str(),
"RECREATE");
102 hist->second->Write();
109 file << cal.first << std::endl <<
"\t slopes(";
110 for (
float i : cal.second.slopes)
112 file <<
")" << std::endl <<
"\t offsets(";
113 for (
float i : cal.second.offsets)
115 file <<
")" << std::endl <<
"\t pulls(";
116 for (
float i : cal.second.pulls)
118 file <<
")" << std::endl;
std::map< std::string, MethodCalibrations > calibrations
static unsigned layer_index(bool TIB, bool stereo, unsigned layer)
static void fit(Book &book)
void write_calibrations() const
void write_ensembles_plots(const Book &) const
std::vector< int > vMethods
static std::pair< std::pair< float, float >, std::pair< float, float > > offset_slope(const std::vector< EnsembleSummary > &)
const TrackerTopology * tTopo_
static std::map< std::string, std::vector< EnsembleSummary > > ensemble_summary(const Book &)
void fill(TTree *, Book &) const
const std::string inFileLocation
void summarize_ensembles(Book &) const
void write_ensembles_text(const Book &)
const std::vector< std::string > inputFiles
iterator begin(string_t re=".*")
void write_samples_plots(const Book &) const
EnsembleCalibrationLA(const edm::ParameterSet &)
boost::filter_iterator< match_name, book_t::const_iterator > const_iterator
static float pull(const std::vector< EnsembleSummary > &)
T const * product() const
void endRun(const edm::Run &, const edm::EventSetup &) override
iterator end(string_t re=".*")