29 :
asg::AsgMessaging(std::string(
name))
30 , m_doRemoveF3AtHighEt(false)
31 , m_doRemoveTRTPIDAtHighEt(false)
32 , m_doSmoothBinInterpolation(false)
33 , m_useOneExtraHighETLHBin(false)
34 , m_highETBinThreshold(125)
35 , m_doPileupTransform(false)
36 , m_doCentralityTransform(false)
37 , m_discMaxForPileupTransform(2.0)
38 , m_pileupMaxForPileupTransform(50)
42 , m_variableBitMask(0x0)
44 , m_cutPosition_kinematic(-9)
45 , m_cutPosition_NSilicon(-9)
46 , m_cutPosition_NPixel(-9)
47 , m_cutPosition_NBlayer(-9)
48 , m_cutPosition_ambiguity(-9)
49 , m_cutPosition_LH(-9)
50 , m_cutPositionTrackA0(-9)
51 , m_cutPositionTrackMatchEta(-9)
52 , m_cutPositionTrackMatchPhiRes(-9)
53 , m_cutPositionWstotAtHighET(-9)
54 , m_cutPositionEoverPAtHighET(-9)
56 for (
unsigned int varIndex = 0; varIndex <
s_fnVariables; varIndex++) {
58 for (
auto &
ip : fPDFbin) {
60 for (
unsigned int eta = 0; eta <
s_fnEtaBins; eta++) {
61 ip[
et][eta][varIndex] =
nullptr;
74 for (
unsigned int varIndex = 0; varIndex < s_fnVariables; varIndex++) {
75 for (
auto & fPDFbin : fPDFbins) {
76 for (
auto &
ip : fPDFbin) {
77 for (
unsigned int et = 0;
et < s_fnEtBinsHist;
et++) {
78 for (
unsigned int eta = 0; eta < s_fnEtaBins; eta++) {
79 if (
ip[
et][eta][varIndex]) {
80 delete ip[
et][eta][varIndex];
81 ip[
et][eta][varIndex] =
nullptr;
99 if (m_pdfFileName.empty()) {
100 ATH_MSG_WARNING(
"You need to specify the input PDF file name before you "
101 "call initialize() with "
102 "setPDFFileName('your/file/name.root') ");
103 sc = StatusCode::FAILURE;
106 unsigned int number_of_expected_bin_combinedLH;
107 if (m_useOneExtraHighETLHBin)
108 number_of_expected_bin_combinedLH = s_fnDiscEtBinsOneExtra * s_fnEtaBins;
110 number_of_expected_bin_combinedLH = s_fnDiscEtBins * s_fnEtaBins;
111 unsigned int number_of_expected_bin_combinedOther =
112 s_fnDiscEtBins * s_fnEtaBins;
114 if (m_cutLikelihood.size() != number_of_expected_bin_combinedLH) {
115 ATH_MSG_ERROR(
"Configuration issue : cutLikelihood expected size "
116 << number_of_expected_bin_combinedLH <<
" input size "
117 << m_cutLikelihood.size());
118 sc = StatusCode::FAILURE;
121 if (!m_discHardCutForPileupTransform.empty()) {
122 if (m_discHardCutForPileupTransform.size() !=
123 number_of_expected_bin_combinedLH) {
125 "Configuration issue : DiscHardCutForPileupTransform expected size "
126 << number_of_expected_bin_combinedLH <<
" input size "
127 << m_discHardCutForPileupTransform.size());
128 sc = StatusCode::FAILURE;
131 if (!m_discHardCutSlopeForPileupTransform.empty()) {
132 if (m_discHardCutSlopeForPileupTransform.size() !=
133 number_of_expected_bin_combinedLH) {
135 "DiscHardCutSlopeForPileupTransform expected size "
136 << number_of_expected_bin_combinedLH <<
" input size "
137 << m_discHardCutSlopeForPileupTransform.size());
138 sc = StatusCode::FAILURE;
141 if (!m_discLooseForPileupTransform.empty()) {
142 if (m_discLooseForPileupTransform.size() !=
143 number_of_expected_bin_combinedLH) {
145 "Configuration issue : DiscLooseForPileupTransform expected size "
146 << number_of_expected_bin_combinedLH <<
" input size "
147 << m_discLooseForPileupTransform.size());
148 sc = StatusCode::FAILURE;
153 if (!m_cutA0.empty()) {
154 if (m_cutA0.size() != number_of_expected_bin_combinedOther) {
156 << number_of_expected_bin_combinedOther <<
" input size "
158 sc = StatusCode::FAILURE;
163 if (!m_cutDeltaEta.empty()) {
164 if (m_cutDeltaEta.size() != number_of_expected_bin_combinedOther) {
165 ATH_MSG_ERROR(
"Configuration issue : CutDeltaEta expected size "
166 << number_of_expected_bin_combinedOther <<
" input size "
167 << m_cutDeltaEta.size());
168 sc = StatusCode::FAILURE;
173 if (!m_cutDeltaPhiRes.empty()) {
174 if (m_cutDeltaPhiRes.size() != number_of_expected_bin_combinedOther) {
175 ATH_MSG_ERROR(
"Configuration issue : CutDeltaPhiRes expected size "
176 << number_of_expected_bin_combinedOther <<
" input size "
177 << m_cutDeltaPhiRes.size());
178 sc = StatusCode::FAILURE;
181 if (
sc == StatusCode::FAILURE) {
183 "Could NOT initialize! Please fix the errors mentioned above...");
191 m_cutPosition_kinematic = m_acceptInfo.addCut(
"kinematic",
"pass kinematic");
192 if (m_cutPosition_kinematic < 0) {
193 sc = StatusCode::FAILURE;
197 m_cutPosition_NSilicon = m_acceptInfo.addCut(
"NSilicon",
"pass NSilicon");
198 if (m_cutPosition_NSilicon < 0) {
199 sc = StatusCode::FAILURE;
203 m_cutPosition_NPixel = m_acceptInfo.addCut(
"NPixel",
"pass NPixel");
204 if (m_cutPosition_NPixel < 0) {
205 sc = StatusCode::FAILURE;
209 m_cutPosition_NBlayer = m_acceptInfo.addCut(
"NBlayer",
"pass NBlayer");
210 if (m_cutPosition_NBlayer < 0) {
211 sc = StatusCode::FAILURE;
215 m_cutPosition_ambiguity = m_acceptInfo.addCut(
"ambiguity",
"pass ambiguity");
216 if (m_cutPosition_ambiguity < 0) {
217 sc = StatusCode::FAILURE;
221 m_cutPosition_LH = m_acceptInfo.addCut(
"passLH",
"pass Likelihood");
222 if (m_cutPosition_LH < 0) {
223 sc = StatusCode::FAILURE;
227 m_cutPositionTrackA0 =
228 m_acceptInfo.addCut(
"TrackA0",
"A0 (aka d0) wrt beam spot < Cut");
229 if (m_cutPositionTrackA0 < 0) {
230 sc = StatusCode::FAILURE;
234 m_cutPositionTrackMatchEta = m_acceptInfo.addCut(
235 "TrackMatchEta",
"Track match deta in 1st sampling < Cut");
236 if (m_cutPositionTrackMatchEta < 0) {
237 sc = StatusCode::FAILURE;
241 m_cutPositionTrackMatchPhiRes = m_acceptInfo.addCut(
242 "TrackMatchPhiRes",
"Track match dphi in 2nd sampling, rescaled < Cut");
243 if (m_cutPositionTrackMatchPhiRes < 0) {
244 sc = StatusCode::FAILURE;
248 m_cutPositionWstotAtHighET = m_acceptInfo.addCut(
249 "WstotAtHighET",
"Above HighETBinThreshold, Wstot < Cut");
250 if (m_cutPositionWstotAtHighET < 0) {
251 sc = StatusCode::FAILURE;
255 m_cutPositionEoverPAtHighET = m_acceptInfo.addCut(
256 "EoverPAtHighET",
"Above HighETBinThreshold, EoverP < Cut");
257 if (m_cutPositionEoverPAtHighET < 0) {
258 sc = StatusCode::FAILURE;
262 if (
sc == StatusCode::FAILURE) {
264 "! Something went wrong with the setup of the decision objects...");
270 m_variableBitMask = getLikelihoodBitmask(m_variableNames);
274 TString tmpString(m_pdfFileName);
275 gSystem->ExpandPathName(tmpString);
276 std::string
fname(tmpString.Data());
277 auto pdfFile = std::unique_ptr<TFile>(TFile::Open(
fname.c_str(),
"READ"));
280 ATH_MSG_ERROR(
" No ROOT file found here: " << m_pdfFileName);
281 return StatusCode::FAILURE;
285 for (
unsigned int varIndex = 0; varIndex < s_fnVariables; varIndex++) {
286 const std::string& vstr = s_fVariables[varIndex];
290 if (m_variableNames.find(vstr) == std::string::npos &&
291 !m_variableNames.empty()) {
294 loadVarHistograms(vstr, pdfFile.get(), varIndex);
301 ATH_MSG_DEBUG(
"Initialization complete for a LH tool with these specs:"
302 <<
"\n - pdfFileName : "
304 <<
"\n - Variable bitmask : "
305 << m_variableBitMask);
309 <<
"\n - (bool)CutBL (yes/no) : "
310 << (!m_cutBL.empty() ?
"yes" :
"no")
311 <<
"\n - (bool)CutPi (yes/no) : "
312 << (!m_cutPi.empty() ?
"yes" :
"no")
313 <<
"\n - (bool)CutSi (yes/no) : "
314 << (!m_cutSi.empty() ?
"yes" :
"no")
315 <<
"\n - (bool)CutAmbiguity (yes/no) : "
316 << (!m_cutAmbiguity.empty() ?
"yes" :
"no")
317 <<
"\n - (bool)doRemoveF3AtHighEt (yes/no) : "
318 << (m_doRemoveF3AtHighEt ?
"yes" :
"no")
319 <<
"\n - (bool)doRemoveTRTPIDAtHighEt (yes/no) : "
320 << (m_doRemoveTRTPIDAtHighEt ?
"yes" :
"no")
321 <<
"\n - (bool)doSmoothBinInterpolation (yes/no) : "
322 << (m_doSmoothBinInterpolation ?
"yes" :
"no")
323 <<
"\n - (bool)useOneExtraHighETLHBin(yes/no) : "
324 << (m_useOneExtraHighETLHBin ?
"yes" :
"no")
325 <<
"\n - (double)HighETBinThreshold : "
326 << m_highETBinThreshold
327 <<
"\n - (bool)doPileupTransform (yes/no) : "
328 << (m_doPileupTransform ?
"yes" :
"no")
329 <<
"\n - (bool)doCentralityTransform (yes/no) : "
330 << (m_doCentralityTransform ?
"yes" :
"no")
331 <<
"\n - (bool)CutLikelihood (yes/no) : "
332 << (!m_cutLikelihood.empty() ?
"yes" :
"no")
333 <<
"\n - (bool)CutLikelihoodPileupCorrection (yes/no) : "
334 << (!m_cutLikelihoodPileupCorrection.empty() ?
"yes" :
"no")
335 <<
"\n - (bool)CutA0 (yes/no) : "
336 << (!m_cutA0.empty() ?
"yes" :
"no")
337 <<
"\n - (bool)CutDeltaEta (yes/no) : "
338 << (!m_cutDeltaEta.empty() ?
"yes" :
"no")
339 <<
"\n - (bool)CutDeltaPhiRes (yes/no) : "
340 << (!m_cutDeltaPhiRes.empty() ?
"yes" :
"no")
341 <<
"\n - (bool)CutWstotAtHighET (yes/no) : "
342 << (!m_cutWstotAtHighET.empty() ?
"yes" :
"no")
343 <<
"\n - (bool)CutEoverPAtHighET (yes/no) : "
344 << (!m_cutEoverPAtHighET.empty() ?
"yes" :
"no"));
351 unsigned int varIndex)
353 for (
unsigned int s_or_b = 0; s_or_b < 2; ++s_or_b) {
354 for (
unsigned int ip = 0;
ip < IP_BINS; ++
ip) {
355 for (
unsigned int et = 0;
et < s_fnEtBinsHist; ++
et) {
356 for (
unsigned int eta = 0; eta < s_fnEtaBins; ++eta) {
358 std::string sig_bkg = (s_or_b == 0) ?
"sig" :
"bkg";
362 unsigned int eta_tmp = (eta > 0) ? eta - 1 : eta;
365 unsigned int et_tmp =
et;
367 getBinName(binname, et_tmp, eta_tmp,
ip, m_ipBinning);
369 if (((std::string(binname).
find(
"2.37") != std::string::npos)) &&
370 (vstr.find(
"el_f3") != std::string::npos)) {
374 if (((std::string(binname).
find(
"2.01") != std::string::npos) ||
375 (std::string(binname).
find(
"2.37") != std::string::npos)) &&
376 (vstr.find(
"TRT") != std::string::npos)) {
381 snprintf(pdfdir, 500,
"%s/%s", vstr.c_str(), sig_bkg.c_str());
385 "%s_%s_smoothed_hist_from_KDE_%s",
389 char pdf_newname[500];
390 snprintf(pdf_newname,
392 "%s_%s_%s_LHtool_copy_%s",
398 if (!pdfFile->GetListOfKeys()->Contains(vstr.c_str())) {
400 << vstr <<
" because the folder does not exist.");
403 if (!((TDirectory*)pdfFile->Get(vstr.c_str()))
405 ->Contains(sig_bkg.c_str())) {
407 << vstr <<
" because the folder does not exist.");
414 if (
et == 0 && !((TDirectory*)pdfFile->Get(pdfdir))
417 getBinName(binname, et_tmp + 1, eta_tmp,
ip, m_ipBinning);
420 "%s_%s_smoothed_hist_from_KDE_%s",
424 snprintf(pdf_newname,
426 "%s_%s_%s_LHtool_copy4GeV_%s",
432 if (((TDirectory*)pdfFile->Get(pdfdir))
436 fPDFbins[s_or_b][
ip][
et][eta][varIndex] =
441 ATH_MSG_INFO(
"Skipping all other histograms with this variable.");
455 int nSiHitsPlusDeadSensors,
470 vars.nSiHitsPlusDeadSensors = nSiHitsPlusDeadSensors;
473 vars.ambiguityBit = ambiguityBit;
476 vars.deltaphires = deltaphires;
495 bool passNSilicon(
true);
496 bool passNPixel(
true);
497 bool passNBlayer(
true);
500 bool passTrackA0(
true);
501 bool passDeltaEta(
true);
502 bool passDeltaPhiRes(
true);
503 bool passWstotAtHighET(
true);
504 bool passEoverPAtHighET(
true);
506 if (std::abs(vars_struct.
eta) > 2.47) {
507 ATH_MSG_DEBUG(
"This electron is std::abs(eta)>2.47 Returning False.");
511 unsigned int etbinLH = getLikelihoodEtDiscBin(vars_struct.
eT,
true);
512 unsigned int etbinOther = getLikelihoodEtDiscBin(vars_struct.
eT,
false);
513 unsigned int etabin = getLikelihoodEtaBin(vars_struct.
eta);
516 if (etbinLH >= s_fnDiscEtBinsOneExtra) {
518 << vars_struct.
eT <<
". Returning false..");
522 if (etbinOther >= s_fnDiscEtBins) {
524 << vars_struct.
eT <<
". Returning false..");
529 acceptData.
setCutResult(m_cutPosition_kinematic, passKine);
535 if (!m_cutAmbiguity.empty()) {
538 m_cutAmbiguity[etabin])) {
545 if (!m_cutBL.empty()) {
552 if (!m_cutPi.empty()) {
559 if (!m_cutSi.empty()) {
562 passNSilicon =
false;
566 double cutDiscriminant;
567 unsigned int ibin_combinedLH =
568 etbinLH * s_fnEtaBins + etabin;
570 unsigned int ibin_combinedOther =
571 etbinOther * s_fnEtaBins +
575 if (!m_cutLikelihood.empty()) {
577 if (ibin_combinedLH >= m_cutLikelihood.size()) {
580 <<
" is outside of the range specified by the input"
581 << m_cutLikelihood.size() <<
"This should never happen!");
585 if (m_doSmoothBinInterpolation) {
586 cutDiscriminant = InterpolateCuts(
587 m_cutLikelihood, m_cutLikelihood4GeV, vars_struct.
eT, vars_struct.
eta);
588 if (!m_doPileupTransform && !m_cutLikelihoodPileupCorrection.empty() &&
589 !m_cutLikelihoodPileupCorrection4GeV.empty())
591 vars_struct.
ip * InterpolateCuts(m_cutLikelihoodPileupCorrection,
592 m_cutLikelihoodPileupCorrection4GeV,
596 if (vars_struct.
eT > 7000. || m_cutLikelihood4GeV.empty()) {
597 cutDiscriminant = m_cutLikelihood[ibin_combinedLH];
600 if (!m_doPileupTransform && !m_cutLikelihoodPileupCorrection.empty()) {
602 vars_struct.
ip * m_cutLikelihoodPileupCorrection[ibin_combinedLH];
605 cutDiscriminant = m_cutLikelihood4GeV[etabin];
606 if (!m_doPileupTransform &&
607 !m_cutLikelihoodPileupCorrection4GeV.empty())
609 vars_struct.
ip * m_cutLikelihoodPileupCorrection4GeV[etabin];
615 if (vars_struct.
likelihood < cutDiscriminant) {
622 if (!m_cutA0.empty()) {
623 if (std::abs(vars_struct.
d0) > m_cutA0[ibin_combinedOther]) {
630 if (!m_cutDeltaEta.empty()) {
631 if (std::abs(vars_struct.
deltaEta) > m_cutDeltaEta[ibin_combinedOther]) {
633 passDeltaEta =
false;
638 if (!m_cutDeltaPhiRes.empty()) {
640 m_cutDeltaPhiRes[ibin_combinedOther]) {
642 passDeltaPhiRes =
false;
647 if (vars_struct.
eT > m_highETBinThreshold * 1000) {
649 if (!m_cutWstotAtHighET.empty()) {
650 if (std::abs(vars_struct.
wstot) > m_cutWstotAtHighET[etabin]) {
652 passWstotAtHighET =
false;
657 if (!m_cutEoverPAtHighET.empty()) {
658 if (std::abs(vars_struct.
EoverP) > m_cutEoverPAtHighET[etabin]) {
660 passEoverPAtHighET =
false;
666 acceptData.
setCutResult(m_cutPosition_NSilicon, passNSilicon);
667 acceptData.
setCutResult(m_cutPosition_NPixel, passNPixel);
668 acceptData.
setCutResult(m_cutPosition_NBlayer, passNBlayer);
671 acceptData.
setCutResult(m_cutPositionTrackA0, passTrackA0);
672 acceptData.
setCutResult(m_cutPositionTrackMatchEta, passDeltaEta);
673 acceptData.
setCutResult(m_cutPositionTrackMatchPhiRes, passDeltaPhiRes);
674 acceptData.
setCutResult(m_cutPositionWstotAtHighET, passWstotAtHighET);
675 acceptData.
setCutResult(m_cutPositionEoverPAtHighET, passEoverPAtHighET);
712 vars.d0sigma = d0sigma;
714 vars.deltaPoverP = deltaPoverP;
715 vars.deltaphires = deltaphires;
716 vars.TRT_PID = TRT_PID;
730 unsigned int etabin = getLikelihoodEtaBin(vars_struct.
eta);
732 if (etabin == 3 || etabin == 4) {
733 rhad_corr = vars_struct.
rHad;
735 rhad_corr = vars_struct.
rHad1;
739 : std::abs(vars_struct.
d0) / vars_struct.
d0sigma;
741 std::vector<double>
vec = {
743 vars_struct.
f1, vars_struct.
f3, vars_struct.
Reta,
744 rhad_corr, vars_struct.
rphi, vars_struct.
d0,
749 result = this->evaluateLikelihood(
750 vec, vars_struct.
eT, vars_struct.
eta, vars_struct.
ip);
757 const std::vector<float>& varVector,
762 std::vector<double>
vec;
763 for (
unsigned int var = 0;
var < s_fnVariables;
var++) {
764 vec.push_back(varVector[
var]);
766 return evaluateLikelihood(
vec,
et, eta,
ip);
771 const std::vector<double>& varVector,
777 const double GeV = 1000;
778 unsigned int etbin = getLikelihoodEtHistBin(
et);
779 unsigned int etabin = getLikelihoodEtaBin(eta);
780 unsigned int ipbin = getIpBin(
ip);
783 <<
" etabin: " << etabin);
785 if (etbin >= s_fnEtBinsHist) {
789 if (etabin >= s_fnEtaBins) {
794 if (varVector.size() != s_fnVariables) {
795 ATH_MSG_WARNING(
"Error! Variable vector size mismatch! Check your vector!");
802 const std::string TRT_string =
"TRT";
803 const std::string el_f3_string =
"el_f3";
804 const std::string el_TRT_PID_string =
"el_TRT_PID";
806 for (
unsigned int var = 0;
var < s_fnVariables;
var++) {
808 const std::string& varstr = s_fVariables[
var];
811 if (!(m_variableBitMask & (0
x1 <<
var))) {
815 if (((etabin == 8) || (etabin == 9)) &&
816 (varstr.find(TRT_string) != std::string::npos)) {
820 if ((etabin == 9) && (varstr.find(el_f3_string) != std::string::npos)) {
824 if (m_doRemoveF3AtHighEt && (
et > 80 *
GeV) &&
825 (varstr.find(el_f3_string) != std::string::npos)) {
829 if (m_doRemoveTRTPIDAtHighEt && (
et > 80 *
GeV) &&
830 (varstr.find(el_TRT_PID_string) != std::string::npos)) {
833 for (
unsigned int s_or_b = 0; s_or_b < 2; s_or_b++) {
836 fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->FindBin(varVector[
var]);
839 if (m_doSmoothBinInterpolation) {
840 prob = InterpolatePdfs(s_or_b, ipbin,
et, eta,
bin,
var);
843 double(fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->Integral());
851 fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->GetBinContent(
bin)) /
857 }
else if (s_or_b == 1) {
863 return TransformLikelihoodOutput(SigmaS, SigmaB,
ip,
et, eta);
876 double fEpsilon = 1
e-99;
886 }
else if (disc <= 0.0) {
891 disc = -
log(1.0 / disc - 1.0) * (1. /
double(tau));
898 if (m_doPileupTransform) {
910 if (m_discHardCutForPileupTransform.empty() ||
911 m_discHardCutSlopeForPileupTransform.empty() ||
912 m_discLooseForPileupTransform.empty()) {
914 "Vectors needed for pileup-dependent transform not correctly filled! "
915 "Skipping the transform.");
919 if (m_doCentralityTransform &&
920 m_discHardCutQuadForPileupTransform.empty()) {
921 ATH_MSG_WARNING(
"Vectors needed for centrality-dependent transform not "
923 "Skipping the transform.");
927 unsigned int etabin = getLikelihoodEtaBin(eta);
929 double disc_hard_cut_ref = 0;
930 double disc_hard_cut_ref_slope = 0;
931 double disc_hard_cut_ref_quad =
933 double disc_loose_ref = 0;
934 double disc_max = m_discMaxForPileupTransform;
935 double pileup_max = m_pileupMaxForPileupTransform;
937 if (m_doSmoothBinInterpolation) {
938 disc_hard_cut_ref = InterpolateCuts(m_discHardCutForPileupTransform,
939 m_discHardCutForPileupTransform4GeV,
942 disc_hard_cut_ref_slope =
943 InterpolateCuts(m_discHardCutSlopeForPileupTransform,
944 m_discHardCutSlopeForPileupTransform4GeV,
947 if (m_doCentralityTransform)
948 disc_hard_cut_ref_quad =
949 InterpolateCuts(m_discHardCutQuadForPileupTransform,
950 m_discHardCutQuadForPileupTransform4GeV,
953 disc_loose_ref = InterpolateCuts(m_discLooseForPileupTransform,
954 m_discLooseForPileupTransform4GeV,
959 if (
et > 7000. || m_discHardCutForPileupTransform4GeV.empty()) {
960 unsigned int etfinebinLH = getLikelihoodEtDiscBin(
et,
true);
961 unsigned int ibin_combined = etfinebinLH * s_fnEtaBins + etabin;
962 disc_hard_cut_ref = m_discHardCutForPileupTransform[ibin_combined];
963 disc_hard_cut_ref_slope =
964 m_discHardCutSlopeForPileupTransform[ibin_combined];
965 if (m_doCentralityTransform)
966 disc_hard_cut_ref_quad =
967 m_discHardCutQuadForPileupTransform[ibin_combined];
968 disc_loose_ref = m_discLooseForPileupTransform[ibin_combined];
970 if (m_discHardCutForPileupTransform4GeV.empty() ||
971 m_discHardCutSlopeForPileupTransform4GeV.empty() ||
972 m_discLooseForPileupTransform4GeV.empty()) {
974 "correctly filled for 4-7 GeV "
975 "bin! Skipping the transform.");
978 if (m_doCentralityTransform &&
979 m_discHardCutQuadForPileupTransform4GeV.empty()) {
981 "not correctly filled for 4-7 "
982 "GeV bin! Skipping the transform.");
985 disc_hard_cut_ref = m_discHardCutForPileupTransform4GeV[etabin];
986 disc_hard_cut_ref_slope =
987 m_discHardCutSlopeForPileupTransform4GeV[etabin];
988 if (m_doCentralityTransform)
989 disc_hard_cut_ref_quad =
990 m_discHardCutQuadForPileupTransform4GeV[etabin];
991 disc_loose_ref = m_discLooseForPileupTransform4GeV[etabin];
997 double disc_hard_cut_ref_prime =
998 disc_hard_cut_ref + disc_hard_cut_ref_slope * ip_for_corr +
999 disc_hard_cut_ref_quad * ip_for_corr * ip_for_corr;
1001 if (disc <= disc_loose_ref) {
1003 }
else if (disc <= disc_hard_cut_ref_prime) {
1005 double denom =
double(disc_hard_cut_ref_prime - disc_loose_ref);
1008 disc = disc_loose_ref + (disc - disc_loose_ref) *
1009 (disc_hard_cut_ref - disc_loose_ref) /
denom;
1010 }
else if (disc_hard_cut_ref_prime < disc && disc <= disc_max) {
1012 double denom =
double(disc_max - disc_hard_cut_ref_prime);
1015 disc = disc_hard_cut_ref + (disc - disc_hard_cut_ref_prime) *
1016 (disc_max - disc_hard_cut_ref) /
denom;
1029 for (
unsigned int ipBin = 0; ipBin < IP_BINS; ++ipBin) {
1030 if (
ip < s_fIpBounds[ipBin + 1])
1041 const unsigned int nEtaBins = s_fnEtaBins;
1043 1.52, 1.81, 2.01, 2.37, 2.47 };
1057 const double GeV = 1000;
1059 const unsigned int nEtBins = s_fnEtBinsHist;
1060 const double eTBins[nEtBins] = { 7 *
GeV, 10 *
GeV, 15 *
GeV, 20 *
GeV,
1063 for (
unsigned int eTBin = 0; eTBin < nEtBins; ++eTBin) {
1064 if (
eT < eTBins[eTBin]) {
1077 const bool isLHbinning)
const
1079 const double GeV = 1000;
1081 if (m_useOneExtraHighETLHBin && isLHbinning) {
1082 const unsigned int nEtBins = s_fnDiscEtBinsOneExtra;
1083 const double eTBins[nEtBins] = {
1086 40 *
GeV, 45 *
GeV, m_highETBinThreshold *
GeV,
1090 for (
unsigned int eTBin = 0; eTBin < nEtBins; ++eTBin) {
1091 if (
eT < eTBins[eTBin])
1098 const unsigned int nEtBins = s_fnDiscEtBins;
1099 const double eTBins[nEtBins] = { 10 *
GeV, 15 *
GeV, 20 *
GeV,
1103 for (
unsigned int eTBin = 0; eTBin < nEtBins; ++eTBin) {
1104 if (
eT < eTBins[eTBin])
1118 const std::string& iptype)
1120 double eta_bounds[9] = { 0.0, 0.6, 0.8, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37 };
1121 int et_bounds[s_fnEtBinsHist] = { 4, 7, 10, 15, 20, 30, 40 };
1122 if (!iptype.empty()) {
1125 "%s%det%02deta%0.2f",
1127 int(s_fIpBounds[ipbin]),
1129 eta_bounds[etabin]);
1131 snprintf(
buffer, 200,
"et%deta%0.2f", et_bounds[etbin], eta_bounds[etabin]);
1137 const std::string& vars)
const
1139 unsigned int mask = 0x0;
1141 for (
unsigned int var = 0;
var < s_fnVariables;
var++) {
1142 if (vars.find(s_fVariables[
var]) != std::string::npos) {
1156 const std::vector<double>&
cuts,
1157 const std::vector<double>& cuts_4gev,
1164 unsigned int etbinLH = getLikelihoodEtDiscBin(
et,
true);
1165 unsigned int etabin = getLikelihoodEtaBin(eta);
1166 unsigned int ibin_combinedLH = etbinLH * s_fnEtaBins + etabin;
1167 double cut =
cuts.at(ibin_combinedLH);
1170 if (!cuts_4gev.empty()) {
1172 cut = cuts_4gev.at(etabin);
1186 if (
et > 47500. || !(etbinLH < s_fnDiscEtBins)) {
1191 if (7000. <
et &&
et < 10000.) {
1197 const double GeV = 1000;
1198 const double eTBins[s_fnDiscEtBins] = { 8.5 *
GeV, 12.5 *
GeV, 17.5 *
GeV,
1201 double bin_center = eTBins[etbinLH];
1202 if (
et > bin_center) {
1203 double cut_next =
cut;
1204 if (etbinLH + 1 <= 8)
1205 cut_next =
cuts.at((etbinLH + 1) * s_fnEtaBins + etabin);
1209 double cut_before =
cut;
1211 cut_before =
cuts.at((etbinLH - 1) * s_fnEtaBins + etabin);
1212 }
else if (etbinLH == 0 && !cuts_4gev.empty()) {
1213 cut_before = cuts_4gev.at(etabin);
1228 unsigned int var)
const
1233 int etbin = getLikelihoodEtHistBin(
et);
1234 int etabin = getLikelihoodEtaBin(eta);
1236 double(fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->Integral());
1238 double(fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->GetBinContent(
bin)) /
1241 int Nbins = fPDFbins[s_or_b][ipbin][etbin][etabin][
var]->GetNbinsX();
1248 if (22500. <
et &&
et < 27500.) {
1251 if (32500. <
et &&
et < 37500.) {
1255 if (7000. <
et &&
et < 10000.) {
1261 const double GeV = 1000;
1262 const double eTHistBins[s_fnEtBinsHist] = { 6. *
GeV, 8.5 *
GeV,
1266 double bin_center = eTHistBins[etbin];
1267 if (etbin == 4 &&
et >= 27500.) {
1268 bin_center = 27500.;
1270 if (etbin == 5 &&
et >= 37500.) {
1271 bin_center = 37500.;
1273 if (
et > bin_center) {
1274 double prob_next =
prob;
1275 if (etbin + 1 <= 6) {
1278 fPDFbins[s_or_b][ipbin][etbin + 1][etabin][
var]->GetNbinsX();
1280 if (Nbins < NbinsPlus) {
1282 }
else if (Nbins > NbinsPlus) {
1286 double integral_next =
1287 double(fPDFbins[s_or_b][ipbin][etbin + 1][etabin][
var]->Integral());
1289 double(fPDFbins[s_or_b][ipbin][etbin + 1][etabin][
var]->GetBinContent(
1296 double prob_before =
prob;
1297 if (etbin - 1 >= 0) {
1300 fPDFbins[s_or_b][ipbin][etbin - 1][etabin][
var]->GetNbinsX();
1302 if (Nbins < NbinsMinus) {
1303 binminus =
int(
round(
bin * (Nbins / NbinsMinus)));
1304 }
else if (Nbins > NbinsMinus) {
1305 binminus =
int(
round(
bin * (NbinsMinus / Nbins)));
1307 double integral_before =
1308 double(fPDFbins[s_or_b][ipbin][etbin - 1][etabin][
var]->Integral());
1310 double(fPDFbins[s_or_b][ipbin][etbin - 1][etabin][
var]->GetBinContent(
1321 "el_d0significance",
1329 "el_trackd0pvunbiased",
1332 "el_deltaphiRescaled",