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)
 
int get_csc_max_slope (int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB)
 
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 double ptscale [31]
 
const std::vector< double > ptScale
 
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.

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

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

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  }

◆ calc_eta()

double emtf::calc_eta ( int  bits)
inline

Definition at line 99 of file TrackTools.h.

References gpuClustering::pixelStatus::bits, and PVValHelper::eta.

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

99  {
100  double eta = static_cast<double>(bits);
101  eta *= 0.010875;
102  return eta;
103  }
constexpr uint32_t bits
Definition: gpuClustering.h:23

◆ calc_eta_from_theta_deg()

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

Definition at line 117 of file TrackTools.h.

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().

117  { // endcap [-1,+1]
118  double theta_rad = deg_to_rad(wrap_theta_deg(theta_deg)); // put theta in [0, 90] range
119  double eta = calc_eta_from_theta_rad(theta_rad);
120  eta = (endcap == -1) ? -eta : eta;
121  return eta;
122  }
double wrap_theta_deg(double deg)
Definition: TrackTools.h:52
double calc_eta_from_theta_rad(double theta_rad)
Definition: TrackTools.h:112
double deg_to_rad(double deg)
Definition: TrackTools.h:72

◆ calc_eta_from_theta_rad()

double emtf::calc_eta_from_theta_rad ( double  theta_rad)
inline

Definition at line 112 of file TrackTools.h.

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

Referenced by calc_eta_from_theta_deg().

112  {
113  double eta = -1. * std::log(std::tan(theta_rad / 2.));
114  return eta;
115  }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22

◆ calc_eta_GMT()

int emtf::calc_eta_GMT ( double  val)
inline

Definition at line 124 of file TrackTools.h.

References heppy_batch::val.

124  {
125  val /= 0.010875;
126  int gmt_eta = static_cast<int>(std::round(val));
127  return gmt_eta;
128  }

◆ calc_phi_glob_deg()

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

Definition at line 170 of file TrackTools.h.

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().

170  { // loc in deg, sector [1-6]
171  double glob = loc + 15. + (60. * (sector - 1));
172  glob = (glob < 180.) ? glob : glob - 360.;
173  return glob;
174  }

◆ calc_phi_glob_rad()

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

Definition at line 176 of file TrackTools.h.

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

176  { // loc in rad, sector [1-6]
177  return deg_to_rad(calc_phi_glob_deg(rad_to_deg(loc), sector));
178  }
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:170
double deg_to_rad(double deg)
Definition: TrackTools.h:72
double rad_to_deg(double rad)
Definition: TrackTools.h:77

◆ calc_phi_GMT_deg()

double emtf::calc_phi_GMT_deg ( int  bits)
inline

Definition at line 221 of file TrackTools.h.

References gpuClustering::pixelStatus::bits.

Referenced by calc_phi_GMT_rad().

221  {
222  double phi = static_cast<double>(bits);
223  phi = (phi * 360. / 576.) + (180. / 576.);
224  return phi;
225  }
constexpr uint32_t bits
Definition: gpuClustering.h:23

◆ calc_phi_GMT_int()

int emtf::calc_phi_GMT_int ( double  val)
inline

Definition at line 233 of file TrackTools.h.

References heppy_batch::val, and wrap_phi_deg().

233  { // phi in deg
234  val = wrap_phi_deg(val); // put phi in [-180,180] range
235  val = (val - 180. / 576.) / (360. / 576.);
236  int gmt_phi = static_cast<int>(std::round(val));
237  return gmt_phi;
238  }
double wrap_phi_deg(double deg)
Definition: TrackTools.h:36

◆ calc_phi_GMT_rad()

double emtf::calc_phi_GMT_rad ( int  bits)
inline

Definition at line 231 of file TrackTools.h.

References gpuClustering::pixelStatus::bits, calc_phi_GMT_deg(), and deg_to_rad().

231 { return deg_to_rad(calc_phi_GMT_deg(bits)); }
constexpr uint32_t bits
Definition: gpuClustering.h:23
double deg_to_rad(double deg)
Definition: TrackTools.h:72
double calc_phi_GMT_deg(int bits)
Definition: TrackTools.h:221

