330 auto beamSpotInfo = luminosityBlockCache(
iLumi.index());
340 beamSpotInfo->beamSpotMap_[
"PV"] =
thePVFitter_->getBeamSpot();
345 map<std::string, pair<double, double> > resultsMap;
346 vector<pair<double, double> > vertexResults;
350 for (BeamSpotContainer::iterator itBS = beamSpotInfo->beamSpotMap_.begin();
351 itBS != beamSpotInfo->beamSpotMap_.end();
355 resultsMap[itBS->first] = pair<double, double>(itBS->second.x0(), itBS->second.x0Error());
356 }
else if (*itV ==
"y") {
357 resultsMap[itBS->first] = pair<double, double>(itBS->second.y0(), itBS->second.y0Error());
358 }
else if (*itV ==
"z") {
359 resultsMap[itBS->first] = pair<double, double>(itBS->second.z0(), itBS->second.z0Error());
360 }
else if (*itV ==
"sigmaX") {
361 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthX(), itBS->second.BeamWidthXError());
362 }
else if (*itV ==
"sigmaY") {
363 resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthY(), itBS->second.BeamWidthYError());
364 }
else if (*itV ==
"sigmaZ") {
365 resultsMap[itBS->first] = pair<double, double>(itBS->second.sigmaZ(), itBS->second.sigmaZ0Error());
367 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
368 <<
" that I can't recognize!";
373 vertexResults.clear();
375 for (
const auto& itPV : beamSpotInfo->vertices_) {
376 for (
const auto&
pv : itPV) {
378 vertexResults.push_back(
pv.xWithError());
379 }
else if (*itV ==
"y") {
380 vertexResults.push_back(
pv.yWithError());
381 }
else if (*itV ==
"z") {
382 vertexResults.push_back(
pv.zWithError());
383 }
else if (*itV !=
"sigmaX" && *itV !=
"sigmaY" && *itV !=
"sigmaZ") {
384 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ has been built with the name " << *itV
385 <<
" that I can't recognize!";
395 if (itM->second ==
"Coordinate") {
396 if (beamSpotInfo->beamSpotMap_.find(
"DB") != beamSpotInfo->beamSpotMap_.end()) {
399 }
else if (itM->second ==
"PrimaryVertex fit-DataBase") {
400 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
403 }
else if (itM->second ==
"PrimaryVertex fit-BeamFit") {
404 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
407 }
else if (itM->second ==
"PrimaryVertex fit-Online") {
408 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
411 }
else if (itM->second ==
"PrimaryVertex-DataBase") {
412 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
413 for (
vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
415 histo->Fill(itPV->first - resultsMap[
"DB"].first);
418 }
else if (itM->second ==
"PrimaryVertex-BeamFit") {
419 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"BF") != resultsMap.end()) {
420 for (
vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
422 histo->Fill(itPV->first - resultsMap[
"BF"].first);
425 }
else if (itM->second ==
"PrimaryVertex-Online") {
426 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
427 for (
vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
429 histo->Fill(itPV->first - resultsMap[
"SC"].first);
432 }
else if (itM->second ==
"Lumibased BeamSpotFit") {
433 if (resultsMap.find(
"BF") != resultsMap.end()) {
434 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"BF"].first);
435 histo->setBinError(
iLumi.id().luminosityBlock(), resultsMap[
"BF"].second);
437 }
else if (itM->second ==
"Lumibased PrimaryVertex") {
438 if (resultsMap.find(
"PV") != resultsMap.end()) {
439 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"PV"].first);
440 histo->setBinError(
iLumi.id().luminosityBlock(), resultsMap[
"PV"].second);
442 }
else if (itM->second ==
"Lumibased DataBase") {
443 if (resultsMap.find(
"DB") != resultsMap.end()) {
444 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"DB"].first);
445 histo->setBinError(
iLumi.id().luminosityBlock(), resultsMap[
"DB"].second);
447 }
else if (itM->second ==
"Lumibased Online") {
448 if (resultsMap.find(
"SC") != resultsMap.end()) {
449 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"SC"].first);
450 histo->setBinError(
iLumi.id().luminosityBlock(), resultsMap[
"SC"].second);
452 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase fit") {
453 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
454 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"PV"].first - resultsMap[
"DB"].first);
455 histo->setBinError(
iLumi.id().luminosityBlock(),
458 }
else if (itM->second ==
"Lumibased PrimaryVertex-Online fit") {
459 if (resultsMap.find(
"PV") != resultsMap.end() && resultsMap.find(
"SC") != resultsMap.end()) {
460 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"PV"].first - resultsMap[
"SC"].first);
461 histo->setBinError(
iLumi.id().luminosityBlock(),
464 }
else if (itM->second ==
"Lumibased Online-DataBase fit") {
465 if (resultsMap.find(
"SC") != resultsMap.end() && resultsMap.find(
"DB") != resultsMap.end()) {
466 histo->setBinContent(
iLumi.id().luminosityBlock(), resultsMap[
"SC"].first - resultsMap[
"DB"].first);
467 histo->setBinError(
iLumi.id().luminosityBlock(),
470 }
else if (itM->second ==
"Lumibased PrimaryVertex-DataBase") {
471 if (resultsMap.find(
"DB") != resultsMap.end() && !vertexResults.empty()) {
472 for (
vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
474 histo->setBinContent(
iLumi.id().luminosityBlock(), (*itPV).first - resultsMap[
"DB"].first);
475 histo->setBinError(
iLumi.id().luminosityBlock(),
479 }
else if (itM->second ==
"Lumibased PrimaryVertex-Online") {
480 if (resultsMap.find(
"SC") != resultsMap.end() && !vertexResults.empty()) {
481 for (
vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
483 histo->setBinContent(
iLumi.id().luminosityBlock(), (*itPV).first - resultsMap[
"SC"].first);
484 histo->setBinError(
iLumi.id().luminosityBlock(),
495 LogInfo(
"AlcaBeamMonitor") <<
"The histosMap_ have a histogram named " << itM->second
496 <<
" that I can't recognize in this loop!";
std::multimap< std::string, std::string > histoByCategoryNames_
U second(std::pair< T, U > const &p)
std::vector< std::string > varNamesV_
std::vector< int > processedLumis_
Log< level::Info, false > LogInfo
std::unique_ptr< PVFitter > thePVFitter_
std::unique_ptr< BeamFitter > theBeamFitter_
HistosContainer histosMap_
Power< A, B >::type pow(const A &a, const B &b)