26 mask_(pset.existsAs<
bool>(
"vetoModules")?pset.getParameter<
bool>(
"vetoModules"):
true),
27 fedMaskVector_(pset.existsAs<
std::vector<uint32_t> >(
"fedMaskVector")?pset.getParameter<
std::vector<uint32_t> >(
"fedMaskVector"):
std::vector<uint32_t>()),
28 fecMaskVector_(pset.existsAs<
std::vector<uint32_t> >(
"fecMaskVector")?pset.getParameter<
std::vector<uint32_t> >(
"fecMaskVector"):
std::vector<uint32_t>()),
29 ringVector_(pset.existsAs<
std::vector<uint32_t> >(
"ringVector")?pset.getParameter<
std::vector<uint32_t> >(
"ringVector"):
std::vector<uint32_t>()),
30 ccuVector_(pset.existsAs<
std::vector<uint32_t> >(
"ccuVector")?pset.getParameter<
std::vector<uint32_t> >(
"ccuVector"):
std::vector<uint32_t>()),
31 i2cChanVector_(pset.existsAs<
std::vector<uint32_t> >(
"i2cChanVector")?pset.getParameter<
std::vector<uint32_t> >(
"i2cChanVector"):
std::vector<uint32_t>()),
32 lldChanVector_(pset.existsAs<
std::vector<uint32_t> >(
"lldChanVector")?pset.getParameter<
std::vector<uint32_t> >(
"lldChanVector"):
std::vector<uint32_t>()),
34 dataWithMaskCached_(
false)
37 <<
"[" << __PRETTY_FUNCTION__ <<
"]" 38 <<
" Constructing object...";
43 <<
"[CommissioningHistograms::" << __func__ <<
"]" 44 <<
" NULL pointer to DQMStore!";
63 <<
"[" << __PRETTY_FUNCTION__ <<
"]" 64 <<
" Constructing object...";
71 <<
"[" << __PRETTY_FUNCTION__ <<
"]" 72 <<
" Destructing object...";
80 ss <<
" [Histo::" << __func__ <<
"]" << std::endl
81 <<
" Histogram title : " << title_ << std::endl
82 <<
" MonitorElement* : 0x" 84 << std::setw(8) << std::setfill(
'0') << me_ << std::endl
88 << std::setw(8) << std::setfill(
'0') << cme_ << std::endl
95 const std::vector<std::string>&
contents ) {
98 if ( contents.empty() ) {
100 <<
"[CommissioningHistograms::" << __func__ <<
"]" 101 <<
" Found no histograms!";
106 std::vector<std::string>::const_iterator istr = contents.begin();
107 while ( istr != contents.end() ) {
110 std::string source_dir = istr->substr( 0, istr->find(
":") );
116 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
120 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
121 std::vector<MonitorElement*>::iterator ime = me_list.begin();
122 for ( ; ime != me_list.end(); ime++ ) {
126 <<
"[CommissioningHistograms::" << __func__ <<
"]" 127 <<
" NULL pointer to MonitorElement!";
136 if ( pos != std::string::npos ) {
138 if ( !value.empty() ) {
140 <<
"[CommissioningHistograms::" << __func__ <<
"]" 141 <<
" Found string \"" << title.substr(pos,std::string::npos)
142 <<
"\" with value \"" << value <<
"\"";
143 if ( !(bei->get(client_dir+
"/"+title.substr(pos,std::string::npos))) ) {
144 bei->setCurrentFolder(client_dir);
145 bei->bookString( title.substr(pos,std::string::npos),
value );
147 <<
"[CommissioningHistograms::" << __func__ <<
"]" 148 <<
" Booked string \"" << title.substr(pos,std::string::npos)
149 <<
"\" in directory \"" << client_dir <<
"\"";
152 std::stringstream ss;
170 const std::vector<std::string>&
contents ) {
173 if ( contents.empty() ) {
175 <<
"[CommissioningHistograms::" << __func__ <<
"]" 176 <<
" Found no histograms!";
181 std::vector<std::string>::const_iterator istr = contents.begin();
182 while ( istr != contents.end() ) {
185 std::string source_dir = istr->substr( 0, istr->find(
":") );
191 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
195 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
197 if ( me_list.empty() ) {
199 <<
"[CommissioningHistograms::" << __func__ <<
"]" 200 <<
" No MonitorElements found in dir " << source_dir;
204 std::vector<MonitorElement*>::iterator ime = me_list.begin();
205 for ( ; ime != me_list.end(); ime++ ) {
209 <<
"[CommissioningHistograms::" << __func__ <<
"]" 210 <<
" NULL pointer to MonitorElement!";
219 if ( pos != std::string::npos ) {
221 if ( !value.empty() ) {
223 <<
"[CommissioningHistograms::" << __func__ <<
"]" 224 <<
" Found string \"" << title.substr(pos,std::string::npos)
225 <<
"\" with value \"" << value <<
"\"";
226 if ( !(bei->get(client_dir+
sistrip::dir_+title.substr(pos,std::string::npos))) ) {
227 bei->setCurrentFolder(client_dir);
228 bei->bookString( title.substr(pos,std::string::npos),
value );
230 <<
"[CommissioningHistograms::" << __func__ <<
"]" 231 <<
" Booked string \"" << title.substr(pos,std::string::npos)
232 <<
"\" in directory \"" << client_dir <<
"\"";
245 <<
"[CommissioningHistograms::" << __func__ <<
"]" 246 <<
" Unable to extract RunType!";
254 const std::vector<std::string>&
contents ) {
257 if ( contents.empty() ) {
259 <<
"[CommissioningHistograms::" << __func__ <<
"]" 260 <<
" Found no histograms!";
265 std::vector<std::string>::const_iterator istr = contents.begin();
266 while ( istr != contents.end() ) {
269 std::string source_dir = istr->substr( 0, istr->find(
":") );
275 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
278 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
279 std::vector<MonitorElement*>::iterator ime = me_list.begin();
280 for ( ; ime != me_list.end(); ime++ ) {
284 <<
"[CommissioningHistograms::" << __func__ <<
"]" 285 <<
" NULL pointer to MonitorElement!";
292 if( pos == std::string::npos ) pos = title.find(
"isha");
293 if( pos == std::string::npos ) pos = title.find(
"vfs");
294 if( pos != std::string::npos ) {
295 int value = (*ime)->getIntValue();
298 <<
"[CommissioningHistograms::" << __func__ <<
"]" 299 <<
" Found \"" << title.substr(pos,std::string::npos)
300 <<
"\" with value \"" << value <<
"\"";
301 if ( !(bei->get(client_dir+
"/"+title.substr(pos,std::string::npos))) ) {
302 bei->setCurrentFolder(client_dir);
303 bei->bookInt( title.substr(pos,std::string::npos))->
Fill(value);
305 <<
"[CommissioningHistograms::" << __func__ <<
"]" 306 <<
" Booked \"" << title.substr(pos,std::string::npos)
307 <<
"\" in directory \"" << client_dir <<
"\"";
322 <<
"[CommissioningHistograms::" << __func__ <<
"]" 323 <<
" Extracting available histograms...";
328 <<
"[CommissioningHistograms::" << __func__ <<
"]" 329 <<
" NULL pointer to DQMStore!";
334 if ( contents.empty() ) {
336 <<
"[CommissioningHistograms::" << __func__ <<
"]" 337 <<
" Empty contents vector!";
342 std::vector<std::string>::const_iterator idir;
343 for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
349 std::string source_dir = idir->substr( 0, idir->find(
":") );
372 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
376 std::vector<MonitorElement*> me_list =
bei_->getContents( source_dir );
379 std::vector<MonitorElement*>::iterator ime = me_list.begin();
380 for ( ; ime != me_list.end(); ime++ ) {
394 std::stringstream ss;
395 ss <<
"[CommissioningHistograms::" << __func__ <<
"]" 396 <<
" Unexpected granularity for histogram title: " 397 << std::endl <<
title 399 << std::endl <<
path;
402 channel =
title.channel();
442 HistosMap::iterator ihistos =
histos_.find( key );
443 if ( ihistos !=
histos_.end() ) {
444 Histos::iterator ihis = ihistos->second.begin();
445 while ( !histo && ihis < ihistos->
second.end() ) {
446 if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
456 histo->
title_ = (*ime)->getName();
460 histo->
me_ =
bei_->get( client_dir +
"/"+(*ime)->getName() );
463 <<
"[CommissioningHistograms::" << __func__ <<
"]" 464 <<
" NULL pointer to MonitorElement!";
477 <<
"[CommissioningHistograms::" << __func__ <<
"]" 478 <<
" Found histograms for " <<
histos_.size()
479 <<
" structures in cached histogram map!";
488 <<
"[CommissioningHistograms::" << __func__ <<
"]" 489 <<
" (Derived) implementation to come...";
495 Analyses::iterator ianal =
data().begin();
496 Analyses::iterator janal =
data().end();
497 for ( ; ianal != janal; ++ianal ) {
498 if ( ianal->second ) {
499 std::stringstream ss;
500 ianal->second->print( ss );
511 std::stringstream good;
512 std::stringstream bad;
514 Analyses::iterator ianal =
data().begin();
515 Analyses::iterator janal =
data().end();
516 for ( ; ianal != janal; ++ianal ) {
517 if ( ianal->second ) {
518 if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
519 else { ianal->second->summary( bad ); }
523 if ( good.str().empty() ) { good <<
"None found!"; }
525 <<
"[CommissioningHistograms::" << __func__ <<
"]" 526 <<
" Printing summary of good analyses:" <<
"\n" 529 if ( bad.str().empty() ) {
return; }
531 <<
"[CommissioningHistograms::" << __func__ <<
"]" 532 <<
" Printing summary of bad analyses:" <<
"\n" 541 <<
"[CommissioningHistograms::" << __func__ <<
"]" 542 <<
" Printing histogram map, which has " 543 <<
histos_.size() <<
" entries...";
544 HistosMap::const_iterator ihistos =
histos_.begin();
545 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
546 std::stringstream ss;
547 ss <<
" Found " << ihistos->second.size()
548 <<
" histogram(s) for key: " << std::endl
550 Histos::const_iterator ihisto = ihistos->second.begin();
551 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
552 if ( *ihisto ) { (*ihisto)->
print(ss); }
553 else { ss <<
" NULL pointer to Histo object!"; }
563 <<
"[CommissioningHistograms::" << __func__ <<
"]" 564 <<
" Clearing histogram map...";
565 HistosMap::iterator ihistos =
histos_.begin();
566 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
567 Histos::iterator ihisto = ihistos->second.begin();
568 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
569 if ( *ihisto ) {
delete *ihisto; }
571 ihistos->second.clear();
583 <<
"[CommissioningHistograms::" << __func__ <<
"]";
595 <<
"[CommissioningHistograms::" << __func__ <<
"]" 596 <<
" No analyses generated!";
604 if ( !xbins ) {
return; }
622 <<
"[CommissioningHistograms::" << __func__ <<
"]" 623 <<
" NULL pointer to DQMStore!";
630 <<
"[CommissioningHistograms::" << __func__ <<
"]" 631 <<
" Removing histograms...";
633 if ( !pattern.empty() ) {
635 if (
bei_->dirExists(pattern) ) {
636 bei_->rmdir(pattern);
640 <<
"[CommissioningHistograms::" << __func__ <<
"]" 641 <<
" Removing directories (and MonitorElements" 642 <<
" therein) that match the pattern \"" 648 bei_->removeContents();
650 if(
bei_->dirExists(
"Collector") ) {
651 bei_->rmdir(
"Collector");
653 if(
bei_->dirExists(
"EvF") ) {
656 if(
bei_->dirExists(
"SiStrip") ) {
657 bei_->rmdir(
"SiStrip");
661 <<
"[CommissioningHistograms::" << __func__ <<
"]" 662 <<
" Removing \"DQM source\" directories (and MonitorElements therein)";
667 <<
"[CommissioningHistograms::" << __func__ <<
"]" 668 <<
" Removed histograms!";
681 std::stringstream ss;
683 if ( !path.empty() ) {
686 if ( ss.str().find(
".root") == std::string::npos ) { ss <<
".root"; }
693 if ( getenv(scratch.c_str()) !=
nullptr ) {
694 dir = getenv(scratch.c_str());
698 if ( !dir.empty() ) { ss << dir <<
"/"; }
699 else { ss <<
"/tmp/"; }
702 if(partitionName.empty())
704 << std::setfill(
'0') << std::setw(8) << run_number
708 << std::setfill(
'0') << std::setw(8) << run_number
715 <<
"[CommissioningHistograms::" << __func__ <<
"]" 716 <<
" Saving histograms to root file" 717 <<
" (This may take some time!)";
721 <<
"[CommissioningHistograms::" << __func__ <<
"]" 722 <<
" Saved histograms to root file \"" 723 << ss.str() <<
"\"!";
733 const uint32_t&
xbins,
735 const float& xhigh ) {
747 bei_->removeElement( name );
752 float high =
static_cast<float>(
xbins );
756 me =
bei_->book1D( name, name, xbins, xlow, xhigh );
758 me =
bei_->book1D( name, name, xbins, 0., high );
761 me =
bei_->book1D( name, name,
764 me =
bei_->book2D( name, name, xbins, 0., high,
769 me =
bei_->bookProfile( name, name, xbins, 0., high,
776 <<
"[CommissioningHistograms::" << __func__ <<
"]" 777 <<
" Unexpected presentation \"" 779 <<
"\" Unable to create summary plot!";
785 <<
"[CommissioningHistograms::" << __func__ <<
"]" 786 <<
" Created summary plot with name \"" << me->
getName()
787 <<
"\" in directory \"" 788 <<
bei_->pwd() <<
"\"!";
791 <<
"[CommissioningHistograms::" << __func__ <<
"]" 792 <<
" NULL pointer to MonitorElement!" 793 <<
" Unable to create summary plot!";
800 <<
"[CommissioningHistograms::" << __func__ <<
"]" 801 <<
" Unable to extract root object!" 802 <<
" Returning NULL pointer!";
806 bei_->setCurrentFolder( pwd );
813 if (!getMaskedData)
return data_;
817 Analyses::iterator ianal =
data_.begin();
818 Analyses::iterator janal =
data_.end();
819 for ( ; ianal != janal; ++ianal ) {
823 bool maskThisAnal_ =
false;
836 maskThisAnal_ =
true;
static std::string name(const sistrip::RunType &, const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory)
static const char runNumber_[]
void save(std::string &filename, uint32_t run_number=0, std::string partitionName="")
std::vector< uint32_t > lldChanVector_
const uint32_t & fedKey() const
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_)
Analyses & data(bool getMaskedData=false)
const uint16_t & fecRing() 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_
std::vector< uint32_t > fecMaskVector_
static const char dqmClientFileName_[]
std::vector< uint32_t > ccuVector_
const std::string & getName() const
get name of ME
static const char mlDqmClient_[]
const uint16_t & lldChan() const
static const uint16_t FED_ADC_RANGE
virtual void printAnalyses()
const uint16_t & fecSlot() const
static const uint16_t valid_
void print(std::stringstream &ss) const override
virtual void printSummary()
const uint32_t & key() const
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 &)
std::vector< uint32_t > i2cChanVector_
std::vector< uint32_t > fedMaskVector_
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 uint32_t & fecKey() const
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 &)
std::unique_ptr< Factory > factory_
const uint16_t & ccuAddr() const
static const uint16_t invalid_
std::map< uint32_t, CommissioningAnalysis * > Analyses
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 > &)
const uint16_t & ccuChan() const
DQMStore *const bei() const
const uint16_t & fedId() const
Abstract base for derived classes that provide analysis of commissioning histograms.
static const char collate_[]
void remove(std::string pattern="")
std::vector< uint32_t > ringVector_
void fill(TH1 &summary_histo)
virtual void histoAnalysis(bool debug)