CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TkMuCorrDynamicWindows Class Reference

#include <L1TkMuCorrDynamicWindows.h>

Public Types

typedef std::vector< L1TTTrackTypeL1TTTrackCollectionType
 
typedef TTTrack< Ref_Phase2TrackerDigi_L1TTTrackType
 

Public Member Functions

std::vector< int > find_match (const EMTFTrackCollection &l1mus, const L1TTTrackCollectionType &l1trks)
 
std::vector< int > find_match_stub (const EMTFHitCollection &l1mus, const L1TTTrackCollectionType &l1trks, const int &station, bool requireBX0=true)
 
 L1TkMuCorrDynamicWindows (const std::vector< double > &bounds, TFile *fIn_theta, TFile *fIn_phi)
 
 L1TkMuCorrDynamicWindows (const std::vector< double > &bounds, TFile *fIn_theta, TFile *fIn_phi, TFile *fIn_theta_S1, TFile *fIn_phi_S1)
 
const float max_trk_aeta ()
 
const float max_trk_chi2 ()
 
const int min_trk_nstubs ()
 
const float min_trk_p ()
 
const int n_trk_par ()
 
void set_do_relax_factor (bool val)
 
void set_do_trk_qual_presel (bool val)
 
void set_max_trk_aeta (float val)
 
void set_max_trk_chi2 (float val)
 
void set_min_trk_nstubs (int val)
 
void set_min_trk_p (float val)
 
void set_n_trk_par (int val)
 
void set_relaxation_pattern (float pt_start, float pt_end)
 
void set_safety_factor (float sf)
 
void set_safety_factor (float sf_l, float sf_h)
 
void set_sf_initialrelax (float sf)
 
void set_sf_initialrelax (float sf_l, float sf_h)
 
 ~L1TkMuCorrDynamicWindows ()
 

Static Public Member Functions

static std::vector< double > prepare_corr_bounds (const string &fname, const string &hname)
 

Private Member Functions

double deg_to_rad (double x)
 
double eta_to_theta (double x)
 
int findBin (double val)
 
std::vector< int > make_unique_coll (const unsigned int &l1musSize, const L1TTTrackCollectionType &l1trks, const std::vector< int > &matches)
 
double sf_progressive (double x, double xstart, double xstop, double ystart, double ystop)
 
double to_mpi_pi (double x)
 
double to_mpio2_pio2 (double x)
 

Private Attributes

std::vector< double > bounds_
 
bool do_relax_factor_
 
float initial_sf_h_
 
float initial_sf_l_
 
float max_trk_aeta_
 
float max_trk_chi2_
 
int min_trk_nstubs_
 
float min_trk_p_
 
int nbins_
 
int nTrkPars_
 
float pt_end_
 
float pt_start_
 
float safety_factor_h_
 
float safety_factor_l_
 
bool track_qual_presel_
 
std::vector< MuMatchWindowwdws_phi_
 
std::vector< MuMatchWindowwdws_phi_S1_
 
std::vector< MuMatchWindowwdws_theta_
 
std::vector< MuMatchWindowwdws_theta_S1_
 

Detailed Description

Definition at line 24 of file L1TkMuCorrDynamicWindows.h.

Member Typedef Documentation

◆ L1TTTrackCollectionType

Definition at line 27 of file L1TkMuCorrDynamicWindows.h.

◆ L1TTTrackType

Definition at line 26 of file L1TkMuCorrDynamicWindows.h.

Constructor & Destructor Documentation

◆ L1TkMuCorrDynamicWindows() [1/2]

L1TkMuCorrDynamicWindows::L1TkMuCorrDynamicWindows ( const std::vector< double > &  bounds,
TFile *  fIn_theta,
TFile *  fIn_phi 
)

Definition at line 7 of file L1TkMuCorrDynamicWindows.cc.

8  : wdws_theta_(bounds.size() - 1, MuMatchWindow()),
9  wdws_phi_(bounds.size() - 1, MuMatchWindow()),
10  wdws_theta_S1_(bounds.size() - 1, MuMatchWindow()),
11  wdws_phi_S1_(bounds.size() - 1, MuMatchWindow()) {
12  set_safety_factor(0.5);
14  set_relaxation_pattern(2.0, 6.0);
15  set_do_relax_factor(true);
16 
17  track_qual_presel_ = true;
18 
19  nbins_ = bounds.size() - 1;
20  bounds_ = bounds;
21 
22  // now load in memory the TF1 fits
23 
24  for (int ib = 0; ib < nbins_; ++ib) {
25  std::string wdn;
26  std::string nml;
27  std::string nmh;
28  TF1* fl;
29  TF1* fh;
30 
31  // Station 2
32  wdn = std::string("wdw_theta_") + std::to_string(ib + 1);
33  nml = std::string("fit_low_") + std::to_string(ib + 1);
34  nmh = std::string("fit_high_") + std::to_string(ib + 1);
35  fl = (TF1*)fIn_theta->Get(nml.c_str());
36  fh = (TF1*)fIn_theta->Get(nmh.c_str());
37  if (fl == nullptr || fh == nullptr)
38  throw cms::Exception("L1TkMuCorrDynamicWindows")
39  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
40  wdws_theta_.at(ib).SetName(wdn);
41  wdws_theta_.at(ib).SetLower(fl);
42  wdws_theta_.at(ib).SetUpper(fh);
43 
44  wdn = std::string("wdw_phi_") + std::to_string(ib + 1);
45  nml = std::string("fit_low_") + std::to_string(ib + 1);
46  nmh = std::string("fit_high_") + std::to_string(ib + 1);
47  fl = (TF1*)fIn_phi->Get(nml.c_str());
48  fh = (TF1*)fIn_phi->Get(nmh.c_str());
49  if (fl == nullptr || fh == nullptr)
50  throw cms::Exception("L1TkMuCorrDynamicWindows")
51  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
52  wdws_phi_.at(ib).SetName(wdn);
53  wdws_phi_.at(ib).SetLower(fl);
54  wdws_phi_.at(ib).SetUpper(fh);
55  }
56 }

