CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
emtf Namespace Reference

Classes

class  AbsoluteDeviation
 
struct  CPPFTag
 
struct  CSCTag
 
struct  DTTag
 
struct  Event
 
class  Forest
 
struct  GEMTag
 
class  Huber
 
struct  IRPCTag
 
class  LeastSquares
 
class  LossFunction
 
struct  ME0Tag
 
class  Node
 
class  PercentErrorSquared
 
struct  RPCTag
 
class  Tree
 

Typedefs

using Feature = std::array< float, NUM_FEATURES >
 
using Prediction = std::array< float, NUM_PREDICTIONS >
 
template<typename T >
using sector_array = std::array< T, NUM_SECTORS >
 
template<typename T >
using zone_array = std::array< T, NUM_ZONES >
 

Functions

int calc_chamber (int station, int sector, int subsector, int ring, int csc_ID)
 
double calc_eta (int bits)
 
double calc_eta_from_theta_deg (double theta_deg, int endcap)
 
double calc_eta_from_theta_rad (double theta_rad)
 
int calc_eta_GMT (double val)
 
double calc_phi_glob_deg (double loc, int sector)
 
double calc_phi_glob_rad (double loc, int sector)
 
double calc_phi_GMT_deg (int bits)
 
int calc_phi_GMT_int (double val)
 
double calc_phi_GMT_rad (int bits)
 
double calc_phi_loc_deg (int bits)
 
double calc_phi_loc_deg_from_glob (double glob, int sector)
 
int calc_phi_loc_int (double glob, int sector)
 
int calc_phi_loc_int_rpc (double glob, int sector)
 
double calc_phi_loc_rad (int bits)
 
double calc_pt (int bits)
 
int calc_pt_GMT (double val)
 
int calc_ring (int station, int csc_ID, int strip)
 
double calc_theta_deg (double eta)
 
double calc_theta_deg_from_eta (double eta)
 
double calc_theta_deg_from_int (int theta_int)
 
int calc_theta_int (double theta, int endcap)
 
int calc_theta_int_rpc (double theta, int endcap)
 
double calc_theta_rad (double eta)
 
double calc_theta_rad_from_eta (double eta)
 
double calc_theta_rad_from_int (int theta_int)
 
int calc_uGMT_chamber (int csc_ID, int subsector, int neighbor, int station)
 
double deg_to_rad (double deg)
 
void dump_fw_raw_input (const l1t::EMTFHitCollection &out_hits, const l1t::EMTFTrackCollection &out_tracks)
 
std::pair< int, int > get_csc_max_pattern_and_quality (int station, int ring)
 
std::pair< int, int > get_csc_max_strip_and_wire (int station, int ring)
 
int get_trigger_csc_ID (int ring, int station, int chamber)
 
int get_trigger_sector (int ring, int station, int chamber)
 
void mergeNtuples (const char *ntuplename, const char *filestomerge, const char *outputfile)
 
template<typename T >
std::string numToStr (T num)
 
float processPrediction (float BDTPt, int Quality, float PrelimFit)
 
double rad_to_deg (double rad)
 
template<class bidiiter >
bidiiter shuffle (bidiiter begin, bidiiter end, size_t num_random)
 
void sort_uGMT_muons (l1t::RegionalMuonCandBxCollection &cands)
 
void sortNtupleByEvent (const char *ntuplename, const char *filenametosort, const char *outputfile)
 
double wrap_phi_deg (double deg)
 
double wrap_phi_rad (double rad)
 
double wrap_theta_deg (double deg)
 
double wrap_theta_rad (double rad)
 

Variables

constexpr int MAX_ENDCAP = 2
 
constexpr int MAX_TRIGSECTOR = 6
 
constexpr int MIN_ENDCAP = 1
 
constexpr int MIN_TRIGSECTOR = 1
 
constexpr int NUM_FEATURES = 23
 
constexpr int NUM_PREDICTIONS = 2
 
constexpr int NUM_SECTORS = 12
 
constexpr int NUM_STATION_PAIRS = 6
 
constexpr int NUM_STATIONS = 4
 
constexpr int NUM_ZONE_HITS = 160
 
constexpr int NUM_ZONES = 4
 
const std::vector< double > ptScale
 
const double ptscale [31]
 
const double twoJets_scale [16]
 
const std::vector< double > twoJetsScale
 

Typedef Documentation

◆ Feature

using emtf::Feature = typedef std::array<float, NUM_FEATURES>

Definition at line 71 of file Common.h.

◆ Prediction

using emtf::Prediction = typedef std::array<float, NUM_PREDICTIONS>

Definition at line 72 of file Common.h.

◆ sector_array

template<typename T >
using emtf::sector_array = typedef std::array<T, NUM_SECTORS>

Definition at line 63 of file Common.h.

◆ zone_array

template<typename T >
using emtf::zone_array = typedef std::array<T, NUM_ZONES>

Definition at line 65 of file Common.h.

Function Documentation

◆ calc_chamber()

int emtf::calc_chamber ( int  station,
int  sector,
int  subsector,
int  ring,
int  csc_ID 
)

Definition at line 28 of file TrackTools.cc.

