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 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_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 9 of file L1TkMuCorrDynamicWindows.cc.

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

References bounds_, Exception, cuy::ib, nbins_, set_do_relax_factor(), set_relaxation_pattern(), set_safety_factor(), set_sf_initialrelax(), AlCaHLTBitMon_QueryRunRegistry::string, 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 60 of file L1TkMuCorrDynamicWindows.cc.

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

References bounds_, Exception, cuy::ib, nbins_, set_do_relax_factor(), set_relaxation_pattern(), set_safety_factor(), set_sf_initialrelax(), AlCaHLTBitMon_QueryRunRegistry::string, 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

◆ eta_to_theta()

double L1TkMuCorrDynamicWindows::eta_to_theta ( double  x)
inlineprivate

Definition at line 87 of file L1TkMuCorrDynamicWindows.h.

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

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 155 of file L1TkMuCorrDynamicWindows.cc.

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

References funct::abs(), angle_units::operators::convertDegToRad(), reco::deltaPhi(), HLT_FULL_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(), jetUpdater_cfi::sort, 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 236 of file L1TkMuCorrDynamicWindows.cc.

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

References funct::abs(), angle_units::operators::convertDegToRad(), reco::deltaPhi(), HLT_FULL_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(), jetUpdater_cfi::sort, relativeConstraints::station, 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 138 of file L1TkMuCorrDynamicWindows.cc.

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

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 348 of file L1TkMuCorrDynamicWindows.cc.

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

References electrons_cff::bool, HiBiasedCentrality_cfi::function, oniaPATMuonsWithTrigger_cff::matches, nTrkPars_, MillePedeFileConverter_cfg::out, HLT_FULL_cff::pt1, HLT_FULL_cff::pt2, and jetUpdater_cfi::sort.

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 389 of file L1TkMuCorrDynamicWindows.cc.

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

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 101 of file L1TkMuCorrDynamicWindows.h.

101  {
102  if (x < xstart)
103  return ystart;
104  if (x >= xstart && x < xstop)
105  return ystart + (x - xstart) * (ystop - ystart) / (xstop - xstart);
106  return ystop;
107  }

References x.

Referenced by find_match(), and find_match_stub().

◆ to_mpio2_pio2()

double L1TkMuCorrDynamicWindows::to_mpio2_pio2 ( double  x)
inlineprivate

Definition at line 92 of file L1TkMuCorrDynamicWindows.h.

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

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 110 of file L1TkMuCorrDynamicWindows.h.

Referenced by findBin(), and L1TkMuCorrDynamicWindows().

◆ do_relax_factor_

bool L1TkMuCorrDynamicWindows::do_relax_factor_
private

Definition at line 121 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 118 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 117 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 126 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 109 of file L1TkMuCorrDynamicWindows.h.

Referenced by findBin(), and L1TkMuCorrDynamicWindows().

◆ nTrkPars_

int L1TkMuCorrDynamicWindows::nTrkPars_
private

Definition at line 125 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 120 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 119 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 116 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 115 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 114 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 113 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:366
L1TkMuCorrDynamicWindows::safety_factor_h_
float safety_factor_h_
Definition: L1TkMuCorrDynamicWindows.h:116
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
relativeConstraints.station
station
Definition: relativeConstraints.py:67
oniaPATMuonsWithTrigger_cff.matches
matches
Definition: oniaPATMuonsWithTrigger_cff.py:77
L1TkMuCorrDynamicWindows::max_trk_aeta_
float max_trk_aeta_
Definition: L1TkMuCorrDynamicWindows.h:127
angle_units::operators::convertDegToRad
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
L1TkMuCorrDynamicWindows::set_safety_factor
void set_safety_factor(float sf_l, float sf_h)
Definition: L1TkMuCorrDynamicWindows.h:45
L1TkMuCorrDynamicWindows::findBin
int findBin(double val)
Definition: L1TkMuCorrDynamicWindows.cc:138
L1TkMuCorrDynamicWindows::max_trk_chi2_
float max_trk_chi2_
Definition: L1TkMuCorrDynamicWindows.h:128
DDAxes::x
L1TkMuCorrDynamicWindows::to_mpio2_pio2
double to_mpio2_pio2(double x)
Definition: L1TkMuCorrDynamicWindows.h:92
L1TkMuCorrDynamicWindows::min_trk_p_
float min_trk_p_
Definition: L1TkMuCorrDynamicWindows.h:126
parallelization.uint
uint
Definition: parallelization.py:124
L1TkMuCorrDynamicWindows::wdws_theta_S1_
std::vector< MuMatchWindow > wdws_theta_S1_
Definition: L1TkMuCorrDynamicWindows.h:113
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:129
L1TkMuCorrDynamicWindows::wdws_phi_S1_
std::vector< MuMatchWindow > wdws_phi_S1_
Definition: L1TkMuCorrDynamicWindows.h:114
L1TkMuCorrDynamicWindows::nbins_
int nbins_
Definition: L1TkMuCorrDynamicWindows.h:109
HLT_FULL_cff.pt1
pt1
Definition: HLT_FULL_cff.py:9870
MuMatchWindow
Definition: MuMatchWindow.h:17
L1TkMuCorrDynamicWindows::track_qual_presel_
bool track_qual_presel_
Definition: L1TkMuCorrDynamicWindows.h:122
L1TkMuCorrDynamicWindows::pt_start_
float pt_start_
Definition: L1TkMuCorrDynamicWindows.h:119
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
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
L1TkMuCorrDynamicWindows::do_relax_factor_
bool do_relax_factor_
Definition: L1TkMuCorrDynamicWindows.h:121
L1TkMuCorrDynamicWindows::wdws_theta_
std::vector< MuMatchWindow > wdws_theta_
Definition: L1TkMuCorrDynamicWindows.h:111
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
cuy.ib
ib
Definition: cuy.py:662
HLT_FULL_cff.pt2
pt2
Definition: HLT_FULL_cff.py:9872
L1TkMuCorrDynamicWindows::sf_progressive
double sf_progressive(double x, double xstart, double xstop, double ystart, double ystop)
Definition: L1TkMuCorrDynamicWindows.h:101
L1TkMuCorrDynamicWindows::bounds_
std::vector< double > bounds_
Definition: L1TkMuCorrDynamicWindows.h:110
L1TkMuCorrDynamicWindows::initial_sf_l_
float initial_sf_l_
Definition: L1TkMuCorrDynamicWindows.h:117
L1TkMuCorrDynamicWindows::initial_sf_h_
float initial_sf_h_
Definition: L1TkMuCorrDynamicWindows.h:118
L1TkMuCorrDynamicWindows::nTrkPars_
int nTrkPars_
Definition: L1TkMuCorrDynamicWindows.h:125
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:245
HiBiasedCentrality_cfi.function
function
Definition: HiBiasedCentrality_cfi.py:4
L1TkMuCorrDynamicWindows::pt_end_
float pt_end_
Definition: L1TkMuCorrDynamicWindows.h:120
L1TkMuCorrDynamicWindows::eta_to_theta
double eta_to_theta(double x)
Definition: L1TkMuCorrDynamicWindows.h:87
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:348
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:115
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
L1TkMuCorrDynamicWindows::wdws_phi_
std::vector< MuMatchWindow > wdws_phi_
Definition: L1TkMuCorrDynamicWindows.h:112