33 #ifdef WITH_ECAL_COND_DB
68 std::cout <<
" *** Ecal Barrel Generic Monitor Client ***" << std::endl;
94 std::cout <<
" Ecal Cond DB: " << std::endl;
96 std::cout <<
" dbUserName = '" << dbUserName_ <<
"'" << std::endl;
97 if ( dbHostName_.size() != 0 ) {
98 std::cout <<
" dbHostName = '" << dbHostName_ <<
"'" << std::endl;
99 std::cout <<
" dbHostPort = '" << dbHostPort_ <<
"'" << std::endl;
101 std::cout <<
" dbTagName = '" << dbTagName_ <<
"'" << std::endl;
102 #ifndef WITH_ECAL_COND_DB
104 std::cout <<
"WARNING: DB access is NOT available" << std::endl;
108 std::cout <<
" Ecal Cond DB is OFF" << std::endl;
118 std::cout <<
" mergeRuns switch is ON" << std::endl;
120 std::cout <<
" mergeRuns switch is OFF" << std::endl;
164 std::cout <<
" cloneME switch is ON" << std::endl;
166 std::cout <<
" cloneME switch is OFF" << std::endl;
176 std::cout <<
" debug switch is ON" << std::endl;
178 std::cout <<
" debug switch is OFF" << std::endl;
201 std::cout <<
" producing reportSummaries" << std::endl;
210 std::cout <<
" enableCleanup switch is ON" << std::endl;
212 std::cout <<
" enableCleanup switch is OFF" << std::endl;
224 std::cout <<
" Selected SMs:" << std::endl;
241 std::cout <<
" Enabled Clients:" << std::endl;
538 clientsStatus_.insert(std::pair<std::string,int>(
"Integrity", 0 ));
541 clientsStatus_.insert(std::pair<std::string,int>(
"Pedestal", 3 ));
542 clientsStatus_.insert(std::pair<std::string,int>(
"PedestalOnline", 4 ));
543 clientsStatus_.insert(std::pair<std::string,int>(
"TestPulse", 5 ));
544 clientsStatus_.insert(std::pair<std::string,int>(
"TriggerTower", 8 ));
545 clientsStatus_.insert(std::pair<std::string,int>(
"Cluster", 9 ));
546 clientsStatus_.insert(std::pair<std::string,int>(
"Timing", 10 ));
548 clientsStatus_.insert(std::pair<std::string,int>(
"StatusFlags", 12 ));
549 clientsStatus_.insert(std::pair<std::string,int>(
"Occupancy", 13 ));
597 if (
debug_ )
std::cout <<
"EcalBarrelMonitorClient: beginJob" << std::endl;
631 if (
debug_ )
std::cout <<
"EcalBarrelMonitorClient: beginRun" << std::endl;
668 std::cout <<
"Standard beginRun() for run " << r.
id().
run() << std::endl;
695 for (
int i = 0;
i < 36;
i++) {
712 me =
dqmStore_->
book2D(
"reportSummaryMap",
"EcalBarrel Report Summary Map", 72, 0., 72., 34, 0., 34);
713 for (
int iettx = 0; iettx < 34; iettx++ ) {
714 for (
int ipttx = 0; ipttx < 72; ipttx++ ) {
730 std::cout <<
"Checking last event at endJob() ... " << std::endl;
741 std::cout <<
"Forcing endRun() ... " << std::endl;
828 std::cout <<
"Standard endRun() for run " << r.
id().
run() << std::endl;
859 if ( me ) me->
Fill(-1.0);
861 for (
int i = 0;
i < 36;
i++) {
863 if ( me ) me->
Fill(-1.0);
867 for (
int iettx = 0; iettx < 34; iettx++ ) {
868 for (
int ipttx = 0; ipttx < 72; ipttx++ ) {
902 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
908 std::cout <<
"EB" << name <<
"Client is missing plots; resetting now" << std::endl;
961 #ifdef WITH_ECAL_COND_DB
968 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
971 }
catch (std::runtime_error &
e) {
975 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
978 }
catch (std::runtime_error &e) {
1004 bool foundRunIOV =
false;
1013 }
catch (std::runtime_error &
e) {
1015 foundRunIOV =
false;
1021 if ( ! foundRunIOV ) {
1027 runiov_.setRunNumber(
run_);
1028 runiov_.setRunStart(startRun);
1029 runiov_.setRunTag(runtag);
1038 }
catch (std::runtime_error &
e) {
1046 }
catch (std::runtime_error &e) {
1048 foundRunIOV =
false;
1059 std::cout <<
"=============RunIOV:" << std::endl;
1060 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1061 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1062 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1063 std::cout <<
"====================" << std::endl;
1065 std::cout <<
"=============RunTag:" << std::endl;
1066 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1067 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1068 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1069 std::cout <<
"====================" << std::endl;
1073 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1074 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1077 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1078 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1100 }
catch (std::runtime_error &
e) {
1114 #ifdef WITH_ECAL_COND_DB
1121 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1124 }
catch (std::runtime_error &
e) {
1128 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1131 }
catch (std::runtime_error &e) {
1153 bool foundMonIOV =
false;
1158 RunTag runtag = runiov_.getRunTag();
1162 }
catch (std::runtime_error &
e) {
1164 foundMonIOV =
false;
1170 if ( !foundMonIOV ) {
1172 moniov_.setRunIOV(runiov_);
1173 moniov_.setSubRunNumber(
subrun_);
1176 moniov_.setSubRunStart(startSubRun);
1178 moniov_.setSubRunStart(runiov_.getRunStart());
1181 moniov_.setMonRunTag(montag);
1187 RunTag runtag = runiov_.getRunTag();
1190 }
catch (std::runtime_error &
e) {
1194 RunTag runtag = runiov_.getRunTag();
1198 }
catch (std::runtime_error &e) {
1200 foundMonIOV =
false;
1211 std::cout <<
"==========MonRunIOV:" << std::endl;
1212 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1213 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1214 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1215 std::cout <<
"====================" << std::endl;
1217 std::cout <<
"==========MonRunTag:" << std::endl;
1218 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1219 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1220 std::cout <<
"====================" << std::endl;
1267 std::map<EcalLogicID, MonRunDat>
dataset;
1275 if (
h_ ) nevt =
h_->GetSumOfWeights();
1290 }
catch (std::runtime_error &
e) {
1300 }
catch (std::runtime_error &
e) {
1311 }
catch (std::runtime_error &
e) {
1323 #ifdef WITH_ECAL_COND_DB
1330 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1333 }
catch (std::runtime_error &
e) {
1337 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1340 }
catch (std::runtime_error &e) {
1349 std::map<EcalLogicID, RunDat>
dataset;
1353 if (
h_ ) nevt =
h_->GetSumOfWeights();
1359 bool foundRunDat =
false;
1367 }
catch (std::runtime_error &
e) {
1369 foundRunDat =
false;
1375 if ( ! foundRunDat ) {
1381 }
catch (std::runtime_error &
e) {
1391 }
catch (std::runtime_error &
e) {
1406 }
catch (std::runtime_error &
e) {
1430 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1431 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1432 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1440 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1451 sscanf(s.c_str(),
"i=%d", &ecal_run);
1459 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1469 sscanf(s.c_str(),
"i=%d", &
evtType_);
1487 (
jevt_ % 1000 == 0 );
1489 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1494 std::cout <<
" EB run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1499 if (
h_->GetSumOfWeights() != 0 ) {
1501 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1502 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1504 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1516 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1531 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1540 (
jevt_ % 10000 == 0 );
1542 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1563 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1590 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1609 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1615 int new_run_ =
run_;
1618 if ( new_run_ != old_run_ ) {
1624 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1640 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1662 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1672 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1689 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1699 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1732 std::vector<MonitorElement*>::const_iterator meitr;
1733 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1734 if ( !strncmp((*meitr)->getName().c_str(),
"EB", 2)
1735 && strncmp((*meitr)->getName().c_str(),
"EBTrend", 7)
1736 && strncmp((*meitr)->getName().c_str(),
"by lumi", 7) ) {
LuminosityBlockID id() const
std::multimap< EBClient *, int > clientsRuns_
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
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)
std::vector< std::string > clientsNames_
void insertRunIOV(RunIOV *iov)
std::vector< std::string > enabledClients_
Some "id" conversions.
static std::string sEB(const unsigned ism)
void beginLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
BeginLumiBlock.
RunIOV fetchRunIOV(RunTag *tag, run_t run)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setToCurrentGMTime()
void setGeneralTag(std::string tag)
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 beginJob(void)
BeginJob.
void endLuminosityBlock(const edm::LuminosityBlock &l, const edm::EventSetup &c)
EndLumiBlock.
void softReset(bool flag)
SoftReset.
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
void setRunTypeDef(const RunTypeDef runTypeDef)
void removeElement(const std::string &name)
void setFriends(std::vector< EBClient * > clients)
Set Clients.
void setNumEvents(int num)
EcalBarrelMonitorClient(const edm::ParameterSet &ps)
Constructor.
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)
std::vector< EBClient * > clients_
std::map< std::string, int > clientsStatus_
std::string valueString(void) const
virtual ~EcalBarrelMonitorClient()
Destructor.
bool dirExists(const std::string &path) const
true if directory exists
Ecal Monitor Utils for Client.
void setMonRunOutcomeDef(MonRunOutcomeDef outcomeDef)
std::vector< std::string > runTypes_
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
void setRunType(std::string runtype)
void beginRunDb(void)
BeginRunDB.
LuminosityBlockNumber_t luminosityBlock() const
const char * getRunType(void)
EBSummaryClient * summaryClient_
MonRunIOV fetchMonRunIOV(RunTag *runtag, MonRunTag *montag, run_t run, subrun_t monrun)
void beginJob(void)
BeginJob.
void endRunDb(void)
EndRunDB.
void setMonitoringVersion(std::string ver)
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)
void setLocation(std::string loc)
void insertDataSet(const std::map< EcalLogicID, DATT > *data, IOVT *iov)
std::vector< int > superModules_
void writeDb(void)
WriteDB.
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 analyze(void)
Analyze.
void beginRun(void)
BeginRun.
void cleanup(void)
Cleanup.
void setCurrentFolder(const std::string &fullpath)
void analyze(void)
Analyze.
void beginRun(void)
BeginRun.