28  {
29  int chamber = -999;
30  if (station == 1) {
31  chamber = ((sector - 1) * 6) + csc_ID + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
32  if (ring == 2)
33  chamber -= 3;
34  if (ring == 3)
35  chamber -= 6;
36  if (subsector == 2)
37  chamber += 3;
38  if (chamber > 36)
39  chamber -= 36;
40  } else if (ring == 1) {
41  chamber = ((sector - 1) * 3) + csc_ID + 1; // Chamber offset of 1: First chamber in sector 1 is chamber 2
42  if (chamber > 18)
43  chamber -= 18;
44  } else if (ring == 2) {
45  chamber = ((sector - 1) * 6) + csc_ID - 3 + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
46  if (chamber > 36)
47  chamber -= 36;
48  }
49  return chamber;
50  }

References relativeConstraints::chamber, relativeConstraints::ring, and relativeConstraints::station.

Referenced by l1t::stage2::emtf::ImportME().

◆ calc_eta()

double emtf::calc_eta ( int  bits)
inline

Definition at line 95 of file TrackTools.h.

95  {
96  double eta = static_cast<double>(bits);
97  eta *= 0.010875;
98  return eta;
99  }

References PVValHelper::eta.

Referenced by l1t::stage2::emtf::ImportSP().

◆ calc_eta_from_theta_deg()

double emtf::calc_eta_from_theta_deg ( double  theta_deg,
int  endcap 
)
inline

Definition at line 113 of file TrackTools.h.

113  { // endcap [-1,+1]
114  double theta_rad = deg_to_rad(wrap_theta_deg(theta_deg)); // put theta in [0, 90] range
115  double eta = calc_eta_from_theta_rad(theta_rad);
116  eta = (endcap == -1) ? -eta : eta;
117  return eta;
118  }

References calc_eta_from_theta_rad(), deg_to_rad(), makeMuonMisalignmentScenario::endcap, PVValHelper::eta, and wrap_theta_deg().

Referenced by AngleCalculation::calculate_angles(), PrimitiveConversion::convert_csc_details(), PrimitiveConversion::convert_other_details(), PrimitiveConversion::convert_rpc_details(), and l1t::stage2::emtf::ImportRPC().

◆ calc_eta_from_theta_rad()

double emtf::calc_eta_from_theta_rad ( double  theta_rad)
inline

Definition at line 108 of file TrackTools.h.

108  {
109  double eta = -1. * std::log(std::tan(theta_rad / 2.));
110  return eta;
111  }

References PVValHelper::eta, dqm-mbProfile::log, and funct::tan().

Referenced by calc_eta_from_theta_deg().

◆ calc_eta_GMT()

int emtf::calc_eta_GMT ( double  val)
inline

Definition at line 120 of file TrackTools.h.

120  {
121  val /= 0.010875;
122  int gmt_eta = static_cast<int>(std::round(val));
123  return gmt_eta;
124  }

References heppy_batch::val.

◆ calc_phi_glob_deg()

double emtf::calc_phi_glob_deg ( double  loc,
int  sector 
)
inline

Definition at line 166 of file TrackTools.h.

166  { // loc in deg, sector [1-6]
167  double glob = loc + 15. + (60. * (sector - 1));
168  glob = (glob < 180.) ? glob : glob - 360.;
169  return glob;
170  }

Referenced by calc_phi_glob_rad(), AngleCalculation::calculate_angles(), PrimitiveConversion::convert_csc_details(), PrimitiveConversion::convert_other_details(), PrimitiveConversion::convert_rpc_details(), l1t::stage2::emtf::ImportRPC(), and l1t::stage2::emtf::ImportSP().

◆ calc_phi_glob_rad()

double emtf::calc_phi_glob_rad ( double  loc,
int  sector 
)
inline

Definition at line 172 of file TrackTools.h.

172  { // loc in rad, sector [1-6]
173  return deg_to_rad(calc_phi_glob_deg(rad_to_deg(loc), sector));
174  }

References calc_phi_glob_deg(), deg_to_rad(), and rad_to_deg().

◆ calc_phi_GMT_deg()

double emtf::calc_phi_GMT_deg ( int  bits)
inline

Definition at line 217 of file TrackTools.h.

217  {
218  double phi = static_cast<double>(bits);
219  phi = (phi * 360. / 576.) + (180. / 576.);
220  return phi;
221  }

Referenced by calc_phi_GMT_rad().

◆ calc_phi_GMT_int()

int emtf::calc_phi_GMT_int ( double  val)
inline

Definition at line 229 of file TrackTools.h.

229  { // phi in deg
230  val = wrap_phi_deg(val); // put phi in [-180,180] range
231  val = (val - 180. / 576.) / (360. / 576.);
232  int gmt_phi = static_cast<int>(std::round(val));
233  return gmt_phi;
234  }

References heppy_batch::val, and wrap_phi_deg().

◆ calc_phi_GMT_rad()

double emtf::calc_phi_GMT_rad ( int  bits)
inline

Definition at line 227 of file TrackTools.h.

227 { return deg_to_rad(calc_phi_GMT_deg(bits)); }

References calc_phi_GMT_deg(), and deg_to_rad().

◆ calc_phi_loc_deg()

double emtf::calc_phi_loc_deg ( int  bits)
inline

Definition at line 176 of file TrackTools.h.

176  {
177  double loc = static_cast<double>(bits);
178  loc = (loc / 60.) - 22.;
179  return loc;
180  }

