31 : monitorName_(ps.getUntrackedParameter<
string>(
"MonitorName")),
35 numberOfValuesToSave_(0) {
62 histosMap_[itV][itM.first][itM.second] =
nullptr;
84 for (
auto& itMM : itM.second) {
85 if (itMM.first !=
"run") {
86 for (
auto& itMMM : itMM.second) {
88 title = itM.first +
"_{0} " + itMMM.first;
89 if (itMM.first ==
"lumi") {
94 LogInfo(
"OnlineBeamMonitorClient") <<
"Unrecognized category " << itMM.first;
96 if (itMMM.second !=
nullptr) {
97 if (itMMM.first.find(
'-') != string::npos) {
98 itMMM.second->setAxisTitle(
string(
"#Delta ") + itM.first +
"_{0} (cm)", 2);
100 itMMM.second->setAxisTitle(itM.first +
"_{0} (cm)", 2);
102 itMMM.second->setAxisTitle(
"Lumisection", 1);
113 "Choice between HLT (+1) and Legacy (-1) BS",
133 auto const& spotDB = *bsHLTHandle;
139 for (
int i = 0;
i < 7; ++
i) {
140 for (
int j = 0;
j < 7; ++
j) {
146 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
151 aSpot->setEmittanceX(spotDB.GetEmittanceX());
152 aSpot->setEmittanceY(spotDB.GetEmittanceY());
153 aSpot->setbetaStar(spotDB.GetBetaStar());
155 if (spotDB.GetBeamType() == 2) {
166 auto const& spotDB = *bsLegacyHandle;
171 for (
int i = 0;
i < 7; ++
i) {
172 for (
int j = 0;
j < 7; ++
j) {
178 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
183 aSpot->setEmittanceX(spotDB.GetEmittanceX());
184 aSpot->setEmittanceY(spotDB.GetEmittanceY());
185 aSpot->setbetaStar(spotDB.GetBetaStar());
187 if (spotDB.GetBeamType() == 2) {
198 auto const& spotDB = *bsTransientHandle;
204 for (
int i = 0;
i < 7; ++
i) {
205 for (
int j = 0;
j < 7; ++
j) {
211 BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(),
matrix);
216 aSpot->setEmittanceX(spotDB.GetEmittanceX());
217 aSpot->setEmittanceY(spotDB.GetEmittanceY());
218 aSpot->setbetaStar(spotDB.GetBetaStar());
220 if (spotDB.GetBeamType() == 2) {
255 map<std::string, pair<double, double> > resultsMap;
256 vector<pair<double, double> > vertexResults;
263 resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
264 }
else if (itV ==
"y") {
265 resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
266 }
else if (itV ==
"z") {
267 resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
268 }
else if (itV ==
"sigmaX") {
269 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
270 }
else if (itV ==
"sigmaY") {
271 resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
272 }
else if (itV ==
"sigmaZ") {
273 resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
275 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ has been built with the name " << itV
276 <<
" that I can't recognize!";
284 if (itM.second ==
"Lumibased BeamSpotHLT") {
285 if (resultsMap.find(
"HLT") != resultsMap.end()) {
289 }
else if (itM.second ==
"Lumibased BeamSpotLegacy") {
290 if (resultsMap.find(
"Legacy") != resultsMap.end()) {
294 }
else if (itM.second ==
"Lumibased BeamSpotTransient") {
295 if (resultsMap.find(
"Transient") != resultsMap.end()) {
300 LogInfo(
"OnlineBeamMonitor") <<
"The histosMap_ have a histogram named " << itM.second
301 <<
" that I can't recognize in this loop!";
312 const double bigNumber = 1000000.;
318 for (
auto& itHH : itH.second) {
319 double min = bigNumber;
320 double max = -bigNumber;
321 if (itHH.first !=
"run") {
322 for (
auto& itHHH : itHH.second) {
323 if (itHHH.second !=
nullptr) {
324 for (
int bin = 1;
bin <= itHHH.second->getTH1()->GetNbinsX();
bin++) {
325 if (itHHH.second->getTH1()->GetBinError(
bin) != 0 || itHHH.second->getTH1()->GetBinContent(
bin) != 0) {
326 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
327 itHHH.first ==
"Lumibased BeamSpotTransient") {
328 if (
min > itHHH.second->getTH1()->GetBinContent(
bin)) {
329 min = itHHH.second->getTH1()->GetBinContent(
bin);
331 if (max < itHHH.second->getTH1()->GetBinContent(
bin)) {
332 max = itHHH.second->getTH1()->GetBinContent(
bin);
335 LogInfo(
"OnlineBeamMonitorClient") <<
"The histosMap_ have a histogram named " << itHHH.first
336 <<
" that I can't recognize in this loop!";
342 for (
auto& itHHH : itHH.second) {
343 if (itHHH.second !=
nullptr) {
344 if (itHHH.first ==
"Lumibased BeamSpotHLT" || itHHH.first ==
"Lumibased BeamSpotLegacy" ||
345 itHHH.first ==
"Lumibased BeamSpotTransient") {
346 if ((
max == -bigNumber &&
min == bigNumber) ||
max -
min == 0) {
347 itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
348 itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
350 itHHH.second->getTH1()->SetMinimum(
min - 0.1 * (
max -
min));
351 itHHH.second->getTH1()->SetMaximum(
max + 0.1 * (
max -
min));
354 LogInfo(
"OnlineBeamMonitorClient")
355 <<
"The histosMap_ have a histogram named " << itHHH.first <<
" that I can't recognize in this loop!";
357 itHHH.second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5,
lastLumi + 0.5);