21 nbins_ = bounds.size() - 1;
40 fl = (
TF1*)fIn_theta->Get(nml.c_str());
41 fc = (
TF1*)fIn_theta->Get(nmc.c_str());
42 fh = (
TF1*)fIn_theta->Get(nmh.c_str());
43 if (fl ==
nullptr ||
fc ==
nullptr || fh ==
nullptr) {
45 LogTrace(
"L1TkMuMantra") <<
"... fit theta low : " << fl << std::endl;
46 LogTrace(
"L1TkMuMantra") <<
"... fit theta cent : " <<
fc << std::endl;
47 LogTrace(
"L1TkMuMantra") <<
"... fit theta high : " << fh << std::endl;
49 throw cms::Exception(
"L1TkMuMantra") <<
"TF1 named " << nml <<
" or " << nmc <<
" or " << nmh
50 <<
" not found in file " << fIn_theta->GetName() <<
".\n";
61 fl = (
TF1*)fIn_phi->Get(nml.c_str());
62 fc = (
TF1*)fIn_phi->Get(nmc.c_str());
63 fh = (
TF1*)fIn_phi->Get(nmh.c_str());
64 if (fl ==
nullptr ||
fc ==
nullptr || fh ==
nullptr) {
66 LogTrace(
"L1TkMuMantra") <<
"... fit phi low : " << fl << std::endl;
67 LogTrace(
"L1TkMuMantra") <<
"... fit phi cent : " <<
fc << std::endl;
68 LogTrace(
"L1TkMuMantra") <<
"... fit phi high : " << fh << std::endl;
70 throw cms::Exception(
"L1TkMuMantra") <<
"TF1 named " << nml <<
" or " << nmc <<
" or " << nmh
71 <<
" not found in file " << fIn_theta->GetName() <<
".\n";
93 LogTrace(
"L1TkMuMantra") <<
"Something strange happened at val " <<
val << std::endl;
100 LogTrace(
"L1TkMuMantra") <<
" ---- eta : " <<
eta <<
" pt: " <<
pt << std::endl;
101 LogTrace(
"L1TkMuMantra") <<
" ---- bin " << ibin << std::endl;
102 LogTrace(
"L1TkMuMantra") <<
" ---- "
103 <<
"- low_phi : " <<
wdws_phi_.at(ibin).bound_low(
pt)
104 <<
"- cent_phi : " <<
wdws_phi_.at(ibin).bound_cent(
pt)
105 <<
"- high_phi : " <<
wdws_phi_.at(ibin).bound_high(
pt) << std::endl;
107 LogTrace(
"L1TkMuMantra") <<
" ---- "
110 <<
"- high_theta : " <<
wdws_theta_.at(ibin).bound_high(
pt) << std::endl;
117 for (
uint imu = 0; imu <
muons.size(); ++imu) {
119 std::vector<std::pair<double, int>> matched_trks;
120 for (
uint itrk = 0; itrk <
tracks.size(); ++itrk) {
130 double dtheta_endc = (
mu.theta - trk.
theta) *
sign(
mu.theta);
139 double phi_low =
wdws_phi_.at(ibin).bound_low(trk.
pt);
140 double phi_cent =
wdws_phi_.at(ibin).bound_cent(trk.
pt);
141 double phi_high =
wdws_phi_.at(ibin).bound_high(trk.
pt);
143 bool in_phi = (dphi_charge > phi_low && dphi_charge < phi_high);
149 bool in_theta = (dtheta_endc > theta_low && dtheta_endc < theta_high);
151 if (in_phi && in_theta) {
152 double sort_par = 99999;
159 matched_trks.emplace_back(sort_par, itrk);
164 if (!matched_trks.empty()) {
165 sort(matched_trks.begin(), matched_trks.end());
168 ibest = matched_trks.rbegin()->second;
170 ibest = matched_trks.begin()->second;
179 double delta_high =
high - cent;
180 double delta_low = cent -
low;
190 LogTrace(
"L1TkMuMantra") <<
"L1TkMuMantra : setting arbitration type to " <<
type << std::endl;
193 else if (
type ==
"MinDeltaPt")
196 throw cms::Exception(
"L1TkMuMantra") <<
"setArbitrationType : cannot understand the arbitration type passed.\n";
201 TFile* fIn = TFile::Open(
fname.c_str());
202 if (fIn ==
nullptr) {
203 throw cms::Exception(
"L1TkMuMantra") <<
"Can't find file " <<
fname <<
" to derive bounds.\n";
205 TH2* h_test = (TH2*)fIn->Get(hname.c_str());
206 if (h_test ==
nullptr) {
207 throw cms::Exception(
"L1TkMuMantra") <<
"Can't find histo " << hname <<
" in file " <<
fname
208 <<
" to derive bounds.\n";
211 int nbds = h_test->GetNbinsY() + 1;
212 std::vector<double> bounds(nbds);
213 for (
int ib = 0;
ib < nbds; ++
ib) {
214 bounds.at(
ib) = h_test->GetYaxis()->GetBinLowEdge(
ib + 1);