Referenced by calc_phi_loc_rad(), AngleCalculation::calculate_angles(), PrimitiveConversion::convert_csc_details(), PrimitiveConversion::convert_other_details(), PrimitiveConversion::convert_rpc_details(), l1t::stage2::emtf::ImportRPC(), and l1t::stage2::emtf::ImportSP().

◆ calc_phi_loc_deg_from_glob()

double emtf::calc_phi_loc_deg_from_glob ( double  glob,
int  sector 
)
inline

Definition at line 195 of file TrackTools.h.

195  { // glob in deg, sector [1-6]
196  glob = wrap_phi_deg(glob); // put phi in [-180,180] range
197  double loc = glob - 15. - (60. * (sector - 1));
198  return loc;
199  }

References wrap_phi_deg().

Referenced by calc_phi_loc_int(), calc_phi_loc_int_rpc(), and PrimitiveConversion::convert_dt().

◆ calc_phi_loc_int()

int emtf::calc_phi_loc_int ( double  glob,
int  sector 
)
inline

Definition at line 201 of file TrackTools.h.

201  { // glob in deg, sector [1-6]
202  double loc = calc_phi_loc_deg_from_glob(glob, sector);
203  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
204  loc = (loc + 22.) * 60.;
205  int phi_int = static_cast<int>(std::round(loc));
206  return phi_int;
207  }

References calc_phi_loc_deg_from_glob().

Referenced by PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), and PrimitiveConversion::convert_rpc().

◆ calc_phi_loc_int_rpc()

int emtf::calc_phi_loc_int_rpc ( double  glob,
int  sector 
)
inline

Definition at line 209 of file TrackTools.h.

209  { // glob in deg, sector [1-6]
210  double loc = calc_phi_loc_deg_from_glob(glob, sector);
211  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
212  loc = (loc + 22.) * 60. / 4.; // 4x coarser resolution
213  int phi_int = static_cast<int>(std::round(loc));
214  return phi_int;
215  }

References calc_phi_loc_deg_from_glob().

Referenced by PrimitiveConversion::convert_rpc().

◆ calc_phi_loc_rad()

double emtf::calc_phi_loc_rad ( int  bits)
inline

Definition at line 182 of file TrackTools.h.

182 { return deg_to_rad(calc_phi_loc_deg(bits)); }

References calc_phi_loc_deg(), and deg_to_rad().

◆ calc_pt()

double emtf::calc_pt ( int  bits)
inline

Definition at line 80 of file TrackTools.h.

80  {
81  double pt = static_cast<double>(bits);
82  pt = 0.5 * (pt - 1);
83  return pt;
84  }

References DiDispStaMuonMonitor_cfi::pt.

◆ calc_pt_GMT()

int emtf::calc_pt_GMT ( double  val)
inline

Definition at line 86 of file TrackTools.h.

86  {
87  val = (val * 2) + 1;
88  int gmt_pt = static_cast<int>(std::round(val));
89  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
90  return gmt_pt;
91  }

References heppy_batch::val.

◆ calc_ring()

int emtf::calc_ring ( int  station,
int  csc_ID,
int  strip 
)

Definition at line 5 of file TrackTools.cc.

5  {
6  if (station > 1) {
7  if (csc_ID < 4)
8  return 1;
9  else if (csc_ID < 10)
10  return 2;
11  else
12  return -999;
13  } else if (station == 1) {
14  if (csc_ID < 4 && strip > 127)
15  return 4;
16  else if (csc_ID < 4 && strip >= 0)
17  return 1;
18  else if (csc_ID > 3 && csc_ID < 7)
19  return 2;
20  else if (csc_ID > 6 && csc_ID < 10)
21  return 3;
22  else
23  return -999;
24  } else
25  return -999;
26  }

References relativeConstraints::station.

Referenced by l1t::stage2::emtf::ImportME().

◆ calc_theta_deg()

double emtf::calc_theta_deg ( double  eta)
inline

Definition at line 141 of file TrackTools.h.

141 { return rad_to_deg(calc_theta_rad(eta)); }

References calc_theta_rad(), PVValHelper::eta, and rad_to_deg().

◆ calc_theta_deg_from_eta()

double emtf::calc_theta_deg_from_eta ( double  eta)
inline

Definition at line 162 of file TrackTools.h.

References calc_theta_rad_from_eta(), PVValHelper::eta, and rad_to_deg().

◆ calc_theta_deg_from_int()

double emtf::calc_theta_deg_from_int ( int  theta_int)
inline

Definition at line 128 of file TrackTools.h.

128  {
129  double theta = static_cast<double>(theta_int);
130  theta = theta * (45.0 - 8.5) / 128. + 8.5;
131  return theta;
132  }

References theta().

Referenced by calc_theta_rad_from_int(), AngleCalculation::calculate_angles(), PrimitiveConversion::convert_csc_details(), PrimitiveConversion::convert_other_details(), PrimitiveConversion::convert_rpc_details(), and l1t::stage2::emtf::ImportRPC().

◆ calc_theta_int()

int emtf::calc_theta_int ( double  theta,
int  endcap 
)
inline

Definition at line 143 of file TrackTools.h.

143  { // theta in deg, endcap [-1,+1]
144  theta = (endcap == -1) ? (180. - theta) : theta;
145  theta = (theta - 8.5) * 128. / (45.0 - 8.5);
146  int theta_int = static_cast<int>(std::round(theta));
147  return theta_int;
148  }

