16#include <TObjString.h>
24const float VALUE_OVERFLOW = std::numeric_limits<float>::max();
26template <
typename TargetPtr,
typename SourcePtr>
27TargetPtr checked_cast(SourcePtr ptr) {
29 static_assert(std::is_pointer<TargetPtr>::value,
30 "attempt to cast to no ptr object");
31 static_assert(std::is_pointer<SourcePtr>::value,
32 "attempt to cast from no ptr object");
36 throw std::runtime_error(
37 "Attempt to cast from nullptr in egammaLayerRecalibTool");
41 TargetPtr
obj =
dynamic_cast<TargetPtr
>(
ptr);
43 throw std::runtime_error(
"failed dynamic cast for " +
44 std::string(
ptr->GetName()) +
45 " in egammaLayerRecalibTool");
54 const int bin =
m_histo->FindFixBin(input.eta);
60 const int bin =
m_histo->FindFixBin(input.eta);
66 const int bin =
m_histo->FindFixBin(input.eta);
72 const int bin =
m_histo->FindFixBin(input.eta);
78 const int bin =
m_histo->FindFixBin(input.eta);
84 const int bin =
m_histo.FindFixBin(input.eta, input.phi);
90 const int bin =
m_histo.FindFixBin(input.etaCalo, input.RunNumber);
100 return m_formula.Eval(input.eta, input.phi, input.RunNumber);
104 return m_tool.getCorr(input.RunNumber, input.eta, input.phi);
108 return m_toolEMECPS.getCorr(input.RunNumber, input.eta, input.phi);
112 return m_tool->getCorr(0, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
116 return m_tool->getCorr(1, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
120 return m_tool->getCorr(2, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
124 return m_tool->getCorr(3, input.RunNumber, input.averageInteractionsPerCrossing, input.eta);
157 const double Es1 = inputs.E1raw;
158 const double Es2 = inputs.E2raw;
159 if (Es1 == 0 and Es2 == 0) {
164 const double sum = Es1 + Es2;
165 const double alpha = amount;
166 const double den = (alpha * Es1 + Es2);
167 inputs.E1raw = alpha * Es1 * sum / den;
168 inputs.E2raw = Es2 * sum / den;
174 throw std::runtime_error(
"not implemented");
179 inputs.E1raw *= amount;
180 inputs.E2raw *= amount;
181 inputs.E3raw *= amount;
186 inputs.E1raw += amount;
187 inputs.E2raw += amount;
188 inputs.E3raw += amount;
193 inputs.E0raw *= amount;
194 inputs.E1raw *= amount;
195 inputs.E2raw *= amount;
196 inputs.E3raw *= amount;
201 inputs.E0raw += amount;
202 inputs.E1raw += amount;
203 inputs.E2raw += amount;
204 inputs.E3raw += amount;
209 if (
"layer1_2012" == tune)
return "layer1_2012_v5";
210 if (
"layer1_alt_2012" == tune)
return "layer1_alt_2012_v5";
211 if (
"layer1_2011" == tune)
return "layer1_2011_v5";
212 if (
"layer1_alt_2011" == tune)
return "layer1_alt_2011_v5";
213 if (
"layer1_2010" == tune)
return "layer1_2010_v5";
214 if (
"ps_2012" == tune)
return "ps_2012_v3";
215 if (
"ps_2011" == tune)
return "ps_2011_v3";
216 if (
"ps_2010" == tune)
return "ps_2010_v3";
217 if (
"layer1_2012_up" == tune)
return "layer1_2012_v5_up";
218 if (
"layer1_2012_down" == tune)
return "layer1_2012_v5_down";
219 if (
"layer1_2012_errup" == tune)
return "layer1_2012_v5_errup";
220 if (
"layer1_2012_errdown" == tune)
return "layer1_2012_v5_errdown";
221 if (
"layer1_2011_up" == tune)
return "layer1_2011_v5_up";
222 if (
"layer1_2011_down" == tune)
return "layer1_2011_v5_down";
223 if (
"layer1_2011_errup" == tune)
return "layer1_2011_v5_errup";
224 if (
"layer1_2011_errdown" == tune)
return "layer1_2011_v5_errdown";
225 if (
"layer1_2010_up" == tune)
return "layer1_2010_v5_up";
226 if (
"layer1_2010_down" == tune)
return "layer1_2010_v5_down";
227 if (
"layer1_2010_errup" == tune)
return "layer1_2010_v5_errup";
228 if (
"layer1_2010_errdown" == tune)
return "layer1_2010_v5_errdown";
229 if (
"ps_2012_up" == tune)
return "ps_2012_v3_up";
230 if (
"ps_2012_down" == tune)
return "ps_2012_v3_down";
231 if (
"ps_2012_errup" == tune)
return "ps_2012_v3_errup";
232 if (
"ps_2012_errdown" == tune)
return "ps_2012_v3_errdown";
233 if (
"ps_2011_up" == tune)
return "ps_2011_v3_up";
234 if (
"ps_2011_down" == tune)
return "ps_2011_v3_down";
235 if (
"ps_2011_errup" == tune)
return "ps_2011_v3_errup";
236 if (
"ps_2011_errdown" == tune)
return "ps_2011_v3_errdown";
237 if (
"ps_2010_up" == tune)
return "ps_2010_v3_up";
238 if (
"ps_2010_down" == tune)
return "ps_2010_v3_down";
239 if (
"ps_2010_errup" == tune)
return "ps_2010_v3_errup";
240 if (
"ps_2010_errdown" == tune)
return "ps_2010_v3_errdown";
250 if (tune.empty()) { }
251 else if (
"es2024_run3_extrapolate_v0" == tune) {
252 add_scale(
"run3_partial_ofc_extrapolate_v0");
255 else if (
"es2022_22.0_Precision_v1" == tune) {
256 add_scale(
"run2_alt_with_layer2_r22_Precision_v1");
258 else if (
"es2022_22.0_Precision" == tune) {
259 add_scale(
"run2_alt_with_layer2_r22_Precision");
261 else if (
"es2018_21.0_v0" == tune) {
262 add_scale(
"run2_alt_with_layer2_r21_v1");
264 else if (
"es2017_21.0_v0" == tune) {
265 add_scale(
"run2_alt_with_layer2_r21_v0");
267 else if (
"es2017_20.7_final" == tune) {
271 else if (
"es2017_20.7_improved" == tune) {
276 else if (
"pileup_20.7" == tune) {
284 else if (
"run3_partial_ofc_extrapolate_v0" == tune) {
285 add_scale(
"layer2_run3_ofc_extrapolate_v0");
290 else if (
"run2_alt_with_layer2_r22_Precision_v1"==tune) {
291 add_scale(
"layer2_alt_el_mu_comb_r21_v0_fix");
296 else if (
"run2_alt_with_layer2_r22_Precision"==tune) {
297 add_scale(
"layer2_alt_el_mu_comb_r21_v0");
301 else if (
"run2_alt_with_layer2_r21_v1"==tune) {
305 else if (
"run2_alt_with_layer2_r21_v0"==tune) {
309 else if(
"run2_alt_with_layer2_modif" == tune) {
315 else if (
"2012" == tune) {
320 else if(
"2012_with_layer2" == tune) {
325 else if (
"2012_alt" == tune) {
330 else if(
"2012_alt_with_layer2" == tune) {
335 else if(
"2012_alt_with_layer2_modif" == tune) {
341 else if(
"2010_with_layer2" == tune) {
345 else if (
"2012_layer1_up" == tune) {
350 else if (
"2012_layer1_down" == tune) {
355 else if (
"2012_layer1_errup" == tune) {
358 else if (
"2012_layer1_errdown" == tune) {
361 else if (
"2012_ps_down" == tune) {
366 else if (
"2012_ps_up" == tune) {
371 else if (
"2012_ps_errdown" == tune) {
374 else if (
"2012_ps_errup" == tune) {
377 else if (
"2012_up" == tune) {
382 else if (
"2012_down" == tune) {
387 else if (
"2012_errup" == tune) {
391 else if (
"2012_errdown" == tune) {
396 else if (
"2011" == tune) {
400 else if(
"2011_with_layer2" == tune) {
404 else if (
"2011_alt" == tune) {
408 else if(
"2011_alt_with_layer2" == tune) {
412 else if (
"2011_layer1_up" == tune) {
416 else if (
"2011_layer1_down" == tune) {
420 else if (
"2011_layer1_errup" == tune) {
423 else if (
"2011_layer1_errdown" == tune) {
426 else if (
"2011_ps_down" == tune) {
430 else if (
"2011_ps_up" == tune) {
434 else if (
"2011_ps_errdown" == tune) {
437 else if (
"2011_ps_errup" == tune) {
440 else if (
"2011_up" == tune) {
444 else if (
"2011_down" == tune) {
448 else if (
"2011_errup" == tune) {
452 else if (
"2011_errdown" == tune) {
457 else if (
"2010" == tune) {
461 else if (
"2010_layer1_up" == tune) {
465 else if (
"2010_layer1_down" == tune) {
469 else if (
"2010_layer1_errup" == tune) {
472 else if (
"2010_layer1_errdown" == tune) {
475 else if (
"2010_ps_down" == tune) {
479 else if (
"2010_ps_up" == tune) {
483 else if (
"2010_ps_errdown" == tune) {
486 else if (
"2010_ps_errup" == tune) {
489 else if (
"2010_up" == tune) {
493 else if (
"2010_down" == tune) {
497 else if (
"2010_errup" == tune) {
501 else if (
"2010_errdown" == tune) {
505 else if (
"ps_HV1" == tune) {
508 else if (
"ps_EMECHV1" == tune) {
511 else if (
"test1" == tune) {
512 TH1F h_presampler(
"h_presampler",
"h_presampler", 10, -2.5, 2.5);
515 for (
int ibin = 1; ibin <= 5; ++ibin) {
516 h_presampler.SetBinContent(ibin, -0.1);
517 h_presampler.SetBinContent(ibin + 5, 0.1);
522 else if (
"acc_zee_run3_v0" == tune){
524 TFile f(
file.c_str());
525 TH2F* histo_acc =
static_cast<TH2F*
>(f.Get(
"hACC_Zee_rel23"));
531 else if (
"acc_zee_r22_v1" == tune) {
533 TFile f(
file.c_str());
534 TH2F* histo_acc =
static_cast<TH2F*
>(f.Get(
"hACC_Zee_rel22"));
539 else if (
"acc_zee_r22_v0" == tune) {
541 TFile f(
file.c_str());
542 TH2F* histo_acc =
static_cast<TH2F*
>(f.Get(
"hACC_Zee_rel22"));
547 else if (
"layer1_1" == tune) {
548 TFormula f(
"formula_layer1_1",
"(abs(x)<1.425) ? 0.97 : 1");
551 else if (
"layer1_2" == tune) {
552 TFormula f(
"formula_layer1_2",
"(abs(x)<1.425) ? 0.97 : 1.05");
555 else if (
"layer1_alt_2012_v5" == tune) {
557 TFile f(
file.c_str());
558 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_alt_2012"));
562 else if (
"layer1_2012_v5" == tune) {
564 TFile f(
file.c_str());
565 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
569 else if (
"layer1_2012_v5_down" == tune) {
571 TFile f(
file.c_str());
572 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
576 else if (
"layer1_2012_v5_up" == tune) {
578 TFile f(
file.c_str());
579 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
583 else if (
"layer1_2012_v5_errdown" == tune) {
585 TFile f(
file.c_str());
586 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
590 else if (
"layer1_2012_v5_errup" == tune) {
592 TFile f(
file.c_str());
593 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
597 else if (
"layer1_alt_2011_v5" == tune) {
599 TFile f(
file.c_str());
600 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_alt_2011"));
604 else if (
"layer1_2011_v5" == tune) {
606 TFile f(
file.c_str());
607 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
611 else if (
"layer1_2011_v5_down" == tune) {
613 TFile f(
file.c_str());
614 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
618 else if (
"layer1_2011_v5_up" == tune) {
620 TFile f(
file.c_str());
621 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
625 else if (
"layer1_2011_v5_errdown" == tune) {
627 TFile f(
file.c_str());
628 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
632 else if (
"layer1_2011_v5_errup" == tune) {
634 TFile f(
file.c_str());
635 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
639 else if (
"layer1_2010_v5" == tune) {
641 TFile f(
file.c_str());
642 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
646 else if (
"layer1_2010_v5_down" == tune) {
648 TFile f(
file.c_str());
649 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
653 else if (
"layer1_2010_v5_up" == tune) {
655 TFile f(
file.c_str());
656 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
660 else if (
"layer1_2010_v5_errdown" == tune) {
662 TFile f(
file.c_str());
663 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
667 else if (
"layer1_2010_v5_errup" == tune) {
669 TFile f(
file.c_str());
670 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
674 else if (
"layer2_run3_ofc_extrapolate_v0"==tune){
676 TFile f(
file.c_str());
677 TH1D* histo =
static_cast<TH1D*
>(f.Get(
"hE1E2_emu_run2_rel21_v1_run3ofc"));
683 else if(
"layer2_alt_el_mu_comb_r21_v0_fix"==tune) {
685 TFile f(
file.c_str());
686 TH1D* histo =
static_cast<TH1D*
>(f.Get(
"hE1E2_emu_run2_rel21_v0_fix"));
691 else if(
"layer2_alt_el_mu_comb_r21_v0"==tune) {
693 TFile f(
file.c_str());
694 TH1D* histo =
static_cast<TH1D*
>(f.Get(
"hE1E2_emu_run2_rel21_v0"));
699 else if(
"layer2_alt_run2_r21_v1"==tune) {
701 TFile f(
file.c_str());
702 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2_mu_run2_rel21_v1"));
706 else if(
"layer2_alt_run2_r21_v0"==tune) {
708 TFile f(
file.c_str());
709 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2mu_2016_rel21_v1"));
713 else if(
"layer2_alt_run2_v1" == tune) {
715 TFile f(
file.c_str());
716 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2mu_2016_v1"));
720 else if(
"layer2_alt_2012_v5" == tune) {
722 TFile f(
file.c_str());
723 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_alt_2012"));
727 else if(
"layer2_2012_v5" == tune) {
729 TFile f(
file.c_str());
730 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
734 else if(
"layer2_2012_v5_down" == tune) {
736 TFile f(
file.c_str());
737 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
741 else if(
"layer2_2012_v5_up" == tune) {
743 TFile f(
file.c_str());
744 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
748 else if (
"layer2_2012_v5_errdown" == tune) {
750 TFile f(
file.c_str());
751 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
755 else if (
"layer2_2012_v5_errup" == tune) {
757 TFile f(
file.c_str());
758 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2012"));
762 else if(
"layer2_alt_2011_v5" == tune) {
764 TFile f(
file.c_str());
765 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_alt_2011"));
769 else if(
"layer2_2011_v5" == tune) {
771 TFile f(
file.c_str());
772 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
776 else if(
"layer2_2011_v5_down" == tune) {
778 TFile f(
file.c_str());
779 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
783 else if(
"layer2_2011_v5_up" == tune) {
785 TFile f(
file.c_str());
786 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
790 else if (
"layer2_2011_v5_errdown" == tune) {
792 TFile f(
file.c_str());
793 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
797 else if (
"layer2_2011_v5_errup" == tune) {
799 TFile f(
file.c_str());
800 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2011"));
804 else if(
"layer2_2010_v5" == tune) {
806 TFile f(
file.c_str());
807 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
811 else if(
"layer2_2010_v5_down" == tune) {
813 TFile f(
file.c_str());
814 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
818 else if(
"layer2_2010_v5_up" == tune) {
820 TFile f(
file.c_str());
821 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
825 else if (
"layer2_2010_v5_errdown" == tune) {
827 TFile f(
file.c_str());
828 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
832 else if (
"layer2_2010_v5_errup" == tune) {
834 TFile f(
file.c_str());
835 TH1* histo = checked_cast<TH1*>(f.Get(
"hE1E2ave_2010"));
839 else if (
"ps_2016_r21_v0" == tune) {
841 TFile f(
file.c_str());
842 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2016_rel21"));
846 else if (
"ps_run3_ofc_extrapolate_v0" == tune){
848 TFile f(
file.c_str());
849 TH1F* histo_ps_tot_error =
static_cast<TH1F*
>(f.Get(
"hPS_MuonLowMu_rel21_run3ofc"));
850 assert(histo_ps_tot_error);
854 else if (
"ps_mu_r21_v0" == tune) {
856 TFile f(
file.c_str());
857 TH1F* histo_ps_tot_error =
static_cast<TH1F*
>(f.Get(
"hPS_MuonLowMu_rel21"));
858 assert(histo_ps_tot_error);
862 else if (
"ps_2016_v1" == tune) {
864 TFile f(
file.c_str());
865 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2016"));
869 else if (
"ps_2012_v3" == tune) {
871 TFile f(
file.c_str());
872 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2012"));
876 else if (
"ps_2012_v3_down" == tune) {
878 TFile f(
file.c_str());
879 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2012"));
883 else if (
"ps_2012_v3_up" == tune){
885 TFile f(
file.c_str());
886 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2012"));
890 else if (
"ps_2012_v3_errdown" == tune){
892 TFile f(
file.c_str());
893 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2012"));
897 else if (
"ps_2012_v3_errup" == tune){
899 TFile f(
file.c_str());
900 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2012"));
904 else if (
"ps_2011_v3" == tune) {
906 TFile f(
file.c_str());
907 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2011"));
911 else if (
"ps_2011_v3_down" == tune) {
913 TFile f(
file.c_str());
914 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2011"));
918 else if (
"ps_2011_v3_up" == tune){
920 TFile f(
file.c_str());
921 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2011"));
925 else if (
"ps_2011_v3_errdown" == tune){
927 TFile f(
file.c_str());
928 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2011"));
932 else if (
"ps_2011_v3_errup" == tune){
934 TFile f(
file.c_str());
935 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2011"));
940 else if (
"ps_2010_v3" == tune) {
942 TFile f(
file.c_str());
943 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2010"));
947 else if (
"ps_2010_v3_down" == tune) {
949 TFile f(
file.c_str());
950 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2010"));
954 else if (
"ps_2010_v3_up" == tune) {
956 TFile f(
file.c_str());
957 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2010"));
961 else if (
"ps_2010_v3_errdown" == tune){
963 TFile f(
file.c_str());
964 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2010"));
968 else if (
"ps_2010_v3_errup" == tune){
970 TFile f(
file.c_str());
971 TH1* histo_ps_tot_error = checked_cast<TH1*>(f.Get(
"hPS_2010"));
976 throw std::runtime_error(tune+
" is not a valid tune");
1000 const float amount = (*modifier.second)(inputs);
1001 const auto s = (*modifier.first)(inputs, amount);
1002 ATH_MSG_DEBUG(
" after E0|E1|E2|E3 = " << inputs.E0raw <<
"|" << inputs.E1raw <<
"|" << inputs.E2raw <<
"|" << inputs.E3raw);
1018 std::string fixT =
"";
1019 double addE2 = 0, addE3 = 0;
1022 fixT =
"_egFixForTopoTimingCut";
1023 unsigned short stat =
1027 " but some layer info is not available,"
1028 " from L2 : " << stat%2 <<
" from L3 : " << stat/2);
1035 eta_calo = cluster->
eta();
1041 eta_calo = accEtaCalo(*cluster);
1044 ATH_MSG_ERROR(
"etaCalo not available as auxilliary variable,"
1045 " using cluster eta as eta calo!");
1046 eta_calo=cluster->
eta();
1070 deco_layer_correction(
"layer_correction");
1073 ATH_MSG_DEBUG(
"decorating cluster with corrected layer energies");
1075 inputs.E0raw : cluster->
energyBE(0);
1077 inputs.E1raw : cluster->
energyBE(1);
1079 inputs.E2raw : cluster->
energyBE(2) + addE2;
1081 inputs.E3raw : cluster->
energyBE(3) + addE3;
1082 deco_layer_correction(*cluster) = isData ?
m_tune+fixT : fixT;
1087 " decorating particle with non-corrected layer energies");
1092 deco_E0(*cluster) = cluster->
energyBE(0);
1093 deco_E1(*cluster) = cluster->
energyBE(1);
1094 deco_E2(*cluster) = cluster->
energyBE(2) + addE2;
1095 deco_E3(*cluster) = cluster->
energyBE(3) + addE3;
1096 deco_layer_correction(*cluster) = isData ?
m_tune +
"_Err" + fixT : fixT;
1105 delete modifier.first;
1106 delete modifier.second;
1113std::map<std::string, std::string>
parse(
const std::string& list)
1115 std::cout <<
"list: '" << list <<
"'" << std::endl;
1116 std::map<std::string, std::string>
result;
1117 TIter next(TString(list).Tokenize(
","));
1118 while (TObjString* sObj = (TObjString*) next())
1120 const TString& item(sObj->GetString());
1121 std::cout <<
"item: '" << item <<
"'" << std::endl;
1122 TObjArray* item_list = TString(item).Tokenize(
":");
1125 if (item_list->GetEntries() == 1) {
1127 value =
static_cast<TObjString*
>(item_list->At(0))->GetString().Data();
1129 else if (item_list->GetEntries() == 2) {
1130 key =
static_cast<TObjString*
>(item_list->At(0))->GetString().Data();
1131 value =
static_cast<TObjString*
>(item_list->At(1))->GetString().Data();
1134 std::cerr <<
"invalid string " << item << std::endl;
1137 std::cerr <<
"trying to insert two times key " << key << std::endl;
1140 result.insert(std::make_pair(key, value));
1146std::pair<std::string, egammaLayerRecalibTool*>
1149 std::map<std::string, std::string> args_map =
parse(args);
1151 std::string name =
"";
1152 std::string amount_name =
"";
1153 std::string type_name =
"";
1158 if (args_map.find(
"amount") != args_map.end()) {
1159 std::string amount_str = args_map[
"amount"];
1161 if (amount_str.back()==
'%') {
1163 amount_str.pop_back();
1165 const float amount = TString(amount_str).Atof() * (perc ? 0.01 : 1);
1168 std::stringstream amount_stream;
1169 amount_stream << amount;
1170 amount_name = amount_stream.str();
1171 std::replace(amount_name.begin(), amount_name.end(),
'-',
'n');
1172 std::replace(amount_name.begin(), amount_name.end(),
'.',
'p');
1174 else if (args_map.find(
"name") != args_map.end()) {
1175 name = args_map[
"name"];
1177 else if (args_map.find(
"histo") != args_map.end()) {
1179 if (args_map.find(
"file") == args_map.end()) {
1180 std::cerr <<
"with histo you must specify file" << std::endl;
1183 if (args_map.find(
"formulax") != args_map.end()) dim = 1;
1187 std::cerr <<
"with histo you must specify formulax" << std::endl;
1191 TFile f(args_map[
"file"].c_str());
1192 std::cout <<
"opening histo " << args_map[
"histo"] <<
" from file " << args_map[
"file"] << std::endl;
1193 TH1F* histo =
dynamic_cast<TH1F*
>(f.Get(args_map[
"histo"].c_str()));
1196 histo->SetDirectory(
nullptr);
1199 else{assert(
false); }
1201 else { assert(
false); }
1204 std::cerr <<
"cannot understand argument " << args << std::endl;
1216 if (not type_name.empty() and not amount_name.empty()) {
1217 name = type_name +
"_" + amount_name;
1221 std::cerr <<
"you need to specify a name for the bias with type " <<
type << std::endl;
1224 if (modifier and amount_getter) {
1225 tool->add_scale(modifier, amount_getter);
1228 tool->add_scale(
type);
1231 if(modifier)
delete modifier;
1232 if(amount_getter)
delete amount_getter;
1235 return {name, tool};
#define ATH_MSG_WARNING(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Return value from object correction CP tools.
@ Error
Some error happened during the object correction.
@ OutOfValidityRange
Input object is out of validity range.
@ Ok
The correction was done successfully.
SG::Decorator< T, ALLOC > Decorator
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
AsgMessaging(const std::string &name)
Constructor with a name.
Correction for pileup induced energy shit as function of mu per layer for 2016 data.
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ ETACALOFRAME
Eta in the calo frame (for egamma)
bool eventType(EventType type) const
Check for one particular bitmask value.
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
@ IS_SIMULATION
true: simulation, false: data
uint32_t runNumber() const
The current event's run number.
unsigned short energyInMissingCells(const xAOD::Egamma &eg, double &e2, double &e3)
Get the energies in sampling 2 and 3 that are in cells rejected by the topo-cluster timing cut but th...
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
EventInfo_v1 EventInfo
Definition of the latest event info version.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
virtual float operator()(const StdCalibrationInputs &input) const
corr_HV_EMECPS m_toolEMECPS
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
std::unique_ptr< TH1 > m_histo
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
virtual float operator()(const StdCalibrationInputs &input) const
corr_pileupShift * m_tool
virtual float operator()(const StdCalibrationInputs &inputs) const
corr_pileupShift * m_tool
virtual float operator()(const StdCalibrationInputs &inputs) const
virtual float operator()(const StdCalibrationInputs &inputs) const
corr_pileupShift * m_tool
corr_pileupShift * m_tool
virtual float operator()(const StdCalibrationInputs &inputs) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const
virtual void shift_inputs(StdCalibrationInputs &, float amount) const
virtual void scale_inputs(StdCalibrationInputs &, float amount) const