Skip to content

Commit 21fb68d

Browse files
committed
Updated logging categories in the AlignmentGlobal plugins.
1 parent 9e64eea commit 21fb68d

File tree

2 files changed

+62
-57
lines changed

2 files changed

+62
-57
lines changed

CalibPPS/AlignmentGlobal/plugins/PPSAlignmentHarvester.cc

Lines changed: 60 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ PPSAlignmentHarvester::PPSAlignmentHarvester(const edm::ParameterSet& iConfig)
162162
debugFile_ = std::make_unique<TFile>("debug_harvester.root", "recreate");
163163
}
164164

165-
edm::LogInfo("PPS").log([&](auto& li) {
166-
li << "[harvester] parameters:\n";
165+
edm::LogInfo("PPSAlignmentHarvester").log([&](auto& li) {
166+
li << "parameters:\n";
167167
li << "* dqm_dir: " << dqmDir_ << "\n";
168168
li << "* sequence:\n";
169169
for (unsigned int i = 0; i < sequence_.size(); i++) {
@@ -224,8 +224,8 @@ void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker& iBooker,
224224
sh_x_map_[rpc.id_] = rpc.sh_x_;
225225
}
226226
}
227-
edm::LogInfo("PPS").log([&](auto& li) {
228-
li << "[harvester] Setting sh_x from config of:\n";
227+
edm::LogInfo("PPSAlignmentHarvester").log([&](auto& li) {
228+
li << "Setting sh_x from config of:\n";
229229
for (const auto& sc : {cfg.sectorConfig45(), cfg.sectorConfig56()}) {
230230
for (const auto& rpc : {sc.rp_N_, sc.rp_F_}) {
231231
li << " " << rpc.name_ << " to " << std::fixed << std::setprecision(3) << rpc.sh_x_;
@@ -247,7 +247,7 @@ void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker& iBooker,
247247
yAlignment(iBooker, iGetter, cfg);
248248
doYAli = true;
249249
} else
250-
edm::LogError("PPS") << "[harvester] " << aliMethod << " is a wrong method name.";
250+
edm::LogError("PPSAlignmentHarvester") << aliMethod << " is a wrong method name.";
251251
seqPos++;
252252
}
253253

@@ -295,25 +295,25 @@ void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker& iBooker,
295295
auto& rpResults = finalResults.getRPCorrection(rpc.id_);
296296

297297
if (!(xCorrRange_.first <= rpResults.getShX() && rpResults.getShX() <= xCorrRange_.second)) {
298-
edm::LogWarning("PPS") << "The horizontal shift of " << rpc.name_ << " (" << std::fixed << std::setw(9)
299-
<< std::setprecision(1) << rpResults.getShX() * 1000.
300-
<< " um) outside of the reasonability range. Setting it to 0.";
298+
edm::LogWarning("PPSAlignmentHarvester")
299+
<< "The horizontal shift of " << rpc.name_ << " (" << std::fixed << std::setw(9) << std::setprecision(1)
300+
<< rpResults.getShX() * 1000. << " um) outside of the reasonability range. Setting it to 0.";
301301
rpResults.setShX(0.);
302302
rpResults.setShXUnc(0.);
303303
}
304304

305305
if (!(yCorrRange_.first <= rpResults.getShY() && rpResults.getShY() <= yCorrRange_.second)) {
306-
edm::LogWarning("PPS") << " The vertical shift of " << rpc.name_ << " (" << std::fixed << std::setw(9)
307-
<< std::setprecision(1) << rpResults.getShY() * 1000.
308-
<< " um) outside of the reasonability range. Setting it to 0.";
306+
edm::LogWarning("PPSAlignmentHarvester")
307+
<< "The vertical shift of " << rpc.name_ << " (" << std::fixed << std::setw(9) << std::setprecision(1)
308+
<< rpResults.getShY() * 1000. << " um) outside of the reasonability range. Setting it to 0.";
309309
rpResults.setShY(0.);
310310
rpResults.setShYUnc(0.);
311311
}
312312
}
313313
}
314314

315315
// print the text results
316-
edm::LogInfo("PPS") << "final merged results:\n" << finalResults;
316+
edm::LogInfo("PPSAlignmentHarvester") << "final merged results:\n" << finalResults;
317317

318318
if (textResultsFile_.is_open()) {
319319
textResultsFile_ << "final merged results:\n" << finalResults;
@@ -325,7 +325,8 @@ void PPSAlignmentHarvester::dqmEndRun(DQMStore::IBooker& iBooker,
325325
if (poolDbService.isAvailable()) {
326326
poolDbService->writeOneIOV(finalResults, poolDbService->currentTime(), "CTPPSRPAlignmentCorrectionsDataRcd");
327327
} else {
328-
edm::LogWarning("PPS") << "Could not store the results in a DB object. PoolDBService not available.";
328+
edm::LogWarning("PPSAlignmentHarvester")
329+
<< "Could not store the results in a DB object. PoolDBService not available.";
329330
}
330331
}
331332

@@ -394,7 +395,7 @@ std::unique_ptr<TGraphErrors> PPSAlignmentHarvester::buildGraphFromMonitorElemen
394395
// collect "p_y_diffFN_vs_y" corresponding to found "h_y"
395396
auto* p_y_diffFN_vs_y_monitor = iGetter.get(parentPath + "p_y_diffFN_vs_y");
396397
if (p_y_diffFN_vs_y_monitor == nullptr) {
397-
edm::LogWarning("PPS") << "[x_alignment] could not find p_y_diffFN_vs_y in: " << parentPath;
398+
edm::LogWarning("PPSAlignmentHarvester") << "[x_alignment] could not find p_y_diffFN_vs_y in: " << parentPath;
398399
continue;
399400
}
400401
TProfile* p_y_diffFN_vs_y = p_y_diffFN_vs_y_monitor->getTProfile();
@@ -435,9 +436,10 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker& iBooker,
435436
const auto range_test = cfg.alignment_x_meth_o_ranges().at(rpc.id_);
436437

437438
// print config
438-
edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] "
439-
<< "ref: x_min = " << range_ref.x_min_ << ", x_max = " << range_ref.x_max_ << "\n"
440-
<< "test: x_min = " << range_test.x_min_ << ", x_max = " << range_test.x_max_;
439+
edm::LogInfo("PPSAlignmentHarvester") << std::fixed << std::setprecision(3) << "[x_alignment] "
440+
<< "ref: x_min = " << range_ref.x_min_ << ", x_max = " << range_ref.x_max_
441+
<< "\n"
442+
<< "test: x_min = " << range_test.x_min_ << ", x_max = " << range_test.x_max_;
441443

442444
// make spline from g_ref
443445
auto s_ref = std::make_unique<TSpline3>("s_ref", g_ref->GetX(), g_ref->GetY(), g_ref->GetN());
@@ -520,8 +522,8 @@ void PPSAlignmentHarvester::doMatch(DQMStore::IBooker& iBooker,
520522
sh_best_unc = 1. / sqrt(ff_pol2->GetParameter(2));
521523

522524
// print results
523-
edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] "
524-
<< "sh_best = (" << sh_best << " +- " << sh_best_unc << ") mm";
525+
edm::LogInfo("PPSAlignmentHarvester") << std::fixed << std::setprecision(3) << "[x_alignment] "
526+
<< "sh_best = (" << sh_best << " +- " << sh_best_unc << ") mm";
525527

526528
auto g_test_shifted = std::make_unique<TGraphErrors>(*g_test);
527529
for (int i = 0; i < g_test_shifted->GetN(); ++i) {
@@ -581,7 +583,7 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker,
581583
{std::make_pair(sc.rp_F_, sc_ref.rp_F_), std::make_pair(sc.rp_N_, sc_ref.rp_N_)}) {
582584
auto mes_test = iGetter.getAllContents(dqmDir_ + "/worker/" + sc.name_ + "/near_far/x slices, " + rpc.position_);
583585
if (mes_test.empty()) {
584-
edm::LogWarning("PPS") << "[x_alignment] " << rpc.name_ << ": could not load mes_test";
586+
edm::LogWarning("PPSAlignmentHarvester") << "[x_alignment] " << rpc.name_ << ": could not load mes_test";
585587
continue;
586588
}
587589

@@ -591,7 +593,7 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker,
591593

592594
auto vec_ref = cfg_ref.matchingReferencePoints().at(rpc.id_);
593595
if (vec_ref.empty()) {
594-
edm::LogInfo("PPS") << "[x_alignment] " << rpc.name_ << ": reference points vector is empty";
596+
edm::LogInfo("PPSAlignmentHarvester") << "[x_alignment] " << rpc.name_ << ": reference points vector is empty";
595597
continue;
596598
}
597599

@@ -604,9 +606,9 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker,
604606

605607
// require minimal number of points
606608
if (g_ref->GetN() < (int)cfg.methOGraphMinN() || g_test->GetN() < (int)cfg.methOGraphMinN()) {
607-
edm::LogWarning("PPS") << "[x_alignment] " << rpc.name_ << ": insufficient data, skipping (g_ref "
608-
<< g_ref->GetN() << "/" << cfg.methOGraphMinN() << ", g_test " << g_test->GetN() << "/"
609-
<< cfg.methOGraphMinN() << ")";
609+
edm::LogWarning("PPSAlignmentHarvester")
610+
<< "[x_alignment] " << rpc.name_ << ": insufficient data, skipping (g_ref " << g_ref->GetN() << "/"
611+
<< cfg.methOGraphMinN() << ", g_test " << g_test->GetN() << "/" << cfg.methOGraphMinN() << ")";
610612
continue;
611613
}
612614

@@ -646,8 +648,8 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker,
646648
// save the results
647649
CTPPSRPAlignmentCorrectionData rpResult(sh, sh_unc, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.);
648650
xAliResults_.setRPCorrection(rpc.id_, rpResult);
649-
edm::LogInfo("PPS") << std::fixed << std::setprecision(3) << "[x_alignment] "
650-
<< "Setting sh_x of " << rpc.name_ << " to " << sh;
651+
edm::LogInfo("PPSAlignmentHarvester") << std::fixed << std::setprecision(3) << "[x_alignment] "
652+
<< "Setting sh_x of " << rpc.name_ << " to " << sh;
651653

652654
// update the shift
653655
if (overwriteShX_) {
@@ -656,7 +658,7 @@ void PPSAlignmentHarvester::xAlignment(DQMStore::IBooker& iBooker,
656658
}
657659
}
658660

659-
edm::LogInfo("PPS") << seqPos << ": x_alignment:\n" << xAliResults_;
661+
edm::LogInfo("PPSAlignmentHarvester") << seqPos << ": x_alignment:\n" << xAliResults_;
660662

661663
if (textResultsFile_.is_open())
662664
textResultsFile_ << seqPos << ": x_alignment:\n" << xAliResults_ << "\n\n";
@@ -684,14 +686,16 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
684686

685687
auto* p_x_diffFN_vs_x_N_monitor = iGetter.get(dqmDir_ + "/worker/" + sc.name_ + "/near_far/p_x_diffFN_vs_x_N");
686688
if (p_x_diffFN_vs_x_N_monitor == nullptr) {
687-
edm::LogWarning("PPS") << "[x_alignment_relative] " << sc.name_ << ": cannot load data, skipping";
689+
edm::LogWarning("PPSAlignmentHarvester")
690+
<< "[x_alignment_relative] " << sc.name_ << ": cannot load data, skipping";
688691
continue;
689692
}
690693
TProfile* p_x_diffFN_vs_x_N = p_x_diffFN_vs_x_N_monitor->getTProfile();
691694

692695
if (p_x_diffFN_vs_x_N->GetEntries() < cfg.nearFarMinEntries()) {
693-
edm::LogWarning("PPS") << "[x_alignment_relative] " << sc.name_ << ": insufficient data, skipping (near_far "
694-
<< p_x_diffFN_vs_x_N->GetEntries() << "/" << cfg.nearFarMinEntries() << ")";
696+
edm::LogWarning("PPSAlignmentHarvester")
697+
<< "[x_alignment_relative] " << sc.name_ << ": insufficient data, skipping (near_far "
698+
<< p_x_diffFN_vs_x_N->GetEntries() << "/" << cfg.nearFarMinEntries() << ")";
695699
continue;
696700
}
697701

@@ -710,10 +714,10 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
710714
const double a = ff->GetParameter(1), a_unc = ff->GetParError(1);
711715
const double b = ff->GetParameter(0), b_unc = ff->GetParError(0);
712716

713-
edm::LogInfo("PPS") << "[x_alignment_relative] " << sc.name_ << ":\n"
714-
<< std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max
715-
<< "\n"
716-
<< " sh_x_N = " << sh_x_N << ", slope (fix) = " << slope << ", slope (fitted) = " << a;
717+
edm::LogInfo("PPSAlignmentHarvester")
718+
<< "[x_alignment_relative] " << sc.name_ << ":\n"
719+
<< std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max << "\n"
720+
<< " sh_x_N = " << sh_x_N << ", slope (fix) = " << slope << ", slope (fitted) = " << a;
717721

718722
CTPPSRPAlignmentCorrectionData rpResult_N(+b / 2., b_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.);
719723
xAliRelResults_.setRPCorrection(sc.rp_N_.id_, rpResult_N);
@@ -734,10 +738,10 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
734738
CTPPSRPAlignmentCorrectionData rpResult_sl_fix_F(-b_fs / 2., b_fs_unc / 2., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.);
735739
xAliRelResultsSlopeFixed_.setRPCorrection(sc.rp_F_.id_, rpResult_sl_fix_F);
736740

737-
edm::LogInfo("PPS") << "[x_alignment_relative] " << std::fixed << std::setprecision(3)
738-
<< "ff: " << ff->GetParameter(0) << " + " << ff->GetParameter(1) << " * (x - "
739-
<< ff->GetParameter(2) << "), ff_sl_fix: " << ff_sl_fix->GetParameter(0) << " + "
740-
<< ff_sl_fix->GetParameter(1) << " * (x - " << ff_sl_fix->GetParameter(2) << ")";
741+
edm::LogInfo("PPSAlignmentHarvester")
742+
<< "[x_alignment_relative] " << std::fixed << std::setprecision(3) << "ff: " << ff->GetParameter(0) << " + "
743+
<< ff->GetParameter(1) << " * (x - " << ff->GetParameter(2) << "), ff_sl_fix: " << ff_sl_fix->GetParameter(0)
744+
<< " + " << ff_sl_fix->GetParameter(1) << " * (x - " << ff_sl_fix->GetParameter(2) << ")";
741745

742746
// rebook the diffFN plot in the harvester
743747
iBooker.setCurrentFolder(dqmDir_ + "/harvester/x_alignment_relative/" + sc.name_);
@@ -756,9 +760,9 @@ void PPSAlignmentHarvester::xAlignmentRelative(DQMStore::IBooker& iBooker,
756760
}
757761

758762
// write results
759-
edm::LogInfo("PPS") << seqPos << ": x_alignment_relative:\n"
760-
<< xAliRelResults_ << seqPos + 1 << ": x_alignment_relative_sl_fix:\n"
761-
<< xAliRelResultsSlopeFixed_;
763+
edm::LogInfo("PPSAlignmentHarvester") << seqPos << ": x_alignment_relative:\n"
764+
<< xAliRelResults_ << seqPos + 1 << ": x_alignment_relative_sl_fix:\n"
765+
<< xAliRelResultsSlopeFixed_;
762766

763767
if (textResultsFile_.is_open()) {
764768
textResultsFile_ << seqPos << ": x_alignment_relative:\n" << xAliRelResults_ << "\n";
@@ -900,16 +904,17 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
900904
iGetter.get(dqmDir_ + "/worker/" + sc.name_ + "/multiplicity selection/" + rpc.name_ + "/h2_y_vs_x");
901905

902906
if (h2_y_vs_x == nullptr) {
903-
edm::LogWarning("PPS") << "[y_alignment] " << rpc.name_ << ": cannot load data, skipping";
907+
edm::LogWarning("PPSAlignmentHarvester") << "[y_alignment] " << rpc.name_ << ": cannot load data, skipping";
904908
continue;
905909
}
906910

907911
iBooker.setCurrentFolder(dqmDir_ + "/harvester/y alignment/" + rpc.name_);
908912
auto* h_y_cen_vs_x = buildModeGraph(iBooker, h2_y_vs_x, cfg, rpc);
909913

910914
if ((unsigned int)h_y_cen_vs_x->GetEntries() < cfg.modeGraphMinN()) {
911-
edm::LogWarning("PPS") << "[y_alignment] " << rpc.name_ << ": insufficient data, skipping (mode graph "
912-
<< h_y_cen_vs_x->GetEntries() << "/" << cfg.modeGraphMinN() << ")";
915+
edm::LogWarning("PPSAlignmentHarvester")
916+
<< "[y_alignment] " << rpc.name_ << ": insufficient data, skipping (mode graph "
917+
<< h_y_cen_vs_x->GetEntries() << "/" << cfg.modeGraphMinN() << ")";
913918
continue;
914919
}
915920

@@ -928,10 +933,10 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
928933
const double a = ff->GetParameter(1), a_unc = ff->GetParError(1);
929934
const double b = ff->GetParameter(0), b_unc = ff->GetParError(0);
930935

931-
edm::LogInfo("PPS") << "[y_alignment] " << rpc.name_ << ":\n"
932-
<< std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max
933-
<< "\n"
934-
<< " sh_x = " << sh_x << ", slope (fix) = " << slope << ", slope (fitted) = " << a;
936+
edm::LogInfo("PPSAlignmentHarvester")
937+
<< "[y_alignment] " << rpc.name_ << ":\n"
938+
<< std::fixed << std::setprecision(3) << " x_min = " << x_min << ", x_max = " << x_max << "\n"
939+
<< " sh_x = " << sh_x << ", slope (fix) = " << slope << ", slope (fitted) = " << a;
935940

936941
CTPPSRPAlignmentCorrectionData rpResult(0., 0., b, b_unc, 0., 0., 0., 0., 0., 0., 0., 0.);
937942
yAliResults_.setRPCorrection(rpc.id_, rpResult);
@@ -948,10 +953,10 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
948953
CTPPSRPAlignmentCorrectionData rpResult_sl_fix(0., 0., b_fs, b_fs_unc, 0., 0., 0., 0., 0., 0., 0., 0.);
949954
yAliResultsSlopeFixed_.setRPCorrection(rpc.id_, rpResult_sl_fix);
950955

951-
edm::LogInfo("PPS") << "[y_alignment] " << std::fixed << std::setprecision(3) << "ff: " << ff->GetParameter(0)
952-
<< " + " << ff->GetParameter(1) << " * (x - " << ff->GetParameter(2)
953-
<< "), ff_sl_fix: " << ff_sl_fix->GetParameter(0) << " + " << ff_sl_fix->GetParameter(1)
954-
<< " * (x - " << ff_sl_fix->GetParameter(2) << ")";
956+
edm::LogInfo("PPSAlignmentHarvester")
957+
<< "[y_alignment] " << std::fixed << std::setprecision(3) << "ff: " << ff->GetParameter(0) << " + "
958+
<< ff->GetParameter(1) << " * (x - " << ff->GetParameter(2) << "), ff_sl_fix: " << ff_sl_fix->GetParameter(0)
959+
<< " + " << ff_sl_fix->GetParameter(1) << " * (x - " << ff_sl_fix->GetParameter(2) << ")";
955960

956961
if (debug_) {
957962
gDirectory = rpDir;
@@ -970,9 +975,9 @@ void PPSAlignmentHarvester::yAlignment(DQMStore::IBooker& iBooker,
970975
}
971976

972977
// write results
973-
edm::LogInfo("PPS") << seqPos << ": y_alignment:\n"
974-
<< yAliResults_ << seqPos << ": y_alignment_sl_fix:\n"
975-
<< yAliResultsSlopeFixed_;
978+
edm::LogInfo("PPSAlignmentHarvester") << seqPos << ": y_alignment:\n"
979+
<< yAliResults_ << seqPos << ": y_alignment_sl_fix:\n"
980+
<< yAliResultsSlopeFixed_;
976981

977982
if (textResultsFile_.is_open()) {
978983
textResultsFile_ << seqPos << ": y_alignment:\n" << yAliResults_ << "\n";

CalibPPS/AlignmentGlobal/plugins/PPSAlignmentWorker.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ PPSAlignmentWorker::PPSAlignmentWorker(const edm::ParameterSet& iConfig)
111111
tracksToken_(consumes<CTPPSLocalTrackLiteCollection>(iConfig.getParameter<edm::InputTag>("tagTracks"))),
112112
dqmDir_(iConfig.getParameter<std::string>("dqm_dir")),
113113
debug_(iConfig.getParameter<bool>("debug")) {
114-
edm::LogInfo("PPS").log([&](auto& li) {
115-
li << "[worker] parameters:\n";
114+
edm::LogInfo("PPSAlignmentWorker").log([&](auto& li) {
115+
li << "parameters:\n";
116116
li << "* label: " << iConfig.getParameter<std::string>("label") << "\n";
117117
li << "* tagTracks: " << iConfig.getParameter<edm::InputTag>("tagTracks") << "\n";
118118
li << "* dqm_dir: " << dqmDir_ << "\n";

0 commit comments

Comments
 (0)