23 nbins_ = bounds.size() - 1;
42 fl = (TF1*)fIn_theta->Get(nml.c_str());
43 fc = (TF1*)fIn_theta->Get(nmc.c_str());
44 fh = (TF1*)fIn_theta->Get(nmh.c_str());
45 if (fl ==
nullptr ||
fc ==
nullptr || fh ==
nullptr) {
47 LogTrace(
"L1TkMuMantra") <<
"... fit theta low : " << fl << std::endl;
48 LogTrace(
"L1TkMuMantra") <<
"... fit theta cent : " <<
fc << std::endl;
49 LogTrace(
"L1TkMuMantra") <<
"... fit theta high : " << fh << std::endl;
51 throw cms::Exception(
"L1TkMuMantra") <<
"TF1 named " << nml <<
" or " << nmc <<
" or " << nmh
52 <<
" not found in file " << fIn_theta->GetName() <<
".\n";
63 fl = (TF1*)fIn_phi->Get(nml.c_str());
64 fc = (TF1*)fIn_phi->Get(nmc.c_str());
65 fh = (TF1*)fIn_phi->Get(nmh.c_str());
66 if (fl ==
nullptr ||
fc ==
nullptr || fh ==
nullptr) {
68 LogTrace(
"L1TkMuMantra") <<
"... fit phi low : " << fl << std::endl;
69 LogTrace(
"L1TkMuMantra") <<
"... fit phi cent : " <<
fc << std::endl;
70 LogTrace(
"L1TkMuMantra") <<
"... fit phi high : " << fh << std::endl;
72 throw cms::Exception(
"L1TkMuMantra") <<
"TF1 named " << nml <<
" or " << nmc <<
" or " << nmh
73 <<
" not found in file " << fIn_theta->GetName() <<
".\n";
95 LogTrace(
"L1TkMuMantra") <<
"Something strange happened at val " <<
val << std::endl;
102 LogTrace(
"L1TkMuMantra") <<
" ---- eta : " <<
eta <<
" pt: " <<
pt << std::endl;
103 LogTrace(
"L1TkMuMantra") <<
" ---- bin " << ibin << std::endl;
104 LogTrace(
"L1TkMuMantra") <<
" ---- "
105 <<
"- low_phi : " <<
wdws_phi_.at(ibin).bound_low(
pt)
106 <<
"- cent_phi : " <<
wdws_phi_.at(ibin).bound_cent(
pt)
107 <<
"- high_phi : " <<
wdws_phi_.at(ibin).bound_high(
pt) << std::endl;
109 LogTrace(
"L1TkMuMantra") <<
" ---- "
112 <<
"- high_theta : " <<
wdws_theta_.at(ibin).bound_high(
pt) << std::endl;
119 for (
uint imu = 0; imu <
muons.size(); ++imu) {
121 std::vector<std::pair<double, int>> matched_trks;
122 for (
uint itrk = 0; itrk <
tracks.size(); ++itrk) {
132 double dtheta_endc = (
mu.theta - trk.
theta) *
sign(
mu.theta);
141 double phi_low =
wdws_phi_.at(ibin).bound_low(trk.
pt);
142 double phi_cent =
wdws_phi_.at(ibin).bound_cent(trk.
pt);
143 double phi_high =
wdws_phi_.at(ibin).bound_high(trk.
pt);
145 bool in_phi = (dphi_charge > phi_low && dphi_charge < phi_high);
151 bool in_theta = (dtheta_endc > theta_low && dtheta_endc < theta_high);
153 if (in_phi && in_theta) {
154 double sort_par = 99999;
161 matched_trks.emplace_back(sort_par, itrk);
166 if (!matched_trks.empty()) {
167 sort(matched_trks.begin(), matched_trks.end());
170 ibest = matched_trks.rbegin()->second;
172 ibest = matched_trks.begin()->second;
181 double delta_high =
high - cent;
182 double delta_low = cent -
low;
192 LogTrace(
"L1TkMuMantra") <<
"L1TkMuMantra : setting arbitration type to " <<
type << std::endl;
195 else if (
type ==
"MinDeltaPt")
198 throw cms::Exception(
"L1TkMuMantra") <<
"setArbitrationType : cannot understand the arbitration type passed.\n";
203 TFile* fIn = TFile::Open(
fname.c_str());
204 if (fIn ==
nullptr) {
205 throw cms::Exception(
"L1TkMuMantra") <<
"Can't find file " <<
fname <<
" to derive bounds.\n";
207 TH2* h_test = (TH2*)fIn->Get(hname.c_str());
208 if (h_test ==
nullptr) {
209 throw cms::Exception(
"L1TkMuMantra") <<
"Can't find histo " << hname <<
" in file " <<
fname
210 <<
" to derive bounds.\n";
213 int nbds = h_test->GetNbinsY() + 1;
214 std::vector<double> bounds(nbds);
215 for (
int ib = 0;
ib < nbds; ++
ib) {
216 bounds.at(
ib) = h_test->GetYaxis()->GetBinLowEdge(
ib + 1);