CMS 3D CMS Logo

Classes | Typedefs | Functions | Variables
emtf Namespace Reference

Classes

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

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)
 
template<typename T = void>
EMTFGEMDetId construct_EMTFGEMDetId (const L1TMuon::TriggerPrimitive &tp)
 
double deg_to_rad (double deg)
 
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)
 
double range_phi_deg (double deg)
 
double range_phi_rad (double rad)
 
double range_theta_deg (double deg)
 
double range_theta_rad (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)
 

Variables

int MAX_ENDCAP = 2
 
int MAX_TRIGSECTOR = 6
 
int MIN_ENDCAP = 1
 
int MIN_TRIGSECTOR = 1
 
int NUM_SECTORS = 12
 
int NUM_STATION_PAIRS = 6
 
int NUM_STATIONS = 4
 
int NUM_ZONE_HITS = 160
 
int NUM_ZONES = 4
 
const double ptscale [31]
 
const std::vector< double > ptScale
 
const double twoJets_scale [16]
 
const std::vector< double > twoJetsScale = std::vector<double>(twoJets_scale, twoJets_scale + sizeof twoJets_scale / sizeof twoJets_scale[0])
 

Typedef Documentation

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

Definition at line 76 of file Common.h.

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

Definition at line 78 of file Common.h.

Function Documentation

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

Definition at line 21 of file TrackTools.cc.

References relativeConstraints::chamber.

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

21  {
22  int chamber = -999;
23  if (station == 1) {
24  chamber = ((sector-1) * 6) + csc_ID + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
25  if (ring == 2) chamber -= 3;
26  if (ring == 3) chamber -= 6;
27  if (subsector == 2) chamber += 3;
28  if (chamber > 36) chamber -= 36;
29  }
30  else if (ring == 1) {
31  chamber = ((sector-1) * 3) + csc_ID + 1; // Chamber offset of 1: First chamber in sector 1 is chamber 2
32  if (chamber > 18) chamber -= 18;
33  }
34  else if (ring == 2) {
35  chamber = ((sector-1) * 6) + csc_ID - 3 + 2; // Chamber offset of 2: First chamber in sector 1 is chamber 3
36  if (chamber > 36) chamber -= 36;
37  }
38  return chamber;
39 }
double emtf::calc_eta ( int  bits)
inline

Definition at line 76 of file TrackTools.h.

References bits, and PVValHelper::eta.

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

76  {
77  double eta = static_cast<double>(bits);
78  eta *= 0.010875;
79  return eta;
80  }
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
double emtf::calc_eta_from_theta_deg ( double  theta_deg,
int  endcap 
)
inline

Definition at line 94 of file TrackTools.h.

References calc_eta_from_theta_rad(), deg_to_rad(), PVValHelper::eta, and range_theta_deg().

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

94  { // endcap [-1,+1]
95  double theta_rad = deg_to_rad(range_theta_deg(theta_deg)); // put theta in [0, 90] range
96  double eta = calc_eta_from_theta_rad(theta_rad);
97  eta = (endcap == -1) ? -eta : eta;
98  return eta;
99  }
double calc_eta_from_theta_rad(double theta_rad)
Definition: TrackTools.h:89
double deg_to_rad(double deg)
Definition: TrackTools.h:49
double range_theta_deg(double deg)
Definition: TrackTools.h:33
double emtf::calc_eta_from_theta_rad ( double  theta_rad)
inline

Definition at line 89 of file TrackTools.h.

References PVValHelper::eta, cmsBatch::log, and funct::tan().

Referenced by calc_eta_from_theta_deg().

89  {
90  double eta = -1. * std::log(std::tan(theta_rad/2.));
91  return eta;
92  }
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
int emtf::calc_eta_GMT ( double  val)
inline

Definition at line 101 of file TrackTools.h.

101  {
102  val /= 0.010875;
103  int gmt_eta = static_cast<int>(std::round(val));
104  return gmt_eta;
105  }
double emtf::calc_phi_glob_deg ( double  loc,
int  sector 
)
inline

Definition at line 153 of file TrackTools.h.

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

153  { // loc in deg, sector [1-6]
154  double glob = loc + 15. + (60. * (sector-1));
155  glob = (glob < 180.) ? glob : glob - 360.;
156  return glob;
157  }
double emtf::calc_phi_glob_rad ( double  loc,
int  sector 
)
inline

Definition at line 159 of file TrackTools.h.

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

