31 #ifdef WITH_ECAL_COND_DB
67 std::cout <<
" *** Ecal Endcap Generic Monitor Client ***" << std::endl;
93 std::cout <<
" Ecal Cond DB: " << std::endl;
95 std::cout <<
" dbUserName = '" << dbUserName_ <<
"'" << std::endl;
96 if ( dbHostName_.size() != 0 ) {
97 std::cout <<
" dbHostName = '" << dbHostName_ <<
"'" << std::endl;
98 std::cout <<
" dbHostPort = '" << dbHostPort_ <<
"'" << std::endl;
100 std::cout <<
" dbTagName = '" << dbTagName_ <<
"'" << std::endl;
101 #ifndef WITH_ECAL_COND_DB
103 std::cout <<
"WARNING: DB access is NOT available" << std::endl;
107 std::cout <<
" Ecal Cond DB is OFF" << std::endl;
117 std::cout <<
" mergeRuns switch is ON" << std::endl;
119 std::cout <<
" mergeRuns switch is OFF" << std::endl;
163 std::cout <<
" cloneME switch is ON" << std::endl;
165 std::cout <<
" cloneME switch is OFF" << std::endl;
175 std::cout <<
" debug switch is ON" << std::endl;
177 std::cout <<
" debug switch is OFF" << std::endl;
200 std::cout <<
" producing reportSummaries" << std::endl;
209 std::cout <<
" enableCleanup switch is ON" << std::endl;
211 std::cout <<
" enableCleanup switch is OFF" << std::endl;
223 std::cout <<
" Selected SMs:" << std::endl;
240 std::cout <<
" Enabled Clients:" << std::endl;
582 clientsStatus_.insert(std::pair<std::string,int>(
"Integrity", 0 ));
585 clientsStatus_.insert(std::pair<std::string,int>(
"Pedestal", 3 ));
586 clientsStatus_.insert(std::pair<std::string,int>(
"PedestalOnline", 4 ));
587 clientsStatus_.insert(std::pair<std::string,int>(
"TestPulse", 5 ));
588 clientsStatus_.insert(std::pair<std::string,int>(
"TriggerTower", 8 ));
589 clientsStatus_.insert(std::pair<std::string,int>(
"Cluster", 9 ));
590 clientsStatus_.insert(std::pair<std::string,int>(
"Timing", 10 ));
592 clientsStatus_.insert(std::pair<std::string,int>(
"StatusFlags", 12 ));
593 clientsStatus_.insert(std::pair<std::string,int>(
"Occupancy", 13 ));
643 if (
debug_ )
std::cout <<
"EcalEndcapMonitorClient: beginJob" << std::endl;
676 if (
debug_ )
std::cout <<
"EcalEndcapMonitorClient: beginRun" << std::endl;
713 std::cout <<
"Standard beginRun() for run " << r.
id().
run() << std::endl;
734 for (
int i = 0;
i < 18;
i++) {
750 me =
dqmStore_->
book2D(
"reportSummaryMap",
"EcalEndcap Report Summary Map", 40, 0., 200., 20, 0., 100);
751 for (
int jx = 1; jx <= 40; jx++ ) {
752 for (
int jy = 1; jy <= 20; jy++ ) {
773 std::cout <<
"Checking last event at endJob() ... " << std::endl;
785 std::cout <<
"Forcing endRun() ... " << std::endl;
873 std::cout <<
"Standard endRun() for run " << r.
id().
run() << std::endl;
906 if ( me ) me->
Fill(-1.0);
908 for (
int i = 0;
i < 18;
i++) {
910 if ( me ) me->
Fill(-1.0);
914 for (
int jx = 1; jx <= 40; jx++ ) {
915 for (
int jy = 1; jy <= 20; jy++ ) {
949 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
955 std::cout <<
"EE" << name <<
"Client is missing plots; issuing beginRun" << std::endl;
1009 #ifdef WITH_ECAL_COND_DB
1016 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1019 }
catch (std::runtime_error &
e) {
1023 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1026 }
catch (std::runtime_error &e) {
1052 bool foundRunIOV =
false;
1061 }
catch (std::runtime_error &
e) {
1063 foundRunIOV =
false;
1069 if ( ! foundRunIOV ) {
1075 runiov_.setRunNumber(
run_);
1076 runiov_.setRunStart(startRun);
1077 runiov_.setRunTag(runtag);
1086 }
catch (std::runtime_error &
e) {
1094 }
catch (std::runtime_error &e) {
1096 foundRunIOV =
false;
1107 std::cout <<
"=============RunIOV:" << std::endl;
1108 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1109 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1110 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1111 std::cout <<
"====================" << std::endl;
1113 std::cout <<
"=============RunTag:" << std::endl;
1114 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1115 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1116 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1117 std::cout <<
"====================" << std::endl;
1121 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1122 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1125 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1126 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1148 }
catch (std::runtime_error &
e) {
1162 #ifdef WITH_ECAL_COND_DB
1169 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1172 }
catch (std::runtime_error &
e) {
1176 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1179 }
catch (std::runtime_error &e) {
1201 bool foundMonIOV =
false;
1206 RunTag runtag = runiov_.getRunTag();
1210 }
catch (std::runtime_error &
e) {
1212 foundMonIOV =
false;
1218 if ( !foundMonIOV ) {
1220 moniov_.setRunIOV(runiov_);
1221 moniov_.setSubRunNumber(
subrun_);
1224 moniov_.setSubRunStart(startSubRun);
1226 moniov_.setSubRunStart(runiov_.getRunStart());
1229 moniov_.setMonRunTag(montag);
1235 RunTag runtag = runiov_.getRunTag();
1238 }
catch (std::runtime_error &
e) {
1242 RunTag runtag = runiov_.getRunTag();
1246 }
catch (std::runtime_error &e) {
1248 foundMonIOV =
false;
1259 std::cout <<
"==========MonRunIOV:" << std::endl;
1260 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1261 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1262 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1263 std::cout <<
"====================" << std::endl;
1265 std::cout <<
"==========MonRunTag:" << std::endl;
1266 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1267 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1268 std::cout <<
"====================" << std::endl;
1316 std::map<EcalLogicID, MonRunDat>
dataset;
1324 if (
h_ ) nevt =
h_->GetSumOfWeights();
1339 }
catch (std::runtime_error &
e) {
1349 }
catch (std::runtime_error &
e) {
1360 }
catch (std::runtime_error &
e) {
1372 #ifdef WITH_ECAL_COND_DB
1379 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1382 }
catch (std::runtime_error &
e) {
1386 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1389 }
catch (std::runtime_error &e) {
1398 std::map<EcalLogicID, RunDat>
dataset;
1402 if (
h_ ) nevt =
h_->GetSumOfWeights();
1408 bool foundRunDat =
false;
1416 }
catch (std::runtime_error &
e) {
1418 foundRunDat =
false;
1424 if ( ! foundRunDat ) {
1430 }
catch (std::runtime_error &
e) {
1440 }
catch (std::runtime_error &
e) {
1455 }
catch (std::runtime_error &
e) {
1479 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1480 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1481 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1489 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1500 sscanf(s.c_str(),
"i=%d", &ecal_run);
1508 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1518 sscanf(s.c_str(),
"i=%d", &
evtType_);
1536 (
jevt_ % 1000 == 0 );
1538 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1543 std::cout <<
" EE run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1548 if (
h_->GetSumOfWeights() != 0 ) {
1550 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1551 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1553 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1565 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1580 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1589 (
jevt_ % 10000 == 0 );
1591 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1612 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1639 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1658 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1664 int new_run_ =
run_;
1667 if ( new_run_ != old_run_ ) {
1673 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1689 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1711 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1721 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1738 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1748 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1783 std::vector<MonitorElement*>::const_iterator meitr;
1784 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1785 if ( !strncmp((*meitr)->getName().c_str(),
"EE", 2)
1786 && strncmp((*meitr)->getName().c_str(),
"EETrend", 7)
1787 && strncmp((*meitr)->getName().c_str(),
"by lumi", 7) ) {
void beginJob(void)
BeginJob.
LuminosityBlockID id() const
Cache logicID vector from database.
EventNumber_t event() const
void setRunTypeDef(const RunTypeDef &runTypeDef)
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
static std::string sEE(const unsigned ism)
void setTaskList(int list)
bool containsAnyMonitorable(const std::string &path) const
void setNumEvents(int num)
void setBinContent(int binx, double content)
set content of bin (1-D)
void insertRunIOV(RunIOV *iov)
virtual ~EcalEndcapMonitorClient()
Destructor.
std::vector< std::string > runTypes_
void setMonRunOutcomeDef(const MonRunOutcomeDef &outcomeDef)
void analyze(void)
Analyze.
Some "id" conversions.
RunIOV fetchRunIOV(RunTag *tag, run_t run)
void setFriends(const std::vector< EEClient * > &clients)
Set Clients.
std::map< std::string, int > clientsStatus_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setToCurrentGMTime()
void setGeneralTag(std::string tag)
void endRunDb(void)
EndRunDB.
MonitorElement * bookFloat(const char *name)
Book float.
void setShortDesc(std::string desc)
void disableSoftReset(MonitorElement *me)
void cleanup(void)
Cleanup.
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
EESummaryClient * summaryClient_
EcalEndcapMonitorClient(const edm::ParameterSet &ps)
Constructor.
std::vector< std::string > clientsNames_
void beginRunDb(void)
BeginRunDB.
void beginRun(void)
BeginRun.
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
void removeElement(const std::string &name)
void setNumEvents(int num)
void writeDb(void)
WriteDB.
void beginRun(void)
BeginRun.
void softReset(MonitorElement *me)
void setMonVersionDef(const MonVersionDef &ver)
void setTaskOutcome(int outcome)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
static void initMasking(const edm::EventSetup &setup, bool verbose=false)
void beginLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
BeginLumiBlock.
void setLocationDef(const LocationDef &locDef)
std::string valueString(void) const
void softReset(bool flag)
SoftReset.
bool dirExists(const std::string &path) const
true if directory exists
Ecal Monitor Utils for Client.
std::vector< EEClient * > clients_
std::vector< std::string > enabledClients_
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
void setRunType(std::string runtype)
std::multimap< EEClient *, int > clientsRuns_
LuminosityBlockNumber_t luminosityBlock() const
void beginJob(void)
BeginJob.
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun)
void setMonitoringVersion(std::string ver)
void analyze(void)
Analyze.
void insertMonRunIOV(MonRunIOV *iov)
bool open(const std::string &filename, bool overwrite=false, const std::string &path="", const std::string &prepend="", OpenRunDirs stripdirs=KeepRunDirs, bool fileMustExist=true)
std::vector< int > superModules_
void setLocation(std::string loc)
void insertDataSet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
void setGeneralTag(std::string tag)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
static EcalLogicID getEcalLogicID(const char *name, const int id1=EcalLogicID::NULLID, const int id2=EcalLogicID::NULLID, const int id3=EcalLogicID::NULLID)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
EndLumiBlock.
void setCurrentFolder(const std::string &fullpath)
const char * getRunType(void)