|
|
Go to the documentation of this file.
26 #include <sys/types.h>
40 outputFileName_(
pset.getUntrackedParameter<
std::
string>(
"OutputRootFile",
"")),
41 collateHistos_(!
pset.getUntrackedParameter<
bool>(
"UseClientFile",
false)),
42 analyzeHistos_(
pset.getUntrackedParameter<
bool>(
"AnalyzeHistos",
true)),
43 xmlFile_((
pset.getUntrackedParameter<
edm::FileInPath>(
"SummaryXmlFile",
edm::FileInPath())).
fullPath()),
44 createSummaryPlots_(
false),
55 <<
" Constructing object...";
59 pset.getUntrackedParameter<uint32_t>(
"RunNumber"),
67 <<
" Destructing object...";
74 <<
" Analyzing root file(s)...";
79 <<
" NULL pointer to DQMStore!"
87 std::ifstream root_file;
88 root_file.open(
ifile->c_str());
89 if (!root_file.is_open()) {
91 <<
" The input root file \"" << *
ifile <<
"\" could not be opened!"
92 <<
" Please check the path and filename!";
98 <<
" The input root files appear to be a mixture"
99 <<
" of \"Source\" and \"Client\" files!"
105 <<
" There appear to be multiple input \"Client\" root files!"
109 if (
found != std::string::npos) {
116 <<
" Collated histograms found in input root file \"" <<
inputFiles_[0] <<
"\"";
121 std::ifstream xml_file;
123 if (!xml_file.is_open()) {
125 <<
" The SummaryPlot XML file \"" <<
xmlFile_ <<
"\" could not be opened!"
126 <<
" Please check the path and filename!"
138 <<
" No input root files specified!";
143 <<
" Opening root files. This may take some time!...";
147 <<
" Opening root file \"" << *
jfile <<
"\"... (This may take some time.)";
154 <<
" Opened root file \"" << *
jfile <<
"\"!";
157 <<
" Opened " <<
inputFiles_.size() <<
" root files!";
165 std::set<std::string>
temp;
166 for (
auto me : allmes) {
167 const auto&
name =
me->getPathname();
173 for (
const auto&
s :
temp) {
181 <<
" Found " <<
contents.size() <<
" directories containing MonitorElements";
185 std::stringstream
ss;
186 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
187 <<
" Directories found: " << std::endl;
188 std::vector<std::string>::iterator istr =
contents.begin();
189 for (; istr !=
contents.end(); istr++) {
190 ss <<
" " << *istr << std::endl;
219 <<
" Parsing summary plot XML file...";
224 <<
" Parsed summary plot XML file and found " <<
plots_.size() <<
" plots defined!";
227 <<
" Null string for SummaryPlotXmlFile!"
228 <<
" No summary plots will be created!";
232 std::stringstream
ss;
233 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]" << std::endl <<
" Input root files : ";
240 ss << std::setw(25) << std::setfill(
' ') <<
": ";
242 ss <<
"\"" << *
ifile <<
"\"" << std::endl;
246 <<
" Run number : " <<
runNumber_ << std::endl
247 <<
" Summary plot XML file : ";
257 <<
" Creating CommissioningHistogram object...";
261 <<
" Created CommissioningHistogram object!";
264 <<
" NULL pointer to CommissioningHistogram object!"
277 <<
" Analyzing histograms...";
282 <<
" Analyzed histograms!";
285 <<
" No histogram analysis performed!";
291 <<
" Generating summary plots...";
292 std::vector<SummaryPlot>::const_iterator iplot =
plots_.begin();
293 for (; iplot !=
plots_.end(); iplot++) {
299 <<
" Generated summary plots!";
302 <<
" No summary plots generated!";
320 <<
" Client file not saved!";
339 <<
" Finished analyzing root file(s)...";
345 if (!(
event.id().event() % 10)) {
347 <<
" Empty event loop! User can kill job...";
361 <<
" CommissioningHistogram object already exists!"
369 <<
" NULL pointer to DQMStore!";
402 <<
" Undefined run type!";
407 <<
" Unknown run type!";
419 bool collate_histos) {
421 std::stringstream
ss;
426 if (!collate_histos) {
427 nameStr =
"SiStripCommissioningClient_";
429 nameStr =
"SiStripCommissioningSource_";
432 LogTrace(
"TEST") <<
" runStr " << runStr;
437 if ((
dp = opendir(
path.c_str())) ==
nullptr) {
439 <<
" Error locating directory \"" <<
path <<
"\". No such directory!";
444 while ((dirp = readdir(
dp)) !=
nullptr) {
446 bool goodName = (
fileName.find(nameStr) != std::string::npos);
447 bool goodRun = (
fileName.find(runStr) != std::string::npos);
449 bool goodPartition =
true;
455 if (goodName && goodRun &&
rootFile && goodPartition) {
465 if (!collate_histos &&
files.size() > 1) {
466 std::stringstream
ss;
467 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
468 <<
" Found more than one client file!";
469 std::vector<std::string>::const_iterator
ifile =
files.begin();
470 std::vector<std::string>::const_iterator
jfile =
files.end();
475 }
else if (
files.empty()) {
477 <<
" No input files found!";
static std::string runType(const sistrip::RunType &)
SiStripCommissioningOfflineClient(const edm::ParameterSet &)
virtual void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
sistrip::RunType runType_
void analyze(const edm::Event &, const edm::EventSetup &) override
void remove(std::string pattern="")
void extractHistograms(const std::vector< std::string > &)
T getUntrackedParameter(std::string const &, T const &) const
static const char dqmClientFileName_[]
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Log< level::Warning, false > LogWarning
static const char mlDqmClient_[]
std::vector< std::string > inputFiles_
CommissioningHistograms * histos_
std::string outputFileName_
virtual void setInputFiles(std::vector< std::string > &, const std::string, const std::string, uint32_t, bool)
virtual void createHistos(const edm::ParameterSet &, const edm::EventSetup &)
static uint32_t runNumber(DQMStore *const, const std::vector< std::string > &)
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
std::string partitionName_
virtual void printSummary()
std::vector< SummaryPlot > plots_
Log< level::Error, false > LogError
Parses the "summary plot" xml configuration file.
static sistrip::RunType runType(DQMStore *const, const std::vector< std::string > &)
void beginRun(const edm::Run &, const edm::EventSetup &) override
static const char collate_[]
Log< level::Info, true > LogVerbatim
void save(std::string &filename, uint32_t run_number=0, std::string partitionName="")
void parseXML(const std::string &xml_file)
virtual void histoAnalysis(bool debug)
DQM_DEPRECATED bool open(std::string const &filename, bool overwrite=false, std::string const &path="", std::string const &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
edm::ParameterSet parameters_
std::vector< SummaryPlot > summaryPlots(const sistrip::RunType &)
~SiStripCommissioningOfflineClient() override
virtual void uploadToConfigDb()
static const char runNumber_[]
static void copyCustomInformation(DQMStore *const, const std::vector< std::string > &)
virtual void printAnalyses()