References bounds_, Exception, cuy::ib, nbins_, set_do_relax_factor(), set_relaxation_pattern(), set_safety_factor(), set_sf_initialrelax(), AlCaHLTBitMon_QueryRunRegistry::string, tools::TF1, track_qual_presel_, wdws_phi_, and wdws_theta_.

◆ L1TkMuCorrDynamicWindows() [2/2]

L1TkMuCorrDynamicWindows::L1TkMuCorrDynamicWindows ( const std::vector< double > &  bounds,
TFile *  fIn_theta,
TFile *  fIn_phi,
TFile *  fIn_theta_S1,
TFile *  fIn_phi_S1 
)

Definition at line 58 of file L1TkMuCorrDynamicWindows.cc.

60  : wdws_theta_(bounds.size() - 1, MuMatchWindow()),
61  wdws_phi_(bounds.size() - 1, MuMatchWindow()),
62  wdws_theta_S1_(bounds.size() - 1, MuMatchWindow()),
63  wdws_phi_S1_(bounds.size() - 1, MuMatchWindow()) {
64  set_safety_factor(0.0);
66  set_relaxation_pattern(2.0, 6.0);
67  set_do_relax_factor(true);
68 
69  track_qual_presel_ = true;
70 
71  nbins_ = bounds.size() - 1;
72  bounds_ = bounds;
73 
74  // now load in memory the TF1 fits
75 
76  for (int ib = 0; ib < nbins_; ++ib) {
77  std::string wdn;
78  std::string nml;
79  std::string nmh;
80  TF1* fl;
81  TF1* fh;
82 
83  // Station 2
84  wdn = std::string("wdw_theta_") + std::to_string(ib + 1);
85  nml = std::string("fit_low_") + std::to_string(ib + 1);
86  nmh = std::string("fit_high_") + std::to_string(ib + 1);
87  fl = (TF1*)fIn_theta->Get(nml.c_str());
88  fh = (TF1*)fIn_theta->Get(nmh.c_str());
89  if (fl == nullptr || fh == nullptr)
90  throw cms::Exception("L1TkMuCorrDynamicWindows")
91  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
92  wdws_theta_.at(ib).SetName(wdn);
93  wdws_theta_.at(ib).SetLower(fl);
94  wdws_theta_.at(ib).SetUpper(fh);
95 
96  wdn = std::string("wdw_phi_") + std::to_string(ib + 1);
97  nml = std::string("fit_low_") + std::to_string(ib + 1);
98  nmh = std::string("fit_high_") + std::to_string(ib + 1);
99  fl = (TF1*)fIn_phi->Get(nml.c_str());
100  fh = (TF1*)fIn_phi->Get(nmh.c_str());
101  if (fl == nullptr || fh == nullptr)
102  throw cms::Exception("L1TkMuCorrDynamicWindows")
103  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
104  wdws_phi_.at(ib).SetName(wdn);
105  wdws_phi_.at(ib).SetLower(fl);
106  wdws_phi_.at(ib).SetUpper(fh);
107 
108  // Station 1 - MW's don't have to exist for TkMuon correlator
109  // It is only needed for TkMuStub
110  wdn = std::string("wdw_theta_") + std::to_string(ib + 1);
111  nml = std::string("fit_low_") + std::to_string(ib + 1);
112  nmh = std::string("fit_high_") + std::to_string(ib + 1);
113  fl = (TF1*)fIn_theta_S1->Get(nml.c_str());
114  fh = (TF1*)fIn_theta_S1->Get(nmh.c_str());
115  if (fl == nullptr || fh == nullptr)
116  throw cms::Exception("L1TkMuCorrDynamicWindows")
117  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
118  wdws_theta_S1_.at(ib).SetName(wdn);
119  wdws_theta_S1_.at(ib).SetLower(fl);
120  wdws_theta_S1_.at(ib).SetUpper(fh);
121 
122  wdn = std::string("wdw_phi_") + std::to_string(ib + 1);
123  nml = std::string("fit_low_") + std::to_string(ib + 1);
124  nmh = std::string("fit_high_") + std::to_string(ib + 1);
125  fl = (TF1*)fIn_phi_S1->Get(nml.c_str());
126  fh = (TF1*)fIn_phi_S1->Get(nmh.c_str());
127  if (fl == nullptr || fh == nullptr)
128  throw cms::Exception("L1TkMuCorrDynamicWindows")
129  << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n";
130  wdws_phi_S1_.at(ib).SetName(wdn);
131  wdws_phi_S1_.at(ib).SetLower(fl);
132  wdws_phi_S1_.at(ib).SetUpper(fh);
133  }
134 }

