6 #include <boost/foreach.hpp> 7 #include <boost/lexical_cast.hpp> 14 inFileLocation( conf.getParameter<
std::
string>(
"InFileLocation")),
15 Prefix( conf.getUntrackedParameter<
std::
string>(
"Prefix",
"")),
16 maxEvents( conf.getUntrackedParameter<unsigned>(
"MaxEvents",0)),
17 samples( conf.getParameter<unsigned>(
"Samples")),
18 nbins( conf.getParameter<unsigned>(
"NBins")),
19 lowBin( conf.getParameter<double>(
"LowBin")),
20 highBin( conf.getParameter<double>(
"HighBin")),
21 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);
47 std::pair<std::string, std::vector<LA_Filler_Fitter::EnsembleSummary> > ensemble;
51 file << summary << std::endl;
60 boost::regex
format(
".*(T[IO]B)_layer(\\d)([as])_(.*)");
61 if(boost::regex_match(ensemble.first,format)) {
62 const bool TIB =
"TIB" == boost::regex_replace(ensemble.first, format,
"\\1");
63 const bool stereo =
"s" == boost::regex_replace(ensemble.first, format,
"\\3");
64 const unsigned layer = boost::lexical_cast<
unsigned>(boost::regex_replace(ensemble.first, format,
"\\2"));
65 label = boost::regex_replace(ensemble.first, format,
"\\4");
74 file << std::endl << std::endl
75 <<
"# Best Fit Line: " 76 << line.first.first <<
"("<< line.first.second<<
") + x* " 77 << line.second.first<<
"("<< line.second.second<<
")" 79 <<
"# Pull (average sigma of (x_measure-x_truth)/e_measure): " << pull
81 <<
"LA_Calibration( METHOD_XXXXX , xxx, " << line.second.first <<
", " << line.first.first <<
", " << pull <<
")," << std::endl;
88 TFile
file((
Prefix+
"sampleFits.root").c_str(),
"RECREATE");
90 hist->second->Write();
96 TFile
file((
Prefix+
"ensembleFits.root").c_str(),
"RECREATE");
98 hist->second->Write();
105 std::pair<std::string,MethodCalibrations> cal;
107 file << cal.first << std::endl
108 <<
"\t slopes("; BOOST_FOREACH(
float i, cal.second.slopes) file << i<<
","; file <<
")" << std::endl
109 <<
"\t offsets("; BOOST_FOREACH(
float i, cal.second.offsets) file << i<<
","; file <<
")" << std::endl
110 <<
"\t pulls("; BOOST_FOREACH(
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 > &)
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 > &)
iterator end(string_t re=".*")