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, bool combined=true)
 
int lookup (unsigned int index) const
 
unsigned int nbits () 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:122
unsigned int nbits_
Definition: TrackletLUT.h:148
const tt::Setup * setup_
Definition: TrackletLUT.h:123

◆ ~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(), DMR_cfg::cut, TTStubAlgorithm_official< T >::degradeBend(), HLT_2024v14_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:295
const Settings & settings_
Definition: TrackletLUT.h:122
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:123
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 1390 of file TrackletLUT.cc.

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

Referenced by initPhiCorrTable().

1391  {
1392  bool psmodule = layerdisk < N_PSLAYER;
1393 
1394  //for the rbin - calculate the distance to the nominal layer radius
1395  double Delta = (irbin + 0.5) * dr - drmax;
1396 
1397  //calculate the phi correction - this is a somewhat approximate formula
1398  double drnom = 0.18; //This is the nominal module separation for which bend is referenced
1399  double dphi = (Delta / drnom) * bend * settings_.stripPitch(psmodule) / rmean;
1400 
1401  double kphi = psmodule ? settings_.kphi() : settings_.kphi1();
1402 
1403  int idphi = dphi / kphi;
1404 
1405  return idphi;
1406 }
double kphi1() const
Definition: Settings.h:346
const Settings & settings_
Definition: TrackletLUT.h:122
double stripPitch(bool isPSmodule) const
Definition: Settings.h:291
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double kphi() const
Definition: Settings.h:345

◆ 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:122
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:371
double z() const
Definition: SensorModule.h:49
const tt::Setup * setup_
Definition: TrackletLUT.h:123
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:122
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:371

◆ getVMRLookup()

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

Definition at line 1193 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, WZElectronSkims53X_cff::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(), ppsModifySingularModes_cfi::z1, ppsModifySingularModes_cfi::z2, trklet::Settings::zlength(), SiStripMonitorCluster_cfi::zmax, trklet::Settings::zmean(), and SiStripMonitorCluster_cfi::zmin.

Referenced by initVMRTable().

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

◆ 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(), DMR_cfg::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(), 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:295
double bendcutME(unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:496
unsigned int nbits() const
Definition: TrackletLUT.h:119
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
const Settings & settings_
Definition: TrackletLUT.h:122
static std::string LayerName(unsigned int ilayer)
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
double krinvpars() const
Definition: Settings.h:432
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:486
std::string name_
Definition: TrackletLUT.h:144
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
int nbitsrinv() const
Definition: Settings.h:381
double stripPitch(bool isPSmodule) const
Definition: Settings.h:291
double bendcutme(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:480
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:478
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:148
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:146
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
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:450
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:349
double zmatchcut(unsigned int iSeed, unsigned int ilayer) const
Definition: Settings.h:167
double kphi1() const
Definition: Settings.h:346
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:277
const Settings & settings_
Definition: TrackletLUT.h:122
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:144
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:351
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:148
int nbitsalpha() const
Definition: Settings.h:229
std::vector< int > table_
Definition: TrackletLUT.h:146
double krprojshiftdisk() const
Definition: Settings.h:448
double kphi() const
Definition: Settings.h:345
void writeTable() const
constexpr int N_LAYER
Definition: Settings.h:25

◆ initPhiCorrTable()

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

Definition at line 1351 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().

1351  {
1352  bool psmodule = layerdisk < N_PSLAYER;
1353 
1354  unsigned int bendbits = psmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
1355 
1356  unsigned int rbins = (1 << rbits);
1357 
1358  double rmean = settings_.rmean(layerdisk);
1359  double drmax = settings_.drmax();
1360 
1361  double dr = 2.0 * drmax / rbins;
1362 
1363  std::vector<std::array<double, 2>> bend_vals;
1364 
1365  if (settings_.useCalcBendCuts) {
1366  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, psmodule);
1367  bend_vals = getBendCut(layerdisk, sm, psmodule);
1368 
1369  } else {
1370  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1371  bend_vals.push_back({{settings_.benddecode(ibend, layerdisk, layerdisk < N_PSLAYER), 0}});
1372  }
1373  }
1374 
1375  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1376  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1377  double bend = -bend_vals[ibend][0];
1378  int value = getphiCorrValue(layerdisk, bend, irbin, rmean, dr, drmax);
1379  table_.push_back(value);
1380  }
1381  }
1382 
1383  name_ = "VMPhiCorrL" + std::to_string(layerdisk + 1) + ".tab";
1384  nbits_ = 14;
1385  positive_ = false;
1386 
1387  writeTable();
1388 }
const Settings & settings_
Definition: TrackletLUT.h:122
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:486
std::string name_
Definition: TrackletLUT.h:144
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:148
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:146
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
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:450
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:295
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:277
const Settings & settings_
Definition: TrackletLUT.h:122
static std::string LayerName(unsigned int ilayer)
std::string name_
Definition: TrackletLUT.h:144
double stripPitch(bool isPSmodule) const
Definition: Settings.h:291
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:148
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:96
std::vector< int > table_
Definition: TrackletLUT.h:146
double krprojshiftdisk() const
Definition: Settings.h:448
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:334