References bounds_, Exception, cuy::ib, nbins_, set_do_relax_factor(), set_relaxation_pattern(), set_safety_factor(), set_sf_initialrelax(), AlCaHLTBitMon_QueryRunRegistry::string, tools::TF1, track_qual_presel_, wdws_phi_, wdws_phi_S1_, wdws_theta_, and wdws_theta_S1_.

◆ ~L1TkMuCorrDynamicWindows()

L1TkMuCorrDynamicWindows::~L1TkMuCorrDynamicWindows ( )
inline

Definition at line 32 of file L1TkMuCorrDynamicWindows.h.

32 {}

Member Function Documentation

◆ deg_to_rad()

double L1TkMuCorrDynamicWindows::deg_to_rad ( double  x)
inlineprivate

Definition at line 87 of file L1TkMuCorrDynamicWindows.h.

87 { return (x * angle_units::degPerRad); }

References angle_units::degPerRad, and x.

Referenced by find_match(), and find_match_stub().

◆ eta_to_theta()

double L1TkMuCorrDynamicWindows::eta_to_theta ( double  x)
inlineprivate

Definition at line 89 of file L1TkMuCorrDynamicWindows.h.

89  {
90  // give theta in rad
91  return (2. * atan(exp(-1. * x)));
92  }

References JetChargeProducer_cfi::exp, and x.

Referenced by find_match(), and find_match_stub().

◆ find_match()

std::vector< int > L1TkMuCorrDynamicWindows::find_match ( const EMTFTrackCollection l1mus,
const L1TTTrackCollectionType l1trks 
)

Definition at line 153 of file L1TkMuCorrDynamicWindows.cc.

154  {
155  std::vector<int> out(l1trks.size());
156  for (auto l1trkit = l1trks.begin(); l1trkit != l1trks.end(); ++l1trkit) {
157  float trk_pt = l1trkit->momentum().perp();
158  float trk_p = l1trkit->momentum().mag();
159  float trk_aeta = std::abs(l1trkit->momentum().eta());
160  float trk_theta = to_mpio2_pio2(eta_to_theta(l1trkit->momentum().eta()));
161  float trk_phi = l1trkit->momentum().phi();
162  int trk_charge = (l1trkit->rInv() > 0 ? 1 : -1);
163 
164  // porting some selections from the MuonTrackCorr finder
165  // https://github.com/cms-l1t-offline/cmssw/blob/l1t-phase2-932-v1.6/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc#L264
166  // in future, make preselections confiuguable
167  bool reject_trk = false;
168  if (trk_p < min_trk_p_)
169  reject_trk = true;
170  if (trk_aeta > max_trk_aeta_)
171  reject_trk = true;
172  if (track_qual_presel_) {
173  float l1tk_chi2 = l1trkit->chi2();
174  int l1tk_nstubs = l1trkit->getStubRefs().size();
175  if (l1tk_chi2 >= max_trk_chi2_)
176  reject_trk = true;
177  if (l1tk_nstubs < min_trk_nstubs_)
178  reject_trk = true;
179  }
180 
181  int ibin = findBin(trk_aeta);
182 
183  std::vector<std::tuple<float, float, int>> matched; // dtheta, dphi, idx
184  // loop on muons to see which match
185  for (auto l1muit = l1mus.begin(); l1muit != l1mus.end(); ++l1muit) {
186  // match only muons in the central bx - as the track collection refers anyway to bx 0 only
187  if (l1muit->BX() != 0)
188  continue;
189 
190  // putting everything in rad
191  float emtf_theta = to_mpio2_pio2(eta_to_theta(l1muit->Eta()));
192  float emtf_phi = deg_to_rad(l1muit->Phi_glob());
193 
194  float dtheta = std::abs(emtf_theta - trk_theta);
195  float dphi = to_mpi_pi(emtf_phi - trk_phi);
196  float adphi = std::abs(dphi);
197 
198  double sf_l;
199  double sf_h;
200  if (do_relax_factor_) {
203  } else {
204  sf_l = safety_factor_l_;
205  sf_h = safety_factor_h_;
206  }
207 
208  if (
209  // emtf_theta * trk_theta > 0 &&
210  dtheta > (1 - sf_l) * wdws_theta_.at(ibin).bound_low(trk_pt) &&
211  dtheta <= (1 + sf_h) * wdws_theta_.at(ibin).bound_high(trk_pt) &&
212  adphi > (1 - sf_l) * wdws_phi_.at(ibin).bound_low(trk_pt) &&
213  adphi <= (1 + sf_h) * wdws_phi_.at(ibin).bound_high(trk_pt) && dphi * trk_charge < 0 && // sign requirement
214  // rndm > 0.5
215  true)
216  matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit));
217  }
218 
219  if (reject_trk)
220  matched.clear(); // quick fix - to be optimised to avoid the operations above
221 
222  if (matched.empty())
223  out.at(std::distance(l1trks.begin(), l1trkit)) = -1;
224  else {
225  std::sort(matched.begin(), matched.end()); // closest in theta, then in phi
226  out.at(std::distance(l1trks.begin(), l1trkit)) = std::get<2>(matched.at(0));
227  }
228  }
229 
230  // now convert out to a unique set
231  return make_unique_coll(l1mus.size(), l1trks, out);
232 }

References funct::abs(), deg_to_rad(), HLT_2018_cff::distance, do_relax_factor_, eta_to_theta(), findBin(), initial_sf_h_, initial_sf_l_, make_unique_coll(), muonTagProbeFilters_cff::matched, max_trk_aeta_, max_trk_chi2_, min_trk_nstubs_, min_trk_p_, MillePedeFileConverter_cfg::out, pt_end_, pt_start_, safety_factor_h_, safety_factor_l_, sf_progressive(), to_mpi_pi(), to_mpio2_pio2(), track_qual_presel_, wdws_phi_, and wdws_theta_.

