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++ ) {
914 if(name ==
"Cluster" || name ==
"Cosmic" || name ==
"Occupancy" || name ==
"StatusFlags" || name ==
"Trend")
continue;
920 std::cout <<
"EB" << name <<
"Client is missing plots; resetting now" << std::endl;
955 #ifdef WITH_ECAL_COND_DB
962 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
965 }
catch (std::runtime_error &
e) {
969 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
972 }
catch (std::runtime_error &e) {
998 bool foundRunIOV =
false;
1007 }
catch (std::runtime_error &
e) {
1009 foundRunIOV =
false;
1015 if ( ! foundRunIOV ) {
1021 runiov_.setRunNumber(
run_);
1022 runiov_.setRunStart(startRun);
1023 runiov_.setRunTag(runtag);
1032 }
catch (std::runtime_error &
e) {
1040 }
catch (std::runtime_error &e) {
1042 foundRunIOV =
false;
1053 std::cout <<
"=============RunIOV:" << std::endl;
1054 std::cout <<
"Run Number: " << runiov_.getRunNumber() << std::endl;
1055 std::cout <<
"Run Start: " << runiov_.getRunStart().str() << std::endl;
1056 std::cout <<
"Run End: " << runiov_.getRunEnd().str() << std::endl;
1057 std::cout <<
"====================" << std::endl;
1059 std::cout <<
"=============RunTag:" << std::endl;
1060 std::cout <<
"GeneralTag: " << runiov_.getRunTag().getGeneralTag() << std::endl;
1061 std::cout <<
"Location: " << runiov_.getRunTag().getLocationDef().getLocation() << std::endl;
1062 std::cout <<
"Run Type: " << runiov_.getRunTag().getRunTypeDef().getRunType() << std::endl;
1063 std::cout <<
"====================" << std::endl;
1067 std::string rt = runiov_.getRunTag().getRunTypeDef().getRunType();
1068 if ( strcmp(rt.c_str(),
"UNKNOWN") == 0 ) {
1071 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1072 if ( strcmp(rt.c_str(),
runTypes_[
i].c_str()) == 0 ) {
1094 }
catch (std::runtime_error &
e) {
1108 #ifdef WITH_ECAL_COND_DB
1115 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1118 }
catch (std::runtime_error &
e) {
1122 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1125 }
catch (std::runtime_error &e) {
1147 bool foundMonIOV =
false;
1152 RunTag runtag = runiov_.getRunTag();
1156 }
catch (std::runtime_error &
e) {
1158 foundMonIOV =
false;
1164 if ( !foundMonIOV ) {
1166 moniov_.setRunIOV(runiov_);
1167 moniov_.setSubRunNumber(
subrun_);
1170 moniov_.setSubRunStart(startSubRun);
1172 moniov_.setSubRunStart(runiov_.getRunStart());
1175 moniov_.setMonRunTag(montag);
1181 RunTag runtag = runiov_.getRunTag();
1184 }
catch (std::runtime_error &
e) {
1188 RunTag runtag = runiov_.getRunTag();
1192 }
catch (std::runtime_error &e) {
1194 foundMonIOV =
false;
1205 std::cout <<
"==========MonRunIOV:" << std::endl;
1206 std::cout <<
"SubRun Number: " << moniov_.getSubRunNumber() << std::endl;
1207 std::cout <<
"SubRun Start: " << moniov_.getSubRunStart().str() << std::endl;
1208 std::cout <<
"SubRun End: " << moniov_.getSubRunEnd().str() << std::endl;
1209 std::cout <<
"====================" << std::endl;
1211 std::cout <<
"==========MonRunTag:" << std::endl;
1212 std::cout <<
"GeneralTag: " << moniov_.getMonRunTag().getGeneralTag() << std::endl;
1213 std::cout <<
"Monitoring Ver: " << moniov_.getMonRunTag().getMonVersionDef().getMonitoringVersion() << std::endl;
1214 std::cout <<
"====================" << std::endl;
1261 std::map<EcalLogicID, MonRunDat>
dataset;
1269 if (
h_ ) nevt =
h_->GetSumOfWeights();
1284 }
catch (std::runtime_error &
e) {
1294 }
catch (std::runtime_error &
e) {
1305 }
catch (std::runtime_error &
e) {
1317 #ifdef WITH_ECAL_COND_DB
1324 if (
verbose_ )
std::cout <<
"Opening DB connection with TNS_ADMIN ..." << std::endl;
1327 }
catch (std::runtime_error &
e) {
1331 if (
verbose_ )
std::cout <<
"Opening DB connection without TNS_ADMIN ..." << std::endl;
1334 }
catch (std::runtime_error &e) {
1343 std::map<EcalLogicID, RunDat>
dataset;
1347 if (
h_ ) nevt =
h_->GetSumOfWeights();
1353 bool foundRunDat =
false;
1361 }
catch (std::runtime_error &
e) {
1363 foundRunDat =
false;
1369 if ( ! foundRunDat ) {
1375 }
catch (std::runtime_error &
e) {
1385 }
catch (std::runtime_error &
e) {
1400 }
catch (std::runtime_error &
e) {
1424 if ( strcmp(s.c_str(),
"i=0") == 0 )
status_ =
"begin-of-run";
1425 if ( strcmp(s.c_str(),
"i=1") == 0 )
status_ =
"running";
1426 if ( strcmp(s.c_str(),
"i=2") == 0 )
status_ =
"end-of-run";
1434 std::cout <<
" Reading DQM from file, forcing 'begin-of-run'" << std::endl;
1445 sscanf(s.c_str(),
"i=%d", &ecal_run);
1453 sscanf(s.c_str(),
"i=%d", &ecal_evt);
1463 sscanf(s.c_str(),
"i=%d", &
evtType_);
1481 (
jevt_ % 1000 == 0 );
1483 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1488 std::cout <<
" EB run/event number = " << ecal_run <<
"/" << ecal_evt << std::endl;
1493 if (
h_->GetSumOfWeights() != 0 ) {
1495 for (
unsigned int i = 0;
i <
runTypes_.size();
i++ ) {
1496 if ( strcmp(
runTypes_[
i].c_str(),
"UNKNOWN") != 0 &&
h_->GetBinContent(2+
i) != 0 ) {
1498 transform( s.begin(), s.end(), s.begin(), (int(*)(int))tolower );
1510 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 ) {
1525 if ( strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"running") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1534 (
jevt_ % 10000 == 0 );
1536 if ( update || strcmp(
status_.c_str(),
"begin-of-run") == 0 || strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1557 if ( access(
resetFile_.c_str(), W_OK) == 0 ) {
1584 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1603 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1609 int new_run_ =
run_;
1612 if ( new_run_ != old_run_ ) {
1618 std::cout <<
" Old run has finished, issuing endRun() ... " << std::endl;
1634 std::cout <<
" New run has started, issuing beginRun() ... " << std::endl;
1656 if ( strcmp(
status_.c_str(),
"running") == 0 ) {
1666 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1683 if ( strcmp(
status_.c_str(),
"end-of-run") == 0 ) {
1693 std::cout <<
"Forcing beginRun() ... NOW !" << std::endl;
1726 std::vector<MonitorElement*>::const_iterator meitr;
1727 for ( meitr=mes.begin(); meitr!=mes.end(); meitr++ ) {
1728 if ( !strncmp((*meitr)->getName().c_str(),
"EB", 2)
1729 && strncmp((*meitr)->getName().c_str(),
"EBTrend", 7)
1730 && 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)
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.