31 : monitorName_(ps.getUntrackedParameter<
string>(
"MonitorName")),
35 numberOfValuesToSave_(0) {
62 histosMap_[itV][itM.first][itM.second] =
nullptr;
85 for (
auto& itMM : itM.second) {
86 if (itMM.first !=
"run") {
87 for (
auto& itMMM : itMM.second) {
89 title = itM.first +
"_{0} " + itMMM.first;
90 if (itMM.first ==
"lumi") {
95 LogInfo(
"OnlineBeamMonitorClient") <<
"Unrecognized category " << itMM.first;
97 if (itMMM.second !=
nullptr) {
98 if (itMMM.first.find(
'-') != string::npos) {
99 itMMM.second->setAxisTitle(
string(
"#Delta ") + itM.first +
"_{0} (cm)", 2);
101 itMMM.second->setAxisTitle(itM.first +
"_{0} (cm)", 2);
103 itMMM.second->setAxisTitle(
"Lumisection", 1);
114 "Choice between HLT (+1) and Legacy (-1) BS",
134 auto const& spotDB = *bsHLTHandle;
140 for (
int i = 0;
i < 7; ++
i) {
141 for (
int j = 0;
j < 7; ++
j) {
147 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
152 aSpot->setEmittanceX(spotDB.GetEmittanceX());
153 aSpot->setEmittanceY(spotDB.GetEmittanceY());
154 aSpot->setbetaStar(spotDB.GetBetaStar());
156 if (spotDB.GetBeamType() == 2) {
167 auto const& spotDB = *bsLegacyHandle;
172 for (
int i = 0;
i < 7; ++
i) {
173 for (
int j = 0;
j < 7; ++
j) {
179 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
184 aSpot->setEmittanceX(spotDB.GetEmittanceX());
185 aSpot->setEmittanceY(spotDB.GetEmittanceY());
186 aSpot->setbetaStar(spotDB.GetBetaStar());
188 if (spotDB.GetBeamType() == 2) {
199 auto const& spotDB = *bsTransientHandle;
205 for (
int i = 0;
i < 7; ++
i) {
206 for (
int j = 0;
j < 7; ++
j) {
212 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
217 aSpot->setEmittanceX(spotDB.GetEmittanceX());
218 aSpot->setEmittanceY(spotDB.GetEmittanceY());
219 aSpot->setbetaStar(spotDB.GetBetaStar());
221 if (spotDB.GetBeamType() == 2) {
256 map<std::string, pair<double, double> > resultsMap;
257 vector<pair<double, double> > vertexResults;
264 resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
265 }
else if (itV ==
"y") {
266 resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
267 }
else if (itV ==
"z") {
268 resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
269 }
else if (itV ==
"sigmaX") {
270 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
271 }
else if (itV ==
"sigmaY") {
272 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
273 }
else if (itV ==
"sigmaZ") {
274 resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
276 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ has been built with the name " << itV
277 <<
" that I can't recognize!";
285 if (itM.second ==
"Lumibased BeamSpotHLT") {
286 if (resultsMap.find(
"HLT") != resultsMap.end()) {
290 }
else if (itM.second ==
"Lumibased BeamSpotLegacy") {
291 if (resultsMap.find(
"Legacy") != resultsMap.end()) {
295 }
else if (itM.second ==
"Lumibased BeamSpotTransient") {
296 if (resultsMap.find(
"Transient") != resultsMap.end()) {
301 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ have a histogram named " << itM.second
302 <<
" that I can't recognize in this loop!";
313 const double bigNumber = 1000000.;
319 for (
auto& itHH : itH.second) {
320 double min = bigNumber;
321 double max = -bigNumber;
322 if (itHH.first !=
"run") {
323 for (
auto& itHHH : itHH.second) {
324 if (itHHH.second !=
nullptr) {
325 for (
int bin = 1;
bin <= itHHH.second->getTH1()->GetNbinsX();
bin++) {
326 if (itHHH.second->getTH1()->GetBinError(
bin) != 0 || itHHH.second->getTH1()->GetBinContent(
bin) != 0) {
327 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
328 itHHH.first ==
"Lumibased BeamSpotTransient") {
329 if (
min > itHHH.second->getTH1()->GetBinContent(
bin)) {
330 min = itHHH.second->getTH1()->GetBinContent(
bin);
332 if (max < itHHH.second->getTH1()->GetBinContent(
bin)) {
333 max = itHHH.second->getTH1()->GetBinContent(
bin);
336 LogInfo(
"OnlineBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH.first
337 <<
" that I can't recognize in this loop!";
343 for (
auto& itHHH : itHH.second) {
344 if (itHHH.second !=
nullptr) {
345 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
346 itHHH.first ==
"Lumibased BeamSpotTransient") {
347 if ((
max == -bigNumber &&
min == bigNumber) ||
max -
min == 0) {
348 itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
349 itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
351 itHHH.second->getTH1()->SetMinimum(
min - 0.1 * (
max -
min));
352 itHHH.second->getTH1()->SetMaximum(
max + 0.1 * (
max -
min));
355 LogInfo(
"OnlineBeamMonitorClient")
356 <<
"The histosMap_ have a histogram named " << itHHH.first <<
" that I can't recognize in this loop!";
358 itHHH.second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5,
lastLumi + 0.5);