CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
trklet::TrackletLUT Class Reference

#include <TrackletLUT.h>

Public Types

enum  MatchType {
  barrelphi, barrelz, disk2Sphi, disk2Sr,
  diskPSphi, diskPSr, alphainner, alphaouter,
  rSSinner, rSSouter
}
 
enum  VMRTableType {
  me, disk, inner, inneroverlap,
  innerthird
}
 

Public Member Functions

void initBendMatch (unsigned int layerdisk)
 
void initmatchcut (unsigned int layerdisk, MatchType type, unsigned int region)
 
void initPhiCorrTable (unsigned int layerdisk, unsigned int rbits)
 
void initProjectionBend (double k_phider, unsigned int idisk, unsigned int nrbits, unsigned int nphiderbits)
 
void initProjectionDiskRadius (int nrbits)
 
void initteptlut (bool fillInner, bool fillTEMem, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int innerphibits, unsigned int outerphibits, double innerphimin, double innerphimax, double outerphimin, double outerphimax, const std::string &innermem, const std::string &outermem)
 
void initTPlut (bool fillInner, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int nbitsfinephidiff, unsigned int iTP)
 
void initTPregionlut (unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int iAllStub, unsigned int nbitsfinephidiff, unsigned int nbitsfinephi, const TrackletLUT &tplutinner, unsigned int iTP)
 
void initVMRTable (unsigned int layerdisk, VMRTableType type, int region=-1)
 
int lookup (unsigned int index) const
 
TrackletLUToperator= (const TrackletLUT &other)
 
unsigned int size () const
 
 TrackletLUT (const Settings &settings)
 
void writeTable () const
 
 ~TrackletLUT ()=default
 

Private Member Functions

std::vector< std::array< double, 2 > > getBendCut (unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
 
int getphiCorrValue (unsigned int layerdisk, double bend, unsigned int irbin, double rmean, double dr, double drmax) const
 
std::vector< const tt::SensorModule * > getSensorModules (unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
 
std::array< double, 2 > getTanRange (const std::vector< const tt::SensorModule *> &sensorModules)
 
int getVMRLookup (unsigned int layerdisk, double z, double r, double dz, double dr, int iseed=-1) const
 

Private Attributes

std::string name_
 
unsigned int nbits_
 
bool positive_
 
const Settingssettings_
 
const tt::Setupsetup_
 
std::vector< int > table_
 

Detailed Description

Definition at line 26 of file TrackletLUT.h.

Member Enumeration Documentation

◆ MatchType

Enumerator
barrelphi 
barrelz 
disk2Sphi 
disk2Sr 
diskPSphi 
diskPSr 
alphainner 
alphaouter 
rSSinner 
rSSouter 

Definition at line 41 of file TrackletLUT.h.

41  {
42  barrelphi, // write LUT for barrel phi
43  barrelz, // write LUT for barrel z
44  disk2Sphi, // write LUT for disk 2S phi
45  disk2Sr, // write LUT for disk 2S r
46  diskPSphi, // write LUT for disk PS phi
47  diskPSr, // write LUT for disk PS r
48  alphainner, // write alpha corrections LUT for 2S (inner)
49  alphaouter, // write alpha corrections LUT for 2S (outer)
50  rSSinner, // write r LUT for 2S (inner)
51  rSSouter // write r LUT for 2S (inner)
52  };

◆ VMRTableType

Constructor & Destructor Documentation

◆ TrackletLUT()

TrackletLUT::TrackletLUT ( const Settings settings)

Definition at line 12 of file TrackletLUT.cc.

13  : settings_(settings), setup_(settings.setup()), nbits_(0), positive_(true) {}
const tt::Setup * setup() const
Definition: Settings.h:72
const Settings & settings_
Definition: TrackletLUT.h:120
unsigned int nbits_
Definition: TrackletLUT.h:146
const tt::Setup * setup_
Definition: TrackletLUT.h:121

◆ ~TrackletLUT()

trklet::TrackletLUT::~TrackletLUT ( )
default

Member Function Documentation

◆ getBendCut()

std::vector< std::array< double, 2 > > TrackletLUT::getBendCut ( unsigned int  layerdisk,
const std::vector< const tt::SensorModule *> &  sensorModules,
bool  isPS,
double  FEbendcut = 0 
)
private

Definition at line 116 of file TrackletLUT.cc.

References funct::abs(), trklet::convertFEBend(), TkAlMuonSelectors_cfi::cut, TTStubAlgorithm_official< T >::degradeBend(), HLT_2024v13_cff::distance, tt::Setup::encodingBend(), spr::find(), mps_fire::i, trklet::N_LAYER, trklet::Settings::sensorSpacing2S(), settings_, setup_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm(), tt::Setup::stubAlgorithm(), and svgfig::window().

Referenced by initBendMatch(), initPhiCorrTable(), initteptlut(), and initTPlut().

119  {
120  //Finds range of bendstrip for given SensorModules as a function of the encoded bend. Returns in format (mid, half_range).
121  //This uses the stub windows provided by T. Schuh's SensorModule class to determine the bend encoding. TODO test changes in stub windows
122  //Any other change to the bend encoding requires changes here, perhaps a function that given (FEbend, isPS, stub window) and outputs an encoded bend
123  //would be useful for consistency.
124 
125  unsigned int bendbits = isPS ? 3 : 4;
126 
127  std::vector<std::array<double, 2>> bendpars; // mid, cut
128  std::vector<std::array<double, 2>> bendminmax; // min, max
129 
130  //Initialize array
131  for (int i = 0; i < 1 << bendbits; i++) {
132  bendpars.push_back({{99, 0}});
133  bendminmax.push_back({{99, -99}});
134  }
135 
136  //Loop over modules
137  for (auto sm : sensorModules) {
138  int window = sm->windowSize(); //Half-strip units
139  const vector<double>& encodingBend = setup_->encodingBend(window, isPS);
140 
141  //Loop over FEbends
142  for (int ibend = 0; ibend <= 2 * window; ibend++) {
143  int FEbend = ibend - window; //Half-strip units
144  double BEbend = setup_->stubAlgorithm()->degradeBend(isPS, window, FEbend); //Full strip units
145 
146  const auto pos = std::find(encodingBend.begin(), encodingBend.end(), std::abs(BEbend));
147  int bend = std::signbit(BEbend) ? (1 << bendbits) - distance(encodingBend.begin(), pos)
148  : distance(encodingBend.begin(), pos); //Encoded bend
149 
150  double bendmin = FEbend / 2.0 - FEbendcut; //Full Strip units
151  double bendmax = FEbend / 2.0 + FEbendcut;
152 
153  //Convert to bendstrip, calculate at module edges (z min, r max) and (z max, r min)
154  double z_mod[2];
155  double r_mod[2];
156 
157  z_mod[0] = std::abs(sm->z()) + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z max
158  z_mod[1] = std::abs(sm->z()) - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z min
159 
160  r_mod[0] = sm->r() - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r min
161  r_mod[1] = sm->r() + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r max
162 
163  for (int i = 0; i < 2; i++) { // 2 points to cover range in tan(theta) = z/r
164  double CF = std::abs(sm->sinTilt()) * (z_mod[i] / r_mod[i]) + sm->cosTilt();
165 
166  double cbendmin =
167  convertFEBend(bendmin, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
168  double cbendmax =
169  convertFEBend(bendmax, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
170 
171  if (cbendmin < bendminmax[bend][0])
172  bendminmax.at(bend)[0] = cbendmin;
173  if (cbendmax > bendminmax[bend][1])
174  bendminmax.at(bend)[1] = cbendmax;
175  }
176  }
177  }
178  //Convert min, max to mid, cut for ease of use
179  for (int i = 0; i < 1 << bendbits; i++) {
180  double mid = (bendminmax[i][1] + bendminmax[i][0]) / 2;
181  double cut = (bendminmax[i][1] - bendminmax[i][0]) / 2;
182 
183  bendpars[i][0] = mid;
184  bendpars[i][1] = cut;
185  }
186 
187  return bendpars;
188 }
double sensorSpacing2S() const
Definition: Settings.h:288
const Settings & settings_
Definition: TrackletLUT.h:120
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< double > & encodingBend(int windowSize, bool psModule) const
Definition: Setup.cc:377
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float degradeBend(bool psModule, int window, int bend) const
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
double convertFEBend(double FEbend, double sensorSep, double sensorSpacing, double CF, bool barrel, double r=0)
Definition: Util.h:48
const StubAlgorithmOfficial * stubAlgorithm() const
Definition: Setup.h:525
const tt::Setup * setup_
Definition: TrackletLUT.h:121
constexpr int N_LAYER
Definition: Settings.h:25

◆ getphiCorrValue()

int TrackletLUT::getphiCorrValue ( unsigned int  layerdisk,
double  bend,
unsigned int  irbin,
double  rmean,
double  dr,
double  drmax 
) const
private

Definition at line 1380 of file TrackletLUT.cc.

References trklet::Settings::kphi(), trklet::Settings::kphi1(), trklet::N_PSLAYER, settings_, and trklet::Settings::stripPitch().

Referenced by initPhiCorrTable().

1381  {
1382  bool psmodule = layerdisk < N_PSLAYER;
1383 
1384  //for the rbin - calculate the distance to the nominal layer radius
1385  double Delta = (irbin + 0.5) * dr - drmax;
1386 
1387  //calculate the phi correction - this is a somewhat approximate formula
1388  double drnom = 0.18; //This is the nominal module separation for which bend is referenced
1389  double dphi = (Delta / drnom) * bend * settings_.stripPitch(psmodule) / rmean;
1390 
1391  double kphi = psmodule ? settings_.kphi() : settings_.kphi1();
1392 
1393  int idphi = dphi / kphi;
1394 
1395  return idphi;
1396 }
double kphi1() const
Definition: Settings.h:339
const Settings & settings_
Definition: TrackletLUT.h:120
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double kphi() const
Definition: Settings.h:338

◆ getSensorModules()

std::vector< const tt::SensorModule * > TrackletLUT::getSensorModules ( unsigned int  layerdisk,
bool  isPS,
std::array< double, 2 >  tan_range = {{-1, -1}},
unsigned int  nzbins = 1,
unsigned int  zbin = 0 
)
private

Definition at line 15 of file TrackletLUT.cc.

References funct::abs(), cms::cuda::assert(), Reference_intrackfit_cff::barrel, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), dumpMFGeometry_cfg::delta, Exception, trklet::N_LAYER, tt::SensorModule::r(), tt::Setup::sensorModules(), settings_, setup_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm(), trklet::tan_theta(), tier0::unique(), tt::SensorModule::z(), trklet::Settings::z0cut(), SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by initBendMatch(), initPhiCorrTable(), initteptlut(), and initTPlut().

16  {
17  //Returns a vector of SensorModules using T. Schuh's Setup and SensorModule classes.
18  //Can be used 3 ways:
19  //Default: No specified tan_range or nzbins, returns all SensorModules in specified layerdisk (unique in |z|)
20  //tan_range: Returns modules in given tan range, where the min and max tan(theta) are measured from 0 -/+ z0 to account for displaced tracks
21  //zbins: Returns modules in specified z bin (2 zbins = (Flat, Tilted), 13 zbins = (Flat, TR1, ..., TR12). Only for tilted barrel
22 
23  bool use_tan_range = !(tan_range[0] == -1 and tan_range[1] == -1);
24  bool use_zbins = (nzbins > 1);
25 
26  bool barrel = layerdisk < N_LAYER;
27 
28  int layerId = barrel ? layerdisk + 1 : layerdisk + N_LAYER - 1;
29 
30  std::vector<const tt::SensorModule*> sensorModules;
31 
32  double z0 = settings_.z0cut();
33 
34  for (auto& sm : setup_->sensorModules()) {
35  if (sm.layerId() != layerId || sm.z() < 0 || sm.psModule() != isPS) {
36  continue;
37  }
38 
39  if (use_tan_range) {
40  const double term = (sm.numColumns() / 2 - 0.5) * sm.pitchCol();
41  double rmin = sm.r() - term * std::abs(sm.sinTilt());
42  double rmax = sm.r() + term * std::abs(sm.sinTilt());
43 
44  double zmin = std::abs(sm.z()) - term * std::abs(sm.cosTilt());
45  double zmax = std::abs(sm.z()) + term * std::abs(sm.cosTilt());
46 
47  //z0_max is swapped here so that the comparison down 5 lines is from same origin (+/- z0)
48  double mod_tan_max = tan_theta(rmin, zmax, z0, false);
49  double mod_tan_min = tan_theta(rmax, zmin, z0, true);
50 
51  if (mod_tan_max >= tan_range[0] && mod_tan_min <= tan_range[1]) {
52  sensorModules.push_back(&sm);
53  }
54  } else if (use_zbins) {
55  assert(layerdisk < 3);
56 
57  if (nzbins == 2) {
58  bool useFlat = (zbin == 0);
59  bool isFlat = (sm.tilt() == 0);
60 
61  if (useFlat and isFlat)
62  sensorModules.push_back(&sm);
63  else if (!useFlat and !isFlat)
64  sensorModules.push_back(&sm);
65  } else if (nzbins == 13) {
66  if (sm.ringId(setup_) == zbin)
67  sensorModules.push_back(&sm);
68  } else {
69  throw cms::Exception("Unspecified number of z bins");
70  }
71  } else {
72  sensorModules.push_back(&sm);
73  }
74  }
75 
76  //Remove Duplicate Modules
77  static constexpr double delta = 1.e-3;
78  auto smallerR = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) { return lhs->r() < rhs->r(); };
79  auto smallerZ = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) { return lhs->z() < rhs->z(); };
80  auto equalRZ = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) {
81  return abs(lhs->r() - rhs->r()) < delta && abs(lhs->z() - rhs->z()) < delta;
82  };
83  stable_sort(sensorModules.begin(), sensorModules.end(), smallerR);
84  stable_sort(sensorModules.begin(), sensorModules.end(), smallerZ);
85  sensorModules.erase(unique(sensorModules.begin(), sensorModules.end(), equalRZ), sensorModules.end());
86 
87  return sensorModules;
88 }
const Settings & settings_
Definition: TrackletLUT.h:120
assert(be >=bs)
const std::vector< SensorModule > & sensorModules() const
Definition: Setup.h:126
def unique(seq, keepstr=True)
Definition: tier0.py:24
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double r() const
Definition: SensorModule.h:45
double tan_theta(double r, double z, double z0, bool z0_max)
Definition: Util.h:54
double z0cut() const
Definition: Settings.h:364
double z() const
Definition: SensorModule.h:49
const tt::Setup * setup_
Definition: TrackletLUT.h:121
constexpr int N_LAYER
Definition: Settings.h:25