◆ find_match_stub()

std::vector< int > L1TkMuCorrDynamicWindows::find_match_stub ( const EMTFHitCollection l1mus,
const L1TTTrackCollectionType l1trks,
const int &  station,
bool  requireBX0 = true 
)

Definition at line 234 of file L1TkMuCorrDynamicWindows.cc.

237  {
238  std::vector<int> out(l1trks.size());
239  for (auto l1trkit = l1trks.begin(); l1trkit != l1trks.end(); ++l1trkit) {
240  float trk_pt = l1trkit->momentum().perp();
241  float trk_p = l1trkit->momentum().mag();
242  float trk_aeta = std::abs(l1trkit->momentum().eta());
243  float trk_theta = to_mpio2_pio2(eta_to_theta(l1trkit->momentum().eta()));
244  float trk_phi = l1trkit->momentum().phi();
245  int trk_charge = (l1trkit->rInv() > 0 ? 1 : -1);
246 
247  // porting some selections from the MuonTrackCorr finder
248  // https://github.com/cms-l1t-offline/cmssw/blob/l1t-phase2-932-v1.6/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc#L264
249  // for future: make preselections confiuguable
250  bool reject_trk = false;
251  if (trk_p < min_trk_p_)
252  reject_trk = true;
253  if (trk_aeta > max_trk_aeta_)
254  reject_trk = true;
255  if (track_qual_presel_) {
256  float l1tk_chi2 = l1trkit->chi2();
257  int l1tk_nstubs = l1trkit->getStubRefs().size();
258  if (l1tk_chi2 >= max_trk_chi2_)
259  reject_trk = true;
260  if (l1tk_nstubs < min_trk_nstubs_)
261  reject_trk = true;
262  }
263 
264  int ibin = findBin(trk_aeta);
265 
266  std::vector<std::tuple<float, float, int>> matched; // dtheta, dphi, idx
267  // loop on stubs to see which match
268  for (auto l1muit = l1mus.begin(); l1muit != l1mus.end(); ++l1muit) {
269  if (!(l1muit->Is_CSC() || l1muit->Is_RPC()))
270  continue;
271 
272  int hit_station = l1muit->Station();
273  // match only stubs in the central bx - as the track collection refers anyway to bx 0 only
274  if (requireBX0 && l1muit->BX() != 0)
275  continue;
276 
277  // allow only track matching to stubs from the given station, station= 1,2,3,4
278  if (station < 5 && hit_station != station)
279  continue;
280  // in case of station=12 allow track matching to stubs from either station 1 or 2.
281  else if (station == 12 && hit_station > 2) // good for tkMuStub12
282  continue;
283  // in case of station=123 allow track matching to stubs from either station 1, 2, or 3.
284  else if (station == 123 && hit_station > 3) // good for tkMuStub123
285  continue;
286  // in case of station=1234 allow track matching to stubs from either station 1, 2, 3, or 4.
287  else if (station == 1234 && hit_station > 4) // good for tkMuStub1234
288  continue;
289 
290  float emtf_theta = to_mpio2_pio2(eta_to_theta(l1muit->Eta_sim()));
291  float emtf_phi = deg_to_rad(l1muit->Phi_sim());
292 
293  float dtheta = std::abs(emtf_theta - trk_theta);
294  float dphi = to_mpi_pi(emtf_phi - trk_phi);
295  float adphi = std::abs(dphi);
296 
297  double sf_l;
298  double sf_h;
299  if (do_relax_factor_) {
302  } else {
303  sf_l = safety_factor_l_;
304  sf_h = safety_factor_h_;
305  }
306 
307  if (hit_station == 1 &&
308  //if hit in station 1 use these matching windows for checking
309 
310  dtheta > (1 - sf_l) * wdws_theta_S1_.at(ibin).bound_low(trk_pt) &&
311  dtheta <= (1 + sf_h) * wdws_theta_S1_.at(ibin).bound_high(trk_pt) &&
312  adphi > (1 - sf_l) * wdws_phi_S1_.at(ibin).bound_low(trk_pt) &&
313  adphi <= (1 + sf_h) * wdws_phi_S1_.at(ibin).bound_high(trk_pt) &&
314  dphi * trk_charge < 0 && // sign requirement
315  true)
316  matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit));
317 
318  if (hit_station == 2 && dtheta > (1 - sf_l) * wdws_theta_.at(ibin).bound_low(trk_pt) &&
319  dtheta <= (1 + sf_h) * wdws_theta_.at(ibin).bound_high(trk_pt) &&
320  adphi > (1 - sf_l) * wdws_phi_.at(ibin).bound_low(trk_pt) &&
321  adphi <= (1 + sf_h) * wdws_phi_.at(ibin).bound_high(trk_pt) && dphi * trk_charge < 0 && // sign requirement
322  // rndm > 0.5
323  true)
324  matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit));
325  }
326 
327  if (reject_trk)
328  matched.clear(); // quick fix - to be optimised to avoid the operations above
329 
330  if (matched.empty())
331  out.at(std::distance(l1trks.begin(), l1trkit)) = -1;
332  else {
333  std::sort(matched.begin(), matched.end()); // closest in theta, then in phi
334  out.at(std::distance(l1trks.begin(), l1trkit)) = std::get<2>(matched.at(0));
335  }
336  }
337 
338  // return out;
339 
340  // now convert out to a unique set
341  auto unique_out = make_unique_coll(l1mus.size(), l1trks, out);
342 
343  return unique_out;
344 }

