8 #include <boost/lexical_cast.hpp> 15 inFileLocation( conf.getParameter<
std::
string>(
"InFileLocation")),
16 Prefix( conf.getUntrackedParameter<
std::
string>(
"Prefix",
"")),
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"))
27 Book book(
"la_ensemble");
28 TChain*
const chain =
new TChain(
"la_ensemble");
35 laff.
fill(chain,book);
56 for(
auto const&
summary : ensemble.second)
66 boost::regex
format(
".*(T[IO]B)_layer(\\d)([as])_(.*)");
67 if(boost::regex_match(ensemble.first,format)) {
68 const bool TIB =
"TIB" == boost::regex_replace(ensemble.first, format,
"\\1");
69 const bool stereo =
"s" == boost::regex_replace(ensemble.first, format,
"\\3");
70 const unsigned layer = boost::lexical_cast<
unsigned>(boost::regex_replace(ensemble.first, format,
"\\2"));
71 label = boost::regex_replace(ensemble.first, format,
"\\4");
80 file << std::endl << std::endl
81 <<
"# Best Fit Line: " 82 << line.first.first <<
"("<< line.first.second<<
") + x* " 83 << line.second.first<<
"("<< line.second.second<<
")" 85 <<
"# Pull (average sigma of (x_measure-x_truth)/e_measure): " << pull
87 <<
"LA_Calibration( METHOD_XXXXX , xxx, " << line.second.first <<
", " << line.first.first <<
", " << pull <<
")," << std::endl;
94 TFile
file((
Prefix+
"sampleFits.root").c_str(),
"RECREATE");
96 hist->second->Write();
102 TFile
file((
Prefix+
"ensembleFits.root").c_str(),
"RECREATE");
104 hist->second->Write();
112 file << cal.first << std::endl
113 <<
"\t slopes(";
for(
float i : cal.second.slopes) file << i<<
","; file <<
")" << std::endl
114 <<
"\t offsets(";
for(
float i : cal.second.offsets) file << i<<
","; file <<
")" << std::endl
115 <<
"\t pulls(";
for(
float i : cal.second.pulls) file << i<<
","; 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=".*")
format
Some error handling for the usage.
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=".*")