◆ 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:122
double rmindiskvm() const
Definition: Settings.h:362
assert(be >=bs)
uint64_t word
std::string name_
Definition: TrackletLUT.h:144
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:148
std::vector< int > table_
Definition: TrackletLUT.h:146
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(), DMR_cfg::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:295
const Settings & settings_
Definition: TrackletLUT.h:122
double zlength() const
Definition: Settings.h:133
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
double rmindiskvm() const
Definition: Settings.h:362
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:486
std::array< double, 2 > getTanRange(const std::vector< const tt::SensorModule *> &sensorModules)
Definition: TrackletLUT.cc:90
std::string name_
Definition: TrackletLUT.h:144
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:291
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:478
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:371
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:148
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:363
double rinvcutte() const
Definition: Settings.h:360
double zmaxdisk(unsigned int iDisk) const
Definition: Settings.h:181
std::vector< int > table_
Definition: TrackletLUT.h:146
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
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:450
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:488
constexpr int N_LAYER
Definition: Settings.h:25
double rcrit() const
Definition: Settings.h:334

◆ 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(), DMR_cfg::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:295
double dphisectorHG() const
Definition: Settings.h:327
const Settings & settings_
Definition: TrackletLUT.h:122
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:362
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:486
std::array< double, 2 > getTanRange(const std::vector< const tt::SensorModule *> &sensorModules)
Definition: TrackletLUT.cc:90
std::string name_
Definition: TrackletLUT.h:144
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:291
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:478
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:371
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbits_
Definition: TrackletLUT.h:148
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:363
double rinvcutte() const
Definition: Settings.h:360
double zmaxdisk(unsigned int iDisk) const
Definition: Settings.h:181
std::vector< int > table_
Definition: TrackletLUT.h:146
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
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:450
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:488
constexpr int N_LAYER
Definition: Settings.h:25
double rcrit() const
Definition: Settings.h:334

◆ 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:122
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:144
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:110
unsigned int nbits_
Definition: TrackletLUT.h:148
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:142
std::vector< int > table_
Definition: TrackletLUT.h:146
void writeTable() const