◆ getTanRange()

std::array< double, 2 > TrackletLUT::getTanRange ( const std::vector< const tt::SensorModule *> &  sensorModules)
private

Definition at line 90 of file TrackletLUT.cc.

References funct::abs(), settings_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm(), trklet::tan_theta(), trklet::Settings::z0cut(), SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by initteptlut(), and initTPlut().

90  {
91  //Given a set of modules returns a range in tan(theta), the angle is measured in the r-z(+/-z0) plane from the r-axis
92 
93  std::array<double, 2> tan_range = {{2147483647, 0}}; //(tan_min, tan_max)
94 
95  double z0 = settings_.z0cut();
96 
97  for (auto sm : sensorModules) {
98  const double term = (sm->numColumns() / 2 - 0.5) * sm->pitchCol();
99  double rmin = sm->r() - term * std::abs(sm->sinTilt());
100  double rmax = sm->r() + term * std::abs(sm->sinTilt());
101 
102  double zmin = std::abs(sm->z()) - term * sm->cosTilt();
103  double zmax = std::abs(sm->z()) + term * sm->cosTilt();
104 
105  double mod_tan_max = tan_theta(rmin, zmax, z0, true); //(r, z, z0, bool z0_max), z0_max measures from +/- z0
106  double mod_tan_min = tan_theta(rmax, zmin, z0, false);
107 
108  if (mod_tan_min < tan_range[0])
109  tan_range[0] = mod_tan_min;
110  if (mod_tan_max > tan_range[1])
111  tan_range[1] = mod_tan_max;
112  }
113  return tan_range;
114 }
const Settings & settings_
Definition: TrackletLUT.h:120
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double tan_theta(double r, double z, double z0, bool z0_max)
Definition: Util.h:54
double z0cut() const
Definition: Settings.h:364

◆ getVMRLookup()

int TrackletLUT::getVMRLookup ( unsigned int  layerdisk,
double  z,
double  r,
double  dz,
double  dr,
int  iseed = -1 
) const
private

Definition at line 1183 of file TrackletLUT.cc.

References funct::abs(), cms::cuda::assert(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), PVValHelper::dz, iseed, trklet::L1D1, trklet::L2D1, trklet::L2L3, trklet::L2L3D1, SiStripPI::max, SiStripPI::min, trklet::N_LAYER, NBINS, trklet::Settings::NLONGVMBINS(), hltL1SingleMuFiltered5_cfi::overlap, diffTwoXMLs::r2, trklet::Settings::rmaxdisk(), trklet::Settings::rmaxdiskl1overlapvm(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), trklet::Settings::rmindiskl2overlapvm(), trklet::Settings::rmindiskvm(), settings_, relativeConstraints::value, ALPAKA_ACCELERATOR_NAMESPACE::caPixelDoublets::z0cut, trklet::Settings::z0cut(), testProducerWithPsetDescEmpty_cfi::z2, trklet::Settings::zlength(), SiStripMonitorCluster_cfi::zmax, trklet::Settings::zmean(), and SiStripMonitorCluster_cfi::zmin.

Referenced by initVMRTable().