References funct::abs(), deg_to_rad(), HLT_2018_cff::distance, do_relax_factor_, eta_to_theta(), findBin(), initial_sf_h_, initial_sf_l_, make_unique_coll(), muonTagProbeFilters_cff::matched, max_trk_aeta_, max_trk_chi2_, min_trk_nstubs_, min_trk_p_, MillePedeFileConverter_cfg::out, pt_end_, pt_start_, safety_factor_h_, safety_factor_l_, sf_progressive(), relativeConstraints::station, to_mpi_pi(), to_mpio2_pio2(), track_qual_presel_, wdws_phi_, wdws_phi_S1_, wdws_theta_, and wdws_theta_S1_.

◆ findBin()

int L1TkMuCorrDynamicWindows::findBin ( double  val)
private

Definition at line 136 of file L1TkMuCorrDynamicWindows.cc.

136  {
137  // not the most efficient, nor the most elegant implementation for now
138  if (val < bounds_.at(0))
139  return 0;
140  if (val >= bounds_.back())
141  return (nbins_ - 1); // i.e. bounds_size() -2
142 
143  for (uint ib = 0; ib < bounds_.size() - 1; ++ib) {
144  if (val >= bounds_.at(ib) && val < bounds_.at(ib + 1))
145  return ib;
146  }
147 
148  //"Something strange happened at val.
149  throw cms::Exception("L1TkMuCorrDynamicWindows") << "Can't find bin.\n";
150  return 0;
151 }

References bounds_, Exception, cuy::ib, nbins_, parallelization::uint, and heppy_batch::val.

Referenced by find_match(), and find_match_stub().

◆ make_unique_coll()

std::vector< int > L1TkMuCorrDynamicWindows::make_unique_coll ( const unsigned int &  l1musSize,
const L1TTTrackCollectionType l1trks,
const std::vector< int > &  matches 
)
private

Definition at line 346 of file L1TkMuCorrDynamicWindows.cc.

348  {
349  std::vector<int> out(matches.size(), -1);
350 
351  std::vector<std::vector<int>> macthed_to_emtf(l1musSize,
352  std::vector<int>(0)); // one vector of matched trk idx per EMTF
353 
354  for (unsigned int itrack = 0; itrack < matches.size(); ++itrack) {
355  int iemtf = matches.at(itrack);
356  if (iemtf < 0)
357  continue;
358  macthed_to_emtf.at(iemtf).push_back(itrack);
359  }
360 
361  std::function<bool(int, int, const L1TTTrackCollectionType&, int)> track_less_than_proto =
362  [](int idx1, int idx2, const L1TTTrackCollectionType& l1trkcoll, int nTrackParams) {
363  float pt1 = l1trkcoll.at(idx1).momentum().perp();
364  float pt2 = l1trkcoll.at(idx2).momentum().perp();
365  return (pt1 < pt2);
366  };
367 
368  // // and binds to accept only 2 params
369  std::function<bool(int, int)> track_less_than =
370  std::bind(track_less_than_proto, std::placeholders::_1, std::placeholders::_2, l1trks, nTrkPars_);
371 
372  for (unsigned int iemtf = 0; iemtf < macthed_to_emtf.size(); ++iemtf) {
373  std::vector<int>& thisv = macthed_to_emtf.at(iemtf);
374  if (thisv.empty())
375  continue;
376 
377  std::sort(thisv.begin(), thisv.end(), track_less_than);
378 
379  // copy to the output
380  int best_trk = thisv.back();
381  out.at(best_trk) = iemtf;
382  }
383 
384  return out;
385 }

References electrons_cff::bool, HiBiasedCentrality_cfi::function, patCandidatesForDimuonsSequences_cff::matches, nTrkPars_, MillePedeFileConverter_cfg::out, HLT_2018_cff::pt1, and HLT_2018_cff::pt2.

Referenced by find_match(), and find_match_stub().

◆ max_trk_aeta()

const float L1TkMuCorrDynamicWindows::max_trk_aeta ( )
inline

Definition at line 73 of file L1TkMuCorrDynamicWindows.h.

73 { return max_trk_aeta_; }

References max_trk_aeta_.

◆ max_trk_chi2()

const float L1TkMuCorrDynamicWindows::max_trk_chi2 ( )
inline

Definition at line 74 of file L1TkMuCorrDynamicWindows.h.

74 { return max_trk_chi2_; }

References max_trk_chi2_.

◆ min_trk_nstubs()

const int L1TkMuCorrDynamicWindows::min_trk_nstubs ( )
inline

Definition at line 75 of file L1TkMuCorrDynamicWindows.h.

75 { return min_trk_nstubs_; }

References min_trk_nstubs_.

◆ min_trk_p()

const float L1TkMuCorrDynamicWindows::min_trk_p ( )
inline

Definition at line 72 of file L1TkMuCorrDynamicWindows.h.

72 { return min_trk_p_; }

References min_trk_p_.

◆ n_trk_par()

const int L1TkMuCorrDynamicWindows::n_trk_par ( )
inline

Definition at line 71 of file L1TkMuCorrDynamicWindows.h.

71 { return nTrkPars_; }

