8 #include <boost/foreach.hpp> 9 #include <boost/lexical_cast.hpp> 16 inFileLocation( conf.getParameter<
std::
string>(
"InFileLocation")),
17 Prefix( conf.getUntrackedParameter<
std::
string>(
"Prefix",
"")),
18 maxEvents( conf.getUntrackedParameter<unsigned>(
"MaxEvents",0)),
19 samples( conf.getParameter<unsigned>(
"Samples")),
20 nbins( conf.getParameter<unsigned>(
"NBins")),
21 lowBin( conf.getParameter<double>(
"LowBin")),
22 highBin( conf.getParameter<double>(
"HighBin")),
23 vMethods( conf.getParameter<
std::vector<
int> >(
"Methods"))
28 Book book(
"la_ensemble");
29 TChain*
const chain =
new TChain(
"la_ensemble");
35 laff.
fill(chain,book);
54 std::pair<std::string, std::vector<LA_Filler_Fitter::EnsembleSummary> > ensemble;
58 file << summary << std::endl;
67 boost::regex
format(
".*(T[IO]B)_layer(\\d)([as])_(.*)");
68 if(boost::regex_match(ensemble.first,format)) {
69 const bool TIB =
"TIB" == boost::regex_replace(ensemble.first, format,
"\\1");
70 const bool stereo =
"s" == boost::regex_replace(ensemble.first, format,
"\\3");
71 const unsigned layer = boost::lexical_cast<
unsigned>(boost::regex_replace(ensemble.first, format,
"\\2"));
72 label = boost::regex_replace(ensemble.first, format,
"\\4");
81 file << std::endl << std::endl
82 <<
"# Best Fit Line: " 83 << line.first.first <<
"("<< line.first.second<<
") + x* " 84 << line.second.first<<
"("<< line.second.second<<
")" 86 <<
"# Pull (average sigma of (x_measure-x_truth)/e_measure): " << pull
88 <<
"LA_Calibration( METHOD_XXXXX , xxx, " << line.second.first <<
", " << line.first.first <<
", " << pull <<
")," << std::endl;
95 TFile
file((
Prefix+
"sampleFits.root").c_str(),
"RECREATE");
97 hist->second->Write();
103 TFile
file((
Prefix+
"ensembleFits.root").c_str(),
"RECREATE");
105 hist->second->Write();
112 std::pair<std::string,MethodCalibrations> cal;
114 file << cal.first << std::endl
115 <<
"\t slopes("; BOOST_FOREACH(
float i, cal.second.slopes) file << i<<
","; file <<
")" << std::endl
116 <<
"\t offsets("; BOOST_FOREACH(
float i, cal.second.offsets) file << i<<
","; file <<
")" << std::endl
117 <<
"\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 > &)
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
void endRun(const edm::Run &, const edm::EventSetup &)
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
iterator end(string_t re=".*")