1183  {
1184  double z0cut = settings_.z0cut();
1185 
1186  if (layerdisk < N_LAYER) {
1187  double constexpr zcutL2L3 = 52.0; //Stubs closer to IP in z will not be used for L2L3 seeds
1188  if (iseed == Seed::L2L3 && std::abs(z) < zcutL2L3)
1189  return -1;
1190 
1191  double rmean = settings_.rmean(layerdisk);
1192 
1193  double rratio1 = rmean / (r + 0.5 * dr);
1194  double rratio2 = rmean / (r - 0.5 * dr);
1195 
1196  double z1 = (z - 0.5 * dz) * rratio1 + z0cut * (rratio1 - 1.0);
1197  double z2 = (z + 0.5 * dz) * rratio1 + z0cut * (rratio1 - 1.0);
1198  double z3 = (z - 0.5 * dz) * rratio2 + z0cut * (rratio2 - 1.0);
1199  double z4 = (z + 0.5 * dz) * rratio2 + z0cut * (rratio2 - 1.0);
1200  double z5 = (z - 0.5 * dz) * rratio1 - z0cut * (rratio1 - 1.0);
1201  double z6 = (z + 0.5 * dz) * rratio1 - z0cut * (rratio1 - 1.0);
1202  double z7 = (z - 0.5 * dz) * rratio2 - z0cut * (rratio2 - 1.0);
1203  double z8 = (z + 0.5 * dz) * rratio2 - z0cut * (rratio2 - 1.0);
1204 
1205  double zmin = std::min({z1, z2, z3, z4, z5, z6, z7, z8});
1206  double zmax = std::max({z1, z2, z3, z4, z5, z6, z7, z8});
1207 
1209 
1210  int zbin1 = NBINS * (zmin + settings_.zlength()) / (2 * settings_.zlength());
1211  int zbin2 = NBINS * (zmax + settings_.zlength()) / (2 * settings_.zlength());
1212 
1213  if (zbin1 >= NBINS)
1214  return -1;
1215  if (zbin2 < 0)
1216  return -1;
1217 
1218  if (zbin2 >= NBINS)
1219  zbin2 = NBINS - 1;
1220  if (zbin1 < 0)
1221  zbin1 = 0;
1222 
1223  // This is a 10 bit word:
1224  // xxx|yyy|z|rrr
1225  // xxx is the delta z window
1226  // yyy is the z bin
1227  // z is flag to look in next bin
1228  // rrr first fine z bin
1229  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
1230  // and xxx is only 1,2, or 3
1231  // should also reject xxx=0 as this means projection is outside range
1232 
1233  int value = zbin1 / 8;
1234  value *= 2;
1235  if (zbin2 / 8 - zbin1 / 8 > 0)
1236  value += 1;
1237  value *= 8;
1238  value += (zbin1 & 7);
1239  assert(value / 8 < 15);
1240  int deltaz = zbin2 - zbin1;
1241  if (deltaz > 7) {
1242  deltaz = 7;
1243  }
1244  assert(deltaz < 8);
1245  value += (deltaz << 7);
1246 
1247  return value;
1248 
1249  } else {
1250  if (std::abs(z) < 2.0 * z0cut)
1251  return -1;
1252 
1253  double zmean = settings_.zmean(layerdisk - N_LAYER);
1254  if (z < 0.0)
1255  zmean = -zmean;
1256 
1257  double r1 = (r + 0.5 * dr) * (zmean + z0cut) / (z + 0.5 * dz + z0cut);
1258  double r2 = (r - 0.5 * dr) * (zmean - z0cut) / (z + 0.5 * dz - z0cut);
1259  double r3 = (r + 0.5 * dr) * (zmean + z0cut) / (z - 0.5 * dz + z0cut);
1260  double r4 = (r - 0.5 * dr) * (zmean - z0cut) / (z - 0.5 * dz - z0cut);
1261  double r5 = (r + 0.5 * dr) * (zmean - z0cut) / (z + 0.5 * dz - z0cut);
1262  double r6 = (r - 0.5 * dr) * (zmean + z0cut) / (z + 0.5 * dz + z0cut);
1263  double r7 = (r + 0.5 * dr) * (zmean - z0cut) / (z - 0.5 * dz - z0cut);
1264  double r8 = (r - 0.5 * dr) * (zmean + z0cut) / (z - 0.5 * dz + z0cut);
1265 
1266  double rmin = std::min({r1, r2, r3, r4, r5, r6, r7, r8});
1267  double rmax = std::max({r1, r2, r3, r4, r5, r6, r7, r8});
1268 
1270 
1271  double rmindisk = settings_.rmindiskvm();
1272  double rmaxdisk = settings_.rmaxdiskvm();
1273 
1274  if (iseed == Seed::L1D1)
1275  rmaxdisk = settings_.rmaxdiskl1overlapvm();
1276  if (iseed == Seed::L2D1)
1277  rmindisk = settings_.rmindiskl2overlapvm();
1278  if (iseed == Seed::L2L3D1)
1279  rmaxdisk = settings_.rmaxdisk();
1280 
1281  if (rmin > rmaxdisk)
1282  return -1;
1283  if (rmax > rmaxdisk)
1284  rmax = rmaxdisk;
1285 
1286  if (rmax < rmindisk)
1287  return -1;
1288  if (rmin < rmindisk)
1289  rmin = rmindisk;
1290 
1291  int rbin1 = NBINS * (rmin - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1292  int rbin2 = NBINS * (rmax - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1293 
1294  if (iseed == Seed::L2L3D1) {
1295  constexpr double rminspec = 40.0;
1296  rbin1 = NBINS * (rmin - rminspec) / (settings_.rmaxdisk() - rminspec);
1297  rbin2 = NBINS * (rmax - rminspec) / (settings_.rmaxdisk() - rminspec);
1298  }
1299 
1300  if (rbin2 >= NBINS)
1301  rbin2 = NBINS - 1;
1302  if (rbin1 < 0)
1303  rbin1 = 0;
1304 
1305  // This is a 9 bit word:
1306  // xxx|yy|z|rrr
1307  // xxx is the delta r window
1308  // yy is the r bin yy is three bits for overlaps
1309  // z is flag to look in next bin
1310  // rrr fine r bin
1311  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
1312  // and xxx is only 1,2, or 3
1313  // should also reject xxx=0 as this means projection is outside range
1314 
1315  bool overlap = iseed == Seed::L1D1 || iseed == Seed::L2D1 || iseed == Seed::L2L3D1;
1316 
1317  int value = rbin1 / 8;
1318  if (overlap) {
1319  if (z < 0.0)
1320  value += 4;
1321  }
1322  value *= 2;
1323  if (rbin2 / 8 - rbin1 / 8 > 0)
1324  value += 1;
1325  value *= 8;
1326  value += (rbin1 & 7);
1327  assert(value / 8 < 15);
1328  int deltar = rbin2 - rbin1;
1329  if (deltar > 7)
1330  deltar = 7;
1331  if (overlap) {
1332  value += (deltar << 7);
1333  } else {
1334  value += (deltar << 6);
1335  }
1336 
1337  return value;
1338  }
1339 }
const Settings & settings_
Definition: TrackletLUT.h:120
double zlength() const
Definition: Settings.h:133
double rmindiskvm() const
Definition: Settings.h:355
assert(be >=bs)
unsigned int NLONGVMBINS() const
Definition: Settings.h:369
double rmindiskl2overlapvm() const
Definition: Settings.h:359
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: value.py:1
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
double z0cut() const
Definition: Settings.h:364
int iseed
Definition: AMPTWrapper.h:134
double rmaxdisk() const
Definition: Settings.h:134
Definition: deltar.py:1
double rmaxdiskvm() const
Definition: Settings.h:356
const int NBINS
constexpr int N_LAYER
Definition: Settings.h:25
double rmaxdiskl1overlapvm() const
Definition: Settings.h:358

◆ initBendMatch()

void TrackletLUT::initBendMatch ( unsigned int  layerdisk)

Definition at line 901 of file TrackletLUT.cc.

References Reference_intrackfit_cff::barrel, trklet::Settings::bendcutme(), trklet::Settings::bendcutME(), trklet::Settings::bendcutte(), trklet::Settings::benddecode(), trklet::bendstrip(), TkAlMuonSelectors_cfi::cut, getBendCut(), getSensorModules(), trklet::Settings::krinvpars(), trklet::TrackletConfigBuilder::LayerName(), trklet::N_BENDBITS_2S, trklet::N_BENDBITS_PS, trklet::N_LAYER, trklet::N_PSLAYER, name_, nbits_, trklet::Settings::nbitsrinv(), trklet::NRINVBITS, positive_, trklet::rinv(), trklet::Settings::rmean(), trklet::Settings::sensorSpacing2S(), settings_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm(), trklet::Settings::stripPitch(), table_, trklet::Settings::useCalcBendCuts, and writeTable().

Referenced by trklet::MatchEngine::MatchEngine(), and trklet::MatchProcessor::MatchProcessor().

901  {
902  unsigned int nrinv = NRINVBITS;
903  double rinvhalf = 0.5 * ((1 << nrinv) - 1);
904 
905  bool barrel = layerdisk < N_LAYER;
906 
907  if (barrel) {
908  bool isPSmodule = layerdisk < N_PSLAYER;
909  double stripPitch = settings_.stripPitch(isPSmodule);
910  unsigned int nbits = isPSmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
911 
912  std::vector<std::array<double, 2>> bend_cuts;
913 
915  double bendcutFE = settings_.bendcutME(layerdisk, isPSmodule);
916  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, isPSmodule);
917  bend_cuts = getBendCut(layerdisk, sm, isPSmodule, bendcutFE);
918 
919  } else {
920  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
921  double mid = settings_.benddecode(ibend, layerdisk, isPSmodule);
922  double cut = settings_.bendcutte(ibend, layerdisk, isPSmodule);
923  bend_cuts.push_back({{mid, cut}});
924  }
925  }
926 
927  for (unsigned int irinv = 0; irinv < (1u << nrinv); irinv++) {
928  double rinv = (irinv - rinvhalf) * (1 << (settings_.nbitsrinv() - nrinv)) * settings_.krinvpars();
929 
930  double projbend = bendstrip(settings_.rmean(layerdisk), rinv, stripPitch, settings_.sensorSpacing2S());
931  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
932  double mid = bend_cuts[ibend][0];
933  double cut = bend_cuts[ibend][1];
934 
935  double pass = mid + cut > projbend && mid - cut < projbend;
936 
937  table_.push_back(pass);
938  }
939  }
940  } else {
941  std::vector<std::array<double, 2>> bend_cuts_2S;
942  std::vector<std::array<double, 2>> bend_cuts_PS;
943 
945  double bendcutFE2S = settings_.bendcutME(layerdisk, false);
946  std::vector<const tt::SensorModule*> sm2S = getSensorModules(layerdisk, false);
947  bend_cuts_2S = getBendCut(layerdisk, sm2S, false, bendcutFE2S);
948 
949  double bendcutFEPS = settings_.bendcutME(layerdisk, true);
950  std::vector<const tt::SensorModule*> smPS = getSensorModules(layerdisk, true);
951  bend_cuts_PS = getBendCut(layerdisk, smPS, true, bendcutFEPS);
952 
953  } else {
954  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
955  double mid = settings_.benddecode(ibend, layerdisk, false);
956  double cut = settings_.bendcutme(ibend, layerdisk, false);
957  bend_cuts_2S.push_back({{mid, cut}});
958  }
959  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
960  double mid = settings_.benddecode(ibend, layerdisk, true);
961  double cut = settings_.bendcutme(ibend, layerdisk, true);
962  bend_cuts_PS.push_back({{mid, cut}});
963  }
964  }
965 
966  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) {
967  double projbend = 0.5 * (iprojbend - rinvhalf);
968  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
969  double mid = bend_cuts_2S[ibend][0];
970  double cut = bend_cuts_2S[ibend][1];
971 
972  double pass = mid + cut > projbend && mid - cut < projbend;
973 
974  table_.push_back(pass);
975  }
976  }
977  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) { //Should this be binned in r?
978  double projbend = 0.5 * (iprojbend - rinvhalf);
979  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
980  double mid = bend_cuts_PS[ibend][0];
981  double cut = bend_cuts_PS[ibend][1];
982 
983  double pass = mid + cut > projbend && mid - cut < projbend;
984 
985  table_.push_back(pass);
986  }
987  }
988  }
989 
990  positive_ = false;
991  nbits_ = 1;
992 
993  name_ = "METable_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
994 
995  writeTable();
996 }
double sensorSpacing2S() const
Definition: Settings.h:288
double bendcutME(unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:489
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:443
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
double krinvpars() const
Definition: Settings.h:425
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:479
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
int nbitsrinv() const
Definition: Settings.h:374
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
double bendcutme(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:473
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:471
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< std::array< double, 2 > > getBendCut(unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
Definition: TrackletLUT.cc:116
std::vector< int > table_
Definition: TrackletLUT.h:144
std::vector< const tt::SensorModule * > getSensorModules(unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
Definition: TrackletLUT.cc:15
void writeTable() const
double bendstrip(double r, double rinv, double stripPitch, double sensorSpacing)
Definition: Util.h:42
constexpr int N_LAYER
Definition: Settings.h:25

◆ initmatchcut()

void TrackletLUT::initmatchcut ( unsigned int  layerdisk,
MatchType  type,
unsigned int  region 
)

Definition at line 190 of file TrackletLUT.cc.

References alphainner, alphaouter, trklet::Settings::alphashift(), barrelphi, barrelz, trklet::Settings::combined(), disk2Sphi, disk2Sr, diskPSphi, diskPSr, trklet::Settings::half2SmoduleWidth(), mps_fire::i, trklet::Settings::kphi(), trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::krprojshiftdisk(), trklet::Settings::kz(), trklet::TrackletConfigBuilder::LayerName(), trklet::N_DSS_MOD, trklet::N_LAYER, trklet::N_SEED, name_, nbits_, trklet::Settings::nbitsalpha(), positive_, trklet::Settings::rcut2S(), trklet::Settings::rcutPS(), trklet::Settings::rDSSinner(), trklet::Settings::rDSSouter(), nano_mu_digi_cff::region, trklet::Settings::rmean(), trklet::Settings::rphicut2S(), trklet::Settings::rphicutPS(), trklet::Settings::rphimatchcut(), rSSinner, rSSouter, settings_, table_, writeTable(), and trklet::Settings::zmatchcut().

Referenced by trklet::MatchCalculator::MatchCalculator(), and trklet::MatchProcessor::MatchProcessor().

190  {
191  char cregion = 'A' + region;
192 
193  for (unsigned int iSeed = 0; iSeed < N_SEED; iSeed++) {
194  if (type == barrelphi) {
195  table_.push_back(settings_.rphimatchcut(iSeed, layerdisk) / (settings_.kphi1() * settings_.rmean(layerdisk)));
196  }
197  if (type == barrelz) {
198  table_.push_back(settings_.zmatchcut(iSeed, layerdisk) / settings_.kz());
199  }
200  if (type == diskPSphi) {
201  table_.push_back(settings_.rphicutPS(iSeed, layerdisk - N_LAYER) / (settings_.kphi() * settings_.kr()));
202  }
203  if (type == disk2Sphi) {
204  table_.push_back(settings_.rphicut2S(iSeed, layerdisk - N_LAYER) / (settings_.kphi() * settings_.kr()));
205  }
206  if (type == disk2Sr) {
207  table_.push_back(settings_.rcut2S(iSeed, layerdisk - N_LAYER) / settings_.krprojshiftdisk());
208  }
209  if (type == diskPSr) {
210  table_.push_back(settings_.rcutPS(iSeed, layerdisk - N_LAYER) / settings_.krprojshiftdisk());
211  }
212  }
213  if (type == alphainner) {
214  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
216  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSinner(i) * settings_.rDSSinner(i)) /
217  settings_.kphi());
218  }
219  }
220  if (type == alphaouter) {
221  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
223  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSouter(i) * settings_.rDSSouter(i)) /
224  settings_.kphi());
225  }
226  }
227  if (type == rSSinner) {
228  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
229  table_.push_back(settings_.rDSSinner(i) / settings_.kr());
230  }
231  }
232  if (type == rSSouter) {
233  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
234  table_.push_back(settings_.rDSSouter(i) / settings_.kr());
235  }
236  }
237 
238  name_ = settings_.combined() ? "MP_" : "MC_";
239 
240  if (type == barrelphi) {
241  nbits_ = 10;
242  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_phicut.tab";
243  }
244  if (type == barrelz) {
245  nbits_ = 9;
246  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_zcut.tab";
247  }
248  if (type == diskPSphi) {
249  nbits_ = 19;
250  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_PSphicut.tab";
251  }
252  if (type == disk2Sphi) {
253  nbits_ = 19;
254  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_2Sphicut.tab";
255  }
256  if (type == disk2Sr) {
257  nbits_ = 7;
258  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_2Srcut.tab";
259  }
260  if (type == diskPSr) {
261  nbits_ = 2;
262  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_PSrcut.tab";
263  }
264  if (type == alphainner) {
265  nbits_ = 8;
266  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_alphainner.tab";
267  }
268  if (type == alphaouter) {
269  nbits_ = 8;
270  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_alphaouter.tab";
271  }
272  if (type == rSSinner) {
273  nbits_ = 15;
274  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_rDSSinner.tab";
275  }
276  if (type == rSSouter) {
277  nbits_ = 15;
278  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_rDSSouter.tab";
279  }
280 
281  positive_ = false;
282 
283  writeTable();
284 }
double rphicutPS(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:168
double kz() const
Definition: Settings.h:342
double zmatchcut(unsigned int iSeed, unsigned int ilayer) const
Definition: Settings.h:167
double kphi1() const
Definition: Settings.h:339
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:183
constexpr unsigned int N_SEED
Definition: Settings.h:28
bool combined() const
Definition: Settings.h:270
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
double rphimatchcut(unsigned int iSeed, unsigned int ilayer) const
Definition: Settings.h:166
constexpr unsigned int N_DSS_MOD
Definition: Settings.h:31
std::string name_
Definition: TrackletLUT.h:142
double half2SmoduleWidth() const
Definition: Settings.h:140
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:186
int alphashift() const
Definition: Settings.h:228
double rcut2S(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:171
double kr() const
Definition: Settings.h:344
double rphicut2S(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:170
double rcutPS(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:169
unsigned int nbits_
Definition: TrackletLUT.h:146
int nbitsalpha() const
Definition: Settings.h:229
std::vector< int > table_
Definition: TrackletLUT.h:144
double krprojshiftdisk() const
Definition: Settings.h:441
double kphi() const
Definition: Settings.h:338
void writeTable() const
constexpr int N_LAYER
Definition: Settings.h:25

◆ initPhiCorrTable()

void TrackletLUT::initPhiCorrTable ( unsigned int  layerdisk,
unsigned int  rbits 
)

Definition at line 1341 of file TrackletLUT.cc.

References trklet::Settings::benddecode(), trklet::Settings::drmax(), getBendCut(), getphiCorrValue(), getSensorModules(), trklet::N_BENDBITS_2S, trklet::N_BENDBITS_PS, trklet::N_PSLAYER, name_, nbits_, positive_, trklet::Settings::rmean(), settings_, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::sm(), table_, to_string(), trklet::Settings::useCalcBendCuts, and writeTable().

Referenced by trklet::Sector::addStub().

1341  {
1342  bool psmodule = layerdisk < N_PSLAYER;
1343 
1344  unsigned int bendbits = psmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
1345 
1346  unsigned int rbins = (1 << rbits);
1347 
1348  double rmean = settings_.rmean(layerdisk);
1349  double drmax = settings_.drmax();
1350 
1351  double dr = 2.0 * drmax / rbins;
1352 
1353  std::vector<std::array<double, 2>> bend_vals;
1354 
1355  if (settings_.useCalcBendCuts) {
1356  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, psmodule);
1357  bend_vals = getBendCut(layerdisk, sm, psmodule);
1358 
1359  } else {
1360  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1361  bend_vals.push_back({{settings_.benddecode(ibend, layerdisk, layerdisk < N_PSLAYER), 0}});
1362  }
1363  }
1364 
1365  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1366  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1367  double bend = -bend_vals[ibend][0];
1368  int value = getphiCorrValue(layerdisk, bend, irbin, rmean, dr, drmax);
1369  table_.push_back(value);
1370  }
1371  }
1372 
1373  name_ = "VMPhiCorrL" + std::to_string(layerdisk + 1) + ".tab";
1374  nbits_ = 14;
1375  positive_ = false;
1376 
1377  writeTable();
1378 }
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:443
const Settings & settings_
Definition: TrackletLUT.h:120
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
int getphiCorrValue(unsigned int layerdisk, double bend, unsigned int irbin, double rmean, double dr, double drmax) const
static std::string to_string(const XMLCh *ch)
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:479
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
Definition: value.py:1
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double drmax() const
Definition: Settings.h:137
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< std::array< double, 2 > > getBendCut(unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
Definition: TrackletLUT.cc:116
std::vector< int > table_
Definition: TrackletLUT.h:144
std::vector< const tt::SensorModule * > getSensorModules(unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
Definition: TrackletLUT.cc:15
void writeTable() const

◆ initProjectionBend()

void TrackletLUT::initProjectionBend ( double  k_phider,
unsigned int  idisk,
unsigned int  nrbits,
unsigned int  nphiderbits 
)

Definition at line 801 of file TrackletLUT.cc.

References trklet::bendstrip(), trklet::Settings::combined(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), trklet::Settings::krprojshiftdisk(), trklet::TrackletConfigBuilder::LayerName(), trklet::N_LAYER, name_, nbits_, trklet::Settings::nbitsphiprojderL123(), trklet::Settings::nrbitsstub(), trklet::NRINVBITS, positive_, trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::sensorSpacing2S(), settings_, trklet::Settings::stripPitch(), submitPVValidationJobs::t, table_, writeTable(), and trklet::Settings::zmean().

Referenced by trklet::MatchProcessor::MatchProcessor(), and trklet::ProjectionRouter::ProjectionRouter().

804  {
805  unsigned int nsignbins = 2;
806  unsigned int nrbins = 1 << (nrbits);
807  unsigned int nphiderbins = 1 << (nphiderbits);
808 
809  for (unsigned int isignbin = 0; isignbin < nsignbins; isignbin++) {
810  for (unsigned int irbin = 0; irbin < nrbins; irbin++) {
811  int ir = irbin;
812  if (ir > (1 << (nrbits - 1)))
813  ir -= (1 << nrbits);
814  ir = ir << (settings_.nrbitsstub(N_LAYER) - nrbits);
815  for (unsigned int iphiderbin = 0; iphiderbin < nphiderbins; iphiderbin++) {
816  int iphider = iphiderbin;
817  if (iphider > (1 << (nphiderbits - 1)))
818  iphider -= (1 << nphiderbits);
819  iphider = iphider << (settings_.nbitsphiprojderL123() - nphiderbits);
820 
821  double rproj = ir * settings_.krprojshiftdisk();
822  double phider = iphider * k_phider;
823  double t = settings_.zmean(idisk) / rproj;
824 
825  if (isignbin)
826  t = -t;
827 
828  double rinv = -phider * (2.0 * t);
829 
830  double stripPitch = (rproj < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
831  double bendproj = bendstrip(rproj, rinv, stripPitch, settings_.sensorSpacing2S());
832 
833  constexpr double maxbend = (1 << NRINVBITS) - 1;
834 
835  int ibendproj = 2.0 * bendproj + 0.5 * maxbend;
836  if (ibendproj < 0)
837  ibendproj = 0;
838  if (ibendproj > maxbend)
839  ibendproj = maxbend;
840 
841  table_.push_back(ibendproj);
842  }
843  }
844  }
845 
846  positive_ = false;
847  nbits_ = 5;
848  name_ = settings_.combined() ? "MP_" : "PR_";
849  name_ += "ProjectionBend_" + TrackletConfigBuilder::LayerName(N_LAYER + idisk) + ".tab";
850 
851  writeTable();
852 }
double sensorSpacing2S() const
Definition: Settings.h:288
unsigned int nrbitsstub(unsigned int layerdisk) const
Definition: Settings.h:93
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
bool combined() const
Definition: Settings.h:270
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
std::string name_
Definition: TrackletLUT.h:142
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:146
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:96
std::vector< int > table_
Definition: TrackletLUT.h:144
double krprojshiftdisk() const
Definition: Settings.h:441
void writeTable() const
double bendstrip(double r, double rinv, double stripPitch, double sensorSpacing)
Definition: Util.h:42
constexpr int N_LAYER
Definition: Settings.h:25
double rcrit() const
Definition: Settings.h:327

◆ initProjectionDiskRadius()

void TrackletLUT::initProjectionDiskRadius ( int  nrbits)

Definition at line 854 of file TrackletLUT.cc.

References cms::cuda::assert(), ztail::d, trklet::N_RZBITS, name_, nbits_, trklet::NFINERZBITS, positive_, trklet::Settings::rmaxdisk(), trklet::Settings::rmindiskvm(), settings_, table_, and writeTable().

Referenced by trklet::MatchProcessor::MatchProcessor().

854  {
855  //When a projection to a disk is considered this offset and added and subtracted to calculate
856  //the bin the projection is pointing to. This is to account for resolution effects such that
857  //projections that are near a bin boundary will be assigned to both bins. The value (3 cm) should
858  //cover the uncertanty in the resolution.
859  double roffset = 3.0;
860 
861  for (unsigned int ir = 0; ir < (1u << nrbits); ir++) {
862  double r = ir * settings_.rmaxdisk() / (1u << nrbits);
863 
864  int rbin1 =
865  (1 << N_RZBITS) * (r - roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
866  int rbin2 =
867  (1 << N_RZBITS) * (r + roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
868 
869  if (rbin1 < 0) {
870  rbin1 = 0;
871  }
872  rbin2 = clamp(rbin2, 0, ((1 << N_RZBITS) - 1));
873 
874  assert(rbin1 <= rbin2);
875  assert(rbin2 - rbin1 <= 1);
876 
877  int d = rbin1 != rbin2;
878 
879  int finer =
880  (1 << (N_RZBITS + NFINERZBITS)) *
881  ((r - settings_.rmindiskvm()) - rbin1 * (settings_.rmaxdisk() - settings_.rmindiskvm()) / (1 << N_RZBITS)) /
883 
884  finer = clamp(finer, 0, ((1 << (NFINERZBITS + 1)) - 1));
885 
886  //Pack the data in a 8 bit word (ffffrrrd) where f is finer, r is rbin1, and d is difference
887  int N_DIFF_FLAG = 1; // Single bit for bool flag
888 
889  int word = (finer << (N_RZBITS + N_DIFF_FLAG)) + (rbin1 << N_DIFF_FLAG) + d;
890 
891  table_.push_back(word);
892  }
893 
894  //Size of the data word from above (8 bits)
895  nbits_ = NFINERZBITS + 1 + N_RZBITS + 1;
896  positive_ = true;
897  name_ = "ProjectionDiskRadius.tab";
898  writeTable();
899 }
constexpr unsigned int N_RZBITS
Definition: Settings.h:39
const Settings & settings_
Definition: TrackletLUT.h:120
double rmindiskvm() const
Definition: Settings.h:355
assert(be >=bs)
uint64_t word
std::string name_
Definition: TrackletLUT.h:142
d
Definition: ztail.py:151
constexpr unsigned int NFINERZBITS
Definition: Settings.h:37
double rmaxdisk() const
Definition: Settings.h:134
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< int > table_
Definition: TrackletLUT.h:144
void writeTable() const

◆ initteptlut()

void TrackletLUT::initteptlut ( bool  fillInner,
bool  fillTEMem,
unsigned int  iSeed,
unsigned int  layerdisk1,
unsigned int  layerdisk2,
unsigned int  innerphibits,
unsigned int  outerphibits,
double  innerphimin,
double  innerphimax,
double  outerphimin,
double  outerphimax,
const std::string &  innermem,
const std::string &  outermem 
)

Definition at line 559 of file TrackletLUT.cc.

References funct::abs(), trklet::Settings::bendcutte(), trklet::Settings::bendcutTE(), trklet::Settings::benddecode(), trklet::bendstrip(), TkAlMuonSelectors_cfi::cut, trklet::D1D2, trklet::D3D4, getBendCut(), getSensorModules(), getTanRange(), testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, trklet::L1D1, trklet::L1L2, trklet::L2D1, trklet::L2L3, trklet::L3L4, trklet::L5L6, trklet::N_BENDBITS_2S, trklet::N_BENDBITS_PS, trklet::N_LAYER, name_, nbits_, or, positive_, trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::rinvcutte(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), trklet::Settings::rmindiskvm(), trklet::Settings::sensorSpacing2S(), settings_, trklet::Settings::stripPitch(), table_, trklet::tan_theta(), trklet::Settings::useCalcBendCuts, writeTable(), trklet::Settings::z0cut(), trklet::Settings::zlength(), trklet::Settings::zmaxdisk(), trklet::Settings::zmean(), and trklet::Settings::zmindisk().

Referenced by trklet::TrackletEngine::setVMPhiBin().

571  {
572  int outerrbits = 0;
573  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
574  outerrbits = 3;
575  }
576 
577  int outerrbins = (1 << outerrbits);
578  int innerphibins = (1 << innerphibits);
579  int outerphibins = (1 << outerphibits);
580 
581  double phiinner[2];
582  double phiouter[2];
583  double router[2];
584 
585  bool isPSinner;
586  bool isPSouter;
587 
588  if (iSeed == Seed::L3L4) {
589  isPSinner = true;
590  isPSouter = false;
591  } else if (iSeed == Seed::L5L6) {
592  isPSinner = false;
593  isPSouter = false;
594  } else {
595  isPSinner = true;
596  isPSouter = true;
597  }
598 
599  unsigned int nbendbitsinner = isPSinner ? N_BENDBITS_PS : N_BENDBITS_2S;
600  unsigned int nbendbitsouter = isPSouter ? N_BENDBITS_PS : N_BENDBITS_2S;
601 
602  if (fillTEMem) {
603  if (fillInner) {
604  table_.resize((1 << nbendbitsinner), false);
605  } else {
606  table_.resize((1 << nbendbitsouter), false);
607  }
608  }
609 
610  double z0 = settings_.z0cut();
611 
612  for (int irouterbin = 0; irouterbin < outerrbins; irouterbin++) {
613  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
614  router[0] = settings_.rmindiskvm() + irouterbin * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
615  router[1] =
616  settings_.rmindiskvm() + (irouterbin + 1) * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
617  } else {
618  router[0] = settings_.rmean(layerdisk2);
619  router[1] = settings_.rmean(layerdisk2);
620  }
621 
622  //Determine bend cuts using geometry
623  std::vector<std::array<double, 2>> bend_cuts_inner;
624  std::vector<std::array<double, 2>> bend_cuts_outer;
625 
627  std::vector<const tt::SensorModule*> sminner;
628  std::vector<const tt::SensorModule*> smouter;
629 
630  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
631  double outer_tan_max = tan_theta(settings_.rmean(layerdisk2), settings_.zlength(), z0, true);
632  std::array<double, 2> tan_range = {{0, outer_tan_max}};
633 
634  smouter = getSensorModules(layerdisk2, isPSouter, tan_range);
635  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
636 
637  } else if (iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
638  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
639  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
640 
641  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
642  std::array<double, 2> tan_range = getTanRange(smouter);
643  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
644 
645  } else { // D1D2 D3D4
646 
647  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
648  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
649 
650  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
651 
652  std::array<double, 2> tan_range = getTanRange(smouter);
653  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
654  }
655 
656  bend_cuts_inner = getBendCut(layerdisk1, sminner, isPSinner, settings_.bendcutTE(iSeed, true));
657  bend_cuts_outer = getBendCut(layerdisk2, smouter, isPSouter, settings_.bendcutTE(iSeed, false));
658 
659  } else {
660  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
661  double mid = settings_.benddecode(ibend, layerdisk1, nbendbitsinner == 3);
662  double cut = settings_.bendcutte(ibend, layerdisk1, nbendbitsinner == 3);
663  bend_cuts_inner.push_back({{mid, cut}});
664  }
665  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
666  double mid = settings_.benddecode(ibend, layerdisk2, nbendbitsouter == 3);
667  double cut = settings_.bendcutte(ibend, layerdisk2, nbendbitsouter == 3);
668  bend_cuts_outer.push_back({{mid, cut}});
669  }
670  }
671 
672  for (int iphiinnerbin = 0; iphiinnerbin < innerphibins; iphiinnerbin++) {
673  phiinner[0] = innerphimin + iphiinnerbin * (innerphimax - innerphimin) / innerphibins;
674  phiinner[1] = innerphimin + (iphiinnerbin + 1) * (innerphimax - innerphimin) / innerphibins;
675  for (int iphiouterbin = 0; iphiouterbin < outerphibins; iphiouterbin++) {
676  phiouter[0] = outerphimin + iphiouterbin * (outerphimax - outerphimin) / outerphibins;
677  phiouter[1] = outerphimin + (iphiouterbin + 1) * (outerphimax - outerphimin) / outerphibins;
678 
679  double bendinnermin = 20.0;
680  double bendinnermax = -20.0;
681  double bendoutermin = 20.0;
682  double bendoutermax = -20.0;
683  double rinvmin = 1.0;
684  double rinvmax = -1.0;
685  double absrinvmin = 1.0;
686 
687  for (int i1 = 0; i1 < 2; i1++) {
688  for (int i2 = 0; i2 < 2; i2++) {
689  for (int i3 = 0; i3 < 2; i3++) {
690  double rinner = 0.0;
691  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4) {
692  rinner = router[i3] * settings_.zmean(layerdisk1 - N_LAYER) / settings_.zmean(layerdisk2 - N_LAYER);
693  } else {
694  rinner = settings_.rmean(layerdisk1);
695  }
696 
698  if (rinner >= router[i3])
699  continue;
700  }
701 
702  double rinv1 = (rinner < router[i3]) ? -rinv(phiinner[i1], phiouter[i2], rinner, router[i3]) : -20.0;
703  double pitchinner =
704  (rinner < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
705  double pitchouter =
706  (router[i3] < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
707 
708  double abendinner = bendstrip(rinner, rinv1, pitchinner, settings_.sensorSpacing2S());
709  double abendouter = bendstrip(router[i3], rinv1, pitchouter, settings_.sensorSpacing2S());
710 
711  if (abendinner < bendinnermin)
712  bendinnermin = abendinner;
713  if (abendinner > bendinnermax)
714  bendinnermax = abendinner;
715  if (abendouter < bendoutermin)
716  bendoutermin = abendouter;
717  if (abendouter > bendoutermax)
718  bendoutermax = abendouter;
719  if (std::abs(rinv1) < absrinvmin)
720  absrinvmin = std::abs(rinv1);
721  if (rinv1 > rinvmax)
722  rinvmax = rinv1;
723  if (rinv1 < rinvmin)
724  rinvmin = rinv1;
725  }
726  }
727  }
728 
729  double lowrinvcutte = 0.002;
730 
731  bool passptcut;
732  double bendfac;
733 
735  passptcut = rinvmin < settings_.rinvcutte() and rinvmax > -settings_.rinvcutte();
736  bendfac = (rinvmin < lowrinvcutte and rinvmax > -lowrinvcutte) ? 1.05 : 1.0; // Better acceptance for high pt
737  } else {
738  passptcut = absrinvmin < settings_.rinvcutte();
739  bendfac = 1.0;
740  }
741 
742  if (fillInner) {
743  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
744  double bendminfac = (isPSinner and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
745  double bendmaxfac = (isPSinner and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
746 
747  double mid = bend_cuts_inner.at(ibend)[0];
748  double cut = bend_cuts_inner.at(ibend)[1];
749 
750  bool passinner = mid + cut * bendmaxfac > bendinnermin && mid - cut * bendminfac < bendinnermax;
751 
752  if (fillTEMem) {
753  if (passinner)
754  table_[ibend] = 1;
755  } else {
756  table_.push_back(passinner && passptcut);
757  }
758  }
759  } else {
760  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
761  double bendminfac = (isPSouter and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
762  double bendmaxfac = (isPSouter and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
763 
764  double mid = bend_cuts_outer.at(ibend)[0];
765  double cut = bend_cuts_outer.at(ibend)[1];
766 
767  bool passouter = mid + cut * bendmaxfac > bendoutermin && mid - cut * bendminfac < bendoutermax;
768 
769  if (fillTEMem) {
770  if (passouter)
771  table_[ibend] = 1;
772  } else {
773  table_.push_back(passouter && passptcut);
774  }
775  }
776  }
777  }
778  }
779  }
780 
781  positive_ = false;
782  nbits_ = 1;
783 
784  if (fillTEMem) {
785  if (fillInner) {
786  name_ = "VMSTE_" + innermem + "_vmbendcut.tab";
787  } else {
788  name_ = "VMSTE_" + outermem + "_vmbendcut.tab";
789  }
790  } else {
791  name_ = "TE_" + innermem.substr(0, innermem.size() - 2) + "_" + outermem.substr(0, outermem.size() - 2);
792  if (fillInner) {
793  name_ += "_stubptinnercut.tab";
794  } else {
795  name_ += "_stubptoutercut.tab";
796  }
797  }
798  writeTable();
799 }
double sensorSpacing2S() const
Definition: Settings.h:288
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:443
const Settings & settings_
Definition: TrackletLUT.h:120
double zlength() const
Definition: Settings.h:133
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
double rmindiskvm() const
Definition: Settings.h:355
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:479
std::array< double, 2 > getTanRange(const std::vector< const tt::SensorModule *> &sensorModules)
Definition: TrackletLUT.cc:90
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
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
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:471
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
double tan_theta(double r, double z, double z0, bool z0_max)
Definition: Util.h:54
double z0cut() const
Definition: Settings.h:364
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< std::array< double, 2 > > getBendCut(unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
Definition: TrackletLUT.cc:116
double rmaxdiskvm() const
Definition: Settings.h:356
double rinvcutte() const
Definition: Settings.h:353
double zmaxdisk(unsigned int iDisk) const
Definition: Settings.h:181
std::vector< int > table_
Definition: TrackletLUT.h:144
std::vector< const tt::SensorModule * > getSensorModules(unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
Definition: TrackletLUT.cc:15
void writeTable() const
double bendstrip(double r, double rinv, double stripPitch, double sensorSpacing)
Definition: Util.h:42
double zmindisk(unsigned int iDisk) const
Definition: Settings.h:180
double bendcutTE(unsigned int seed, bool inner) const
Definition: Settings.h:481
constexpr int N_LAYER
Definition: Settings.h:25
double rcrit() const
Definition: Settings.h:327

◆ initTPlut()

void TrackletLUT::initTPlut ( bool  fillInner,
unsigned int  iSeed,
unsigned int  layerdisk1,
unsigned int  layerdisk2,
unsigned int  nbitsfinephidiff,
unsigned int  iTP 
)

Definition at line 286 of file TrackletLUT.cc.

References funct::abs(), trklet::Settings::bendcutte(), trklet::Settings::bendcutTE(), trklet::Settings::benddecode(), trklet::bendstrip(), TkAlMuonSelectors_cfi::cut, trklet::D1D2, trklet::D3D4, trklet::Settings::dphisectorHG(), getBendCut(), getSensorModules(), getTanRange(), testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, trklet::L1D1, trklet::L1L2, trklet::L2D1, trklet::L2L3, trklet::L3L4, trklet::L5L6, trklet::TrackletConfigBuilder::LayerName(), trklet::N_BENDBITS_2S, trklet::N_BENDBITS_PS, trklet::N_LAYER, trklet::Settings::nallstubs(), name_, nbits_, trklet::Settings::nfinephi(), trklet::Settings::nvmte(), or, positive_, trklet::Settings::rcrit(), trklet::rinv(), trklet::Settings::rinvcutte(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), trklet::Settings::rmindiskvm(), trklet::Settings::sensorSpacing2S(), settings_, trklet::Settings::stripPitch(), table_, trklet::tan_theta(), trklet::Settings::useCalcBendCuts, writeTable(), trklet::Settings::z0cut(), trklet::Settings::zlength(), trklet::Settings::zmaxdisk(), trklet::Settings::zmean(), and trklet::Settings::zmindisk().

Referenced by trklet::TrackletProcessor::addInput().

291  {
292  //number of fine phi bins in sector
293  int nfinephibins = settings_.nallstubs(layerdisk2) * settings_.nvmte(1, iSeed) * (1 << settings_.nfinephi(1, iSeed));
294  double dfinephi = settings_.dphisectorHG() / nfinephibins;
295 
296  int outerrbits = 3;
297 
298  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
299  outerrbits = 0;
300  }
301 
302  int outerrbins = (1 << outerrbits);
303 
304  double dphi[2];
305  double router[2];
306 
307  bool isPSinner;
308  bool isPSouter;
309 
310  if (iSeed == Seed::L3L4) {
311  isPSinner = true;
312  isPSouter = false;
313  } else if (iSeed == Seed::L5L6) {
314  isPSinner = false;
315  isPSouter = false;
316  } else {
317  isPSinner = true;
318  isPSouter = true;
319  }
320 
321  unsigned int nbendbitsinner = isPSinner ? N_BENDBITS_PS : N_BENDBITS_2S;
322  unsigned int nbendbitsouter = isPSouter ? N_BENDBITS_PS : N_BENDBITS_2S;
323 
324  double z0 = settings_.z0cut();
325 
326  int nbinsfinephidiff = (1 << nbitsfinephidiff);
327 
328  for (int iphibin = 0; iphibin < nbinsfinephidiff; iphibin++) {
329  int iphidiff = iphibin;
330  if (iphibin >= nbinsfinephidiff / 2) {
331  iphidiff = iphibin - nbinsfinephidiff;
332  }
333  //min and max dphi
334  //ramge of dphi to consider due to resolution
335  double deltaphi = 1.5;
336  dphi[0] = (iphidiff - deltaphi) * dfinephi;
337  dphi[1] = (iphidiff + deltaphi) * dfinephi;
338  for (int irouterbin = 0; irouterbin < outerrbins; irouterbin++) {
339  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
340  router[0] =
341  settings_.rmindiskvm() + irouterbin * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
342  router[1] =
343  settings_.rmindiskvm() + (irouterbin + 1) * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
344  } else {
345  router[0] = settings_.rmean(layerdisk2);
346  router[1] = settings_.rmean(layerdisk2);
347  }
348 
349  //Determine bend cuts using geometry
350  std::vector<std::array<double, 2>> bend_cuts_inner;
351  std::vector<std::array<double, 2>> bend_cuts_outer;
352 
354  std::vector<const tt::SensorModule*> sminner;
355  std::vector<const tt::SensorModule*> smouter;
356 
357  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
358  double outer_tan_max = tan_theta(settings_.rmean(layerdisk2), settings_.zlength(), z0, true);
359  std::array<double, 2> tan_range = {{0, outer_tan_max}};
360 
361  smouter = getSensorModules(layerdisk2, isPSouter, tan_range);
362  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
363 
364  } else if (iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
365  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
366  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
367 
368  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
369  std::array<double, 2> tan_range = getTanRange(smouter);
370  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
371 
372  } else { // D1D2 D3D4
373 
374  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
375  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
376 
377  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
378 
379  std::array<double, 2> tan_range = getTanRange(smouter);
380  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
381  }
382 
383  bend_cuts_inner = getBendCut(layerdisk1, sminner, isPSinner, settings_.bendcutTE(iSeed, true));
384  bend_cuts_outer = getBendCut(layerdisk2, smouter, isPSouter, settings_.bendcutTE(iSeed, false));
385 
386  } else {
387  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
388  double mid = settings_.benddecode(ibend, layerdisk1, isPSinner);
389  double cut = settings_.bendcutte(ibend, layerdisk1, isPSinner);
390  bend_cuts_inner.push_back({{mid, cut}});
391  }
392  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
393  double mid = settings_.benddecode(ibend, layerdisk2, isPSouter);
394  double cut = settings_.bendcutte(ibend, layerdisk2, isPSouter);
395  bend_cuts_outer.push_back({{mid, cut}});
396  }
397  }
398 
399  double bendinnermin = 20.0;
400  double bendinnermax = -20.0;
401  double bendoutermin = 20.0;
402  double bendoutermax = -20.0;
403  double rinvmin = 1.0;
404  double rinvmax = -1.0;
405  double absrinvmin = 1.0;
406 
407  for (int i2 = 0; i2 < 2; i2++) {
408  for (int i3 = 0; i3 < 2; i3++) {
409  double rinner = 0.0;
410  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4) {
411  rinner = router[i3] * settings_.zmean(layerdisk1 - N_LAYER) / settings_.zmean(layerdisk2 - N_LAYER);
412  } else {
413  rinner = settings_.rmean(layerdisk1);
414  }
416  if (rinner >= router[i3])
417  continue;
418  }
419  double rinv1 = (rinner < router[i3]) ? rinv(0.0, -dphi[i2], rinner, router[i3]) : 20.0;
420  double pitchinner = (rinner < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
421  double pitchouter =
422  (router[i3] < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
423  double abendinner = bendstrip(rinner, rinv1, pitchinner, settings_.sensorSpacing2S());
424  double abendouter = bendstrip(router[i3], rinv1, pitchouter, settings_.sensorSpacing2S());
425  if (abendinner < bendinnermin)
426  bendinnermin = abendinner;
427  if (abendinner > bendinnermax)
428  bendinnermax = abendinner;
429  if (abendouter < bendoutermin)
430  bendoutermin = abendouter;
431  if (abendouter > bendoutermax)
432  bendoutermax = abendouter;
433  if (std::abs(rinv1) < absrinvmin)
434  absrinvmin = std::abs(rinv1);
435  if (rinv1 > rinvmax)
436  rinvmax = rinv1;
437  if (rinv1 < rinvmin)
438  rinvmin = rinv1;
439  }
440  }
441 
442  bool passptcut;
443  double bendfac;
444  double rinvcutte = settings_.rinvcutte();
445 
447  double lowrinvcutte =
448  rinvcutte / 3; //Somewhat arbitrary value, allows for better acceptance in bins with low rinv (high pt)
449  passptcut = rinvmin < rinvcutte and rinvmax > -rinvcutte;
450  bendfac = (rinvmin < lowrinvcutte and rinvmax > -lowrinvcutte)
451  ? 1.05
452  : 1.0; //Somewhat arbirary value, bend cuts are 5% larger in bins with low rinv (high pt)
453  } else {
454  passptcut = absrinvmin < rinvcutte;
455  bendfac = 1.0;
456  }
457 
458  if (fillInner) {
459  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
460  double bendminfac = (isPSinner and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
461  double bendmaxfac = (isPSinner and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
462 
463  double mid = bend_cuts_inner.at(ibend)[0];
464  double cut = bend_cuts_inner.at(ibend)[1];
465 
466  bool passinner = mid + cut * bendmaxfac > bendinnermin && mid - cut * bendminfac < bendinnermax;
467 
468  table_.push_back(passinner && passptcut);
469  }
470  } else {
471  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
472  double bendminfac = (isPSouter and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
473  double bendmaxfac = (isPSouter and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
474 
475  double mid = bend_cuts_outer.at(ibend)[0];
476  double cut = bend_cuts_outer.at(ibend)[1];
477 
478  bool passouter = mid + cut * bendmaxfac > bendoutermin && mid - cut * bendminfac < bendoutermax;
479 
480  table_.push_back(passouter && passptcut);
481  }
482  }
483  }
484  }
485 
486  positive_ = false;
487  nbits_ = 1;
488  char cTP = 'A' + iTP;
489 
490  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk1) + TrackletConfigBuilder::LayerName(layerdisk2) + cTP;
491 
492  if (fillInner) {
493  name_ += "_stubptinnercut.tab";
494  } else {
495  name_ += "_stubptoutercut.tab";
496  }
497 
498  writeTable();
499 }
double sensorSpacing2S() const
Definition: Settings.h:288
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:443
double dphisectorHG() const
Definition: Settings.h:320
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
double zlength() const
Definition: Settings.h:133
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
double rmindiskvm() const
Definition: Settings.h:355
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:479
std::array< double, 2 > getTanRange(const std::vector< const tt::SensorModule *> &sensorModules)
Definition: TrackletLUT.cc:90
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
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
double stripPitch(bool isPSmodule) const
Definition: Settings.h:284
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:471
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:110
double tan_theta(double r, double z, double z0, bool z0_max)
Definition: Util.h:54
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:116
double z0cut() const
Definition: Settings.h:364
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:146
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:142
std::vector< std::array< double, 2 > > getBendCut(unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
Definition: TrackletLUT.cc:116
double rmaxdiskvm() const
Definition: Settings.h:356
double rinvcutte() const
Definition: Settings.h:353
double zmaxdisk(unsigned int iDisk) const
Definition: Settings.h:181
std::vector< int > table_
Definition: TrackletLUT.h:144
std::vector< const tt::SensorModule * > getSensorModules(unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
Definition: TrackletLUT.cc:15
void writeTable() const
double bendstrip(double r, double rinv, double stripPitch, double sensorSpacing)
Definition: Util.h:42
double zmindisk(unsigned int iDisk) const
Definition: Settings.h:180
double bendcutTE(unsigned int seed, bool inner) const
Definition: Settings.h:481
constexpr int N_LAYER
Definition: Settings.h:25
double rcrit() const
Definition: Settings.h:327

◆ initTPregionlut()

void TrackletLUT::initTPregionlut ( unsigned int  iSeed,
unsigned int  layerdisk1,
unsigned int  layerdisk2,
unsigned int  iAllStub,
unsigned int  nbitsfinephidiff,
unsigned int  nbitsfinephi,
const TrackletLUT tplutinner,
unsigned int  iTP 
)

Definition at line 501 of file TrackletLUT.cc.

References trklet::D1D2, trklet::D3D4, trklet::L1D1, trklet::L2D1, trklet::L5L6, trklet::TrackletConfigBuilder::LayerName(), lookup(), name_, nbits_, trklet::Settings::nbitsallstubs(), trklet::Settings::nfinephi(), trklet::Settings::nvmte(), positive_, settings_, table_, and writeTable().

Referenced by trklet::TrackletProcessor::addInput().

508  {
509  int nirbits = 0;
510  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
511  nirbits = 3;
512  }
513 
514  unsigned int nbendbitsinner = 3;
515 
516  if (iSeed == Seed::L5L6) {
517  nbendbitsinner = 4;
518  }
519 
520  for (int innerfinephi = 0; innerfinephi < (1 << nbitsfinephi); innerfinephi++) {
521  for (int innerbend = 0; innerbend < (1 << nbendbitsinner); innerbend++) {
522  for (int ir = 0; ir < (1 << nirbits); ir++) {
523  unsigned int usereg = 0;
524  for (unsigned int ireg = 0; ireg < settings_.nvmte(1, iSeed); ireg++) {
525  bool match = false;
526  for (int ifinephiouter = 0; ifinephiouter < (1 << settings_.nfinephi(1, iSeed)); ifinephiouter++) {
527  int outerfinephi = iAllStub * (1 << (nbitsfinephi - settings_.nbitsallstubs(layerdisk2))) +
528  ireg * (1 << settings_.nfinephi(1, iSeed)) + ifinephiouter;
529  int idphi = outerfinephi - innerfinephi;
530  bool inrange = (idphi < (1 << (nbitsfinephidiff - 1))) && (idphi >= -(1 << (nbitsfinephidiff - 1)));
531  if (idphi < 0)
532  idphi = idphi + (1 << nbitsfinephidiff);
533  int idphi1 = idphi;
534  if (iSeed >= 4)
535  idphi1 = (idphi << 3) + ir;
536  int ptinnerindexnew = (idphi1 << nbendbitsinner) + innerbend;
537  match = match || (inrange && tplutinner.lookup(ptinnerindexnew));
538  }
539  if (match) {
540  usereg = usereg | (1 << ireg);
541  }
542  }
543 
544  table_.push_back(usereg);
545  }
546  }
547  }
548 
549  positive_ = false;
550  nbits_ = 8;
551  char cTP = 'A' + iTP;
552 
553  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk1) + TrackletConfigBuilder::LayerName(layerdisk2) + cTP +
554  "_usereg.tab";
555 
556  writeTable();
557 }
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
int lookup(unsigned int index) const
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:115
std::string name_
Definition: TrackletLUT.h:142
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:110
unsigned int nbits_
Definition: TrackletLUT.h:146
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:142
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::vector< int > table_
Definition: TrackletLUT.h:144
void writeTable() const

