33 #ifdef WITH_ECAL_COND_DB
69 std::cout <<
" *** Ecal Endcap Generic Monitor Client ***" << std::endl;
95 std::cout <<
" Ecal Cond DB: " << std::endl;
97 std::cout <<
" dbUserName = '" << dbUserName_ <<
"'" << std::endl;
98 if ( dbHostName_.size() != 0 ) {
99 std::cout <<
" dbHostName = '" << dbHostName_ <<
"'" << std::endl;
100 std::cout <<
" dbHostPort = '" << dbHostPort_ <<
"'" << std::endl;
102 std::cout <<
" dbTagName = '" << dbTagName_ <<
"'" << std::endl;
103 #ifndef WITH_ECAL_COND_DB
105 std::cout <<
"WARNING: DB access is NOT available" << std::endl;
109 std::cout <<
" Ecal Cond DB is OFF" << std::endl;
119 std::cout <<
" mergeRuns switch is ON" << std::endl;
121 std::cout <<
" mergeRuns switch is OFF" << std::endl;
165 std::cout <<
" cloneME switch is ON" << std::endl;
167 std::cout <<
" cloneME switch is OFF" << std::endl;
177 std::cout <<
" debug switch is ON" << std::endl;
179 std::cout <<
" debug switch is OFF" << std::endl;
202 std::cout <<
" producing reportSummaries" << std::endl;
211 std::cout <<
" enableCleanup switch is ON" << std::endl;
213 std::cout <<
" enableCleanup switch is OFF" << std::endl;
225 std::cout <<
" Selected SMs:" << std::endl;
242 std::cout <<
" Enabled Clients:" << std::endl;
584 clientsStatus_.insert(std::pair<std::string,int>(
"Integrity", 0 ));
587 clientsStatus_.insert(std::pair<std::string,int>(
"Pedestal", 3 ));
588 clientsStatus_.insert(std::pair<std::string,int>(
"PedestalOnline", 4 ));
589 clientsStatus_.insert(std::pair<std::string,int>(
"TestPulse", 5 ));
590 clientsStatus_.insert(std::pair<std::string,int>(
"TriggerTower", 8 ));
591 clientsStatus_.insert(std::pair<std::string,int>(
"Cluster", 9 ));
592 clientsStatus_.insert(std::pair<std::string,int>(
"Timing", 10 ));
594 clientsStatus_.insert(std::pair<std::string,int>(
"StatusFlags", 12 ));
595 clientsStatus_.insert(std::pair<std::string,int>(
"Occupancy", 13 ));
645 if (
debug_ )
std::cout <<
"EcalEndcapMonitorClient: beginJob" << std::endl;
678 if (
debug_ )
std::cout <<
"EcalEndcapMonitorClient: beginRun" << std::endl;
715 std::cout <<
"Standard beginRun() for run " << r.
id().
run() << std::endl;
736 for (
int i = 0;
i < 18;
i++) {
752 me =
dqmStore_->
book2D(
"reportSummaryMap",
"EcalEndcap Report Summary Map", 40, 0., 200., 20, 0., 100);
753 for (
int jx = 1; jx <= 40; jx++ ) {
754 for (
int jy = 1; jy <= 20; jy++ ) {
775 std::cout <<
"Checking last event at endJob() ... " << std::endl;
787 std::cout <<
"Forcing endRun() ... " << std::endl;
875 std::cout <<
"Standard endRun() for run " << r.
id().
run() << std::endl;
908 if ( me ) me->
Fill(-1.0);
910 for (
int i = 0;
i < 18;
i++) {
912 if ( me ) me->
Fill(-1.0);
916 for (
int jx = 1; jx <= 40; jx++ ) {
917 for (
int jy = 1; jy <= 20; jy++ ) {
964 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
970 std::cout <<
"EE" << name <<
"Client is missing plots; resetting now" << std::endl;
1005 #ifdef WITH_ECAL_COND_DB
1012 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1015 }
catch (std::runtime_error &
e) {
1019 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1022 }
catch (std::runtime_error &e) {
1048 bool foundRunIOV =
false;
1057 }
catch (std::runtime_error &
e) {
1059 foundRunIOV =
false;
1065 if ( ! foundRunIOV ) {
1071 runiov_.setRunNumber(
run_);
1072 runiov_.setRunStart(startRun);
1073 runiov_.setRunTag(runtag);
1082 }
catch (std::runtime_error &
e) {
1090 }
catch (std::runtime_error &e) {
1092 foundRunIOV =
false;
1103 std::cout <<
"=============RunIOV:" << std::endl;
1104 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1105 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1106 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1107 std::cout <<
"====================" << std::endl;
1109 std::cout <<
"=============RunTag:" << std::endl;
1110 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1111 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1112 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1113 std::cout <<
"====================" << std::endl;
1117 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1118 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1121 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1122 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1144 }
catch (std::runtime_error &
e) {
1158 #ifdef WITH_ECAL_COND_DB
1165 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1168 }
catch (std::runtime_error &
e) {
1172 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1175 }
catch (std::runtime_error &e) {
1197 bool foundMonIOV =
false;
1202 RunTag runtag = runiov_.getRunTag();
1206 }
catch (std::runtime_error &
e) {
1208 foundMonIOV =
false;
1214 if ( !foundMonIOV ) {
1216 moniov_.setRunIOV(runiov_);
1217 moniov_.setSubRunNumber(
subrun_);
1220 moniov_.setSubRunStart(startSubRun);
1222 moniov_.setSubRunStart(runiov_.getRunStart());
1225 moniov_.setMonRunTag(montag);
1231 RunTag runtag = runiov_.getRunTag();
1234 }
catch (std::runtime_error &
e) {
1238 RunTag runtag = runiov_.getRunTag();
1242 }
catch (std::runtime_error &e) {
1244 foundMonIOV =
false;
1255 std::cout <<
"==========MonRunIOV:" << std::endl;
1256 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1257 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1258 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1259 std::cout <<
"====================" << std::endl;
1261 std::cout <<
"==========MonRunTag:" << std::endl;
1262 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1263 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1264 std::cout <<
"====================" << std::endl;
1312 std::map<EcalLogicID, MonRunDat>
dataset;
1320 if (
h_ ) nevt =
h_->GetSumOfWeights();
1335 }
catch (std::runtime_error &
e) {
1345 }
catch (std::runtime_error &
e) {
1356 }
catch (std::runtime_error &
e) {
1368 #ifdef WITH_ECAL_COND_DB
1375 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1378 }
catch (std::runtime_error &
e) {
1382 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1385 }
catch (std::runtime_error &e) {
1394 std::map<EcalLogicID, RunDat>
dataset;
1398 if (
h_ ) nevt =
h_->GetSumOfWeights();
1404 bool foundRunDat =
false;
1412 }
catch (std::runtime_error &
e) {
1414 foundRunDat =
false;
1420 if ( ! foundRunDat ) {
1426 }
catch (std::runtime_error &
e) {
1436 }
catch (std::runtime_error &
e) {
1451 }
catch (std::runtime_error &
e) {
1475 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1476 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1477 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1485 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1496 sscanf(s.c_str(),
"i=%d", &ecal_run);
1504 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1514 sscanf(s.c_str(),
"i=%d", &
evtType_);
1532 (
jevt_ % 1000 == 0 );
1534 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1539 std::cout <<
" EE run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1544 if (
h_->GetSumOfWeights() != 0 ) {
1546 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1547 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1549 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1561 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1576 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1585 (
jevt_ % 10000 == 0 );
1587 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1608 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1635 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1654 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1660 int new_run_ =
run_;
1663 if ( new_run_ != old_run_ ) {
1669 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1685 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1707 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1717 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1734 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1744 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1779 std::vector<MonitorElement*>::const_iterator meitr;
1780 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1781 if ( !strncmp((*meitr)->getName().c_str(),
"EE", 2)
1782 && strncmp((*meitr)->getName().c_str(),
"EETrend", 7)
1783 && strncmp((*meitr)->getName().c_str(),
"by lumi", 7) ) {
void beginJob(void)
BeginJob.
LuminosityBlockID id() const
Cache logicID vector from database.
EventNumber_t event() const
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)
void setNumEvents(int num)
void setBinContent(int binx, double content)
set content of bin (1-D)
void setLocationDef(const LocationDef locDef)
void insertRunIOV(RunIOV *iov)
virtual ~EcalEndcapMonitorClient()
Destructor.
std::vector< std::string > runTypes_
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)
std::vector< MonitorElement * > getAllContents(const std::string &path) const
void disableSoftReset(MonitorElement *me)
void cleanup(void)
Cleanup.
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 setRunTypeDef(const RunTypeDef runTypeDef)
void removeElement(const std::string &name)
void setNumEvents(int num)
void writeDb(void)
WriteDB.
void beginRun(void)
BeginRun.
void softReset(MonitorElement *me)
void setMonVersionDef(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.
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.
void setMonRunOutcomeDef(MonRunOutcomeDef outcomeDef)
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)