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 ",
154 auto const& spotDB = *bsHLTHandle;
157 startTimeStampHLT_ = spotDB.startTime();
158 stopTimeStampHLT_ = spotDB.endTime();
159 lumiRangeHLT_ = spotDB.lumiRange();
165 for (
int i = 0;
i < 7; ++
i) {
166 for (
int j = 0;
j < 7; ++
j) {
176 aSpot->setEmittanceX(spotDB.emittanceX());
177 aSpot->setEmittanceY(spotDB.emittanceY());
178 aSpot->setbetaStar(spotDB.betaStar());
180 if (spotDB.beamType() == 2) {
191 auto const& spotDB = *bsLegacyHandle;
197 startTimeStampLegacy_ = spotDB.startTime();
198 stopTimeStampLegacy_ = spotDB.endTime();
199 lumiRangeLegacy_ = spotDB.lumiRange();
202 for (
int i = 0;
i < 7; ++
i) {
203 for (
int j = 0;
j < 7; ++
j) {
209 BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(),
matrix);
214 aSpot->setEmittanceX(spotDB.emittanceX());
215 aSpot->setEmittanceY(spotDB.emittanceY());
216 aSpot->setbetaStar(spotDB.betaStar());
218 if (spotDB.beamType() == 2) {
229 auto const& spotDB = *bsTransientHandle;
236 for (
int i = 0;
i < 7; ++
i) {
237 for (
int j = 0;
j < 7; ++
j) {
243 BeamSpot(apoint, spotDB.sigmaZ(), spotDB.dxdz(), spotDB.dydz(), spotDB.beamWidthX(),
matrix);
248 aSpot->setEmittanceX(spotDB.emittanceX());
249 aSpot->setEmittanceY(spotDB.emittanceY());
250 aSpot->setbetaStar(spotDB.betaStar());
251 if (spotDB.beamType() == 2) {
265 sprintf(
index,
"%s%i",
"_Run", frun);
274 startTimeStamp_ = startTimeStampHLT_;
275 stopTimeStamp_ = stopTimeStampHLT_;
276 lumiRange_ = lumiRangeHLT_;
281 startTimeStamp_ = startTimeStampLegacy_;
282 stopTimeStamp_ = stopTimeStampLegacy_;
283 lumiRange_ = lumiRangeLegacy_;
289 outFile <<
"Runnumber " << frun <<
" bx " << 0 << std::endl;
290 outFile <<
"BeginTimeOfFit " << startTimeStamp_ <<
" " << 0 << std::endl;
291 outFile <<
"EndTimeOfFit " << stopTimeStamp_ <<
" " << 0 << std::endl;
293 outFile <<
"LumiRange " << lumiRange_ << std::endl;
294 outFile <<
"Type " << aSpot->type() << std::endl;
295 outFile <<
"X0 " << aSpot->x0() << std::endl;
296 outFile <<
"Y0 " << aSpot->y0() << std::endl;
297 outFile <<
"Z0 " << aSpot->z0() << std::endl;
298 outFile <<
"sigmaZ0 " << aSpot->sigmaZ() << std::endl;
299 outFile <<
"dxdz " << aSpot->dxdz() << std::endl;
300 outFile <<
"dydz " << aSpot->dydz() << std::endl;
301 outFile <<
"BeamWidthX " << aSpot->BeamWidthX() << std::endl;
302 outFile <<
"BeamWidthY " << aSpot->BeamWidthY() << std::endl;
303 for (
int i = 0;
i < 6; ++
i) {
305 for (
int j = 0;
j < 7; ++
j) {
306 outFile << aSpot->covariance(
i,
j) <<
" ";
310 outFile <<
"Cov(6,j) 0 0 0 0 0 0 " << aSpot->covariance(6, 6) << std::endl;
311 outFile <<
"EmittanceX " << aSpot->emittanceX() << std::endl;
312 outFile <<
"EmittanceY " << aSpot->emittanceY() << std::endl;
313 outFile <<
"BetaStar " << aSpot->betaStar() << std::endl;
347 map<std::string, pair<double, double> > resultsMap;
348 vector<pair<double, double> > vertexResults;
355 resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
356 }
else if (itV ==
"y") {
357 resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
358 }
else if (itV ==
"z") {
359 resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
360 }
else if (itV ==
"sigmaX") {
361 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
362 }
else if (itV ==
"sigmaY") {
363 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
364 }
else if (itV ==
"sigmaZ") {
365 resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
367 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ has been built with the name " << itV
368 <<
" that I can't recognize!";
376 if (itM.second ==
"Lumibased BeamSpotHLT") {
377 if (resultsMap.find(
"HLT") != resultsMap.end()) {
381 }
else if (itM.second ==
"Lumibased BeamSpotLegacy") {
382 if (resultsMap.find(
"Legacy") != resultsMap.end()) {
386 }
else if (itM.second ==
"Lumibased BeamSpotTransient") {
387 if (resultsMap.find(
"Transient") != resultsMap.end()) {
392 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ have a histogram named " << itM.second
393 <<
" that I can't recognize in this loop!";
404 const double bigNumber = 1000000.;
410 for (
auto& itHH : itH.second) {
411 double min = bigNumber;
412 double max = -bigNumber;
413 if (itHH.first !=
"run") {
414 for (
auto& itHHH : itHH.second) {
415 if (itHHH.second !=
nullptr) {
416 for (
int bin = 1;
bin <= itHHH.second->getTH1()->GetNbinsX();
bin++) {
417 if (itHHH.second->getTH1()->GetBinError(
bin) != 0 || itHHH.second->getTH1()->GetBinContent(
bin) != 0) {
418 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
419 itHHH.first ==
"Lumibased BeamSpotTransient") {
420 if (
min > itHHH.second->getTH1()->GetBinContent(
bin)) {
421 min = itHHH.second->getTH1()->GetBinContent(
bin);
423 if (max < itHHH.second->getTH1()->GetBinContent(
bin)) {
424 max = itHHH.second->getTH1()->GetBinContent(
bin);
427 LogInfo(
"OnlineBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH.first
428 <<
" that I can't recognize in this loop!";
434 for (
auto& itHHH : itHH.second) {
435 if (itHHH.second !=
nullptr) {
436 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
437 itHHH.first ==
"Lumibased BeamSpotTransient") {
438 if ((
max == -bigNumber &&
min == bigNumber) ||
max -
min == 0) {
439 itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
440 itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
442 itHHH.second->getTH1()->SetMinimum(
min - 0.1 * (
max -
min));
443 itHHH.second->getTH1()->SetMaximum(
max + 0.1 * (
max -
min));
446 LogInfo(
"OnlineBeamMonitorClient")
447 <<
"The histosMap_ have a histogram named " << itHHH.first <<
" that I can't recognize in this loop!";
449 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
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
void dqmEndRun(edm::Run const &, edm::EventSetup const &) override
math::XYZPoint Point
point in the space
BeamSpotContainer beamSpotsMap_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::string outputDIPTxt_
std::vector< std::string > varNamesV_
void setBeamWidthY(double v)
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
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)