◆ initVMRTable()

void TrackletLUT::initVMRTable ( unsigned int  layerdisk,
VMRTableType  type,
int  region = -1 
)

Definition at line 998 of file TrackletLUT.cc.

References cms::cuda::assert(), newFWLiteAna::bin, trklet::Settings::combined(), trklet::D3, trklet::Settings::drmax(), PVValHelper::dz, trklet::Settings::dzmax(), getVMRLookup(), SurfaceOrientation::inner, PixelRegions::L1, PixelRegions::L2, trklet::L2L3, trklet::L2L3D1, PixelRegions::L3, PixelRegions::L4, trklet::L5, trklet::L6, trklet::TrackletConfigBuilder::LayerName(), hlt_dqm_clientPB-live_cfg::me, trklet::N_LAYER, name_, NBINS, nbits_, trklet::Settings::NLONGVMBINS(), trklet::Settings::NLONGVMBITS(), positive_, trklet::Settings::rDSSinner(), trklet::Settings::rDSSouter(), nano_mu_digi_cff::region, trklet::Settings::rmaxdisk(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), trklet::Settings::rmindiskvm(), settings_, table_, trklet::Settings::vmrlutrbits(), trklet::Settings::vmrlutzbits(), writeTable(), globals_cff::zbins, trklet::Settings::zlength(), SiStripMonitorCluster_cfi::zmax, trklet::Settings::zmean(), and SiStripMonitorCluster_cfi::zmin.