159  { // loc in rad, sector [1-6]
160  return deg_to_rad(calc_phi_glob_deg(rad_to_deg(loc), sector));
161  }
double calc_phi_glob_deg(double loc, int sector)
Definition: TrackTools.h:153
double deg_to_rad(double deg)
Definition: TrackTools.h:49
double rad_to_deg(double rad)
Definition: TrackTools.h:54
double emtf::calc_phi_GMT_deg ( int  bits)
inline

Definition at line 206 of file TrackTools.h.

References bits.

Referenced by calc_phi_GMT_rad().

206  {
207  double phi = static_cast<double>(bits);
208  phi = (phi * 360./576.) + (180./576.);
209  return phi;
210  }
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
int emtf::calc_phi_GMT_int ( double  val)
inline

Definition at line 220 of file TrackTools.h.

References range_phi_deg().

220  { // phi in deg
221  val = range_phi_deg(val); // put phi in [-180,180] range
222  val = (val - 180./576.) / (360./576.);
223  int gmt_phi = static_cast<int>(std::round(val));
224  return gmt_phi;
225  }
double range_phi_deg(double deg)
Definition: TrackTools.h:21
double emtf::calc_phi_GMT_rad ( int  bits)
inline

Definition at line 216 of file TrackTools.h.

References calc_phi_GMT_deg(), and deg_to_rad().

216  {
218  }
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
double deg_to_rad(double deg)
Definition: TrackTools.h:49
double calc_phi_GMT_deg(int bits)
Definition: TrackTools.h:206
double emtf::calc_phi_loc_deg ( int  bits)
inline

Definition at line 163 of file TrackTools.h.

References bits, and create_public_lumi_plots::loc.

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

163  {
164  double loc = static_cast<double>(bits);
165  loc = (loc/60.) - 22.;
166  return loc;
167  }
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
double emtf::calc_phi_loc_deg_from_glob ( double  glob,
int  sector 
)
inline

Definition at line 184 of file TrackTools.h.

References create_public_lumi_plots::loc, and range_phi_deg().

Referenced by calc_phi_loc_int(), and calc_phi_loc_int_rpc().

184  { // glob in deg, sector [1-6]
185  glob = range_phi_deg(glob); // put phi in [-180,180] range
186  double loc = glob - 15. - (60. * (sector-1));
187  return loc;
188  }
double range_phi_deg(double deg)
Definition: TrackTools.h:21
int emtf::calc_phi_loc_int ( double  glob,
int  sector 
)
inline

Definition at line 190 of file TrackTools.h.

References calc_phi_loc_deg_from_glob(), and create_public_lumi_plots::loc.

Referenced by PrimitiveConversion::convert_gem().

190  { // glob in deg, sector [1-6]
191  double loc = calc_phi_loc_deg_from_glob(glob, sector);
192  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
193  loc = (loc + 22.) * 60.;
194  int phi_int = static_cast<int>(std::round(loc));
195  return phi_int;
196  }
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:184
int emtf::calc_phi_loc_int_rpc ( double  glob,
int  sector 
)
inline

Definition at line 198 of file TrackTools.h.

References calc_phi_loc_deg_from_glob(), and create_public_lumi_plots::loc.

Referenced by PrimitiveConversion::convert_rpc().

198  { // glob in deg, sector [1-6]
199  double loc = calc_phi_loc_deg_from_glob(glob, sector);
200  loc = ((loc + 22.) < 0.) ? loc + 360. : loc;
201  loc = (loc + 22.) * 60./4.; // 4x coarser resolution
202  int phi_int = static_cast<int>(std::round(loc));
203  return phi_int;
204  }
double calc_phi_loc_deg_from_glob(double glob, int sector)
Definition: TrackTools.h:184
double emtf::calc_phi_loc_rad ( int  bits)
inline

Definition at line 169 of file TrackTools.h.

References calc_phi_loc_deg(), and deg_to_rad().

169  {
171  }
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
double calc_phi_loc_deg(int bits)
Definition: TrackTools.h:163
double deg_to_rad(double deg)
Definition: TrackTools.h:49
double emtf::calc_pt ( int  bits)
inline

Definition at line 61 of file TrackTools.h.

References bits, and EnergyCorrector::pt.

61  {
62  double pt = static_cast<double>(bits);
63  pt = 0.5 * (pt - 1);
64  return pt;
65  }
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
int emtf::calc_pt_GMT ( double  val)
inline

