16 #include "DipFactory.h" 17 #include "DipPublication.h" 18 #include "DipTimestamp.h" 23 class ErrHandler :
public DipPublicationErrorHandler {
29 edm::LogError(
"BeamSpotDipServer") <<
"exception (create): " <<
e.what();
51 bsLegacyToken_ = esConsumes<edm::Transition::EndLuminosityBlock>();
54 dcsRecordToken_ = consumes<DCSRecord>(dcsRecordInputTag_);
60 dip->setDNSNode(
"cmsdimns1.cern.ch,cmsdimns2.cern.ch");
72 edm::LogInfo(
"BeamSpotDipServer") <<
"begin run " << r.run();
94 edm::LogError(
"BeamSpotDipServer") <<
"exception (start up): " <<
e.what();
112 int nthlumi =
iEvent.luminosityBlock();
114 if (nthlumi > lastlumi) {
126 edm::LogInfo(
"BeamSpotDipServer") <<
"whole tracker on? " << (wholeTrackerOn ?
"yes" :
"no");
174 edm::LogInfo(
"BeamSpotDipServer") <<
"got new record from file";
181 edm::LogInfo(
"BeamSpotDipServer") <<
"problem with new record";
196 auto const&
bs = *bsLegacyHandle;
201 edm::LogInfo(
"BeamSpotDipServer") <<
"got new record from database";
207 edm::LogInfo(
"BeamSpotDipServer") <<
"problem with new record";
222 edm::LogWarning(
"BeamSpotDipServer") <<
"io exception (end of lumi): " <<
e.what();
244 struct stat stat_buf;
246 return (rc == 0 ? stat_buf.st_size : -1);
251 struct stat stat_buf;
253 return (rc == 0 ? stat_buf.st_mtime : -1);
264 list.push_back(
token);
269 list.push_back(
line);
283 outstr =
"No CMS Tracker status available. No DAQ/DQM.";
295 switch (nthLnInRcd) {
297 if (
tmp[1].
find(
"Yes") == string::npos)
298 outstr =
"CMS Tracker OFF.";
300 outstr =
"CMS not taking data or no beam.";
310 edm::LogWarning(
"BeamSpotDipServer") <<
"exception (tkStatus): " <<
e.what();
318 outstr =
"CMS not taking data or no beam.";
320 outstr =
"CMS Tracker OFF.";
337 if (!
alive.test(2)) {
343 stringstream warnMsg;
344 warnMsg <<
"No new data for " <<
lsCount <<
" LS";
345 publishRcd(
"Uncertain", warnMsg.str(),
false,
false);
349 stringstream warnMsg;
351 publishRcd(
"Bad", warnMsg.str(),
false,
false);
359 stringstream warnMsg;
361 publishRcd(
"Bad", warnMsg.str(),
false,
false);
379 edm::LogWarning(
"BeamSpotDipServer") <<
"time variables are not available (readRcd): " <<
e.what();
390 edm::LogWarning(
"BeamSpotDipServer") <<
"lumirange variable not avaialble (readRcd): " <<
e.what();
437 edm::LogWarning(
"BeamSpotDipServer") <<
"PV variables are not available (readRcd): " <<
e.what();
450 edm::LogInfo(
"BeamSpotDipServer") <<
"pos: (" <<
x <<
"," <<
y <<
"," <<
z <<
")" 460 bool rcdQlty =
false;
469 switch (nthLnInRcd) {
471 if (
record.rfind(
"Run", 0) != 0) {
586 edm::LogWarning(
"BeamSpotDipServer") <<
"io exception (readRcd): " <<
e.what();
685 edm::LogWarning(
"BeamSpotDipServer") <<
"exception (trueRcd): " <<
e.what();
707 edm::LogWarning(
"BeamSpotDipServer") <<
"exception (fakeRcd): " <<
e.what();
717 edm::LogInfo(
"BeamSpotDipServer") <<
"sending (" << qlty <<
" | " <<
err <<
")";
731 zeit = DipTimestamp(epoch);
733 zeit = DipTimestamp();
753 }
else if (qlty ==
"UNINITIALIZED") {
760 edm::LogWarning(
"BeamSpotDipServer") <<
"exception (publishRcd): " <<
e.what();
767 strftime(mbstr,
sizeof(mbstr),
"%Y.%m.%d %H:%M:%S %z", std::localtime(&
t));
774 time_t
t =
time(
nullptr);
vector< string > parse(string line, const string &delimiter)
void CMS2LHCRF_POS(float x, float y, float z)
string getDateTime(time_t t)
std::string getDateTime()
def create(alignables, pedeDump, additionalData, outputFile, config)
void dqmEndRun(const edm::Run &, const edm::EventSetup &iSetup) override
bool readRcd(const BeamSpotOnlineObjects &bs)
std::string to_string(const V &value)
DipPublication * publicationPV
void handleException(DipPublication *publication, DipException &e) override
void publishRcd(string qlty, string err, bool pubCMS, bool fitTime)
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
long getFileSize(string filename)
void dqmEndLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
T getUntrackedParameter(std::string const &, T const &) const
void publishRcd(std::string qlty, std::string err, bool pubCMS, bool fitTime)
bool readRcd(ifstream &file)
long getFileSize(std::string filename)
DipPublication * publicationCMS
BeamSpotDipServer(const edm::ParameterSet &)
const bool publishStatErrors
void analyze(const edm::Event &e, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
time_t getLastTime(string filename)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const char * qualities[3]
std::vector< std::string > parse(std::string line, const std::string &delimiter)
Log< level::Info, false > LogInfo
DipPublication * publicationLHC
time_t getLastTime(std::string filename)
void dqmBeginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &) override
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &) override
Log< level::Warning, false > LogWarning
LuminosityBlockNumber_t luminosityBlock() const
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
void CMS2LHCRF_POS(float x, float y, float z)