◆ calc_phi_loc_deg()

double emtf::calc_phi_loc_deg ( int  bits)
inline

◆ calc_phi_loc_deg_from_glob()

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

Definition at line 199 of file TrackTools.h.

References wrap_phi_deg().

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

199  { // glob in deg, sector [1-6]
200  glob = wrap_phi_deg(glob); // put phi in [-180,180] range
201  double loc = glob - 15. - (60. * (sector - 1));
202  return loc;
203  }
double wrap_phi_deg(double deg)
Definition: TrackTools.h:36

◆ calc_phi_loc_int()

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

Definition at line 205 of file TrackTools.h.

References calc_phi_loc_deg_from_glob().

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

205  { // glob in deg, sector [1-6]
206  double loc = calc_phi_loc_deg_from_glob(glob, sector);
207  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
208  loc = (loc + 22.) * 60.;
209  int phi_int = static_cast<int>(std::round(loc));
210  return phi_int;
211  }
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:199

◆ calc_phi_loc_int_rpc()

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

Definition at line 213 of file TrackTools.h.

References calc_phi_loc_deg_from_glob().

Referenced by PrimitiveConversion::convert_rpc().

213  { // glob in deg, sector [1-6]
214  double loc = calc_phi_loc_deg_from_glob(glob, sector);
215  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
216  loc = (loc + 22.) * 60. / 4.; // 4x coarser resolution
217  int phi_int = static_cast<int>(std::round(loc));
218  return phi_int;
219  }
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:199

◆ calc_phi_loc_rad()

double emtf::calc_phi_loc_rad ( int  bits)
inline

Definition at line 186 of file TrackTools.h.

References gpuClustering::pixelStatus::bits, calc_phi_loc_deg(), and deg_to_rad().

186 { return deg_to_rad(calc_phi_loc_deg(bits)); }
constexpr uint32_t bits
Definition: gpuClustering.h:23
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:180
double deg_to_rad(double deg)
Definition: TrackTools.h:72

◆ calc_pt()

double emtf::calc_pt ( int  bits)
inline

Definition at line 84 of file TrackTools.h.

References gpuClustering::pixelStatus::bits, and DiDispStaMuonMonitor_cfi::pt.

84  {
85  double pt = static_cast<double>(bits);
86  pt = 0.5 * (pt - 1);
87  return pt;
88  }
constexpr uint32_t bits
Definition: gpuClustering.h:23

◆ calc_pt_GMT()

int emtf::calc_pt_GMT ( double  val)
inline

Definition at line 90 of file TrackTools.h.

References heppy_batch::val.

90  {
91  val = (val * 2) + 1;
92  int gmt_pt = static_cast<int>(std::round(val));
93  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
94  return gmt_pt;
95  }

◆ calc_ring()

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

Definition at line 5 of file TrackTools.cc.

References relativeConstraints::station.

Referenced by l1t::stage2::emtf::ImportME(), and l1t::stage2::emtf::MEBlockUnpacker::unpack().

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  }

◆ calc_theta_deg()

double emtf::calc_theta_deg ( double  eta)
inline

Definition at line 145 of file TrackTools.h.

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

145 { return rad_to_deg(calc_theta_rad(eta)); }
double calc_theta_rad(double eta)
Definition: TrackTools.h:140
double rad_to_deg(double rad)
Definition: TrackTools.h:77

◆ calc_theta_deg_from_eta()

double emtf::calc_theta_deg_from_eta ( double  eta)
inline

Definition at line 166 of file TrackTools.h.

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

double calc_theta_rad_from_eta(double eta)
Definition: TrackTools.h:161
double rad_to_deg(double rad)
Definition: TrackTools.h:77

◆ calc_theta_deg_from_int()

double emtf::calc_theta_deg_from_int ( int  theta_int)
inline

Definition at line 132 of file TrackTools.h.

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().

