31 : monitorName_(ps.getUntrackedParameter<
string>(
"MonitorName")),
38 numberOfValuesToSave_(0) {
65 histosMap_[itV][itM.first][itM.second] =
nullptr;
88 for (
auto& itMM : itM.second) {
89 if (itMM.first !=
"run") {
90 for (
auto& itMMM : itMM.second) {
92 title = itM.first +
"_{0} " + itMMM.first;
93 if (itMM.first ==
"lumi") {
95 itMMM.second = ibooker.book1D(
name,
title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
96 itMMM.second->setEfficiencyFlag();
98 LogInfo(
"OnlineBeamMonitorClient") <<
"Unrecognized category " << itMM.first;
100 if (itMMM.second !=
nullptr) {
101 if (itMMM.first.find(
'-') != string::npos) {
102 itMMM.second->setAxisTitle(
string(
"#Delta ") + itM.first +
"_{0} (cm)", 2);
104 itMMM.second->setAxisTitle(itM.first +
"_{0} (cm)", 2);
106 itMMM.second->setAxisTitle(
"Lumisection", 1);
117 "Choice between HLT (+1) and Legacy (-1) BS",
118 lastLumi - firstLumi + 1,
137 auto const& spotDB = *bsHLTHandle;
143 for (
int i = 0;
i < 7; ++
i) {
144 for (
int j = 0;
j < 7; ++
j) {
150 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
155 aSpot->setEmittanceX(spotDB.GetEmittanceX());
156 aSpot->setEmittanceY(spotDB.GetEmittanceY());
157 aSpot->setbetaStar(spotDB.GetBetaStar());
159 if (spotDB.GetBeamType() == 2) {
170 auto const& spotDB = *bsLegacyHandle;
175 for (
int i = 0;
i < 7; ++
i) {
176 for (
int j = 0;
j < 7; ++
j) {
182 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
187 aSpot->setEmittanceX(spotDB.GetEmittanceX());
188 aSpot->setEmittanceY(spotDB.GetEmittanceY());
189 aSpot->setbetaStar(spotDB.GetBetaStar());
191 if (spotDB.GetBeamType() == 2) {
202 auto const& spotDB = *bsTransientHandle;
208 for (
int i = 0;
i < 7; ++
i) {
209 for (
int j = 0;
j < 7; ++
j) {
215 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
220 aSpot->setEmittanceX(spotDB.GetEmittanceX());
221 aSpot->setEmittanceY(spotDB.GetEmittanceY());
222 aSpot->setbetaStar(spotDB.GetBetaStar());
224 if (spotDB.GetBeamType() == 2) {
259 map<std::string, pair<double, double> > resultsMap;
260 vector<pair<double, double> > vertexResults;
267 resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
268 }
else if (itV ==
"y") {
269 resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
270 }
else if (itV ==
"z") {
271 resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
272 }
else if (itV ==
"sigmaX") {
273 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
274 }
else if (itV ==
"sigmaY") {
275 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
276 }
else if (itV ==
"sigmaZ") {
277 resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
279 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ has been built with the name " << itV
280 <<
" that I can't recognize!";
288 if (itM.second ==
"Lumibased BeamSpotHLT") {
289 if (resultsMap.find(
"HLT") != resultsMap.end()) {
293 }
else if (itM.second ==
"Lumibased BeamSpotLegacy") {
294 if (resultsMap.find(
"Legacy") != resultsMap.end()) {
298 }
else if (itM.second ==
"Lumibased BeamSpotTransient") {
299 if (resultsMap.find(
"Transient") != resultsMap.end()) {
304 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ have a histogram named " << itM.second
305 <<
" that I can't recognize in this loop!";
316 const double bigNumber = 1000000.;
320 bsChoice_->
getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5, lastLumi + 0.5);
322 for (
auto& itHH : itH.second) {
323 double min = bigNumber;
324 double max = -bigNumber;
325 if (itHH.first !=
"run") {
326 for (
auto& itHHH : itHH.second) {
327 if (itHHH.second !=
nullptr) {
328 for (
int bin = 1;
bin <= itHHH.second->getTH1()->GetNbinsX();
bin++) {
329 if (itHHH.second->getTH1()->GetBinError(
bin) != 0 || itHHH.second->getTH1()->GetBinContent(
bin) != 0) {
330 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
331 itHHH.first ==
"Lumibased BeamSpotTransient") {
332 if (
min > itHHH.second->getTH1()->GetBinContent(
bin)) {
333 min = itHHH.second->getTH1()->GetBinContent(
bin);
335 if (max < itHHH.second->getTH1()->GetBinContent(
bin)) {
336 max = itHHH.second->getTH1()->GetBinContent(
bin);
339 LogInfo(
"OnlineBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH.first
340 <<
" that I can't recognize in this loop!";
346 for (
auto& itHHH : itHH.second) {
347 if (itHHH.second !=
nullptr) {
348 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
349 itHHH.first ==
"Lumibased BeamSpotTransient") {
350 if ((
max == -bigNumber &&
min == bigNumber) ||
max -
min == 0) {
351 itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
352 itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
354 itHHH.second->getTH1()->SetMinimum(
min - 0.1 * (
max -
min));
355 itHHH.second->getTH1()->SetMaximum(
max + 0.1 * (
max -
min));
358 LogInfo(
"OnlineBeamMonitorClient")
359 <<
"The histosMap_ have a histogram named " << itHHH.first <<
" that I can't recognize in this loop!";
361 itHHH.second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5, lastLumi + 0.5);