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

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)
 
void get_csc_max_strip_and_wire (int station, int ring, int &max_strip, int &max_wire)
 
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_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

◆ 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 91 of file TrackTools.h.

91  {
92  double eta = static_cast<double>(bits);
93  eta *= 0.010875;
94  return eta;
95  }

References bits, and 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 109 of file TrackTools.h.

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

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 104 of file TrackTools.h.

104  {
105  double eta = -1. * std::log(std::tan(theta_rad / 2.));
106  return eta;
107  }

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 116 of file TrackTools.h.

116  {
117  val /= 0.010875;
118  int gmt_eta = static_cast<int>(std::round(val));
119  return gmt_eta;
120  }

References heppy_batch::val.

◆ calc_phi_glob_deg()

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

Definition at line 162 of file TrackTools.h.

162  { // loc in deg, sector [1-6]
163  double glob = loc + 15. + (60. * (sector - 1));
164  glob = (glob < 180.) ? glob : glob - 360.;
165  return glob;
166  }

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 168 of file TrackTools.h.

168  { // loc in rad, sector [1-6]
169  return deg_to_rad(calc_phi_glob_deg(rad_to_deg(loc), sector));
170  }

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 213 of file TrackTools.h.

213  {
214  double phi = static_cast<double>(bits);
215  phi = (phi * 360. / 576.) + (180. / 576.);
216  return phi;
217  }

References bits.

Referenced by calc_phi_GMT_rad().

◆ calc_phi_GMT_int()

int emtf::calc_phi_GMT_int ( double  val)
inline

Definition at line 225 of file TrackTools.h.

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

References heppy_batch::val, and wrap_phi_deg().

◆ calc_phi_GMT_rad()

double emtf::calc_phi_GMT_rad ( int  bits)
inline

Definition at line 223 of file TrackTools.h.

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

References bits, calc_phi_GMT_deg(), and deg_to_rad().

◆ calc_phi_loc_deg()

double emtf::calc_phi_loc_deg ( int  bits)
inline

Definition at line 172 of file TrackTools.h.

172  {
173  double loc = static_cast<double>(bits);
174  loc = (loc / 60.) - 22.;
175  return loc;
176  }

References bits.

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 191 of file TrackTools.h.

191  { // glob in deg, sector [1-6]
192  glob = wrap_phi_deg(glob); // put phi in [-180,180] range
193  double loc = glob - 15. - (60. * (sector - 1));
194  return loc;
195  }

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 197 of file TrackTools.h.

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

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 205 of file TrackTools.h.

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. / 4.; // 4x coarser resolution
209  int phi_int = static_cast<int>(std::round(loc));
210  return phi_int;
211  }

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 178 of file TrackTools.h.

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

References bits, calc_phi_loc_deg(), and deg_to_rad().

◆ calc_pt()

double emtf::calc_pt ( int  bits)
inline

Definition at line 76 of file TrackTools.h.

76  {
77  double pt = static_cast<double>(bits);
78  pt = 0.5 * (pt - 1);
79  return pt;
80  }

References bits, and DiDispStaMuonMonitor_cfi::pt.

◆ calc_pt_GMT()

int emtf::calc_pt_GMT ( double  val)
inline

Definition at line 82 of file TrackTools.h.

82  {
83  val = (val * 2) + 1;
84  int gmt_pt = static_cast<int>(std::round(val));
85  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
86  return gmt_pt;
87  }

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 137 of file TrackTools.h.