References nTrkPars_.

◆ prepare_corr_bounds()

std::vector< double > L1TkMuCorrDynamicWindows::prepare_corr_bounds ( const string &  fname,
const string &  hname 
)
static

Definition at line 387 of file L1TkMuCorrDynamicWindows.cc.

387  {
388  // find the boundaries of the match windoww
389  TFile* fIn = TFile::Open(fname.c_str());
390  if (fIn == nullptr) {
391  throw cms::Exception("L1TkMuMantra") << "Can't find file " << fname << " to derive bounds.\n";
392  }
393  TH2* h_test = (TH2*)fIn->Get(hname.c_str());
394  if (h_test == nullptr) {
395  throw cms::Exception("L1TkMuCorrDynamicWindows")
396  << "Can't find histo " << hname << " in file " << fname << " to derive bounds.\n";
397  }
398 
399  int nbds = h_test->GetNbinsY() + 1;
400  vector<double> bounds(nbds);
401  for (int ib = 0; ib < nbds; ++ib) {
402  bounds.at(ib) = h_test->GetYaxis()->GetBinLowEdge(ib + 1);
403  }
404  fIn->Close();
405  return bounds;
406 }

References Exception, alignmentValidation::fname, and cuy::ib.

Referenced by L1TkMuonProducer::L1TkMuonProducer().

◆ set_do_relax_factor()

void L1TkMuCorrDynamicWindows::set_do_relax_factor ( bool  val)
inline

Definition at line 59 of file L1TkMuCorrDynamicWindows.h.

59 { do_relax_factor_ = val; }

References do_relax_factor_, and heppy_batch::val.

Referenced by L1TkMuCorrDynamicWindows().

◆ set_do_trk_qual_presel()

void L1TkMuCorrDynamicWindows::set_do_trk_qual_presel ( bool  val)
inline

Definition at line 61 of file L1TkMuCorrDynamicWindows.h.

References track_qual_presel_, and heppy_batch::val.

◆ set_max_trk_aeta()

void L1TkMuCorrDynamicWindows::set_max_trk_aeta ( float  val)
inline

Definition at line 66 of file L1TkMuCorrDynamicWindows.h.

66 { max_trk_aeta_ = val; }

References max_trk_aeta_, and heppy_batch::val.

◆ set_max_trk_chi2()

void L1TkMuCorrDynamicWindows::set_max_trk_chi2 ( float  val)
inline

Definition at line 67 of file L1TkMuCorrDynamicWindows.h.

67 { max_trk_chi2_ = val; }

References max_trk_chi2_, and heppy_batch::val.

◆ set_min_trk_nstubs()

void L1TkMuCorrDynamicWindows::set_min_trk_nstubs ( int  val)
inline

Definition at line 68 of file L1TkMuCorrDynamicWindows.h.

68 { min_trk_nstubs_ = val; }

References min_trk_nstubs_, and heppy_batch::val.

◆ set_min_trk_p()

void L1TkMuCorrDynamicWindows::set_min_trk_p ( float  val)
inline

Definition at line 65 of file L1TkMuCorrDynamicWindows.h.

65 { min_trk_p_ = val; }

References min_trk_p_, and heppy_batch::val.

◆ set_n_trk_par()

void L1TkMuCorrDynamicWindows::set_n_trk_par ( int  val)
inline

Definition at line 64 of file L1TkMuCorrDynamicWindows.h.

64 { nTrkPars_ = val; }

References nTrkPars_, and heppy_batch::val.

◆ set_relaxation_pattern()

void L1TkMuCorrDynamicWindows::set_relaxation_pattern ( float  pt_start,
float  pt_end 
)
inline

Definition at line 53 of file L1TkMuCorrDynamicWindows.h.

53  {
54  pt_start_ = pt_start;
55  pt_end_ = pt_end;
56  }

References pt_end_, and pt_start_.

Referenced by L1TkMuCorrDynamicWindows().

◆ set_safety_factor() [1/2]

void L1TkMuCorrDynamicWindows::set_safety_factor ( float  sf)
inline

Definition at line 57 of file L1TkMuCorrDynamicWindows.h.

57 { set_safety_factor(sf, sf); }

References set_safety_factor().

Referenced by set_safety_factor().

◆ set_safety_factor() [2/2]

void L1TkMuCorrDynamicWindows::set_safety_factor ( float  sf_l,
float  sf_h 
)
inline

Definition at line 45 of file L1TkMuCorrDynamicWindows.h.

45  {
46  safety_factor_l_ = sf_l;
47  safety_factor_h_ = sf_h;
48  }

References safety_factor_h_, and safety_factor_l_.

Referenced by L1TkMuCorrDynamicWindows().

◆ set_sf_initialrelax() [1/2]

void L1TkMuCorrDynamicWindows::set_sf_initialrelax ( float  sf)
inline

Definition at line 58 of file L1TkMuCorrDynamicWindows.h.

58 { set_sf_initialrelax(sf, sf); }

References set_sf_initialrelax().

Referenced by set_sf_initialrelax().

◆ set_sf_initialrelax() [2/2]

void L1TkMuCorrDynamicWindows::set_sf_initialrelax ( float  sf_l,
float  sf_h 
)
inline

Definition at line 49 of file L1TkMuCorrDynamicWindows.h.

49  {
50  initial_sf_l_ = sf_l;
51  initial_sf_h_ = sf_h;
52  }

References initial_sf_h_, and initial_sf_l_.

