30 : monitorName_(ps.getUntrackedParameter<
string>(
"MonitorName")),
34 numberOfValuesToSave_(0),
35 appendRunTxt_(ps.getUntrackedParameter<
bool>(
"AppendRunToFileName")),
36 writeDIPTxt_(ps.getUntrackedParameter<
bool>(
"WriteDIPAscii")),
37 outputDIPTxt_(ps.getUntrackedParameter<
std::
string>(
"DIPFileName")) {
64 histosMap_[itV][itM.first][itM.second] =
nullptr;
90 for (
auto& itMM : itM.second) {
91 if (itMM.first !=
"run") {
92 for (
auto& itMMM : itMM.second) {
94 title = itM.first +
"_{0} " + itMMM.first;
95 if (itMM.first ==
"lumi") {
100 LogInfo(
"OnlineBeamMonitorClient") <<
"Unrecognized category " << itMM.first;
102 if (itMMM.second !=
nullptr) {
103 if (itMMM.first.find(
'-') != string::npos) {
104 itMMM.second->setAxisTitle(
string(
"#Delta ") + itM.first +
"_{0} (cm)", 2);
106 itMMM.second->setAxisTitle(itM.first +
"_{0} (cm)", 2);
108 itMMM.second->setAxisTitle(
"Lumisection", 1);
119 "BS Choice (+1): HLT - (-1): Legacy - (-10): Fake BS - (0): No Transient ",
138 template <
typename T,
class Except,
class Func,
class Response>
141 LogDebug(
"BeamSpotOnlineParameters") <<
"I have tried" << std::endl;
143 }
catch (Except&
e) {
144 LogDebug(
"BeamSpotOnlineParameters") <<
"I have caught!" << std::endl;
146 return static_cast<T>(
"-999");
164 return m_payload.startTime();
166 return m_payload.endTime();
168 return m_payload.lumiRange();
197 auto const& spotDB = *bsHLTHandle;
211 for (
int i = 0;
i < 7; ++
i) {
212 for (
int j = 0;
j < 7; ++
j) {
222 aSpot->setEmittanceX(spotDB.emittanceX());
223 aSpot->setEmittanceY(spotDB.emittanceY());
224 aSpot->setbetaStar(spotDB.betaStar());
226 if (spotDB.beamType() == 2) {
237 auto const& spotDB = *bsLegacyHandle;
243 startTimeStampLegacy_ =
245 stopTimeStampLegacy_ =
251 for (
int i = 0;
i < 7; ++
i) {
252 for (
int j = 0;
j < 7; ++
j) {
258 BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(),
matrix);
263 aSpot->setEmittanceX(spotDB.emittanceX());
264 aSpot->setEmittanceY(spotDB.emittanceY());
265 aSpot->setbetaStar(spotDB.betaStar());
267 if (spotDB.beamType() == 2) {
278 auto const& spotDB = *bsTransientHandle;
285 for (
int i = 0;
i < 7; ++
i) {
286 for (
int j = 0;
j < 7; ++
j) {
292 BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(),
matrix);
297 aSpot->setEmittanceX(spotDB.emittanceX());
298 aSpot->setEmittanceY(spotDB.emittanceY());
299 aSpot->setbetaStar(spotDB.betaStar());
300 if (spotDB.beamType() == 2) {
314 sprintf(
index,
"%s%i",
"_Run", frun);
323 startTimeStamp_ = startTimeStampHLT_;
324 stopTimeStamp_ = stopTimeStampHLT_;
325 lumiRange_ = lumiRangeHLT_;
330 startTimeStamp_ = startTimeStampLegacy_;
331 stopTimeStamp_ = stopTimeStampLegacy_;
332 lumiRange_ = lumiRangeLegacy_;
338 outFile <<
"Runnumber " << frun <<
" bx " << 0 << std::endl;
339 outFile <<
"BeginTimeOfFit " << startTimeStamp_ <<
" " << 0 << std::endl;
340 outFile <<
"EndTimeOfFit " << stopTimeStamp_ <<
" " << 0 << std::endl;
342 outFile <<
"LumiRange " << lumiRange_ << std::endl;
343 outFile <<
"Type " << aSpot->type() << std::endl;
344 outFile <<
"X0 " << aSpot->x0() << std::endl;
345 outFile <<
"Y0 " << aSpot->y0() << std::endl;
346 outFile <<
"Z0 " << aSpot->z0() << std::endl;
347 outFile <<
"sigmaZ0 " << aSpot->sigmaZ() << std::endl;
348 outFile <<
"dxdz " << aSpot->dxdz() << std::endl;
349 outFile <<
"dydz " << aSpot->dydz() << std::endl;
350 outFile <<
"BeamWidthX " << aSpot->BeamWidthX() << std::endl;
351 outFile <<
"BeamWidthY " << aSpot->BeamWidthY() << std::endl;
352 for (
int i = 0;
i < 6; ++
i) {
354 for (
int j = 0;
j < 7; ++
j) {
355 outFile << aSpot->covariance(
i,
j) <<
" ";
359 outFile <<
"Cov(6,j) 0 0 0 0 0 0 " << aSpot->covariance(6, 6) << std::endl;
360 outFile <<
"EmittanceX " << aSpot->emittanceX() << std::endl;
361 outFile <<
"EmittanceY " << aSpot->emittanceY() << std::endl;
362 outFile <<
"BetaStar " << aSpot->betaStar() << std::endl;
396 map<std::string, pair<double, double> > resultsMap;
397 vector<pair<double, double> > vertexResults;
404 resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
405 }
else if (itV ==
"y") {
406 resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
407 }
else if (itV ==
"z") {
408 resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
409 }
else if (itV ==
"sigmaX") {
410 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
411 }
else if (itV ==
"sigmaY") {
412 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
413 }
else if (itV ==
"sigmaZ") {
414 resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
416 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ has been built with the name " << itV
417 <<
" that I can't recognize!";
425 if (itM.second ==
"Lumibased BeamSpotHLT") {
426 if (resultsMap.find(
"HLT") != resultsMap.end()) {
430 }
else if (itM.second ==
"Lumibased BeamSpotLegacy") {
431 if (resultsMap.find(
"Legacy") != resultsMap.end()) {
435 }
else if (itM.second ==
"Lumibased BeamSpotTransient") {
436 if (resultsMap.find(
"Transient") != resultsMap.end()) {
441 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ have a histogram named " << itM.second
442 <<
" that I can't recognize in this loop!";
453 const double bigNumber = 1000000.;
459 for (
auto& itHH : itH.second) {
460 double min = bigNumber;
461 double max = -bigNumber;
462 if (itHH.first !=
"run") {
463 for (
auto& itHHH : itHH.second) {
464 if (itHHH.second !=
nullptr) {
465 for (
int bin = 1;
bin <= itHHH.second->getTH1()->GetNbinsX();
bin++) {
466 if (itHHH.second->getTH1()->GetBinError(
bin) != 0 || itHHH.second->getTH1()->GetBinContent(
bin) != 0) {
467 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
468 itHHH.first ==
"Lumibased BeamSpotTransient") {
469 if (
min > itHHH.second->getTH1()->GetBinContent(
bin)) {
470 min = itHHH.second->getTH1()->GetBinContent(
bin);
472 if (max < itHHH.second->getTH1()->GetBinContent(
bin)) {
473 max = itHHH.second->getTH1()->GetBinContent(
bin);
476 LogInfo(
"OnlineBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH.first
477 <<
" that I can't recognize in this loop!";
483 for (
auto& itHHH : itHH.second) {
484 if (itHHH.second !=
nullptr) {
485 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
486 itHHH.first ==
"Lumibased BeamSpotTransient") {
487 if ((
max == -bigNumber &&
min == bigNumber) ||
max -
min == 0) {
488 itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
489 itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
491 itHHH.second->getTH1()->SetMinimum(
min - 0.1 * (
max -
min));
492 itHHH.second->getTH1()->SetMaximum(
max + 0.1 * (
max -
min));
495 LogInfo(
"OnlineBeamMonitorClient")
496 <<
"The histosMap_ have a histogram named " << itHHH.first <<
" that I can't recognize in this loop!";
498 itHHH.second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5,
lastLumi + 0.5);
math::Error< dimension >::type CovarianceMatrix
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
LuminosityBlockNumber_t luminosityBlock() const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::multimap< std::string, std::string > histoByCategoryNames_
virtual void setCurrentFolder(std::string const &fullpath)
Run const & getRun() const
ret
prodAgent to be discontinued
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
void dqmEndRun(edm::Run const &, edm::EventSetup const &) override
math::XYZPoint Point
point in the space
Log< level::Error, false > LogError
BeamSpotContainer beamSpotsMap_
std::function< std::string(BSparameters, BeamSpotOnlineObjects)> myStringFunctor
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::string outputDIPTxt_
std::vector< std::string > varNamesV_
void setBeamWidthY(double v)
T try_(Func f, Response r)
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
OnlineBeamMonitor(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
void globalEndLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
std::vector< int > processedLumis_
Log< level::Info, false > LogInfo
LuminosityBlockID id() const
static void print_error(const std::exception &e)
MonitorElement * bsChoice_
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > bsHLTToken_
static void fillDescriptions(edm::ConfigurationDescriptions &)
HistosContainer histosMap_
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd > bsTransientToken_
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::shared_ptr< onlinebeammonitor::NoCache > globalBeginLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) const override
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)