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) {
87 name =
string(
"h") + itM.first + itMMM.first;
88 title = itM.first +
"_{0} " + itMMM.first;
89 if (itMM.first ==
"lumi") {
91 itMMM.second = ibooker.
book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
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 "BS Choice (+1): HLT - (-1): Legacy - (-10): Fake BS - (0): No Transient ",
114 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!";
286 if ((histo =
histosMap_[itV][itM.first][itM.second]) ==
nullptr)
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);
LuminosityBlockID id() const
math::Error< dimension >::type CovarianceMatrix
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::multimap< std::string, std::string > histoByCategoryNames_
virtual void setCurrentFolder(std::string const &fullpath)
#define DEFINE_FWK_MODULE(type)
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::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 &)
void globalEndLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
std::vector< int > processedLumis_
Log< level::Info, false > LogInfo
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
LuminosityBlockNumber_t luminosityBlock() 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)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
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)