Referenced by L1TkMuCorrDynamicWindows().

◆ sf_progressive()

double L1TkMuCorrDynamicWindows::sf_progressive ( double  x,
double  xstart,
double  xstop,
double  ystart,
double  ystop 
)
inlineprivate

Definition at line 111 of file L1TkMuCorrDynamicWindows.h.

111  {
112  if (x < xstart)
113  return ystart;
114  if (x >= xstart && x < xstop)
115  return ystart + (x - xstart) * (ystop - ystart) / (xstop - xstart);
116  return ystop;
117  }

References x.

Referenced by find_match(), and find_match_stub().

◆ to_mpi_pi()

double L1TkMuCorrDynamicWindows::to_mpi_pi ( double  x)
inlineprivate

Definition at line 103 of file L1TkMuCorrDynamicWindows.h.

103  {
104  while (x >= M_PI)
105  x -= 2. * M_PI;
106  while (x < -M_PI)
107  x += 2. * M_PI;
108  return x;
109  }

References M_PI, and x.

Referenced by find_match(), and find_match_stub().

◆ to_mpio2_pio2()

double L1TkMuCorrDynamicWindows::to_mpio2_pio2 ( double  x)
inlineprivate

Definition at line 94 of file L1TkMuCorrDynamicWindows.h.

94  {
95  // put the angle in radians between -pi/2 and pi/2
96  while (x >= 0.5 * M_PI)
97  x -= M_PI;
98  while (x < -0.5 * M_PI)
99  x += M_PI;
100  return x;
101  }

References M_PI, and x.

Referenced by find_match(), and find_match_stub().

Member Data Documentation

◆ bounds_

std::vector<double> L1TkMuCorrDynamicWindows::bounds_
private

Definition at line 120 of file L1TkMuCorrDynamicWindows.h.

Referenced by findBin(), and L1TkMuCorrDynamicWindows().

◆ do_relax_factor_

bool L1TkMuCorrDynamicWindows::do_relax_factor_
private

Definition at line 131 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_do_relax_factor().

◆ initial_sf_h_

float L1TkMuCorrDynamicWindows::initial_sf_h_
private

Definition at line 128 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_sf_initialrelax().

◆ initial_sf_l_

float L1TkMuCorrDynamicWindows::initial_sf_l_
private

Definition at line 127 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_sf_initialrelax().

◆ max_trk_aeta_

float L1TkMuCorrDynamicWindows::max_trk_aeta_
private

◆ max_trk_chi2_

float L1TkMuCorrDynamicWindows::max_trk_chi2_
private

◆ min_trk_nstubs_

int L1TkMuCorrDynamicWindows::min_trk_nstubs_
private

◆ min_trk_p_

float L1TkMuCorrDynamicWindows::min_trk_p_
private

Definition at line 136 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), min_trk_p(), and set_min_trk_p().

◆ nbins_

int L1TkMuCorrDynamicWindows::nbins_
private

Definition at line 119 of file L1TkMuCorrDynamicWindows.h.

Referenced by findBin(), and L1TkMuCorrDynamicWindows().

◆ nTrkPars_

int L1TkMuCorrDynamicWindows::nTrkPars_
private

Definition at line 135 of file L1TkMuCorrDynamicWindows.h.

Referenced by make_unique_coll(), n_trk_par(), and set_n_trk_par().

◆ pt_end_

float L1TkMuCorrDynamicWindows::pt_end_
private

Definition at line 130 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_relaxation_pattern().

◆ pt_start_

float L1TkMuCorrDynamicWindows::pt_start_
private

Definition at line 129 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_relaxation_pattern().

◆ safety_factor_h_

float L1TkMuCorrDynamicWindows::safety_factor_h_
private

Definition at line 126 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_safety_factor().

◆ safety_factor_l_

float L1TkMuCorrDynamicWindows::safety_factor_l_
private

Definition at line 125 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match(), find_match_stub(), and set_safety_factor().

◆ track_qual_presel_

bool L1TkMuCorrDynamicWindows::track_qual_presel_
private

◆ wdws_phi_

std::vector<MuMatchWindow> L1TkMuCorrDynamicWindows::wdws_phi_
private

◆ wdws_phi_S1_

std::vector<MuMatchWindow> L1TkMuCorrDynamicWindows::wdws_phi_S1_
private

Definition at line 124 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match_stub(), and L1TkMuCorrDynamicWindows().

◆ wdws_theta_

std::vector<MuMatchWindow> L1TkMuCorrDynamicWindows::wdws_theta_
private

◆ wdws_theta_S1_

std::vector<MuMatchWindow> L1TkMuCorrDynamicWindows::wdws_theta_S1_
private

Definition at line 123 of file L1TkMuCorrDynamicWindows.h.

