31 #ifdef WITH_ECAL_COND_DB
66 std::cout <<
" *** Ecal Barrel Generic Monitor Client ***" << std::endl;
92 std::cout <<
" Ecal Cond DB: " << std::endl;
94 std::cout <<
" dbUserName = '" << dbUserName_ <<
"'" << std::endl;
95 if ( dbHostName_.size() != 0 ) {
96 std::cout <<
" dbHostName = '" << dbHostName_ <<
"'" << std::endl;
97 std::cout <<
" dbHostPort = '" << dbHostPort_ <<
"'" << std::endl;
99 std::cout <<
" dbTagName = '" << dbTagName_ <<
"'" << std::endl;
100 #ifndef WITH_ECAL_COND_DB
102 std::cout <<
"WARNING: DB access is NOT available" << std::endl;
106 std::cout <<
" Ecal Cond DB is OFF" << std::endl;
116 std::cout <<
" mergeRuns switch is ON" << std::endl;
118 std::cout <<
" mergeRuns switch is OFF" << std::endl;
162 std::cout <<
" cloneME switch is ON" << std::endl;
164 std::cout <<
" cloneME switch is OFF" << std::endl;
174 std::cout <<
" debug switch is ON" << std::endl;
176 std::cout <<
" debug switch is OFF" << std::endl;
199 std::cout <<
" producing reportSummaries" << std::endl;
208 std::cout <<
" enableCleanup switch is ON" << std::endl;
210 std::cout <<
" enableCleanup switch is OFF" << std::endl;
222 std::cout <<
" Selected SMs:" << std::endl;
239 std::cout <<
" Enabled Clients:" << std::endl;
536 clientsStatus_.insert(std::pair<std::string,int>(
"Integrity", 0 ));
539 clientsStatus_.insert(std::pair<std::string,int>(
"Pedestal", 3 ));
540 clientsStatus_.insert(std::pair<std::string,int>(
"PedestalOnline", 4 ));
541 clientsStatus_.insert(std::pair<std::string,int>(
"TestPulse", 5 ));
542 clientsStatus_.insert(std::pair<std::string,int>(
"TriggerTower", 8 ));
543 clientsStatus_.insert(std::pair<std::string,int>(
"Cluster", 9 ));
544 clientsStatus_.insert(std::pair<std::string,int>(
"Timing", 10 ));
546 clientsStatus_.insert(std::pair<std::string,int>(
"StatusFlags", 12 ));
547 clientsStatus_.insert(std::pair<std::string,int>(
"Occupancy", 13 ));
595 if (
debug_ )
std::cout <<
"EcalBarrelMonitorClient: beginJob" << std::endl;
629 if (
debug_ )
std::cout <<
"EcalBarrelMonitorClient: beginRun" << std::endl;
666 std::cout <<
"Standard beginRun() for run " << r.
id().
run() << std::endl;
693 for (
int i = 0;
i < 36;
i++) {
710 me =
dqmStore_->
book2D(
"reportSummaryMap",
"EcalBarrel Report Summary Map", 72, 0., 72., 34, 0., 34);
711 for (
int iettx = 0; iettx < 34; iettx++ ) {
712 for (
int ipttx = 0; ipttx < 72; ipttx++ ) {
728 std::cout <<
"Checking last event at endJob() ... " << std::endl;
739 std::cout <<
"Forcing endRun() ... " << std::endl;
826 std::cout <<
"Standard endRun() for run " << r.
id().
run() << std::endl;
857 if ( me ) me->
Fill(-1.0);
859 for (
int i = 0;
i < 36;
i++) {
861 if ( me ) me->
Fill(-1.0);
865 for (
int iettx = 0; iettx < 34; iettx++ ) {
866 for (
int ipttx = 0; ipttx < 72; ipttx++ ) {
900 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
906 std::cout <<
"EB" << name <<
"Client is missing plots; resetting now" << std::endl;
959 #ifdef WITH_ECAL_COND_DB
966 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
969 }
catch (std::runtime_error &
e) {
973 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
976 }
catch (std::runtime_error &e) {
1002 bool foundRunIOV =
false;
1011 }
catch (std::runtime_error &
e) {
1013 foundRunIOV =
false;
1019 if ( ! foundRunIOV ) {
1025 runiov_.setRunNumber(
run_);
1026 runiov_.setRunStart(startRun);
1027 runiov_.setRunTag(runtag);
1036 }
catch (std::runtime_error &
e) {
1044 }
catch (std::runtime_error &e) {
1046 foundRunIOV =
false;
1057 std::cout <<
"=============RunIOV:" << std::endl;
1058 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1059 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1060 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1061 std::cout <<
"====================" << std::endl;
1063 std::cout <<
"=============RunTag:" << std::endl;
1064 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1065 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1066 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1067 std::cout <<
"====================" << std::endl;
1071 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1072 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1075 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1076 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1098 }
catch (std::runtime_error &
e) {
1112 #ifdef WITH_ECAL_COND_DB
1119 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1122 }
catch (std::runtime_error &
e) {
1126 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1129 }
catch (std::runtime_error &e) {
1151 bool foundMonIOV =
false;
1156 RunTag runtag = runiov_.getRunTag();
1160 }
catch (std::runtime_error &
e) {
1162 foundMonIOV =
false;
1168 if ( !foundMonIOV ) {
1170 moniov_.setRunIOV(runiov_);
1171 moniov_.setSubRunNumber(
subrun_);
1174 moniov_.setSubRunStart(startSubRun);
1176 moniov_.setSubRunStart(runiov_.getRunStart());
1179 moniov_.setMonRunTag(montag);
1185 RunTag runtag = runiov_.getRunTag();
1188 }
catch (std::runtime_error &
e) {
1192 RunTag runtag = runiov_.getRunTag();
1196 }
catch (std::runtime_error &e) {
1198 foundMonIOV =
false;
1209 std::cout <<
"==========MonRunIOV:" << std::endl;
1210 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1211 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1212 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1213 std::cout <<
"====================" << std::endl;
1215 std::cout <<
"==========MonRunTag:" << std::endl;
1216 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1217 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1218 std::cout <<
"====================" << std::endl;
1265 std::map<EcalLogicID, MonRunDat>
dataset;
1273 if (
h_ ) nevt =
h_->GetSumOfWeights();
1288 }
catch (std::runtime_error &
e) {
1298 }
catch (std::runtime_error &
e) {
1309 }
catch (std::runtime_error &
e) {
1321 #ifdef WITH_ECAL_COND_DB
1328 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1331 }
catch (std::runtime_error &
e) {
1335 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1338 }
catch (std::runtime_error &e) {
1347 std::map<EcalLogicID, RunDat>
dataset;
1351 if (
h_ ) nevt =
h_->GetSumOfWeights();
1357 bool foundRunDat =
false;
1365 }
catch (std::runtime_error &
e) {
1367 foundRunDat =
false;
1373 if ( ! foundRunDat ) {
1379 }
catch (std::runtime_error &
e) {
1389 }
catch (std::runtime_error &
e) {
1404 }
catch (std::runtime_error &
e) {
1428 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1429 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1430 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1438 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1449 sscanf(s.c_str(),
"i=%d", &ecal_run);
1457 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1467 sscanf(s.c_str(),
"i=%d", &
evtType_);
1485 (
jevt_ % 1000 == 0 );
1487 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1492 std::cout <<
" EB run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1497 if (
h_->GetSumOfWeights() != 0 ) {
1499 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1500 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1502 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1514 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1529 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1538 (
jevt_ % 10000 == 0 );
1540 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1561 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1588 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1607 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1613 int new_run_ =
run_;
1616 if ( new_run_ != old_run_ ) {
1622 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1638 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1660 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1670 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1687 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1697 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1730 std::vector<MonitorElement*>::const_iterator meitr;
1731 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1732 if ( !strncmp((*meitr)->getName().c_str(),
"EB", 2)
1733 && strncmp((*meitr)->getName().c_str(),
"EBTrend", 7)
1734 && 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
void setRunTypeDef(const RunTypeDef &runTypeDef)
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)
std::vector< std::string > clientsNames_
void insertRunIOV(RunIOV *iov)
void setMonRunOutcomeDef(const MonRunOutcomeDef &outcomeDef)
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)
void disableSoftReset(MonitorElement *me)
std::vector< MonitorElement * > getAllContents(const std::string &path, uint32_t runNumber=0, uint32_t lumi=0) const
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 removeElement(const std::string &name)
void setNumEvents(int num)
EcalBarrelMonitorClient(const edm::ParameterSet &ps)
Constructor.
void setFriends(const std::vector< EBClient * > &clients)
Set Clients.
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 setLocationDef(const LocationDef &locDef)
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.
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.