12 using namespace sistrip;
28 <<
"[" << __PRETTY_FUNCTION__ <<
"]"
29 <<
" Constructing object...";
34 <<
"[CommissioningHistograms::" << __func__ <<
"]"
35 <<
" NULL pointer to DQMStore!";
51 <<
"[" << __PRETTY_FUNCTION__ <<
"]"
52 <<
" Constructing object...";
59 <<
"[" << __PRETTY_FUNCTION__ <<
"]"
60 <<
" Destructing object...";
68 ss <<
" [Histo::" << __func__ <<
"]" << std::endl
69 <<
" Histogram title : " <<
title_ << std::endl
70 <<
" MonitorElement* : 0x"
72 << std::setw(8) << std::setfill(
'0') <<
me_ << std::endl
76 << std::setw(8) << std::setfill(
'0') <<
cme_ << std::endl
83 const std::vector<std::string>&
contents ) {
86 if ( contents.empty() ) {
88 <<
"[CommissioningHistograms::" << __func__ <<
"]"
89 <<
" Found no histograms!";
94 std::vector<std::string>::const_iterator istr = contents.begin();
95 while ( istr != contents.end() ) {
98 std::string source_dir = istr->substr( 0, istr->find(
":") );
104 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
108 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
109 std::vector<MonitorElement*>::iterator ime = me_list.begin();
110 for ( ; ime != me_list.end(); ime++ ) {
114 <<
"[CommissioningHistograms::" << __func__ <<
"]"
115 <<
" NULL pointer to MonitorElement!";
124 if ( pos != std::string::npos ) {
126 if ( !value.empty() ) {
128 <<
"[CommissioningHistograms::" << __func__ <<
"]"
129 <<
" Found string \"" << title.substr(pos,std::string::npos)
130 <<
"\" with value \"" << value <<
"\"";
131 if ( !(bei->get(client_dir+
"/"+title.substr(pos,std::string::npos))) ) {
132 bei->setCurrentFolder(client_dir);
133 bei->bookString( title.substr(pos,std::string::npos),
value );
135 <<
"[CommissioningHistograms::" << __func__ <<
"]"
136 <<
" Booked string \"" << title.substr(pos,std::string::npos)
137 <<
"\" in directory \"" << client_dir <<
"\"";
140 std::stringstream
ss;
158 const std::vector<std::string>&
contents ) {
161 if ( contents.empty() ) {
163 <<
"[CommissioningHistograms::" << __func__ <<
"]"
164 <<
" Found no histograms!";
169 std::vector<std::string>::const_iterator istr = contents.begin();
170 while ( istr != contents.end() ) {
173 std::string source_dir = istr->substr( 0, istr->find(
":") );
179 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
183 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
185 if ( me_list.empty() ) {
187 <<
"[CommissioningHistograms::" << __func__ <<
"]"
188 <<
" No MonitorElements found in dir " << source_dir;
192 std::vector<MonitorElement*>::iterator ime = me_list.begin();
193 for ( ; ime != me_list.end(); ime++ ) {
197 <<
"[CommissioningHistograms::" << __func__ <<
"]"
198 <<
" NULL pointer to MonitorElement!";
207 if ( pos != std::string::npos ) {
209 if ( !value.empty() ) {
211 <<
"[CommissioningHistograms::" << __func__ <<
"]"
212 <<
" Found string \"" << title.substr(pos,std::string::npos)
213 <<
"\" with value \"" << value <<
"\"";
214 if ( !(bei->get(client_dir+
sistrip::dir_+title.substr(pos,std::string::npos))) ) {
215 bei->setCurrentFolder(client_dir);
216 bei->bookString( title.substr(pos,std::string::npos),
value );
218 <<
"[CommissioningHistograms::" << __func__ <<
"]"
219 <<
" Booked string \"" << title.substr(pos,std::string::npos)
220 <<
"\" in directory \"" << client_dir <<
"\"";
233 <<
"[CommissioningHistograms::" << __func__ <<
"]"
234 <<
" Unable to extract RunType!";
242 std::vector<std::string>&
contents ) {
248 const std::vector<std::string>&
contents ) {
251 if ( contents.empty() ) {
253 <<
"[CommissioningHistograms::" << __func__ <<
"]"
254 <<
" Found no histograms!";
259 std::vector<std::string>::const_iterator istr = contents.begin();
260 while ( istr != contents.end() ) {
263 std::string source_dir = istr->substr( 0, istr->find(
":") );
269 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
272 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
273 std::vector<MonitorElement*>::iterator ime = me_list.begin();
274 for ( ; ime != me_list.end(); ime++ ) {
278 <<
"[CommissioningHistograms::" << __func__ <<
"]"
279 <<
" NULL pointer to MonitorElement!";
286 if( pos == std::string::npos ) pos = title.find(
"isha");
287 if( pos == std::string::npos ) pos = title.find(
"vfs");
288 if( pos != std::string::npos ) {
289 int value = (*ime)->getIntValue();
292 <<
"[CommissioningHistograms::" << __func__ <<
"]"
293 <<
" Found \"" << title.substr(pos,std::string::npos)
294 <<
"\" with value \"" << value <<
"\"";
295 if ( !(bei->get(client_dir+
"/"+title.substr(pos,std::string::npos))) ) {
296 bei->setCurrentFolder(client_dir);
297 bei->bookInt( title.substr(pos,std::string::npos))->
Fill(value);
299 <<
"[CommissioningHistograms::" << __func__ <<
"]"
300 <<
" Booked \"" << title.substr(pos,std::string::npos)
301 <<
"\" in directory \"" << client_dir <<
"\"";
316 <<
"[CommissioningHistograms::" << __func__ <<
"]"
317 <<
" Extracting available histograms...";
322 <<
"[CommissioningHistograms::" << __func__ <<
"]"
323 <<
" NULL pointer to DQMStore!";
328 if ( contents.empty() ) {
330 <<
"[CommissioningHistograms::" << __func__ <<
"]"
331 <<
" Empty contents vector!";
336 std::vector<std::string>::const_iterator idir;
337 for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
343 std::string source_dir = idir->substr( 0, idir->find(
":") );
366 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
370 std::vector<MonitorElement*> me_list =
bei_->getContents( source_dir );
373 std::vector<MonitorElement*>::iterator ime = me_list.begin();
374 for ( ; ime != me_list.end(); ime++ ) {
388 std::stringstream
ss;
389 ss <<
"[CommissioningHistograms::" << __func__ <<
"]"
390 <<
" Unexpected granularity for histogram title: "
391 << std::endl <<
title
393 << std::endl <<
path;
396 channel =
title.channel();
436 HistosMap::iterator ihistos =
histos_.find( key );
437 if ( ihistos !=
histos_.end() ) {
438 Histos::iterator ihis = ihistos->second.begin();
439 while ( !histo && ihis < ihistos->
second.end() ) {
440 if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
450 histo->
title_ = (*ime)->getName();
454 histo->
me_ =
bei_->get( client_dir +
"/"+(*ime)->getName() );
457 <<
"[CommissioningHistograms::" << __func__ <<
"]"
458 <<
" NULL pointer to MonitorElement!";
471 <<
"[CommissioningHistograms::" << __func__ <<
"]"
472 <<
" Found histograms for " <<
histos_.size()
473 <<
" structures in cached histogram map!";
482 <<
"[CommissioningHistograms::" << __func__ <<
"]"
483 <<
" (Derived) implementation to come...";
489 Analyses::iterator ianal =
data().begin();
490 Analyses::iterator janal =
data().end();
491 for ( ; ianal != janal; ++ianal ) {
492 if ( ianal->second ) {
493 std::stringstream
ss;
494 ianal->second->print( ss );
505 std::stringstream good;
506 std::stringstream
bad;
508 Analyses::iterator ianal =
data().begin();
509 Analyses::iterator janal =
data().end();
510 for ( ; ianal != janal; ++ianal ) {
511 if ( ianal->second ) {
512 if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
513 else { ianal->second->summary( bad ); }
517 if ( good.str().empty() ) { good <<
"None found!"; }
519 <<
"[CommissioningHistograms::" << __func__ <<
"]"
520 <<
" Printing summary of good analyses:" <<
"\n"
523 if ( bad.str().empty() ) {
return; }
525 <<
"[CommissioningHistograms::" << __func__ <<
"]"
526 <<
" Printing summary of bad analyses:" <<
"\n"
535 <<
"[CommissioningHistograms::" << __func__ <<
"]"
536 <<
" Printing histogram map, which has "
537 <<
histos_.size() <<
" entries...";
538 HistosMap::const_iterator ihistos =
histos_.begin();
539 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
540 std::stringstream
ss;
541 ss <<
" Found " << ihistos->second.size()
542 <<
" histogram(s) for key: " << std::endl
544 Histos::const_iterator ihisto = ihistos->second.begin();
545 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
546 if ( *ihisto ) { (*ihisto)->
print(ss); }
547 else { ss <<
" NULL pointer to Histo object!"; }
557 <<
"[CommissioningHistograms::" << __func__ <<
"]"
558 <<
" Clearing histogram map...";
559 HistosMap::iterator ihistos =
histos_.begin();
560 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
561 Histos::iterator ihisto = ihistos->second.begin();
562 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
563 if ( *ihisto ) {
delete *ihisto; }
565 ihistos->second.clear();
577 <<
"[CommissioningHistograms::" << __func__ <<
"]";
589 <<
"[CommissioningHistograms::" << __func__ <<
"]"
590 <<
" No analyses generated!";
598 if ( !xbins ) {
return; }
616 <<
"[CommissioningHistograms::" << __func__ <<
"]"
617 <<
" NULL pointer to DQMStore!";
624 <<
"[CommissioningHistograms::" << __func__ <<
"]"
625 <<
" Removing histograms...";
627 if ( !pattern.empty() ) {
629 if (
bei_->dirExists(pattern) ) {
630 bei_->rmdir(pattern);
634 <<
"[CommissioningHistograms::" << __func__ <<
"]"
635 <<
" Removing directories (and MonitorElements"
636 <<
" therein) that match the pattern \""
642 bei_->removeContents();
644 if(
bei_->dirExists(
"Collector") ) {
645 bei_->rmdir(
"Collector");
647 if(
bei_->dirExists(
"EvF") ) {
650 if(
bei_->dirExists(
"SiStrip") ) {
651 bei_->rmdir(
"SiStrip");
655 <<
"[CommissioningHistograms::" << __func__ <<
"]"
656 <<
" Removing \"DQM source\" directories (and MonitorElements therein)";
661 <<
"[CommissioningHistograms::" << __func__ <<
"]"
662 <<
" Removed histograms!";
674 std::stringstream
ss;
676 if ( !path.empty() ) {
679 if ( ss.str().find(
".root") == std::string::npos ) { ss <<
".root"; }
686 if ( getenv(scratch.c_str()) !=
NULL ) {
687 dir = getenv(scratch.c_str());
691 if ( !dir.empty() ) { ss << dir <<
"/"; }
692 else { ss <<
"/tmp/"; }
696 << std::setfill(
'0') << std::setw(8) << run_number
703 <<
"[CommissioningHistograms::" << __func__ <<
"]"
704 <<
" Saving histograms to root file"
705 <<
" (This may take some time!)";
709 <<
"[CommissioningHistograms::" << __func__ <<
"]"
710 <<
" Saved histograms to root file \""
711 << ss.str() <<
"\"!";
721 const uint32_t&
xbins,
723 const float& xhigh ) {
735 bei_->removeElement( name );
740 float high =
static_cast<float>(
xbins );
744 me =
bei_->book1D( name, name, xbins, xlow, xhigh );
746 me =
bei_->book1D( name, name, xbins, 0., high );
749 me =
bei_->book1D( name, name,
752 me =
bei_->book2D( name, name, xbins, 0., high,
757 me =
bei_->bookProfile( name, name, xbins, 0., high,
764 <<
"[CommissioningHistograms::" << __func__ <<
"]"
765 <<
" Unexpected presentation \""
767 <<
"\" Unable to create summary plot!";
773 <<
"[CommissioningHistograms::" << __func__ <<
"]"
774 <<
" Created summary plot with name \"" << me->
getName()
775 <<
"\" in directory \""
776 <<
bei_->pwd() <<
"\"!";
779 <<
"[CommissioningHistograms::" << __func__ <<
"]"
780 <<
" NULL pointer to MonitorElement!"
781 <<
" Unable to create summary plot!";
788 <<
"[CommissioningHistograms::" << __func__ <<
"]"
789 <<
" Unable to extract root object!"
790 <<
" Returning NULL pointer!";
794 bei_->setCurrentFolder( pwd );
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
static const char runNumber_[]
const std::string & getName(void) const
get name of ME
TH1 * histogram(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
virtual void print(std::stringstream &ss) const
void print(std::stringstream &) const
Utility class that holds histogram title.
A container class for generic run and event-related info, information required by the commissioning a...
CommissioningHistograms()
static const uint32_t invalid32_
static const char dqmClientFileName_[]
static void getContents(DQMStore *const, std::vector< std::string > &)
static const char mlDqmClient_[]
const uint16_t & lldChan() const
static const uint16_t FED_ADC_RANGE
virtual void printAnalyses()
void save(std::string &filename, uint32_t run_number=0)
static const uint16_t valid_
virtual void printSummary()
const uint32_t & key() const
int bad(Items const &cont)
static const char undefinedView_[]
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
const sistrip::Granularity & granularity() const
U second(std::pair< T, U > const &p)
static std::string view(const sistrip::View &)
static std::string runType(const sistrip::RunType &)
tuple path
else: Piece not in the list, fine.
void extractHistograms(const std::vector< std::string > &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static sistrip::RunType runType(DQMStore *const, const std::vector< std::string > &)
static const char taskId_[]
uint32_t init(const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &top_level_dir, const sistrip::Granularity &, const std::map< uint32_t, CommissioningAnalysis * > &data)
Base utility class that identifies a position within a logical structure of the strip tracker...
const std::string & path() const
static uint32_t runNumber(DQMStore *const, const std::vector< std::string > &)
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
int extract(std::vector< int > *output, const std::string &dati)
virtual ~CommissioningHistograms()
static std::string presentation(const sistrip::Presentation &)
static const uint16_t invalid_
virtual void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
static void copyCustomInformation(DQMStore *const, const std::vector< std::string > &)
DQMStore *const bei() const
static const char collate_[]
void remove(std::string pattern="")
void fill(TH1 &summary_histo)
virtual void histoAnalysis(bool debug)