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 std::vector<std::string>&
contents ) {
260 const std::vector<std::string>&
contents ) {
263 if ( contents.empty() ) {
265 <<
"[CommissioningHistograms::" << __func__ <<
"]" 266 <<
" Found no histograms!";
271 std::vector<std::string>::const_iterator istr = contents.begin();
272 while ( istr != contents.end() ) {
275 std::string source_dir = istr->substr( 0, istr->find(
":") );
281 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
284 std::vector<MonitorElement*> me_list = bei->getContents( source_dir );
285 std::vector<MonitorElement*>::iterator ime = me_list.begin();
286 for ( ; ime != me_list.end(); ime++ ) {
290 <<
"[CommissioningHistograms::" << __func__ <<
"]" 291 <<
" NULL pointer to MonitorElement!";
298 if( pos == std::string::npos ) pos = title.find(
"isha");
299 if( pos == std::string::npos ) pos = title.find(
"vfs");
300 if( pos != std::string::npos ) {
301 int value = (*ime)->getIntValue();
304 <<
"[CommissioningHistograms::" << __func__ <<
"]" 305 <<
" Found \"" << title.substr(pos,std::string::npos)
306 <<
"\" with value \"" << value <<
"\"";
307 if ( !(bei->get(client_dir+
"/"+title.substr(pos,std::string::npos))) ) {
308 bei->setCurrentFolder(client_dir);
309 bei->bookInt( title.substr(pos,std::string::npos))->
Fill(value);
311 <<
"[CommissioningHistograms::" << __func__ <<
"]" 312 <<
" Booked \"" << title.substr(pos,std::string::npos)
313 <<
"\" in directory \"" << client_dir <<
"\"";
328 <<
"[CommissioningHistograms::" << __func__ <<
"]" 329 <<
" Extracting available histograms...";
334 <<
"[CommissioningHistograms::" << __func__ <<
"]" 335 <<
" NULL pointer to DQMStore!";
340 if ( contents.empty() ) {
342 <<
"[CommissioningHistograms::" << __func__ <<
"]" 343 <<
" Empty contents vector!";
348 std::vector<std::string>::const_iterator idir;
349 for ( idir = contents.begin(); idir != contents.end(); idir++ ) {
355 std::string source_dir = idir->substr( 0, idir->find(
":") );
378 if ( slash ==
sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); }
382 std::vector<MonitorElement*> me_list =
bei_->getContents( source_dir );
385 std::vector<MonitorElement*>::iterator ime = me_list.begin();
386 for ( ; ime != me_list.end(); ime++ ) {
400 std::stringstream ss;
401 ss <<
"[CommissioningHistograms::" << __func__ <<
"]" 402 <<
" Unexpected granularity for histogram title: " 403 << std::endl <<
title 405 << std::endl <<
path;
408 channel =
title.channel();
448 HistosMap::iterator ihistos =
histos_.find( key );
449 if ( ihistos !=
histos_.end() ) {
450 Histos::iterator ihis = ihistos->second.begin();
451 while ( !histo && ihis < ihistos->
second.end() ) {
452 if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; }
462 histo->
title_ = (*ime)->getName();
466 histo->
me_ =
bei_->get( client_dir +
"/"+(*ime)->getName() );
469 <<
"[CommissioningHistograms::" << __func__ <<
"]" 470 <<
" NULL pointer to MonitorElement!";
483 <<
"[CommissioningHistograms::" << __func__ <<
"]" 484 <<
" Found histograms for " <<
histos_.size()
485 <<
" structures in cached histogram map!";
494 <<
"[CommissioningHistograms::" << __func__ <<
"]" 495 <<
" (Derived) implementation to come...";
501 Analyses::iterator ianal =
data().begin();
502 Analyses::iterator janal =
data().end();
503 for ( ; ianal != janal; ++ianal ) {
504 if ( ianal->second ) {
505 std::stringstream ss;
506 ianal->second->print( ss );
517 std::stringstream good;
518 std::stringstream bad;
520 Analyses::iterator ianal =
data().begin();
521 Analyses::iterator janal =
data().end();
522 for ( ; ianal != janal; ++ianal ) {
523 if ( ianal->second ) {
524 if ( ianal->second->isValid() ) { ianal->second->summary( good ); }
525 else { ianal->second->summary( bad ); }
529 if ( good.str().empty() ) { good <<
"None found!"; }
531 <<
"[CommissioningHistograms::" << __func__ <<
"]" 532 <<
" Printing summary of good analyses:" <<
"\n" 535 if ( bad.str().empty() ) {
return; }
537 <<
"[CommissioningHistograms::" << __func__ <<
"]" 538 <<
" Printing summary of bad analyses:" <<
"\n" 547 <<
"[CommissioningHistograms::" << __func__ <<
"]" 548 <<
" Printing histogram map, which has " 549 <<
histos_.size() <<
" entries...";
550 HistosMap::const_iterator ihistos =
histos_.begin();
551 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
552 std::stringstream ss;
553 ss <<
" Found " << ihistos->second.size()
554 <<
" histogram(s) for key: " << std::endl
556 Histos::const_iterator ihisto = ihistos->second.begin();
557 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
558 if ( *ihisto ) { (*ihisto)->
print(ss); }
559 else { ss <<
" NULL pointer to Histo object!"; }
569 <<
"[CommissioningHistograms::" << __func__ <<
"]" 570 <<
" Clearing histogram map...";
571 HistosMap::iterator ihistos =
histos_.begin();
572 for ( ; ihistos !=
histos_.end(); ihistos++ ) {
573 Histos::iterator ihisto = ihistos->second.begin();
574 for ( ; ihisto != ihistos->second.end(); ihisto++ ) {
575 if ( *ihisto ) {
delete *ihisto; }
577 ihistos->second.clear();
589 <<
"[CommissioningHistograms::" << __func__ <<
"]";
601 <<
"[CommissioningHistograms::" << __func__ <<
"]" 602 <<
" No analyses generated!";
610 if ( !xbins ) {
return; }
628 <<
"[CommissioningHistograms::" << __func__ <<
"]" 629 <<
" NULL pointer to DQMStore!";
636 <<
"[CommissioningHistograms::" << __func__ <<
"]" 637 <<
" Removing histograms...";
639 if ( !pattern.empty() ) {
641 if (
bei_->dirExists(pattern) ) {
642 bei_->rmdir(pattern);
646 <<
"[CommissioningHistograms::" << __func__ <<
"]" 647 <<
" Removing directories (and MonitorElements" 648 <<
" therein) that match the pattern \"" 654 bei_->removeContents();
656 if(
bei_->dirExists(
"Collector") ) {
657 bei_->rmdir(
"Collector");
659 if(
bei_->dirExists(
"EvF") ) {
662 if(
bei_->dirExists(
"SiStrip") ) {
663 bei_->rmdir(
"SiStrip");
667 <<
"[CommissioningHistograms::" << __func__ <<
"]" 668 <<
" Removing \"DQM source\" directories (and MonitorElements therein)";
673 <<
"[CommissioningHistograms::" << __func__ <<
"]" 674 <<
" Removed histograms!";
687 std::stringstream ss;
689 if ( !path.empty() ) {
692 if ( ss.str().find(
".root") == std::string::npos ) { ss <<
".root"; }
699 if ( getenv(scratch.c_str()) !=
nullptr ) {
700 dir = getenv(scratch.c_str());
704 if ( !dir.empty() ) { ss << dir <<
"/"; }
705 else { ss <<
"/tmp/"; }
708 if(partitionName.empty())
710 << std::setfill(
'0') << std::setw(8) << run_number
714 << std::setfill(
'0') << std::setw(8) << run_number
721 <<
"[CommissioningHistograms::" << __func__ <<
"]" 722 <<
" Saving histograms to root file" 723 <<
" (This may take some time!)";
727 <<
"[CommissioningHistograms::" << __func__ <<
"]" 728 <<
" Saved histograms to root file \"" 729 << ss.str() <<
"\"!";
739 const uint32_t&
xbins,
741 const float& xhigh ) {
753 bei_->removeElement( name );
758 float high =
static_cast<float>(
xbins );
762 me =
bei_->book1D( name, name, xbins, xlow, xhigh );
764 me =
bei_->book1D( name, name, xbins, 0., high );
767 me =
bei_->book1D( name, name,
770 me =
bei_->book2D( name, name, xbins, 0., high,
775 me =
bei_->bookProfile( name, name, xbins, 0., high,
782 <<
"[CommissioningHistograms::" << __func__ <<
"]" 783 <<
" Unexpected presentation \"" 785 <<
"\" Unable to create summary plot!";
791 <<
"[CommissioningHistograms::" << __func__ <<
"]" 792 <<
" Created summary plot with name \"" << me->
getName()
793 <<
"\" in directory \"" 794 <<
bei_->pwd() <<
"\"!";
797 <<
"[CommissioningHistograms::" << __func__ <<
"]" 798 <<
" NULL pointer to MonitorElement!" 799 <<
" Unable to create summary plot!";
806 <<
"[CommissioningHistograms::" << __func__ <<
"]" 807 <<
" Unable to extract root object!" 808 <<
" Returning NULL pointer!";
812 bei_->setCurrentFolder( pwd );
819 if (!getMaskedData)
return data_;
823 Analyses::iterator ianal =
data_.begin();
824 Analyses::iterator janal =
data_.end();
825 for ( ; ianal != janal; ++ianal ) {
829 bool maskThisAnal_ =
false;
842 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_[]
static void getContents(DQMStore *const, std::vector< std::string > &)
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 &)
const uint16_t & ccuAddr() const
static const uint16_t invalid_
std::map< uint32_t, CommissioningAnalysis * > Analyses
std::auto_ptr< Factory > factory_
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)