Definition at line 67 of file TrackTools.h.

67  {
68  val = (val * 2) + 1;
69  int gmt_pt = static_cast<int>(std::round(val));
70  gmt_pt = (gmt_pt > 511) ? 511 : gmt_pt;
71  return gmt_pt;
72  }
int emtf::calc_ring ( int  station,
int  csc_ID,
int  strip 
)

Definition at line 5 of file TrackTools.cc.

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

5  {
6  if (station > 1) {
7  if (csc_ID < 4) return 1;
8  else if (csc_ID < 10) return 2;
9  else return -999;
10  }
11  else if (station == 1) {
12  if (csc_ID < 4 && strip > 127) return 4;
13  else if (csc_ID < 4 && strip >= 0) return 1;
14  else if (csc_ID > 3 && csc_ID < 7) return 2;
15  else if (csc_ID > 6 && csc_ID < 10) return 3;
16  else return -999;
17  }
18  else return -999;
19 }
double emtf::calc_theta_deg ( double  eta)
inline

Definition at line 124 of file TrackTools.h.

References calc_theta_rad(), and rad_to_deg().

124  {
125  return rad_to_deg(calc_theta_rad(eta));
126  }
double calc_theta_rad(double eta)
Definition: TrackTools.h:119
double rad_to_deg(double rad)
Definition: TrackTools.h:54
double emtf::calc_theta_deg_from_eta ( double  eta)
inline

Definition at line 147 of file TrackTools.h.

References calc_theta_rad_from_eta(), and rad_to_deg().

147  {
149  }
double calc_theta_rad_from_eta(double eta)
Definition: TrackTools.h:142
double rad_to_deg(double rad)
Definition: TrackTools.h:54
double emtf::calc_theta_deg_from_int ( int  theta_int)
inline

Definition at line 109 of file TrackTools.h.

References theta().

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

109  {
110  double theta = static_cast<double>(theta_int);
111  theta = theta * (45.0-8.5)/128. + 8.5;
112  return theta;
113  }
Geom::Theta< T > theta() const
int emtf::calc_theta_int ( double  theta,
int  endcap 
)
inline

Definition at line 128 of file TrackTools.h.

References theta().

Referenced by PrimitiveConversion::convert_gem().

128  { // theta in deg, endcap [-1,+1]
129  theta = (endcap == -1) ? (180. - theta) : theta;
130  theta = (theta - 8.5) * 128./(45.0-8.5);
131  int theta_int = static_cast<int>(std::round(theta));
132  return theta_int;
133  }
Geom::Theta< T > theta() const
int emtf::calc_theta_int_rpc ( double  theta,
int  endcap 
)
inline

Definition at line 135 of file TrackTools.h.

References theta().

Referenced by PrimitiveConversion::convert_rpc().

135  { // theta in deg, endcap [-1,+1]
136  theta = (endcap == -1) ? (180. - theta) : theta;
137  theta = (theta - 8.5) * (128./4.)/(45.0-8.5); // 4x coarser resolution
138  int theta_int = static_cast<int>(std::round(theta));
139  return theta_int;
140  }
Geom::Theta< T > theta() const
double emtf::calc_theta_rad ( double  eta)
inline

Definition at line 119 of file TrackTools.h.

References JetChargeProducer_cfi::exp.

Referenced by calc_theta_deg().

119  {
120  double theta_rad = 2. * std::atan(std::exp(-1.*eta));
121  return theta_rad;
122  }
double emtf::calc_theta_rad_from_eta ( double  eta)
inline

Definition at line 142 of file TrackTools.h.

References theta().

Referenced by calc_theta_deg_from_eta().

142  {
143  double theta = std::atan2(1.0, std::sinh(eta)); // cot(theta) = sinh(eta)
144  return theta;
145  }
Geom::Theta< T > theta() const
double emtf::calc_theta_rad_from_int ( int  theta_int)
inline

Definition at line 115 of file TrackTools.h.

References calc_theta_deg_from_int(), and deg_to_rad().

115  {
116  return deg_to_rad(calc_theta_deg_from_int(theta_int));
117  }
double calc_theta_deg_from_int(int theta_int)
Definition: TrackTools.h:109
double deg_to_rad(double deg)
Definition: TrackTools.h:49
int emtf::calc_uGMT_chamber ( int  csc_ID,
int  subsector,
int  neighbor,
int  station 
)