References makeMuonMisalignmentScenario::endcap, and theta().

Referenced by PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), and PrimitiveConversion::convert_rpc().

◆ calc_theta_int_rpc()

int emtf::calc_theta_int_rpc ( double  theta,
int  endcap 
)
inline

Definition at line 150 of file TrackTools.h.

150  { // theta in deg, endcap [-1,+1]
151  theta = (endcap == -1) ? (180. - theta) : theta;
152  theta = (theta - 8.5) * (128. / 4.) / (45.0 - 8.5); // 4x coarser resolution
153  int theta_int = static_cast<int>(std::round(theta));
154  return theta_int;
155  }

References makeMuonMisalignmentScenario::endcap, and theta().

Referenced by PrimitiveConversion::convert_rpc().

◆ calc_theta_rad()

double emtf::calc_theta_rad ( double  eta)
inline

Definition at line 136 of file TrackTools.h.

136  {
137  double theta_rad = 2. * std::atan(std::exp(-1. * eta));
138  return theta_rad;
139  }

References PVValHelper::eta, and JetChargeProducer_cfi::exp.

Referenced by calc_theta_deg().

◆ calc_theta_rad_from_eta()

double emtf::calc_theta_rad_from_eta ( double  eta)
inline

Definition at line 157 of file TrackTools.h.

157  {
158  double theta = std::atan2(1.0, std::sinh(eta)); // cot(theta) = sinh(eta)
159  return theta;
160  }

References PVValHelper::eta, and theta().

Referenced by calc_theta_deg_from_eta().

◆ calc_theta_rad_from_int()

double emtf::calc_theta_rad_from_int ( int  theta_int)
inline

Definition at line 134 of file TrackTools.h.

134 { return deg_to_rad(calc_theta_deg_from_int(theta_int)); }

References calc_theta_deg_from_int(), and deg_to_rad().

◆ calc_uGMT_chamber()

int emtf::calc_uGMT_chamber ( int  csc_ID,
int  subsector,
int  neighbor,
int  station 
)

Definition at line 53 of file TrackTools.cc.

53  {
54  if (station == 1) {
55  if (csc_ID == 3 && neighbor == 1 && subsector == 2)
56  return 1;
57  else if (csc_ID == 6 && neighbor == 1 && subsector == 2)
58  return 2;
59  else if (csc_ID == 9 && neighbor == 1 && subsector == 2)
60  return 3;
61  else if (csc_ID == 3 && neighbor == 0 && subsector == 2)
62  return 4;
63  else if (csc_ID == 6 && neighbor == 0 && subsector == 2)
64  return 5;
65  else if (csc_ID == 9 && neighbor == 0 && subsector == 2)
66  return 6;
67  else
68  return 0;
69  } else {
70  if (csc_ID == 3 && neighbor == 1)
71  return 1;
72  else if (csc_ID == 9 && neighbor == 1)
73  return 2;
74  else if (csc_ID == 3 && neighbor == 0)
75  return 3;
76  else if (csc_ID == 9 && neighbor == 0)
77  return 4;
78  else
79  return 0;
80  }
81  }

References relativeConstraints::station.

Referenced by l1t::stage2::emtf::SPBlockUnpacker::unpack().

◆ deg_to_rad()

double emtf::deg_to_rad ( double  deg)
inline

Definition at line 68 of file TrackTools.h.

68  {
69  constexpr double factor = M_PI / 180.;
70  return deg * factor;
71  }

References DQMScaleToClient_cfi::factor, and M_PI.

Referenced by calc_eta_from_theta_deg(), calc_phi_glob_rad(), calc_phi_GMT_rad(), calc_phi_loc_rad(), and calc_theta_rad_from_int().

◆ dump_fw_raw_input()

void emtf::dump_fw_raw_input ( const l1t::EMTFHitCollection out_hits,
const l1t::EMTFTrackCollection out_tracks 
)

Definition at line 6 of file DebugTools.cc.