◆ initVMRTable()

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

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  // The extra "combined" flag is used to disable the flag from settings_
1030  // in special cases. In particular, in the case of the triplet seeds, the
1031  // VMRouterCM and TrackletProcessorDisplaced currently use the older LUTs
1032  // that were used with the non-combined modules. Once these modules are
1033  // updated, this extra flag can be removed.
1034  if (settings_.combined() && combined) {
1035  int iznew = izbin - (1 << (zbits - 1));
1036  if (iznew < 0)
1037  iznew += (1 << zbits);
1038  assert(iznew >= 0);
1039  assert(iznew < (1 << zbits));
1040  z = zmin + (iznew + 0.5) * dz;
1041  if (layerdisk < N_LAYER) {
1042  int irnew = irbin - (1 << (rbits - 1));
1043  if (irnew < 0)
1044  irnew += (1 << rbits);
1045  assert(irnew >= 0);
1046  assert(irnew < (1 << rbits));
1047  r = rmin + (irnew + 0.5) * dr;
1048  }
1049  }
1050 
1051  unsigned int NRING =
1052  5; //number of 2S rings in disks. This is multiplied below by two since we have two halfs of a module
1053  if (layerdisk >= N_LAYER && irbin < 2 * NRING) //special case for the tabulated radii in 2S disks
1054  r = (layerdisk < N_LAYER + 2) ? settings_.rDSSinner(irbin) : settings_.rDSSouter(irbin);
1055 
1056  int bin;
1057  if (layerdisk < N_LAYER) {
1058  double zproj = z * settings_.rmean(layerdisk) / r;
1059  bin = NBINS * (zproj + settings_.zlength()) / (2 * settings_.zlength());
1060  } else {
1061  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1062  bin = NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
1063  }
1064  if (bin < 0)
1065  bin = 0;
1066  if (bin >= NBINS)
1067  bin = NBINS - 1;
1068 
1069  if (type == VMRTableType::me) {
1070  table_.push_back(bin);
1071  }
1072 
1073  if (type == VMRTableType::disk) {
1074  if (layerdisk >= N_LAYER) {
1075  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1076  bin = 0.5 * NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1077  //bin value of zero indicates that stub is out of range
1078  if (bin < 0)
1079  bin = 0;
1080  if (bin >= NBINS / 2)
1081  bin = 0;
1082  table_.push_back(bin);
1083  }
1084  }
1085 
1086  if (type == VMRTableType::inner) {
1087  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L5 ||
1088  layerdisk == LayerDisk::D1 || layerdisk == LayerDisk::D3) {
1089  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr));
1090  }
1091  if (layerdisk == LayerDisk::L2) {
1092  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr, Seed::L2L3));
1093  }
1094  }
1095 
1096  if (type == VMRTableType::inneroverlap) {
1097  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L2) {
1098  table_.push_back(getVMRLookup(6, z, r, dz, dr, layerdisk + 6));
1099  }
1100  }
1101 
1102  if (type == VMRTableType::innerthird) {
1103  if (layerdisk == LayerDisk::L2) { //projection from L2 to D1 for L2L3D1 seeding
1104  table_.push_back(getVMRLookup(LayerDisk::D1, z, r, dz, dr, Seed::L2L3D1));
1105  }
1106 
1107  if (layerdisk == LayerDisk::L5) { //projection from L5 to L4 for L5L6L4 seeding
1108  table_.push_back(getVMRLookup(LayerDisk::L4, z, r, dz, dr));
1109  }
1110 
1111  if (layerdisk == LayerDisk::L3) { //projection from L3 to L5 for L3L4L2 seeding
1112  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1113  }
1114 
1115  if (layerdisk == LayerDisk::D1) { //projection from D1 to L2 for D1D2L2 seeding
1116  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1117  }
1118  }
1119  }
1120  }
1121 
1122  // The extra "combined" flag is used to disable the flag from settings_ in
1123  // special cases. In particular, in the case of the triplet seeds, the
1124  // VMRouterCM and TrackletProcessorDisplaced currently use the older LUTs
1125  // that were used with the non-combined modules. Once these modules are
1126  // updated, this extra flag can be removed.
1127  if (settings_.combined() && combined) {
1128  if (type == VMRTableType::me) {
1129  nbits_ = 2 * settings_.NLONGVMBITS();
1130  positive_ = false;
1131  name_ = "VMRME_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1132  }
1133  if (type == VMRTableType::disk) {
1134  nbits_ = 2 * settings_.NLONGVMBITS();
1135  positive_ = false;
1136  name_ = "VMRTE_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1137  }
1138  if (type == VMRTableType::inner) {
1139  positive_ = true;
1140  nbits_ = 10;
1141  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk) + TrackletConfigBuilder::LayerName(layerdisk + 1) +
1142  ".tab";
1143  }
1144 
1145  if (type == VMRTableType::inneroverlap) {
1146  positive_ = true;
1147  nbits_ = 10;
1149  }
1150 
1151  } else {
1152  if (type == VMRTableType::me) {
1153  //This if a hack where the same memory is used in both ME and TE modules
1154  if (layerdisk == LayerDisk::L2 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L4 ||
1155  layerdisk == LayerDisk::L6) {
1156  nbits_ = 6;
1157  positive_ = false;
1158  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1159  writeTable();
1160  }
1161 
1162  assert(region >= 0);
1163  char cregion = 'A' + region;
1164  name_ = "VMR_" + TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_finebin.tab";
1165  nbits_ = 6;
1166  positive_ = false;
1167  }
1168 
1169  if (type == VMRTableType::inner) {
1170  positive_ = false;
1171  nbits_ = 10;
1172  name_ = "VMTableInner" + TrackletConfigBuilder::LayerName(layerdisk) +
1173  TrackletConfigBuilder::LayerName(layerdisk + 1) + ".tab";
1174  }
1175 
1176  if (type == VMRTableType::inneroverlap) {
1177  positive_ = false;
1178  nbits_ = 10;
1180  ".tab";
1181  }
1182 
1183  if (type == VMRTableType::disk) {
1184  positive_ = false;
1185  nbits_ = 10;
1186  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1187  }
1188  }
1189 
1190  writeTable();
1191 }
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:191
unsigned int NLONGVMBITS() const
Definition: Settings.h:375
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:183
bool combined() const
Definition: Settings.h:277
const Settings & settings_
Definition: TrackletLUT.h:122
static std::string LayerName(unsigned int ilayer)
double zlength() const
Definition: Settings.h:133
double rmindiskvm() const
Definition: Settings.h:362
double dzmax() const
Definition: Settings.h:138
assert(be >=bs)
unsigned int NLONGVMBINS() const
Definition: Settings.h:376
std::string name_
Definition: TrackletLUT.h:144
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:148
double rmaxdiskvm() const
Definition: Settings.h:363
int getVMRLookup(unsigned int layerdisk, double z, double r, double dz, double dr, int iseed=-1) const
std::vector< int > table_
Definition: TrackletLUT.h:146
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