Referenced by trklet::TrackletProcessor::TrackletProcessor(), trklet::TrackletProcessorDisplaced::TrackletProcessorDisplaced(), trklet::VMRouter::VMRouter(), and trklet::VMRouterCM::VMRouterCM().

998  {
999  unsigned int zbits = settings_.vmrlutzbits(layerdisk);
1000  unsigned int rbits = settings_.vmrlutrbits(layerdisk);
1001 
1002  unsigned int rbins = (1 << rbits);
1003  unsigned int zbins = (1 << zbits);
1004 
1005  double zmin, zmax, rmin, rmax;
1006 
1007  if (layerdisk < N_LAYER) {
1008  zmin = -settings_.zlength();
1009  zmax = settings_.zlength();
1010  rmin = settings_.rmean(layerdisk) - settings_.drmax();
1011  rmax = settings_.rmean(layerdisk) + settings_.drmax();
1012  } else {
1013  rmin = 0;
1014  rmax = settings_.rmaxdisk();
1015  zmin = settings_.zmean(layerdisk - N_LAYER) - settings_.dzmax();
1016  zmax = settings_.zmean(layerdisk - N_LAYER) + settings_.dzmax();
1017  }
1018 
1019  double dr = (rmax - rmin) / rbins;
1020  double dz = (zmax - zmin) / zbins;
1021 
1023 
1024  for (unsigned int izbin = 0; izbin < zbins; izbin++) {
1025  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1026  double r = rmin + (irbin + 0.5) * dr;
1027  double z = zmin + (izbin + 0.5) * dz;
1028 
1029  if (settings_.combined()) {
1030  int iznew = izbin - (1 << (zbits - 1));
1031  if (iznew < 0)
1032  iznew += (1 << zbits);
1033  assert(iznew >= 0);
1034  assert(iznew < (1 << zbits));
1035  z = zmin + (iznew + 0.5) * dz;
1036  if (layerdisk < N_LAYER) {
1037  int irnew = irbin - (1 << (rbits - 1));
1038  if (irnew < 0)
1039  irnew += (1 << rbits);
1040  assert(irnew >= 0);
1041  assert(irnew < (1 << rbits));
1042  r = rmin + (irnew + 0.5) * dr;
1043  }
1044  }
1045 
1046  unsigned int NRING =
1047  5; //number of 2S rings in disks. This is multiplied below by two since we have two halfs of a module
1048  if (layerdisk >= N_LAYER && irbin < 2 * NRING) //special case for the tabulated radii in 2S disks
1049  r = (layerdisk < N_LAYER + 2) ? settings_.rDSSinner(irbin) : settings_.rDSSouter(irbin);
1050 
1051  int bin;
1052  if (layerdisk < N_LAYER) {
1053  double zproj = z * settings_.rmean(layerdisk) / r;
1054  bin = NBINS * (zproj + settings_.zlength()) / (2 * settings_.zlength());
1055  } else {
1056  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1057  bin = NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
1058  }
1059  if (bin < 0)
1060  bin = 0;
1061  if (bin >= NBINS)
1062  bin = NBINS - 1;
1063 
1064  if (type == VMRTableType::me) {
1065  table_.push_back(bin);
1066  }
1067 
1068  if (type == VMRTableType::disk) {
1069  if (layerdisk >= N_LAYER) {
1070  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1071  bin = 0.5 * NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1072  //bin value of zero indicates that stub is out of range
1073  if (bin < 0)
1074  bin = 0;
1075  if (bin >= NBINS / 2)
1076  bin = 0;
1077  table_.push_back(bin);
1078  }
1079  }
1080 
1081  if (type == VMRTableType::inner) {
1082  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L5 ||
1083  layerdisk == LayerDisk::D1 || layerdisk == LayerDisk::D3) {
1084  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr));
1085  }
1086  if (layerdisk == LayerDisk::L2) {
1087  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr, Seed::L2L3));
1088  }
1089  }
1090 
1091  if (type == VMRTableType::inneroverlap) {
1092  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L2) {
1093  table_.push_back(getVMRLookup(6, z, r, dz, dr, layerdisk + 6));
1094  }
1095  }
1096 
1097  if (type == VMRTableType::innerthird) {
1098  if (layerdisk == LayerDisk::L2) { //projection from L2 to D1 for L2L3D1 seeding
1099  table_.push_back(getVMRLookup(LayerDisk::D1, z, r, dz, dr, Seed::L2L3D1));
1100  }
1101 
1102  if (layerdisk == LayerDisk::L5) { //projection from L5 to L4 for L5L6L4 seeding
1103  table_.push_back(getVMRLookup(LayerDisk::L4, z, r, dz, dr));
1104  }
1105 
1106  if (layerdisk == LayerDisk::L3) { //projection from L3 to L5 for L3L4L2 seeding
1107  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1108  }
1109 
1110  if (layerdisk == LayerDisk::D1) { //projection from D1 to L2 for D1D2L2 seeding
1111  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1112  }
1113  }
1114  }
1115  }
1116 
1117  if (settings_.combined()) {
1118  if (type == VMRTableType::me) {
1119  nbits_ = 2 * settings_.NLONGVMBITS();
1120  positive_ = false;
1121  name_ = "VMRME_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1122  }
1123  if (type == VMRTableType::disk) {
1124  nbits_ = 2 * settings_.NLONGVMBITS();
1125  positive_ = false;
1126  name_ = "VMRTE_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1127  }
1128  if (type == VMRTableType::inner) {
1129  positive_ = true;
1130  nbits_ = 10;
1131  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk) + TrackletConfigBuilder::LayerName(layerdisk + 1) +
1132  ".tab";
1133  }
1134 
1135  if (type == VMRTableType::inneroverlap) {
1136  positive_ = true;
1137  nbits_ = 10;
1139  }
1140 
1141  } else {
1142  if (type == VMRTableType::me) {
1143  //This if a hack where the same memory is used in both ME and TE modules
1144  if (layerdisk == LayerDisk::L2 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L4 ||
1145  layerdisk == LayerDisk::L6) {
1146  nbits_ = 6;
1147  positive_ = false;
1148  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1149  writeTable();
1150  }
1151 
1152  assert(region >= 0);
1153  char cregion = 'A' + region;
1154  name_ = "VMR_" + TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_finebin.tab";
1155  nbits_ = 6;
1156  positive_ = false;
1157  }
1158 
1159  if (type == VMRTableType::inner) {
1160  positive_ = false;
1161  nbits_ = 10;
1162  name_ = "VMTableInner" + TrackletConfigBuilder::LayerName(layerdisk) +
1163  TrackletConfigBuilder::LayerName(layerdisk + 1) + ".tab";
1164  }
1165 
1166  if (type == VMRTableType::inneroverlap) {
1167  positive_ = false;
1168  nbits_ = 10;
1170  ".tab";
1171  }
1172 
1173  if (type == VMRTableType::disk) {
1174  positive_ = false;
1175  nbits_ = 10;
1176  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1177  }
1178  }
1179 
1180  writeTable();
1181 }
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:191
unsigned int NLONGVMBITS() const
Definition: Settings.h:368
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:183
bool combined() const
Definition: Settings.h:270
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
double zlength() const
Definition: Settings.h:133
double rmindiskvm() const
Definition: Settings.h:355
double dzmax() const
Definition: Settings.h:138
assert(be >=bs)
unsigned int NLONGVMBINS() const
Definition: Settings.h:369
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:186
Divides< A, C > D1
Definition: Factorize.h:136
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
double drmax() const
Definition: Settings.h:137
double rmaxdisk() const
Definition: Settings.h:134
unsigned int nbits_
Definition: TrackletLUT.h:146
double rmaxdiskvm() const
Definition: Settings.h:356
int getVMRLookup(unsigned int layerdisk, double z, double r, double dz, double dr, int iseed=-1) const
std::vector< int > table_
Definition: TrackletLUT.h:144
const int NBINS
void writeTable() const
unsigned int vmrlutzbits(unsigned int layerdisk) const
Definition: Settings.h:190
constexpr int N_LAYER
Definition: Settings.h:25