6  {
7  // from interface/Common.h
8  constexpr int MIN_ENDCAP = 1;
9  constexpr int MAX_ENDCAP = 2;
10  constexpr int MIN_TRIGSECTOR = 1;
11  constexpr int MAX_TRIGSECTOR = 6;
12 
13  for (int endcap = MIN_ENDCAP; endcap <= MAX_ENDCAP; ++endcap) {
14  for (int sector = MIN_TRIGSECTOR; sector <= MAX_TRIGSECTOR; ++sector) {
15  const int es = (endcap - MIN_ENDCAP) * (MAX_TRIGSECTOR - MIN_TRIGSECTOR + 1) + (sector - MIN_TRIGSECTOR);
16 
17  // _____________________________________________________________________
18  // This prints the hits as raw text input to the firmware simulator
19  // "12345" is the BX separator
20 
21  std::cout << "==== Endcap " << endcap << " Sector " << sector << " Hits ====" << std::endl;
22  std::cout << "bx e s ss st vf ql cp wg id bd hs" << std::endl;
23 
24  bool empty_sector = true;
25  for (const auto& h : out_hits) {
26  if (h.Sector_idx() != es)
27  continue;
28  empty_sector = false;
29  }
30 
31  for (int ibx = -3 - 5; (ibx < +3 + 5 + 5) && !empty_sector; ++ibx) {
32  for (const auto& h : out_hits) {
33  if (h.Subsystem() == L1TMuon::kCSC) {
34  if (h.Sector_idx() != es)
35  continue;
36  if (h.BX() != ibx)
37  continue;
38 
39  int bx = 1;
40  int endcap = (h.Endcap() == 1) ? 1 : 2;
41  int sector = h.PC_sector();
42  int station = (h.PC_station() == 0 && h.Subsector() == 1) ? 1 : h.PC_station();
43  int chamber = h.PC_chamber() + 1;
44  int strip = (h.Station() == 1 && h.Ring() == 4) ? h.Strip() + 128 : h.Strip(); // ME1/1a
45  int wire = h.Wire();
46  int valid = 1;
47  std::cout << bx << " " << endcap << " " << sector << " " << h.Subsector() << " " << station << " "
48  << valid << " " << h.Quality() << " " << h.Pattern() << " " << wire << " " << chamber << " "
49  << h.Bend() << " " << strip << std::endl;
50 
51  } else if (h.Subsystem() == L1TMuon::kRPC) {
52  if (h.Sector_idx() != es)
53  continue;
54  if (h.BX() + 6 != ibx)
55  continue; // RPC hits should be supplied 6 BX later relative to CSC hits
56 
57  // Assign RPC link index. Code taken from src/PrimitiveSelection.cc
58  int rpc_sub = -1;
59  int rpc_chm = -1;
60  if (!h.Neighbor()) {
61  rpc_sub = ((h.Subsector_RPC() + 3) % 6);
62  } else {
63  rpc_sub = 6;
64  }
65  if (h.Station() <= 2) {
66  rpc_chm = (h.Station() - 1);
67  } else {
68  rpc_chm = 2 + (h.Station() - 3) * 2 + (h.Ring() - 2);
69  }
70 
71  int bx = 1;
72  int endcap = (h.Endcap() == 1) ? 1 : 2;
73  int sector = h.PC_sector();
74  int station = rpc_sub;
75  int chamber = rpc_chm + 1;
76  int strip = (h.Phi_fp() >> 2);
77  int wire = (h.Theta_fp() >> 2);
78  int valid = 2; // this marks RPC stub
79  std::cout << bx << " " << endcap << " " << sector << " " << 0 << " " << station << " " << valid << " "
80  << 0 << " " << 0 << " " << wire << " " << chamber << " " << 0 << " " << strip << std::endl;
81  }
82  } // end loop over hits
83 
84  std::cout << "12345" << std::endl;
85  } // end loop over bx
86 
87  // _____________________________________________________________________
88  // This prints the tracks as raw text output from the firmware simulator
89 
90  std::cout << "==== Endcap " << endcap << " Sector " << sector << " Tracks ====" << std::endl;
91  std::cout << "bx e s a mo et ph cr q pt" << std::endl;
92 
93  for (const auto& t : out_tracks) {
94  if (t.Sector_idx() != es)
95  continue;
96 
97  std::cout << t.BX() << " " << (t.Endcap() == 1 ? 1 : 2) << " " << t.Sector() << " " << t.PtLUT().address
98  << " " << t.Mode() << " " << (t.GMT_eta() >= 0 ? t.GMT_eta() : t.GMT_eta() + 512) << " "
99  << t.GMT_phi() << " " << t.GMT_charge() << " " << t.GMT_quality() << " " << t.Pt() << std::endl;
100  } // end loop over tracks
101 
102  } // end loop over sector
103  } // end loop over endcap
104  }

References l1GtPatternGenerator_cfi::bx, relativeConstraints::chamber, gather_cfg::cout, makeMuonMisalignmentScenario::endcap, L1TMuon::kCSC, L1TMuon::kRPC, MAX_ENDCAP, MAX_TRIGSECTOR, MIN_ENDCAP, MIN_TRIGSECTOR, relativeConstraints::station, digitizers_cfi::strip, submitPVValidationJobs::t, and RunInfoPI::valid.

Referenced by TrackFinder::process().

◆ get_csc_max_pattern_and_quality()

std::pair< int, int > emtf::get_csc_max_pattern_and_quality ( int  station,
int  ring 
)

Definition at line 169 of file TrackTools.cc.

169  {
170  int max_pattern = 11;
171  int max_quality = 16;
172  return std::make_pair(max_pattern, max_quality);
173  }

Referenced by PrimitiveSelection::select_csc().

◆ get_csc_max_strip_and_wire()

std::pair< int, int > emtf::get_csc_max_strip_and_wire ( int  station,
int  ring 
)

Definition at line 141 of file TrackTools.cc.

141  {
142  int max_strip = 0; // halfstrip
143  int max_wire = 0; // wiregroup
144  if (station == 1 && ring == 4) { // ME1/1a
145  max_strip = 96;
146  max_wire = 48;
147  } else if (station == 1 && ring == 1) { // ME1/1b
148  max_strip = 128;
149  max_wire = 48;
150  } else if (station == 1 && ring == 2) { // ME1/2
151  max_strip = 160;
152  max_wire = 64;
153  } else if (station == 1 && ring == 3) { // ME1/3
154  max_strip = 128;
155  max_wire = 32;
156  } else if (station == 2 && ring == 1) { // ME2/1
157  max_strip = 160;
158  max_wire = 112;
159  } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1
160  max_strip = 160;
161  max_wire = 96;
162  } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2
163  max_strip = 160;
164  max_wire = 64;
165  }
166  return std::make_pair(max_strip, max_wire);
167  }