◆ nbits()

unsigned int trklet::TrackletLUT::nbits ( ) const
inline

Definition at line 119 of file TrackletLUT.h.

References nbits_.

Referenced by trklet::TrackletProcessorDisplaced::execute(), trklet::VMRouterCM::execute(), and initBendMatch().

119 { return nbits_; }
unsigned int nbits_
Definition: TrackletLUT.h:148

◆ 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:144
unsigned int nbits_
Definition: TrackletLUT.h:148
std::vector< int > table_
Definition: TrackletLUT.h:146

◆ 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:146

◆ writeTable()

void TrackletLUT::writeTable ( ) const

Definition at line 1409 of file TrackletLUT.cc.

References TauDecayModes::dec, Exception, mps_fire::i, mergeVDriftHistosByStation::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().

1409  {
1410  if (name_.empty()) {
1411  return;
1412  }
1413 
1414  if (nbits_ == 0) {
1415  throw cms::Exception("LogicError") << "Error in " << __FILE__ << " nbits_ == 0 ";
1416  }
1417 
1418  if (!settings_.writeTable()) {
1419  return;
1420  }
1421 
1422  ofstream out = openfile(settings_.tablePath(), name_, __FILE__, __LINE__);
1423 
1424  out << "{" << endl;
1425  for (unsigned int i = 0; i < table_.size(); i++) {
1426  if (i != 0) {
1427  out << "," << endl;
1428  }
1429 
1430  int itable = table_[i];
1431  if (positive_) {
1432  if (table_[i] < 0) {
1433  itable = (1 << nbits_) - 1;
1434  }
1435  }
1436 
1437  out << itable;
1438  }
1439  out << endl << "};" << endl;
1440  out.close();
1441 
1442  string name = name_;
1443 
1444  name[name_.size() - 3] = 'd';
1445  name[name_.size() - 2] = 'a';
1446  name[name_.size() - 1] = 't';
1447 
1448  out = openfile(settings_.tablePath(), name, __FILE__, __LINE__);
1449 
1450  int width = (nbits_ + 3) / 4;
1451 
1452  for (unsigned int i = 0; i < table_.size(); i++) {
1453  int itable = table_[i];
1454  if (positive_) {
1455  if (table_[i] < 0) {
1456  itable = (1 << nbits_) - 1;
1457  }
1458  }
1459 
1460  out << uppercase << setfill('0') << setw(width) << hex << itable << dec << endl;
1461  }
1462 
1463  out.close();
1464 }
bool writeTable() const
Definition: Settings.h:201
const Settings & settings_
Definition: TrackletLUT.h:122
std::string tablePath() const
Definition: Settings.h:205
std::string name_
Definition: TrackletLUT.h:144
unsigned int nbits_
Definition: TrackletLUT.h:148
std::vector< int > table_
Definition: TrackletLUT.h:146
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