◆ lookup()

int TrackletLUT::lookup ( unsigned int  index) const

◆ operator=()

TrackletLUT& trklet::TrackletLUT::operator= ( const TrackletLUT other)
inline

Definition at line 30 of file TrackletLUT.h.

References name_, nbits_, trackingPlots::other, positive_, and table_.

30  {
31  name_ = other.name_;
32  table_ = other.table_;
33  nbits_ = other.nbits_;
34  positive_ = other.positive_;
35 
36  return *this;
37  }
std::string name_
Definition: TrackletLUT.h:142
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< int > table_
Definition: TrackletLUT.h:144

◆ size()

unsigned int trklet::TrackletLUT::size ( void  ) const
inline

Definition at line 117 of file TrackletLUT.h.

References table_.

Referenced by ntupleDataFormat._Collection::__iter__(), ntupleDataFormat._Collection::__len__(), and trklet::VMStubsTEMemory::addVMStub().

117 { return table_.size(); }
std::vector< int > table_
Definition: TrackletLUT.h:144

◆ writeTable()

void TrackletLUT::writeTable ( ) const

Definition at line 1399 of file TrackletLUT.cc.

References TauDecayModes::dec, Exception, mps_fire::i, Skims_PA_cff::name, name_, nbits_, trklet::openfile(), MillePedeFileConverter_cfg::out, positive_, settings_, table_, trklet::Settings::tablePath(), ApeEstimator_cff::width, and trklet::Settings::writeTable().

