26 monitorName_(parameters_.getUntrackedParameter<
string>(
27 "MonitorName",
"YourSubsystemName")),
28 numberOfValuesToSave_(0) {
41 pair<string, string>(
"lumi",
"Lumibased BeamSpotFit"));
43 pair<string, string>(
"lumi",
"Lumibased PrimaryVertex"));
45 pair<string, string>(
"lumi",
"Lumibased DataBase"));
47 pair<string, string>(
"lumi",
"Lumibased Scalers"));
49 pair<string, string>(
"lumi",
"Lumibased PrimaryVertex-DataBase fit"));
51 pair<string, string>(
"lumi",
"Lumibased PrimaryVertex-Scalers fit"));
53 pair<string, string>(
"validation",
"Lumibased Scalers-DataBase fit"));
55 pair<string, string>(
"validation",
"Lumibased PrimaryVertex-DataBase"));
57 pair<string, string>(
"validation",
"Lumibased PrimaryVertex-Scalers"));
59 for (vector<string>::iterator itV =
varNamesV_.begin();
63 histosMap_[*itV][itM->first][itM->second] =
nullptr;
79 for (HistosContainer::iterator itM =
histosMap_.begin();
81 for (
map<
string, map<string, MonitorElement*> >::iterator itMM =
83 itMM != itM->second.end(); itMM++) {
84 if (itMM->first !=
"run") {
85 for (map<string, MonitorElement*>::iterator itMMM =
87 itMMM != itMM->second.end(); itMMM++) {
88 if (itMMM->second !=
nullptr) {
89 if (itMM->first ==
"lumi") {
91 itMMM->second->getName());
92 }
else if (itMM->first ==
"validation") {
94 itMMM->second->getName());
96 LogInfo(
"AlcaBeamMonitorClient") <<
"Unrecognized category " 100 itMMM->second =
nullptr;
133 LogInfo(
"AlcaBeamMonitorClient")
136 "Service/hHistoLumiValues which contains all the values has not " 137 "been found in any lumi!";
146 LogInfo(
"AlcaBeamMonitorClient") <<
"End of run " << iRun.
id().
run() <<
"(" 147 << firstLumi <<
"-" << lastLumi <<
")";
152 for (HistosContainer::iterator itM =
histosMap_.begin();
154 for (
map<
string, map<string, MonitorElement*> >::iterator itMM =
156 itMM != itM->second.end(); itMM++) {
157 if (itMM->first !=
"run") {
158 for (map<string, MonitorElement*>::iterator itMMM =
159 itMM->second.begin();
160 itMMM != itMM->second.end(); itMMM++) {
161 name =
string(
"h") + itM->first + itMMM->first;
162 title = itM->first +
"_{0} " + itMMM->first;
163 if (itMM->first ==
"lumi") {
165 itMMM->second =
dbe_->book1D(name, title, lastLumi - firstLumi + 1,
166 firstLumi - 0.5, lastLumi + 0.5);
167 itMMM->second->setEfficiencyFlag();
168 }
else if (itMM->first ==
"validation" &&
169 itMMM->first ==
"Lumibased Scalers-DataBase fit") {
171 itMMM->second =
dbe_->book1D(name, title, lastLumi - firstLumi + 1,
172 firstLumi - 0.5, lastLumi + 0.5);
173 itMMM->second->setEfficiencyFlag();
174 }
else if (itMM->first ==
"validation" &&
175 itMMM->first !=
"Lumibased Scalers-DataBase fit" &&
176 (itM->first ==
"x" || itM->first ==
"y" ||
177 itM->first ==
"z")) {
179 itMMM->second =
dbe_->book1D(name, title, lastLumi - firstLumi + 1,
180 firstLumi - 0.5, lastLumi + 0.5);
181 itMMM->second->setEfficiencyFlag();
183 else if (itMM->first ==
"validation" &&
184 (itM->first ==
"sigmaX" || itM->first ==
"sigmaY" ||
185 itM->first ==
"sigmaZ")) {
187 itMMM->second =
nullptr;
189 LogInfo(
"AlcaBeamMonitorClient") <<
"Unrecognized category " 193 if (itMMM->second !=
nullptr) {
194 if (itMMM->first.find(
'-') != string::npos) {
195 itMMM->second->setAxisTitle(
196 string(
"#Delta ") + itM->first +
"_{0} (cm)", 2);
198 itMMM->second->setAxisTitle(itM->first +
"_{0} (cm)", 2);
200 itMMM->second->setAxisTitle(
"Lumisection", 1);
207 unsigned int bin = 0;
208 for (HistosContainer::iterator itH =
histosMap_.begin();
210 for (
map<
string, map<string, MonitorElement*> >::iterator itHH =
212 itHH != itH->second.end(); itHH++) {
213 for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin();
214 itHHH != itHH->second.end(); itHHH++) {
218 if (itHHH->second !=
nullptr) {
224 bin = itHHH->second->getTH1()->FindBin(itVal->first);
225 itHHH->second->setBinContent(
228 itHHH->second->setBinError(
240 const double bigNumber = 1000000.;
241 for (HistosContainer::iterator itH =
histosMap_.begin();
243 for (
map<
string, map<string, MonitorElement*> >::iterator itHH =
245 itHH != itH->second.end(); itHH++) {
246 double min = bigNumber;
247 double max = -bigNumber;
248 double minDelta = bigNumber;
252 if (itHH->first !=
"run") {
253 for (map<string, MonitorElement*>::iterator itHHH =
254 itHH->second.begin();
255 itHHH != itHH->second.end(); itHHH++) {
256 if (itHHH->second !=
nullptr) {
257 for (
int bin = 1; bin <= itHHH->second->getTH1()->GetNbinsX();
259 if (itHHH->second->getTH1()->GetBinError(bin) != 0 ||
260 itHHH->second->getTH1()->GetBinContent(bin) != 0) {
261 if (itHHH->first ==
"Lumibased BeamSpotFit" ||
262 itHHH->first ==
"Lumibased PrimaryVertex" ||
263 itHHH->first ==
"Lumibased DataBase" ||
264 itHHH->first ==
"Lumibased Scalers") {
265 if (min > itHHH->second->getTH1()->GetBinContent(bin)) {
266 min = itHHH->second->getTH1()->GetBinContent(bin);
268 if (max < itHHH->
second->getTH1()->GetBinContent(bin)) {
269 max = itHHH->second->getTH1()->GetBinContent(bin);
271 }
else if (itHHH->first ==
272 "Lumibased PrimaryVertex-DataBase fit" ||
274 "Lumibased PrimaryVertex-Scalers fit" ||
275 itHHH->first ==
"Lumibased Scalers-DataBase fit" ||
276 itHHH->first ==
"Lumibased PrimaryVertex-DataBase" ||
277 itHHH->first ==
"Lumibased PrimaryVertex-Scalers") {
278 if (minDelta > itHHH->second->getTH1()->GetBinContent(bin)) {
279 minDelta = itHHH->second->getTH1()->GetBinContent(bin);
281 if (maxDelta < itHHH->
second->getTH1()->GetBinContent(bin)) {
282 maxDelta = itHHH->second->getTH1()->GetBinContent(bin);
286 LogInfo(
"AlcaBeamMonitorClient")
287 <<
"The histosMap_ have a histogram named " 289 <<
" that I can't recognize in this loop!";
296 for (map<string, MonitorElement*>::iterator itHHH =
297 itHH->second.begin();
298 itHHH != itHH->second.end(); itHHH++) {
299 if (itHHH->second !=
nullptr) {
300 if (itHHH->first ==
"Lumibased BeamSpotFit" ||
301 itHHH->first ==
"Lumibased PrimaryVertex" ||
302 itHHH->first ==
"Lumibased DataBase" ||
303 itHHH->first ==
"Lumibased Scalers") {
304 if ((max == -bigNumber && min == bigNumber) || max - min == 0) {
305 itHHH->second->getTH1()->SetMinimum(
306 itHHH->second->getTH1()->GetMinimum() - 0.01);
307 itHHH->second->getTH1()->SetMaximum(
308 itHHH->second->getTH1()->GetMaximum() + 0.01);
310 itHHH->second->getTH1()->SetMinimum(min - 0.1 * (max - min));
311 itHHH->second->getTH1()->SetMaximum(max + 0.1 * (max - min));
313 }
else if (itHHH->first ==
"Lumibased PrimaryVertex-DataBase fit" ||
314 itHHH->first ==
"Lumibased PrimaryVertex-Scalers fit" ||
315 itHHH->first ==
"Lumibased Scalers-DataBase fit" ||
316 itHHH->first ==
"Lumibased PrimaryVertex-DataBase" ||
317 itHHH->first ==
"Lumibased PrimaryVertex-Scalers") {
318 if ((maxDelta == -bigNumber && minDelta == bigNumber) ||
319 maxDelta - minDelta == 0) {
320 itHHH->second->getTH1()->SetMinimum(
321 itHHH->second->getTH1()->GetMinimum() - 0.01);
322 itHHH->second->getTH1()->SetMaximum(
323 itHHH->second->getTH1()->GetMaximum() + 0.01);
325 itHHH->second->getTH1()->SetMinimum(minDelta -
326 2 * (maxDelta - minDelta));
327 itHHH->second->getTH1()->SetMaximum(maxDelta +
328 2 * (maxDelta - minDelta));
332 LogInfo(
"AlcaBeamMonitorClient")
333 <<
"The histosMap_ have a histogram named " << itHHH->first
334 <<
" that I can't recognize in this loop!";
LuminosityBlockID id() const
TProfile * getTProfile() const
#define DEFINE_FWK_MODULE(type)
void beginJob(void) override
PositionContainer positionsMap_
HistosContainer histosMap_
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
unsigned int LuminosityBlockNumber_t
std::multimap< std::string, std::string > histoByCategoryNames_
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override
U second(std::pair< T, U > const &p)
void endRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
int numberOfValuesToSave_
bin
set the eta bin as selection string.
~AlcaBeamMonitorClient() override
LuminosityBlockNumber_t luminosityBlock() const
AlcaBeamMonitorClient(const edm::ParameterSet &)
std::vector< std::vector< double > > tmp
std::map< edm::LuminosityBlockNumber_t, std::vector< double > > valuesMap_
std::vector< std::string > varNamesV_
void endLuminosityBlock(const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override