22 #include <boost/cstdint.hpp>
27 #include <sys/types.h>
32 using namespace sistrip;
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 ),
45 clientHistos_(
false ),
54 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
55 <<
" Constructing object...";
66 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
67 <<
" Destructing object...";
74 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
75 <<
" Analyzing root file(s)...";
80 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
81 <<
" NULL pointer to DQMStore!"
91 root_file.open( ifile->c_str() );
92 if( !root_file.is_open() ) {
94 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
95 <<
" The input root file \"" << *ifile
96 <<
"\" could not be opened!"
97 <<
" Please check the path and filename!";
103 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
104 <<
" The input root files appear to be a mixture"
105 <<
" of \"Source\" and \"Client\" files!"
109 if ( found != std::string::npos &&
inputFiles_.size() != 1 ) {
111 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
112 <<
" There appear to be multiple input \"Client\" root files!"
121 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
122 <<
" Collated histograms found in input root file \""
130 if( !xml_file.is_open() ) {
132 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
133 <<
" The SummaryPlot XML file \"" <<
xmlFile_
134 <<
"\" could not be opened!"
135 <<
" Please check the path and filename!"
147 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
148 <<
" No input root files specified!";
153 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
154 <<
" Opening root files. This may take some time!...";
155 std::vector<std::string>::const_iterator jfile =
inputFiles_.begin();
158 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
159 <<
" Opening root file \"" << *jfile
160 <<
"\"... (This may take some time.)";
167 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
168 <<
" Opened root file \"" << *jfile <<
"\"!";
171 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
172 <<
" Opened " <<
inputFiles_.size() <<
" root files!";
180 std::vector<std::string>
temp;
181 std::vector<std::string>::iterator istr = contents.begin();
182 for ( ; istr != contents.end(); istr++ ) {
184 temp.push_back( *istr );
193 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
194 <<
" Found " << contents.size()
195 <<
" directories containing MonitorElements";
199 std::stringstream ss;
200 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
201 <<
" Directories found: " << std::endl;
202 std::vector<std::string>::iterator istr = contents.begin();
203 for ( ; istr != contents.end(); istr++ ) { ss <<
" " << *istr << std::endl; }
219 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
220 <<
" Unknown commissioning runType: "
226 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
235 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
236 <<
" Parsing summary plot XML file...";
241 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
242 <<
" Parsed summary plot XML file and found "
243 <<
plots_.size() <<
" plots defined!";
246 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
247 <<
" Null string for SummaryPlotXmlFile!"
248 <<
" No summary plots will be created!";
252 std::stringstream ss;
253 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]" << std::endl
254 <<
" Input root files : ";
257 std::vector<std::string>::const_iterator ifile =
inputFiles_.begin();
260 ss << std::setw(25) << std::setfill(
' ') <<
": ";
262 ss <<
"\"" << *ifile <<
"\"" << std::endl;
265 ss <<
" Run type : \""
267 <<
" Run number : " <<
runNumber_ << std::endl
268 <<
" Summary plot XML file : ";
269 if (
xmlFile_.empty() ) { ss <<
"(none)"; }
270 else { ss <<
"\"" <<
xmlFile_ <<
"\""; }
275 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
276 <<
" Creating CommissioningHistogram object...";
280 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
281 <<
" Created CommissioningHistogram object!";
284 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
285 <<
" NULL pointer to CommissioningHistogram object!"
298 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
299 <<
" Analyzing histograms...";
302 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
303 <<
" Analyzed histograms!";
306 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
307 <<
" No histogram analysis performed!";
313 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
314 <<
" Generating summary plots...";
315 std::vector<SummaryPlot>::const_iterator iplot =
plots_.begin();
316 for ( ; iplot !=
plots_.end(); iplot++ ) {
319 iplot->presentation(),
321 iplot->granularity() );
325 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
326 <<
" Generated summary plots!";
329 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
330 <<
" No summary plots generated!";
339 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
340 <<
" Client file not saved!";
357 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
358 <<
" Finished analyzing root file(s)...";
366 if ( !(event.
id().
event()%10) ) {
368 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
369 <<
" Empty event loop! User can kill job...";
384 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
385 <<
" CommissioningHistogram object already exists!"
393 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
394 <<
" NULL pointer to DQMStore!";
416 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
417 <<
" Undefined run type!";
422 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
423 <<
" Unknown run type!";
432 const std::string
path,
434 bool collate_histos ) {
437 std::stringstream ss;
438 ss << std::setfill(
'0') << std::setw(8) << run_number;
441 std::string nameStr =
"";
442 if ( !collate_histos ) { nameStr =
"SiStripCommissioningClient_"; }
443 else { nameStr =
"SiStripCommissioningSource_"; }
445 LogTrace(
"TEST") <<
" runStr " << runStr;
450 if ( (dp = opendir(path.c_str())) ==
NULL ) {
452 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
453 <<
" Error locating directory \"" << path
454 <<
"\". No such directory!";
459 while ( (dirp = readdir(dp)) !=
NULL ) {
461 bool goodName = ( fileName.find(nameStr) != std::string::npos );
462 bool goodRun = ( fileName.find(runStr) != std::string::npos );
463 bool rootFile = ( fileName.find(
".root") != std::string::npos );
465 if ( goodName && goodRun && rootFile ) {
469 files.push_back(entry);
475 if ( !collate_histos && files.size() > 1 ) {
476 std::stringstream ss;
477 ss <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
478 <<
" Found more than one client file!";
479 std::vector<std::string>::const_iterator
ifile = files.begin();
480 std::vector<std::string>::const_iterator jfile = files.end();
481 for ( ; ifile != jfile; ++
ifile ) { ss << std::endl << *
ifile; }
483 }
else if ( files.empty() ) {
485 <<
"[SiStripCommissioningOfflineClient::" << __func__ <<
"]"
486 <<
" No input files found!" ;
static const char runNumber_[]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
sistrip::RunType runType_
static const char dqmClientFileName_[]
void parseXML(const std::string &xml_file)
virtual ~SiStripCommissioningOfflineClient()
static const char mlDqmClient_[]
virtual void printAnalyses()
std::string outputFileName_
void save(std::string &filename, uint32_t run_number=0)
virtual void printSummary()
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
virtual void setInputFiles(std::vector< std::string > &, const std::string, uint32_t, bool)
static std::string runType(const sistrip::RunType &)
edm::ParameterSet parameters_
Parses the "summary plot" xml configuration file.
void extractHistograms(const std::vector< std::string > &)
static sistrip::RunType runType(DQMStore *const, const std::vector< std::string > &)
std::pair< std::string, MonitorElement * > entry
virtual void createHistos(const edm::ParameterSet &, const edm::EventSetup &)
SiStripCommissioningOfflineClient(const edm::ParameterSet &)
static uint32_t runNumber(DQMStore *const, const std::vector< std::string > &)
virtual void uploadToConfigDb()
void setVerbose(unsigned level)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< MonitorElement * > getContents(const std::string &path) const
CommissioningHistograms * histos_
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
std::vector< SummaryPlot > summaryPlots(const sistrip::RunType &)
std::vector< SummaryPlot > plots_
virtual void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
std::vector< std::string > inputFiles_
static void copyCustomInformation(DQMStore *const, const std::vector< std::string > &)
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
static const char collate_[]
void remove(std::string pattern="")
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
virtual void histoAnalysis(bool debug)