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++ ) {
951 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
957 std::cout <<
"EE" << name <<
"Client is missing plots; issuing beginRun" << std::endl;
1000 if (
h_ )
delete h_;
1011 #ifdef WITH_ECAL_COND_DB
1018 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1021 }
catch (std::runtime_error &
e) {
1025 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1028 }
catch (std::runtime_error &e) {
1054 bool foundRunIOV =
false;
1063 }
catch (std::runtime_error &
e) {
1065 foundRunIOV =
false;
1071 if ( ! foundRunIOV ) {
1077 runiov_.setRunNumber(
run_);
1078 runiov_.setRunStart(startRun);
1079 runiov_.setRunTag(runtag);
1088 }
catch (std::runtime_error &
e) {
1096 }
catch (std::runtime_error &e) {
1098 foundRunIOV =
false;
1109 std::cout <<
"=============RunIOV:" << std::endl;
1110 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1111 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1112 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1113 std::cout <<
"====================" << std::endl;
1115 std::cout <<
"=============RunTag:" << std::endl;
1116 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1117 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1118 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1119 std::cout <<
"====================" << std::endl;
1123 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1124 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1127 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1128 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1150 }
catch (std::runtime_error &
e) {
1164 #ifdef WITH_ECAL_COND_DB
1171 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1174 }
catch (std::runtime_error &
e) {
1178 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1181 }
catch (std::runtime_error &e) {
1203 bool foundMonIOV =
false;
1208 RunTag runtag = runiov_.getRunTag();
1212 }
catch (std::runtime_error &
e) {
1214 foundMonIOV =
false;
1220 if ( !foundMonIOV ) {
1222 moniov_.setRunIOV(runiov_);
1223 moniov_.setSubRunNumber(
subrun_);
1226 moniov_.setSubRunStart(startSubRun);
1228 moniov_.setSubRunStart(runiov_.getRunStart());
1231 moniov_.setMonRunTag(montag);
1237 RunTag runtag = runiov_.getRunTag();
1240 }
catch (std::runtime_error &
e) {
1244 RunTag runtag = runiov_.getRunTag();
1248 }
catch (std::runtime_error &e) {
1250 foundMonIOV =
false;
1261 std::cout <<
"==========MonRunIOV:" << std::endl;
1262 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1263 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1264 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1265 std::cout <<
"====================" << std::endl;
1267 std::cout <<
"==========MonRunTag:" << std::endl;
1268 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1269 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1270 std::cout <<
"====================" << std::endl;
1318 std::map<EcalLogicID, MonRunDat>
dataset;
1326 if (
h_ ) nevt =
h_->GetSumOfWeights();
1341 }
catch (std::runtime_error &
e) {
1351 }
catch (std::runtime_error &
e) {
1362 }
catch (std::runtime_error &
e) {
1374 #ifdef WITH_ECAL_COND_DB
1381 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1384 }
catch (std::runtime_error &
e) {
1388 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1391 }
catch (std::runtime_error &e) {
1400 std::map<EcalLogicID, RunDat>
dataset;
1404 if (
h_ ) nevt =
h_->GetSumOfWeights();
1410 bool foundRunDat =
false;
1418 }
catch (std::runtime_error &
e) {
1420 foundRunDat =
false;
1426 if ( ! foundRunDat ) {
1432 }
catch (std::runtime_error &
e) {
1442 }
catch (std::runtime_error &
e) {
1457 }
catch (std::runtime_error &
e) {
1481 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1482 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1483 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1491 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1502 sscanf(s.c_str(),
"i=%d", &ecal_run);
1510 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1520 sscanf(s.c_str(),
"i=%d", &
evtType_);
1538 (
jevt_ % 1000 == 0 );
1540 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1545 std::cout <<
" EE run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1550 if (
h_->GetSumOfWeights() != 0 ) {
1552 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1553 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1555 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1567 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1582 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1591 (
jevt_ % 10000 == 0 );
1593 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1614 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1641 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1660 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1666 int new_run_ =
run_;
1669 if ( new_run_ != old_run_ ) {
1675 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1691 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1713 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1723 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1740 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1750 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1785 std::vector<MonitorElement*>::const_iterator meitr;
1786 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1787 if ( !strncmp((*meitr)->getName().c_str(),
"EE", 2)
1788 && strncmp((*meitr)->getName().c_str(),
"EETrend", 7)
1789 && 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)
bool containsAnyMonitorable(const std::string &path) const
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)