Referenced by find_match_stub(), and L1TkMuCorrDynamicWindows().

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
electrons_cff.bool
bool
Definition: electrons_cff.py:372
HLT_2018_cff.pt2
pt2
Definition: HLT_2018_cff.py:8552
L1TkMuCorrDynamicWindows::safety_factor_h_
float safety_factor_h_
Definition: L1TkMuCorrDynamicWindows.h:126
relativeConstraints.station
station
Definition: relativeConstraints.py:67
L1TkMuCorrDynamicWindows::max_trk_aeta_
float max_trk_aeta_
Definition: L1TkMuCorrDynamicWindows.h:137
L1TkMuCorrDynamicWindows::set_safety_factor
void set_safety_factor(float sf_l, float sf_h)
Definition: L1TkMuCorrDynamicWindows.h:45
HLT_2018_cff.pt1
pt1
Definition: HLT_2018_cff.py:8550
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
L1TkMuCorrDynamicWindows::findBin
int findBin(double val)
Definition: L1TkMuCorrDynamicWindows.cc:136
L1TkMuCorrDynamicWindows::max_trk_chi2_
float max_trk_chi2_
Definition: L1TkMuCorrDynamicWindows.h:138
DDAxes::x
L1TkMuCorrDynamicWindows::to_mpio2_pio2
double to_mpio2_pio2(double x)
Definition: L1TkMuCorrDynamicWindows.h:94
L1TkMuCorrDynamicWindows::min_trk_p_
float min_trk_p_
Definition: L1TkMuCorrDynamicWindows.h:136
tools.TF1
TF1
Definition: tools.py:23
parallelization.uint
uint
Definition: parallelization.py:124
L1TkMuCorrDynamicWindows::wdws_theta_S1_
std::vector< MuMatchWindow > wdws_theta_S1_
Definition: L1TkMuCorrDynamicWindows.h:123
angle_units::degPerRad
constexpr long double degPerRad
Definition: angle_units.h:9
L1TkMuCorrDynamicWindows::set_relaxation_pattern
void set_relaxation_pattern(float pt_start, float pt_end)
Definition: L1TkMuCorrDynamicWindows.h:53
L1TkMuCorrDynamicWindows::L1TTTrackCollectionType
std::vector< L1TTTrackType > L1TTTrackCollectionType
Definition: L1TkMuCorrDynamicWindows.h:27
L1TkMuCorrDynamicWindows::min_trk_nstubs_
int min_trk_nstubs_
Definition: L1TkMuCorrDynamicWindows.h:139
L1TkMuCorrDynamicWindows::wdws_phi_S1_
std::vector< MuMatchWindow > wdws_phi_S1_
Definition: L1TkMuCorrDynamicWindows.h:124
L1TkMuCorrDynamicWindows::nbins_
int nbins_
Definition: L1TkMuCorrDynamicWindows.h:119
MuMatchWindow
Definition: MuMatchWindow.h:17
L1TkMuCorrDynamicWindows::track_qual_presel_
bool track_qual_presel_
Definition: L1TkMuCorrDynamicWindows.h:132
L1TkMuCorrDynamicWindows::pt_start_
float pt_start_
Definition: L1TkMuCorrDynamicWindows.h:129
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TkMuCorrDynamicWindows::set_sf_initialrelax
void set_sf_initialrelax(float sf_l, float sf_h)
Definition: L1TkMuCorrDynamicWindows.h:49
L1TkMuCorrDynamicWindows::do_relax_factor_
bool do_relax_factor_
Definition: L1TkMuCorrDynamicWindows.h:131
L1TkMuCorrDynamicWindows::wdws_theta_
std::vector< MuMatchWindow > wdws_theta_
Definition: L1TkMuCorrDynamicWindows.h:121
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
cuy.ib
ib
Definition: cuy.py:662
L1TkMuCorrDynamicWindows::sf_progressive
double sf_progressive(double x, double xstart, double xstop, double ystart, double ystop)
Definition: L1TkMuCorrDynamicWindows.h:111
L1TkMuCorrDynamicWindows::bounds_
std::vector< double > bounds_
Definition: L1TkMuCorrDynamicWindows.h:120
L1TkMuCorrDynamicWindows::initial_sf_l_
float initial_sf_l_
Definition: L1TkMuCorrDynamicWindows.h:127
L1TkMuCorrDynamicWindows::to_mpi_pi
double to_mpi_pi(double x)
Definition: L1TkMuCorrDynamicWindows.h:103
L1TkMuCorrDynamicWindows::initial_sf_h_
float initial_sf_h_
Definition: L1TkMuCorrDynamicWindows.h:128
L1TkMuCorrDynamicWindows::nTrkPars_
int nTrkPars_
Definition: L1TkMuCorrDynamicWindows.h:135
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
heppy_batch.val
val
Definition: heppy_batch.py:351
L1TkMuCorrDynamicWindows::set_do_relax_factor
void set_do_relax_factor(bool val)
Definition: L1TkMuCorrDynamicWindows.h:59
Exception
Definition: hltDiff.cc:246
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
L1TkMuCorrDynamicWindows::deg_to_rad
double deg_to_rad(double x)
Definition: L1TkMuCorrDynamicWindows.h:87
L1TkMuCorrDynamicWindows::pt_end_
float pt_end_
Definition: L1TkMuCorrDynamicWindows.h:130
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
L1TkMuCorrDynamicWindows::eta_to_theta
double eta_to_theta(double x)
Definition: L1TkMuCorrDynamicWindows.h:89
L1TkMuCorrDynamicWindows::make_unique_coll
std::vector< int > make_unique_coll(const unsigned int &l1musSize, const L1TTTrackCollectionType &l1trks, const std::vector< int > &matches)
Definition: L1TkMuCorrDynamicWindows.cc:346
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1TkMuCorrDynamicWindows::safety_factor_l_
float safety_factor_l_
Definition: L1TkMuCorrDynamicWindows.h:125
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
L1TkMuCorrDynamicWindows::wdws_phi_
std::vector< MuMatchWindow > wdws_phi_
Definition: L1TkMuCorrDynamicWindows.h:122