132  {
133  double theta = static_cast<double>(theta_int);
134  theta = theta * (45.0 - 8.5) / 128. + 8.5;
135  return theta;
136  }
Geom::Theta< T > theta() const

◆ calc_theta_int()

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

Definition at line 147 of file TrackTools.h.

References makeMuonMisalignmentScenario::endcap, and theta().

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

147  { // theta in deg, endcap [-1,+1]
148  theta = (endcap == -1) ? (180. - theta) : theta;
149  theta = (theta - 8.5) * 128. / (45.0 - 8.5);
150  int theta_int = static_cast<int>(std::round(theta));
151  return theta_int;
152  }
Geom::Theta< T > theta() const

◆ calc_theta_int_rpc()

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

Definition at line 154 of file TrackTools.h.

References makeMuonMisalignmentScenario::endcap, and theta().

Referenced by PrimitiveConversion::convert_rpc().

154  { // theta in deg, endcap [-1,+1]
155  theta = (endcap == -1) ? (180. - theta) : theta;
156  theta = (theta - 8.5) * (128. / 4.) / (45.0 - 8.5); // 4x coarser resolution
157  int theta_int = static_cast<int>(std::round(theta));
158  return theta_int;
159  }
Geom::Theta< T > theta() const

◆ calc_theta_rad()

double emtf::calc_theta_rad ( double  eta)
inline

Definition at line 140 of file TrackTools.h.

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

Referenced by calc_theta_deg().

140  {
141  double theta_rad = 2. * std::atan(std::exp(-1. * eta));
142  return theta_rad;
143  }

◆ calc_theta_rad_from_eta()

double emtf::calc_theta_rad_from_eta ( double  eta)
inline

Definition at line 161 of file TrackTools.h.

References PVValHelper::eta, and theta().

Referenced by calc_theta_deg_from_eta().

161  {
162  double theta = std::atan2(1.0, std::sinh(eta)); // cot(theta) = sinh(eta)
163  return theta;
164  }
Geom::Theta< T > theta() const

◆ calc_theta_rad_from_int()

double emtf::calc_theta_rad_from_int ( int  theta_int)
inline

Definition at line 138 of file TrackTools.h.

References calc_theta_deg_from_int(), and deg_to_rad().

138 { return deg_to_rad(calc_theta_deg_from_int(theta_int)); }
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:132
double deg_to_rad(double deg)
Definition: TrackTools.h:72

◆ 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.

References relativeConstraints::station.

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

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  }

◆ deg_to_rad()

double emtf::deg_to_rad ( double  deg)
inline

Definition at line 72 of file TrackTools.h.

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().

72  {
73  constexpr double factor = M_PI / 180.;
74  return deg * factor;
75  }
#define M_PI

◆ 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.

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

Referenced by TrackFinder::process().

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  }
constexpr int MIN_ENDCAP
Definition: Common.h:45
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
constexpr int MAX_ENDCAP
Definition: Common.h:46
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ 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.

Referenced by PrimitiveSelection::select_csc().

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

◆ get_csc_max_slope()

int emtf::get_csc_max_slope ( int  station,
int  ring,
bool  useRun3CCLUT_OTMB,
bool  useRun3CCLUT_TMB 
)

Definition at line 175 of file TrackTools.cc.

References or, and relativeConstraints::ring.

Referenced by PrimitiveSelection::select_csc().

175  {
176  int max_slope = 65536; // Uninitialized slope can be 65536. This is expected when CCLUT is not running
177  if (useRun3CCLUT_OTMB and (ring == 1 or ring == 4))
178  max_slope = 16;
179  if (useRun3CCLUT_TMB and (ring == 2 or ring == 3))
180  max_slope = 16;
181  return max_slope;
182  }
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12

◆ 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.

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

Referenced by PrimitiveSelection::select_csc().

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  }

◆ get_trigger_csc_ID()

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

Definition at line 100 of file TrackTools.cc.

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().

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  }

◆ get_trigger_sector()

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

Definition at line 85 of file TrackTools.cc.

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().

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  }

◆ mergeNtuples()

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

Definition at line 88 of file Utilities.cc.

References writedatasetfile::outputfile.

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