References relativeConstraints::ring, and relativeConstraints::station.

Referenced by PrimitiveSelection::select_csc().

◆ get_trigger_csc_ID()

int emtf::get_trigger_csc_ID ( int  ring,
int  station,
int  chamber 
)

Definition at line 100 of file TrackTools.cc.

100  {
101  int result = 0;
102  if (station == 1) {
103  result = (chamber) % 3 + 1; // 1,2,3
104  switch (ring) {
105  case 1:
106  break;
107  case 2:
108  result += 3; // 4,5,6
109  break;
110  case 3:
111  result += 6; // 7,8,9
112  break;
113  case 4: // ME0
114  result = (chamber + 1) % 3 + 1; // 1,2,3
115  break;
116  }
117  } else {
118  if (ring == 1) {
119  result = (chamber + 1) % 3 + 1; // 1,2,3
120  } else {
121  result = (chamber + 3) % 6 + 4; // 4,5,6,7,8,9
122  }
123  }
124  return result;
125  }

References relativeConstraints::chamber, mps_fire::result, relativeConstraints::ring, and relativeConstraints::station.

Referenced by PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), PrimitiveConversion::convert_rpc(), PrimitiveSelection::select_dt(), PrimitiveSelection::select_gem(), and PrimitiveSelection::select_me0().

◆ get_trigger_sector()

int emtf::get_trigger_sector ( int  ring,
int  station,
int  chamber 
)

Definition at line 85 of file TrackTools.cc.

85  {
86  int result = 0;
87  if (station > 1 && ring > 1) {
88  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
89  } else if (station == 1) {
90  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
91  } else {
92  result = ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1; // ch 2-4-> 1, 5-7->2, ...
93  }
94  return (result <= 6) ? result
95  : 6; // max sector is 6, some calculations give a value greater than six but this is expected.
96  }

References relativeConstraints::chamber, mps_fire::result, relativeConstraints::ring, and relativeConstraints::station.

Referenced by PrimitiveConversion::convert_dt(), PrimitiveConversion::convert_gem(), PrimitiveConversion::convert_me0(), PrimitiveSelection::select_dt(), PrimitiveSelection::select_gem(), and PrimitiveSelection::select_me0().

◆ mergeNtuples()

void emtf::mergeNtuples ( const char *  ntuplename,
const char *  filestomerge,
const char *  outputfile 
)

Definition at line 88 of file Utilities.cc.

88  {
89  TChain chain(ntuplename);
90  chain.Add(filestomerge);
91  chain.Merge(outputfile);
92 }

References writedatasetfile::outputfile.

◆ numToStr()

template<typename T >
std::string emtf::numToStr ( T  num)

Definition at line 43 of file Utilities.h.

43  {
44  // Convert a number to a string.
45  std::stringstream ss;
46  ss << num;
47  std::string s = ss.str();
48  return s;
49  };

References EgammaValidation_cff::num, alignCSCRings::s, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by emtf::Tree::addXMLAttributes().

◆ processPrediction()

float emtf::processPrediction ( float  BDTPt,
int  Quality,
float  PrelimFit 
)

Definition at line 46 of file Utilities.cc.

46  {
47  // Discretize and scale the BDTPt prediction
48 
49  // Fix terrible predictions
50  if (BDTPt < 0)
51  BDTPt = PrelimFit;
52  if (BDTPt > 250)
53  BDTPt = PrelimFit;
54 
55  float BDTPt1 = BDTPt;
56  float scaleF = 1.0;
57 
58  // Scale based upon quality
59  if (Quality == 3)
60  scaleF = 1.15;
61  if (Quality == 2)
62  scaleF = 1.3;
63  if (Quality == 1)
64  scaleF = 1.7;
65 
66  BDTPt1 = scaleF * BDTPt1;
67 
68  // Discretize based upon ptscale
69  for (int pts = 0; pts < 31; pts++) {
70  if (ptscale[pts] <= BDTPt1 && ptscale[pts + 1] > BDTPt1) {
71  BDTPt1 = ptscale[pts];
72  break;
73  }
74  }
75 
76  if (BDTPt1 > 140)
77  BDTPt1 = 140;
78  if (BDTPt1 < 0)
79  BDTPt1 = 0;
80 
81  return BDTPt1;
82 }

References RPCpg::pts, and ptscale.

◆ rad_to_deg()

double emtf::rad_to_deg ( double  rad)
inline

◆ shuffle()

template<class bidiiter >
bidiiter emtf::shuffle ( bidiiter  begin,
bidiiter  end,
size_t  num_random 
)

Definition at line 27 of file Utilities.h.

27  {
28  // We will end up with the same elements in the collection except that
29  // the first num_random elements will be randomized.
30 
31  size_t left = std::distance(begin, end);
32  while (num_random--) {
33  bidiiter r = begin;
34  std::advance(r, rand() % left);
35  std::swap(*begin, *r);
36  ++begin;
37  --left;
38  }
39  return begin;
40  }

References HLT_FULL_cff::distance, mps_fire::end, alignCSCRings::r, and std::swap().

Referenced by emtf::Forest::prepareRandomSubsample().

◆ sort_uGMT_muons()