Definition at line 42 of file TrackTools.cc.

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

42  {
43  if (station == 1) {
44  if (csc_ID == 3 && neighbor == 1 && subsector == 2) return 1;
45  else if (csc_ID == 6 && neighbor == 1 && subsector == 2) return 2;
46  else if (csc_ID == 9 && neighbor == 1 && subsector == 2) return 3;
47  else if (csc_ID == 3 && neighbor == 0 && subsector == 2) return 4;
48  else if (csc_ID == 6 && neighbor == 0 && subsector == 2) return 5;
49  else if (csc_ID == 9 && neighbor == 0 && subsector == 2) return 6;
50  else return 0;
51  }
52  else {
53  if (csc_ID == 3 && neighbor == 1) return 1;
54  else if (csc_ID == 9 && neighbor == 1) return 2;
55  else if (csc_ID == 3 && neighbor == 0) return 3;
56  else if (csc_ID == 9 && neighbor == 0) return 4;
57  else return 0;
58  }
59 }
template<typename T = void>
EMTFGEMDetId emtf::construct_EMTFGEMDetId ( const L1TMuon::TriggerPrimitive tp)
double emtf::deg_to_rad ( double  deg)
inline

Definition at line 49 of file TrackTools.h.

References constexpr, 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().

49  {
50  constexpr double factor = M_PI/180.;
51  return deg * factor;
52  }
#define constexpr
#define M_PI
void emtf::mergeNtuples ( const char *  ntuplename,
const char *  filestomerge,
const char *  outputfile 
)

Definition at line 90 of file Utilities.cc.

Referenced by numToStr().

91 {
92  TChain chain(ntuplename);
93  chain.Add(filestomerge);
94  chain.Merge(outputfile);
95 }
Definition: chain.py:1
template<typename T >
std::string emtf::numToStr ( T  num)

Definition at line 44 of file Utilities.h.