◆ numToStr()

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

Definition at line 43 of file Utilities.h.

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

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

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  };

◆ processPrediction()

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

Definition at line 46 of file Utilities.cc.

References RPCpg::pts, and ptscale.

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 }
static const double pts[33]
Definition: Constants.h:30
const double ptscale[31]
Definition: Utilities.cc:29

◆ 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.

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

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

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  }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

◆ sort_uGMT_muons()

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

Definition at line 111 of file MicroGMTConverter.cc.

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

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

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  }
std::vector< RegionalMuonCand >::const_iterator const_iterator
Definition: BXVector.h:18
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)

◆ sortNtupleByEvent()

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

Definition at line 98 of file Utilities.cc.

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

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 }
double f[11][100]
Definition: tree.py:1

◆ wrap_phi_deg()

double emtf::wrap_phi_deg ( double  deg)
inline

Definition at line 36 of file TrackTools.h.

Referenced by calc_phi_GMT_int(), and calc_phi_loc_deg_from_glob().

36  {
37  while (deg < -180.)
38  deg += 360.;
39  while (deg >= +180.)
40  deg -= 360.;
41  return deg;
42  }

◆ wrap_phi_rad()

double emtf::wrap_phi_rad ( double  rad)
inline

Definition at line 44 of file TrackTools.h.

References M_PI.

44  {
45  while (rad < -M_PI)
46  rad += 2. * M_PI;
47  while (rad >= +M_PI)
48  rad -= 2. * M_PI;
49  return rad;
50  }
#define M_PI

◆ wrap_theta_deg()

double emtf::wrap_theta_deg ( double  deg)
inline

Definition at line 52 of file TrackTools.h.

References funct::abs().

Referenced by calc_eta_from_theta_deg().

52  {
53  deg = std::abs(deg);
54  while (deg >= 180.)
55  deg -= 180.;
56  if (deg >= 180. / 2.)
57  deg = 180. - deg;
58  return deg;
59  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ wrap_theta_rad()

double emtf::wrap_theta_rad ( double  rad)
inline

Definition at line 61 of file TrackTools.h.

References funct::abs(), and M_PI.

61  {
62  rad = std::abs(rad);
63  while (rad >= M_PI)
64  rad -= M_PI;
65  if (rad >= M_PI / 2.)
66  rad = M_PI - rad;
67  return rad;
68  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI

Variable Documentation

◆ MAX_ENDCAP

constexpr int emtf::MAX_ENDCAP = 2

◆ MAX_TRIGSECTOR

constexpr int emtf::MAX_TRIGSECTOR = 6

◆ MIN_ENDCAP

constexpr int emtf::MIN_ENDCAP = 1

◆ MIN_TRIGSECTOR

constexpr int emtf::MIN_TRIGSECTOR = 1

◆ NUM_FEATURES

constexpr int emtf::NUM_FEATURES = 23

Definition at line 68 of file Common.h.

Referenced by PtAssignmentEngineDxy::call_tensorflow_dxy().

◆ NUM_PREDICTIONS

constexpr int emtf::NUM_PREDICTIONS = 2

Definition at line 69 of file Common.h.

Referenced by PtAssignmentEngineDxy::call_tensorflow_dxy().

◆ NUM_SECTORS

constexpr int emtf::NUM_SECTORS = 12

Definition at line 51 of file Common.h.

◆ NUM_STATION_PAIRS

constexpr int emtf::NUM_STATION_PAIRS = 6

Definition at line 59 of file Common.h.

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

◆ NUM_STATIONS

constexpr int emtf::NUM_STATIONS = 4

◆ NUM_ZONE_HITS

constexpr int emtf::NUM_ZONE_HITS = 160

Definition at line 55 of file Common.h.

Referenced by PatternRecognition::process_single_zone().

◆ NUM_ZONES

constexpr int emtf::NUM_ZONES = 4

◆ 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().

◆ ptScale

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

◆ 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])
const double twoJets_scale[16]
Definition: Utilities.cc:36

Definition at line 39 of file Utilities.cc.