void emtf::sort_uGMT_muons ( l1t::RegionalMuonCandBxCollection cands)

Definition at line 111 of file MicroGMTConverter.cc.

111  {
112  int minBX = cands.getFirstBX();
113  int maxBX = cands.getLastBX();
114  int emtfMinProc = 0; // ME+ sector 1
115  int emtfMaxProc = 11; // ME- sector 6
116 
117  // New collection, sorted by processor to match uGMT unpacked order
118  auto sortedCands = std::make_unique<l1t::RegionalMuonCandBxCollection>();
119  sortedCands->clear();
120  sortedCands->setBXRange(minBX, maxBX);
121  for (int iBX = minBX; iBX <= maxBX; ++iBX) {
122  for (int proc = emtfMinProc; proc <= emtfMaxProc; proc++) {
124  ++cand) {
125  int cand_proc = cand->processor();
126  if (cand->trackFinderType() == l1t::tftype::emtf_neg)
127  cand_proc += 6;
128  if (cand_proc != proc)
129  continue;
130  sortedCands->push_back(iBX, *cand);
131  }
132  }
133  }
134 
135  // Return sorted collection
136  std::swap(cands, *sortedCands);
137  sortedCands.reset();
138  }

References HLT_FULL_cff::cands, l1t::emtf_neg, simKBmtfStubs_cfi::maxBX, simKBmtfStubs_cfi::minBX, ValidateTausOnZEEFastSim_cff::proc, and std::swap().

Referenced by MicroGMTConverter::convert_all(), and l1t::stage2::EMTFCollections::~EMTFCollections().

◆ sortNtupleByEvent()

void emtf::sortNtupleByEvent ( const char *  ntuplename,
const char *  filenametosort,
const char *  outputfile 
)

Definition at line 98 of file Utilities.cc.

98  {
99  //TFile f("../../all_test_redux_post.root");
100  TFile f(filenametosort);
101  TNtuple* tree = (TNtuple*)f.Get(ntuplename);
102  int nentries = (int)tree->GetEntries();
103  //Drawing variable pz with no graphics option.
104  //variable pz stored in array fV1 (see TTree::Draw)
105  tree->Draw("Event", "", "goff");
106  int* index = new int[nentries];
107  //sort array containing pz in decreasing order
108  //The array index contains the entry numbers in decreasing order
109  TMath::Sort(nentries, tree->GetV1(), index);
110 
111  //open new file to store the sorted Tree
112  //TFile f2("../../test_events_sorted.root","recreate");
113  TFile f2(outputfile, "recreate");
114 
115  //Create an empty clone of the original tree
116  TTree* tsorted = (TTree*)tree->CloneTree(0);
117  for (int i = 0; i < nentries; i++) {
118  tree->GetEntry(index[i]);
119  tsorted->Fill();
120  }
121  tsorted->Write();
122  delete[] index;
123 }

References f, DeadROC_duringRun::f2, mps_fire::i, createfilelist::int, and writedatasetfile::outputfile.

◆ wrap_phi_deg()

double emtf::wrap_phi_deg ( double  deg)
inline

Definition at line 32 of file TrackTools.h.

32  {
33  while (deg < -180.)
34  deg += 360.;
35  while (deg >= +180.)
36  deg -= 360.;
37  return deg;
38  }

Referenced by calc_phi_GMT_int(), and calc_phi_loc_deg_from_glob().

◆ wrap_phi_rad()

double emtf::wrap_phi_rad ( double  rad)
inline

Definition at line 40 of file TrackTools.h.

40  {
41  while (rad < -M_PI)
42  rad += 2. * M_PI;
43  while (rad >= +M_PI)
44  rad -= 2. * M_PI;
45  return rad;
46  }

References M_PI.

◆ wrap_theta_deg()

double emtf::wrap_theta_deg ( double  deg)
inline

Definition at line 48 of file TrackTools.h.

48  {
49  deg = std::abs(deg);
50  while (deg >= 180.)
51  deg -= 180.;
52  if (deg >= 180. / 2.)
53  deg = 180. - deg;
54  return deg;
55  }

References funct::abs().

Referenced by calc_eta_from_theta_deg().

◆ wrap_theta_rad()

double emtf::wrap_theta_rad ( double  rad)
inline

Definition at line 57 of file TrackTools.h.

57  {
58  rad = std::abs(rad);
59  while (rad >= M_PI)
60  rad -= M_PI;
61  if (rad >= M_PI / 2.)
62  rad = M_PI - rad;
63  return rad;
64  }

References funct::abs(), and M_PI.

Variable Documentation

◆ MAX_ENDCAP

constexpr int emtf::MAX_ENDCAP = 2
constexpr

◆ MAX_TRIGSECTOR

constexpr int emtf::MAX_TRIGSECTOR = 6
constexpr

◆ MIN_ENDCAP

constexpr int emtf::MIN_ENDCAP = 1
constexpr

◆ MIN_TRIGSECTOR

constexpr int emtf::MIN_TRIGSECTOR = 1
constexpr

◆ NUM_FEATURES

constexpr int emtf::NUM_FEATURES = 23
constexpr

Definition at line 68 of file Common.h.

Referenced by PtAssignmentEngineDxy::call_tensorflow_dxy().

◆ NUM_PREDICTIONS

