33 monitorName_(parameters_.getUntrackedParameter<
string>(
"MonitorName",
"YourSubsystemName")),
37 scalerLabel_(consumes<
BeamSpot>(parameters_.getUntrackedParameter<
InputTag>(
"ScalerLabel"))),
38 beamSpotLabel_(parameters_.getUntrackedParameter<
InputTag>(
"BeamSpotLabel")),
39 numberOfValuesToSave_(0) {
79 if (itM->first ==
"run") {
80 histosMap_[*itV][itM->first][itM->second] =
nullptr;
114 for (map<string, MonitorElement*>::iterator itMM = itM->second[
"run"].begin(); itMM != itM->second[
"run"].end();
116 name =
string(
"h") + itM->first + itMM->first;
117 title = itM->first +
"_{0} " + itMM->first;
118 if (itM->first ==
"x" || itM->first ==
"y") {
119 if (itMM->first ==
"Coordinate") {
120 itMM->second = ibooker.book1D(
name,
title, 1001, -0.2525, 0.2525);
121 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
122 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
123 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
124 itMM->second = ibooker.book1D(
name,
title, 1001, -0.02525, 0.02525);
128 }
else if (itM->first ==
"z") {
129 if (itMM->first ==
"Coordinate") {
130 itMM->second = ibooker.book1D(
name,
title, 101, -5.05, 5.05);
131 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
132 itMM->first ==
"PrimaryVertex fit-Scalers") {
133 itMM->second = ibooker.book1D(
name,
title, 101, -0.505, 0.505);
134 }
else if (itMM->first ==
"PrimaryVertex-DataBase" || itMM->first ==
"PrimaryVertex-BeamFit" ||
135 itMM->first ==
"PrimaryVertex-Scalers") {
136 itMM->second = ibooker.book1D(
name,
title, 1001, -5.005, 5.005);
140 }
else if (itM->first ==
"sigmaX" || itM->first ==
"sigmaY") {
141 if (itMM->first ==
"Coordinate") {
142 itMM->second = ibooker.book1D(
name,
title, 100, 0, 0.015);
143 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
144 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
145 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
146 itMM->second =
nullptr;
150 }
else if (itM->first ==
"sigmaZ") {
151 if (itMM->first ==
"Coordinate") {
152 itMM->second = ibooker.book1D(
name,
title, 110, 0, 11);
153 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
154 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
155 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
156 itMM->second = ibooker.book1D(
name,
title, 101, -5.05, 5.05);
163 if (itMM->second !=
nullptr) {
164 if (itMM->first ==
"Coordinate") {
165 itMM->second->setAxisTitle(itM->first +
"_{0} (cm)", 1);
166 }
else if (itMM->first ==
"PrimaryVertex fit-DataBase" || itMM->first ==
"PrimaryVertex fit-BeamFit" ||
167 itMM->first ==
"PrimaryVertex fit-Scalers" || itMM->first ==
"PrimaryVertex-DataBase" ||
168 itMM->first ==
"PrimaryVertex-BeamFit" || itMM->first ==
"PrimaryVertex-Scalers") {
169 itMM->second->setAxisTitle(itMM->first +
" " + itM->first +
"_{0} (cm)", 1);
171 itMM->second->setAxisTitle(
"Entries", 2);
192 hD0Phi0_ = ibooker.bookProfile(
"hD0Phi0",
"d_{0} vs. #phi_{0} (All Tracks)", 63, -3.15, 3.15, 100, -0.5, 0.5,
"");
197 hDxyBS_ = ibooker.book1D(
"hDxyBS",
"dxy_{0} w.r.t. Beam spot (All Tracks)", 100, -0.1, 0.1);
224 for (
int i = 0;
i < 7; ++
i) {
225 for (
int j = 0;
j < 7; ++
j) {
248 LogInfo(
"AlcaBeamMonitor") <<
"Database BeamSpot is not valid at lumi: " <<
iLumi.id().luminosityBlock();
310 map<std::string, pair<double, double> > resultsMap;
311 vector<pair<double, double> > vertexResults;
319 resultsMap[itBS->first] = pair<double, double>(itBS->second.x0(), itBS->second.x0Error());
320 }
else if (*itV ==
"y") {
321 resultsMap[itBS->first] = pair<double, double>(itBS->second.y0(), itBS->second.y0Error());
322 }
else if (*itV ==
"z") {
323 resultsMap[itBS->first] = pair<double, double>(itBS->second.z0(), itBS->second.z0Error());
324 }
else if (*itV ==
"sigmaX") {
325 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthX(), itBS->second.BeamWidthXError());
326 }
else if (*itV ==
"sigmaY") {
327 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthY(), itBS->second.BeamWidthYError());
328 }
else if (*itV ==
"sigmaZ") {
329 resultsMap[itBS->first] = pair<double, double>(itBS->second.sigmaZ(), itBS->second.sigmaZ0Error());
331 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
332 <<
" that I can't recognize!";
337 vertexResults.clear();
338 for (vector<VertexCollection>::iterator itPV =
vertices_.begin(); itPV !=
vertices_.end(); itPV++) {
339 if (!itPV->empty()) {
340 for (VertexCollection::const_iterator
pv = itPV->begin();
pv != itPV->end();
pv++) {
341 if (
pv->isFake() ||
pv->tracksSize() < 10)
344 vertexResults.push_back(pair<double, double>(
pv->x(),
pv->xError()));
345 }
else if (*itV ==
"y") {
346 vertexResults.push_back(pair<double, double>(
pv->y(),
pv->yError()));
347 }
else if (*itV ==
"z") {
348 vertexResults.push_back(pair<double, double>(
pv->z(),
pv->zError()));
349 }
else if (*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ") {
350 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
351 <<
" that I can't recognize!";
378 if (itM->first ==
"run" && (
histo =
histosMap_[*itV][itM->first][itM->second]) ==
nullptr) {
380 }
else if (itM->first !=
"run") {
383 if (itM->second ==
"Coordinate") {
387 }
else if (itM->second ==
"PrimaryVertex fit-DataBase") {
388 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
391 }
else if (itM->second ==
"PrimaryVertex fit-BeamFit") {
392 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
395 }
else if (itM->second ==
"PrimaryVertex fit-Scalers") {
396 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
399 }
else if (itM->second ==
"PrimaryVertex-DataBase") {
400 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
401 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
403 histo->Fill(itPV->first - resultsMap[
"DB"].first);
406 }
else if (itM->second ==
"PrimaryVertex-BeamFit") {
407 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
408 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
410 histo->Fill(itPV->first - resultsMap[
"BF"].first);
413 }
else if (itM->second ==
"PrimaryVertex-Scalers") {
414 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
415 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
417 histo->Fill(itPV->first - resultsMap[
"SC"].first);
420 }
else if (itM->second ==
"Lumibased BeamSpotFit") {
421 if (resultsMap.find(
"BF") != resultsMap.end()) {
426 }
else if (itM->second ==
"Lumibased PrimaryVertex") {
427 if (resultsMap.find(
"PV") != resultsMap.end()) {
432 }
else if (itM->second ==
"Lumibased DataBase") {
433 if (resultsMap.find(
"DB") != resultsMap.end()) {
438 }
else if (itM->second ==
"Lumibased Scalers") {
439 if (resultsMap.find(
"SC") != resultsMap.end()) {
444 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase fit") {
445 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
452 }
else if (itM->second ==
"Lumibased PrimaryVertex-Scalers fit") {
453 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
460 }
else if (itM->second ==
"Lumibased Scalers-DataBase fit") {
461 if (resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
468 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase") {
469 if (resultsMap.find(
"DB") != resultsMap.end() && !vertexResults.empty()) {
470 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
489 }
else if (itM->second ==
"Lumibased PrimaryVertex-Scalers") {
490 if (resultsMap.find(
"SC") != resultsMap.end() && !vertexResults.empty()) {
491 for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
517 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ have a histogram named " << itM->second
518 <<
" that I can't recognize in this loop!";