Referenced by initBendMatch(), initmatchcut(), initPhiCorrTable(), initProjectionBend(), initProjectionDiskRadius(), initteptlut(), initTPlut(), initTPregionlut(), and initVMRTable().

1399  {
1400  if (name_.empty()) {
1401  return;
1402  }
1403 
1404  if (nbits_ == 0) {
1405  throw cms::Exception("LogicError") << "Error in " << __FILE__ << " nbits_ == 0 ";
1406  }
1407 
1408  if (!settings_.writeTable()) {
1409  return;
1410  }
1411 
1412  ofstream out = openfile(settings_.tablePath(), name_, __FILE__, __LINE__);
1413 
1414  out << "{" << endl;
1415  for (unsigned int i = 0; i < table_.size(); i++) {
1416  if (i != 0) {
1417  out << "," << endl;
1418  }
1419 
1420  int itable = table_[i];
1421  if (positive_) {
1422  if (table_[i] < 0) {
1423  itable = (1 << nbits_) - 1;
1424  }
1425  }
1426 
1427  out << itable;
1428  }
1429  out << endl << "};" << endl;
1430  out.close();
1431 
1432  string name = name_;
1433 
1434  name[name_.size() - 3] = 'd';
1435  name[name_.size() - 2] = 'a';
1436  name[name_.size() - 1] = 't';
1437 
1438  out = openfile(settings_.tablePath(), name, __FILE__, __LINE__);
1439 
1440  int width = (nbits_ + 3) / 4;
1441 
1442  for (unsigned int i = 0; i < table_.size(); i++) {
1443  int itable = table_[i];
1444  if (positive_) {
1445  if (table_[i] < 0) {
1446  itable = (1 << nbits_) - 1;
1447  }
1448  }
1449 
1450  out << uppercase << setfill('0') << setw(width) << hex << itable << dec << endl;
1451  }
1452 
1453  out.close();
1454 }
bool writeTable() const
Definition: Settings.h:201
const Settings & settings_
Definition: TrackletLUT.h:120
std::string tablePath() const
Definition: Settings.h:205
std::string name_
Definition: TrackletLUT.h:142
unsigned int nbits_
Definition: TrackletLUT.h:146
std::vector< int > table_
Definition: TrackletLUT.h:144
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:154

Member Data Documentation

◆ name_

std::string trklet::TrackletLUT::name_
private

◆ nbits_

unsigned int trklet::TrackletLUT::nbits_
private

◆ positive_

bool trklet::TrackletLUT::positive_
private

◆ settings_

const Settings& trklet::TrackletLUT::settings_
private

◆ setup_

const tt::Setup* trklet::TrackletLUT::setup_
private

◆ table_

std::vector<int> trklet::TrackletLUT::table_
private