constexpr int emtf::NUM_PREDICTIONS = 2
constexpr

Definition at line 69 of file Common.h.

Referenced by PtAssignmentEngineDxy::call_tensorflow_dxy().

◆ NUM_SECTORS

constexpr int emtf::NUM_SECTORS = 12
constexpr

Definition at line 51 of file Common.h.

◆ NUM_STATION_PAIRS

constexpr int emtf::NUM_STATION_PAIRS = 6
constexpr

Definition at line 59 of file Common.h.

Referenced by AngleCalculation::calculate_angles(), and PtAssignment::process().

◆ NUM_STATIONS

constexpr int emtf::NUM_STATIONS = 4
constexpr

◆ NUM_ZONE_HITS

constexpr int emtf::NUM_ZONE_HITS = 160
constexpr

Definition at line 55 of file Common.h.

Referenced by PatternRecognition::process_single_zone().

◆ NUM_ZONES

constexpr int emtf::NUM_ZONES = 4
constexpr

◆ ptScale

const std::vector<double> emtf::ptScale

◆ ptscale

const double emtf::ptscale
Initial value:
= {0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0,
8.0, 10.0, 12.0, 14.0, 16.0, 18.0, 20.0, 25.0, 30.0, 35.0, 40.0,
45.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0, 120.0, 140.0}

Definition at line 29 of file Utilities.cc.

Referenced by L1TGMT::bookHistograms(), and processPrediction().

◆ twoJets_scale

const double emtf::twoJets_scale
Initial value:
= {
0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 20.0, 50.0, 100, 500, 1000, 5000, 7500, 50000}

Definition at line 36 of file Utilities.cc.

◆ twoJetsScale

const std::vector< double > emtf::twoJetsScale
Initial value:
=
std::vector<double>(twoJets_scale, twoJets_scale + sizeof twoJets_scale / sizeof twoJets_scale[0])

Definition at line 39 of file Utilities.cc.

l1t::emtf_neg
Definition: RegionalMuonCandFwd.h:8
writedatasetfile.outputfile
outputfile
Definition: writedatasetfile.py:27
simKBmtfStubs_cfi.minBX
minBX
Definition: simKBmtfStubs_cfi.py:9
mps_fire.i
i
Definition: mps_fire.py:428
emtf::MIN_TRIGSECTOR
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
relativeConstraints.station
station
Definition: relativeConstraints.py:67
emtf::calc_theta_rad_from_eta
double calc_theta_rad_from_eta(double eta)
Definition: TrackTools.h:157
BXVector< RegionalMuonCand >::const_iterator
std::vector< RegionalMuonCand >::const_iterator const_iterator
Definition: BXVector.h:18
emtf::deg_to_rad
double deg_to_rad(double deg)
Definition: TrackTools.h:68
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
emtf::calc_theta_rad
double calc_theta_rad(double eta)
Definition: TrackTools.h:136
tree
Definition: tree.py:1
gather_cfg.cout
cout
Definition: gather_cfg.py:144
emtf::wrap_phi_deg
double wrap_phi_deg(double deg)
Definition: TrackTools.h:32
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
emtf::MAX_ENDCAP
constexpr int MAX_ENDCAP
Definition: Common.h:46
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
emtf::rad_to_deg
double rad_to_deg(double rad)
Definition: TrackTools.h:73
emtf::MAX_TRIGSECTOR
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
emtf::calc_theta_deg_from_int
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:128
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1TMuon::kRPC
Definition: L1TMuonSubsystems.h:5
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
emtf::calc_phi_GMT_deg
double calc_phi_GMT_deg(int bits)
Definition: TrackTools.h:217
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mps_fire.end
end
Definition: mps_fire.py:242
emtf::MIN_ENDCAP
constexpr int MIN_ENDCAP
Definition: Common.h:45
emtf::calc_phi_loc_deg
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:176
emtf::ptscale
const double ptscale[31]
Definition: Utilities.cc:29
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
h
emtf::calc_phi_glob_deg
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:166
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
emtf::wrap_theta_deg
double wrap_theta_deg(double deg)
Definition: TrackTools.h:48
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15142
L1TMuon::kCSC
Definition: L1TMuonSubsystems.h:5
ValidateTausOnZEEFastSim_cff.proc
proc
Definition: ValidateTausOnZEEFastSim_cff.py:6
PVValHelper::phi
Definition: PVValidationHelpers.h:68
DeadROC_duringRun.f2
f2
Definition: DeadROC_duringRun.py:220
cand
Definition: decayParser.h:32
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
createfilelist.int
int
Definition: createfilelist.py:10
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
simKBmtfStubs_cfi.maxBX
maxBX
Definition: simKBmtfStubs_cfi.py:10
emtf::twoJets_scale
const double twoJets_scale[16]
Definition: Utilities.cc:36
emtf::calc_phi_loc_deg_from_glob
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:195
RPCpg::pts
static const double pts[33]
Definition: Constants.h:30
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
alignCSCRings.r
r
Definition: alignCSCRings.py:93
heppy_batch.val
val
Definition: heppy_batch.py:351
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
emtf::calc_eta_from_theta_rad
double calc_eta_from_theta_rad(double theta_rad)
Definition: TrackTools.h:108
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7733
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
chain
Definition: chain.py:1
ecaldqm::Quality
Quality
Definition: DBWriterWorkers.cc:55