137 { 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 158 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 124 of file TrackTools.h.

124  {
125  double theta = static_cast<double>(theta_int);
126  theta = theta * (45.0 - 8.5) / 128. + 8.5;
127  return theta;
128  }

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 139 of file TrackTools.h.

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

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 146 of file TrackTools.h.

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

References makeMuonMisalignmentScenario::endcap, and theta().

Referenced by PrimitiveConversion::convert_rpc().

◆ calc_theta_rad()

double emtf::calc_theta_rad ( double  eta)
inline

Definition at line 132 of file TrackTools.h.

132  {
133  double theta_rad = 2. * std::atan(std::exp(-1. * eta));
134  return theta_rad;
135  }

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 153 of file TrackTools.h.

153  {
154  double theta = std::atan2(1.0, std::sinh(eta)); // cot(theta) = sinh(eta)
155  return theta;
156  }

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 130 of file TrackTools.h.

130 { 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 64 of file TrackTools.h.

64  {
65  constexpr double factor = M_PI / 180.;
66  return deg * factor;
67  }

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 5 of file DebugTools.cc.

5  {
6  // 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() == TriggerPrimitive::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() == TriggerPrimitive::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::TriggerPrimitive::kCSC, L1TMuon::TriggerPrimitive::kRPC, MAX_ENDCAP, MAX_TRIGSECTOR, MIN_ENDCAP, MIN_TRIGSECTOR, relativeConstraints::station, digitizers_cfi::strip, OrderedSet::t, and validateGeometry_cfg::valid.

Referenced by TrackFinder::process().

◆ get_csc_max_strip_and_wire()

void emtf::get_csc_max_strip_and_wire ( int  station,
int  ring,
int &  max_strip,
int &  max_wire 
)

Definition at line 141 of file TrackTools.cc.

141  {
142  max_strip = 0; // halfstrip
143  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;
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 begin, HLT_2018_cff::distance, end, alignCSCRings::r, rand(), and std::swap().

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

◆ sort_uGMT_muons()

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

Definition at line 109 of file MicroGMTConverter.cc.

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

References HLT_2018_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 28 of file TrackTools.h.

28  {
29  while (deg < -180.)
30  deg += 360.;
31  while (deg >= +180.)
32  deg -= 360.;
33  return deg;
34  }

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 36 of file TrackTools.h.

36  {
37  while (rad < -M_PI)
38  rad += 2. * M_PI;
39  while (rad >= +M_PI)
40  rad -= 2. * M_PI;
41  return rad;
42  }

References M_PI.

◆ wrap_theta_deg()

double emtf::wrap_theta_deg ( double  deg)
inline

Definition at line 44 of file TrackTools.h.

44  {
45  deg = std::abs(deg);
46  while (deg >= 180.)
47  deg -= 180.;
48  if (deg >= 180. / 2.)
49  deg = 180. - deg;
50  return deg;
51  }

References funct::abs().

Referenced by calc_eta_from_theta_deg().

◆ wrap_theta_rad()

double emtf::wrap_theta_rad ( double  rad)
inline

Definition at line 53 of file TrackTools.h.

53  {
54  rad = std::abs(rad);
55  while (rad >= M_PI)
56  rad -= M_PI;
57  if (rad >= M_PI / 2.)
58  rad = M_PI - rad;
59  return rad;
60  }

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_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:355
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:153
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:64
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
emtf::calc_theta_rad
double calc_theta_rad(double eta)
Definition: TrackTools.h:132
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:28
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
emtf::MAX_ENDCAP
constexpr int MAX_ENDCAP
Definition: Common.h:46
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
L1TMuon::TriggerPrimitive::kCSC
Definition: MuonTriggerPrimitive.h:59
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
end
#define end
Definition: vmac.h:39
emtf::rad_to_deg
double rad_to_deg(double rad)
Definition: TrackTools.h:69
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:124
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
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:213
PVValHelper::eta
Definition: PVValidationHelpers.h:69
TriggerPrimitive
L1TMuon::TriggerPrimitive TriggerPrimitive
Definition: Common.h:31
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:172
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
L1TMuon::TriggerPrimitive
Definition: MuonTriggerPrimitive.h:56
OrderedSet.t
t
Definition: OrderedSet.py:90
emtf::calc_phi_glob_deg
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:162
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
emtf::wrap_theta_deg
double wrap_theta_deg(double deg)
Definition: TrackTools.h:44
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:34
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:50
simKBmtfStubs_cfi.maxBX
maxBX
Definition: simKBmtfStubs_cfi.py:10
rand
Signal rand(Signal arg)
Definition: vlib.cc:379
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:191
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
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
heppy_batch.val
val
Definition: heppy_batch.py:351
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
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:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:104
begin
#define begin
Definition: vmac.h:32
chain
Definition: chain.py:1
ecaldqm::Quality
Quality
Definition: DBWriterWorkers.cc:55
L1TMuon::TriggerPrimitive::kRPC
Definition: MuonTriggerPrimitive.h:59