References mergeNtuples(), pileupDistInMC::num, estimatePileup_makeJSON::outputfile, processPrediction(), alignCSCRings::s, sortNtupleByEvent(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

45 {
46 // Convert a number to a string.
47  std::stringstream ss;
48  ss << num;
49  std::string s = ss.str();
50  return s;
51 };
float emtf::processPrediction ( float  BDTPt,
int  Quality,
float  PrelimFit 
)

Definition at line 50 of file Utilities.cc.

References RPCpg::pts, and ptscale.

Referenced by numToStr().

51 {
52 // Discretize and scale the BDTPt prediction
53 
54 
55  // Fix terrible predictions
56  if(BDTPt < 0) BDTPt = PrelimFit;
57  if(BDTPt > 250) BDTPt = PrelimFit;
58 
59  float BDTPt1 = BDTPt;
60  float scaleF = 1.0;
61 
62  // Scale based upon quality
63  if (Quality == 3) scaleF = 1.15;
64  if (Quality == 2) scaleF = 1.3;
65  if (Quality == 1) scaleF = 1.7;
66 
67  BDTPt1 = scaleF*BDTPt1;
68 
69 
70  // Discretize based upon ptscale
71  for (int pts=0; pts<31; pts++)
72  {
73  if (ptscale[pts]<=BDTPt1 && ptscale[pts+1]>BDTPt1)
74  {
75  BDTPt1 = ptscale[pts];
76  break;
77  }
78  }
79 
80  if (BDTPt1 > 140) BDTPt1 = 140;
81  if (BDTPt1 < 0) BDTPt1 = 0;
82 
83  return BDTPt1;
84 }
static const double pts[33]
Definition: Constants.h:30
const double ptscale[31]
Definition: Utilities.cc:29
double emtf::rad_to_deg ( double  rad)
inline
double emtf::range_phi_deg ( double  deg)
inline

Definition at line 21 of file TrackTools.h.

Referenced by calc_phi_GMT_int(), and calc_phi_loc_deg_from_glob().

21  {
22  while (deg < -180.) deg += 360.;
23  while (deg >= +180.) deg -= 360.;
24  return deg;
25  }
double emtf::range_phi_rad ( double  rad)
inline

Definition at line 27 of file TrackTools.h.

References M_PI.

27  {
28  while (rad < -M_PI) rad += 2.*M_PI;
29  while (rad >= +M_PI) rad -= 2.*M_PI;
30  return rad;
31  }
#define M_PI
double emtf::range_theta_deg ( double  deg)
inline

Definition at line 33 of file TrackTools.h.

Referenced by calc_eta_from_theta_deg().

33  {
34  deg = fabs(deg);
35  while (deg >= 180.) deg -= 180.;
36  if (deg >= 180./2.) deg = 180. - deg;
37  return deg;
38  }
double emtf::range_theta_rad ( double  rad)
inline

Definition at line 40 of file TrackTools.h.

References M_PI.

40  {
41  rad = fabs(rad);
42  while (rad >= M_PI) rad -= M_PI;
43  if (rad >= M_PI/2.) rad = M_PI - rad;
44  return rad;
45  }
#define M_PI
template<class bidiiter >
bidiiter emtf::shuffle ( bidiiter  begin,
bidiiter  end,
size_t  num_random 
)

Definition at line 27 of file Utilities.h.

References begin, SoftLeptonByDistance_cfi::distance, alignCSCRings::r, rand(), and std::swap().

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

28 {
29 // We will end up with the same elements in the collection except that
30 // the first num_random elements will be randomized.
31 
32  size_t left = std::distance(begin, end);
33  while (num_random--) {
34  bidiiter r = begin;
35  std::advance(r, rand()%left);
36  std::swap(*begin, *r);
37  ++begin;
38  --left;
39  }
40  return begin;
41 }
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
Signal rand(Signal arg)
Definition: vlib.cc:442
void emtf::sort_uGMT_muons ( l1t::RegionalMuonCandBxCollection cands)

Definition at line 118 of file MicroGMTConverter.cc.

References BXVector< T >::begin(), l1t::emtf_neg, BXVector< T >::end(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), simTrackMatching_cfi::maxBX, simTrackMatching_cfi::minBX, proc, and std::swap().

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

120  {
121 
122  int minBX = cands.getFirstBX();
123  int maxBX = cands.getLastBX();
124  int emtfMinProc = 0; // ME+ sector 1
125  int emtfMaxProc = 11; // ME- sector 6
126 
127  // New collection, sorted by processor to match uGMT unpacked order
128  auto sortedCands = std::make_unique<l1t::RegionalMuonCandBxCollection>();
129  sortedCands->clear();
130  sortedCands->setBXRange(minBX, maxBX);
131  for (int iBX = minBX; iBX <= maxBX; ++iBX) {
132  for (int proc = emtfMinProc; proc <= emtfMaxProc; proc++) {
133  for (l1t::RegionalMuonCandBxCollection::const_iterator cand = cands.begin(iBX); cand != cands.end(iBX); ++cand) {
134  int cand_proc = cand->processor();
135  if (cand->trackFinderType() == l1t::tftype::emtf_neg) cand_proc += 6;
136  if (cand_proc != proc) continue;
137  sortedCands->push_back(iBX, *cand);
138  }
139  }
140  }
141 
142  // Return sorted collection
143  std::swap(cands, *sortedCands);
144  sortedCands.reset();
145 }
const_iterator end(int bx) const
TrainProcessor *const proc
Definition: MVATrainer.cc:101
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
int getFirstBX() const
int getLastBX() const
const_iterator begin(int bx) const
std::vector< RegionalMuonCand >::const_iterator const_iterator
Definition: BXVector.h:20
void emtf::sortNtupleByEvent ( const char *  ntuplename,
const char *  filenametosort,
const char *  outputfile 
)

Definition at line 101 of file Utilities.cc.

References f, connectstrParser::f2, mps_fire::i, and createfilelist::int.

Referenced by numToStr().

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

Variable Documentation

int emtf::MAX_ENDCAP = 2
int emtf::MAX_TRIGSECTOR = 6
int emtf::MIN_ENDCAP = 1
int emtf::MIN_TRIGSECTOR = 1
int emtf::NUM_SECTORS = 12

Definition at line 64 of file Common.h.

int emtf::NUM_STATION_PAIRS = 6

Definition at line 72 of file Common.h.

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

int emtf::NUM_STATIONS = 4
int emtf::NUM_ZONE_HITS = 160

Definition at line 68 of file Common.h.

Referenced by PatternRecognition::process_single_zone().

int emtf::NUM_ZONES = 4
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().

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

Definition at line 35 of file Utilities.cc.

Referenced by CSCTFPtLUT::CSCTFPtLUT(), and CSCTFTrackProducer::produce().

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 38 of file Utilities.cc.

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

Definition at line 42 of file Utilities.cc.