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.

12 : settings_(settings), setup_(settings.setup()) {}
const tt::Setup * setup() const
Definition: Settings.h:70
const Settings & settings_
Definition: TrackletLUT.h:120
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 115 of file TrackletLUT.cc.

References funct::abs(), trklet::convertFEBend(), DMR_cfg::cut, TTStubAlgorithm_official< T >::degradeBend(), HLT_2023v12_cff::distance, tt::Setup::encodingBend(), spr::find(), mps_fire::i, trklet::N_LAYER, trklet::Settings::sensorSpacing2S(), settings_, setup_, tt::Setup::stubAlgorithm(), and svgfig::window().

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

118  {
119  //Finds range of bendstrip for given SensorModules as a function of the encoded bend. Returns in format (mid, half_range).
120  //This uses the stub windows provided by T. Schuh's SensorModule class to determine the bend encoding. TODO test changes in stub windows
121  //Any other change to the bend encoding requires changes here, perhaps a function that given (FEbend, isPS, stub window) and outputs an encoded bend
122  //would be useful for consistency.
123 
124  unsigned int bendbits = isPS ? 3 : 4;
125 
126  std::vector<std::array<double, 2>> bendpars; // mid, cut
127  std::vector<std::array<double, 2>> bendminmax; // min, max
128 
129  //Initialize array
130  for (int i = 0; i < 1 << bendbits; i++) {
131  bendpars.push_back({{99, 0}});
132  bendminmax.push_back({{99, -99}});
133  }
134 
135  //Loop over modules
136  for (auto sm : sensorModules) {
137  int window = sm->windowSize(); //Half-strip units
138  const vector<double>& encodingBend = setup_->encodingBend(window, isPS);
139 
140  //Loop over FEbends
141  for (int ibend = 0; ibend <= 2 * window; ibend++) {
142  int FEbend = ibend - window; //Half-strip units
143  double BEbend = setup_->stubAlgorithm()->degradeBend(isPS, window, FEbend); //Full strip units
144 
145  const auto pos = std::find(encodingBend.begin(), encodingBend.end(), std::abs(BEbend));
146  int bend = std::signbit(BEbend) ? (1 << bendbits) - distance(encodingBend.begin(), pos)
147  : distance(encodingBend.begin(), pos); //Encoded bend
148 
149  double bendmin = FEbend / 2.0 - FEbendcut; //Full Strip units
150  double bendmax = FEbend / 2.0 + FEbendcut;
151 
152  //Convert to bendstrip, calculate at module edges (z min, r max) and (z max, r min)
153  double z_mod[2];
154  double r_mod[2];
155 
156  z_mod[0] = std::abs(sm->z()) + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z max
157  z_mod[1] = std::abs(sm->z()) - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z min
158 
159  r_mod[0] = sm->r() - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r min
160  r_mod[1] = sm->r() + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r max
161 
162  for (int i = 0; i < 2; i++) { // 2 points to cover range in tan(theta) = z/r
163  double CF = std::abs(sm->sinTilt()) * (z_mod[i] / r_mod[i]) + sm->cosTilt();
164 
165  double cbendmin =
166  convertFEBend(bendmin, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
167  double cbendmax =
168  convertFEBend(bendmax, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
169 
170  if (cbendmin < bendminmax[bend][0])
171  bendminmax.at(bend)[0] = cbendmin;
172  if (cbendmax > bendminmax[bend][1])
173  bendminmax.at(bend)[1] = cbendmax;
174  }
175  }
176  }
177  //Convert min, max to mid, cut for ease of use
178  for (int i = 0; i < 1 << bendbits; i++) {
179  double mid = (bendminmax[i][1] + bendminmax[i][0]) / 2;
180  double cut = (bendminmax[i][1] - bendminmax[i][0]) / 2;
181 
182  bendpars[i][0] = mid;
183  bendpars[i][1] = cut;
184  }
185 
186  return bendpars;
187 }
double sensorSpacing2S() const
Definition: Settings.h:286
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:373
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:516
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 1361 of file TrackletLUT.cc.

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

Referenced by initPhiCorrTable().

1362  {
1363  bool psmodule = layerdisk < N_PSLAYER;
1364 
1365  //for the rbin - calculate the distance to the nominal layer radius
1366  double Delta = (irbin + 0.5) * dr - drmax;
1367 
1368  //calculate the phi correction - this is a somewhat approximate formula
1369  double drnom = 0.18; //This is the nominal module separation for which bend is referenced
1370  double dphi = (Delta / drnom) * bend * settings_.stripPitch(psmodule) / rmean;
1371 
1372  double kphi = psmodule ? settings_.kphi() : settings_.kphi1();
1373 
1374  int idphi = dphi / kphi;
1375 
1376  return idphi;
1377 }
double kphi1() const
Definition: Settings.h:333
const Settings & settings_
Definition: TrackletLUT.h:120
double stripPitch(bool isPSmodule) const
Definition: Settings.h:282
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double kphi() const
Definition: Settings.h:332

◆ 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 14 of file TrackletLUT.cc.

References funct::abs(), cms::cuda::assert(), Reference_intrackfit_cff::barrel, dumpMFGeometry_cfg::delta, Exception, trklet::N_LAYER, tt::SensorModule::r(), tt::Setup::sensorModules(), settings_, setup_, 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().

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

References funct::abs(), settings_, trklet::tan_theta(), trklet::Settings::z0cut(), SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

Referenced by initteptlut(), and initTPlut().

89  {
90  //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
91 
92  std::array<double, 2> tan_range = {{2147483647, 0}}; //(tan_min, tan_max)
93 
94  double z0 = settings_.z0cut();
95 
96  for (auto sm : sensorModules) {
97  const double term = (sm->numColumns() / 2 - 0.5) * sm->pitchCol();
98  double rmin = sm->r() - term * std::abs(sm->sinTilt());
99  double rmax = sm->r() + term * std::abs(sm->sinTilt());
100 
101  double zmin = std::abs(sm->z()) - term * sm->cosTilt();
102  double zmax = std::abs(sm->z()) + term * sm->cosTilt();
103 
104  double mod_tan_max = tan_theta(rmin, zmax, z0, true); //(r, z, z0, bool z0_max), z0_max measures from +/- z0
105  double mod_tan_min = tan_theta(rmax, zmin, z0, false);
106 
107  if (mod_tan_min < tan_range[0])
108  tan_range[0] = mod_tan_min;
109  if (mod_tan_max > tan_range[1])
110  tan_range[1] = mod_tan_max;
111  }
112  return tan_range;
113 }
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:358

◆ getVMRLookup()

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

Definition at line 1164 of file TrackletLUT.cc.

References funct::abs(), cms::cuda::assert(), 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, gpuPixelDoublets::z0cut, trklet::Settings::z0cut(), testProducerWithPsetDescEmpty_cfi::z2, trklet::Settings::zlength(), SiStripMonitorCluster_cfi::zmax, trklet::Settings::zmean(), and SiStripMonitorCluster_cfi::zmin.

Referenced by initVMRTable().

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

◆ initBendMatch()

void TrackletLUT::initBendMatch ( unsigned int  layerdisk)

Definition at line 888 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_, trklet::Settings::nbitsrinv(), trklet::NRINVBITS, positive_, trklet::rinv(), trklet::Settings::rmean(), trklet::Settings::sensorSpacing2S(), settings_, trklet::Settings::stripPitch(), table_, trklet::Settings::useCalcBendCuts, and writeTable().

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

888  {
889  unsigned int nrinv = NRINVBITS;
890  double rinvhalf = 0.5 * ((1 << nrinv) - 1);
891 
892  bool barrel = layerdisk < N_LAYER;
893 
894  if (barrel) {
895  bool isPSmodule = layerdisk < N_PSLAYER;
896  double stripPitch = settings_.stripPitch(isPSmodule);
897  unsigned int nbits = isPSmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
898 
899  std::vector<std::array<double, 2>> bend_cuts;
900 
902  double bendcutFE = settings_.bendcutME(layerdisk, isPSmodule);
903  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, isPSmodule);
904  bend_cuts = getBendCut(layerdisk, sm, isPSmodule, bendcutFE);
905 
906  } else {
907  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
908  double mid = settings_.benddecode(ibend, layerdisk, isPSmodule);
909  double cut = settings_.bendcutte(ibend, layerdisk, isPSmodule);
910  bend_cuts.push_back({{mid, cut}});
911  }
912  }
913 
914  for (unsigned int irinv = 0; irinv < (1u << nrinv); irinv++) {
915  double rinv = (irinv - rinvhalf) * (1 << (settings_.nbitsrinv() - nrinv)) * settings_.krinvpars();
916 
917  double projbend = bendstrip(settings_.rmean(layerdisk), rinv, stripPitch, settings_.sensorSpacing2S());
918  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
919  double mid = bend_cuts[ibend][0];
920  double cut = bend_cuts[ibend][1];
921 
922  double pass = mid + cut > projbend && mid - cut < projbend;
923 
924  table_.push_back(pass);
925  }
926  }
927  } else {
928  std::vector<std::array<double, 2>> bend_cuts_2S;
929  std::vector<std::array<double, 2>> bend_cuts_PS;
930 
932  double bendcutFE2S = settings_.bendcutME(layerdisk, false);
933  std::vector<const tt::SensorModule*> sm2S = getSensorModules(layerdisk, false);
934  bend_cuts_2S = getBendCut(layerdisk, sm2S, false, bendcutFE2S);
935 
936  double bendcutFEPS = settings_.bendcutME(layerdisk, true);
937  std::vector<const tt::SensorModule*> smPS = getSensorModules(layerdisk, true);
938  bend_cuts_PS = getBendCut(layerdisk, smPS, true, bendcutFEPS);
939 
940  } else {
941  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
942  double mid = settings_.benddecode(ibend, layerdisk, false);
943  double cut = settings_.bendcutme(ibend, layerdisk, false);
944  bend_cuts_2S.push_back({{mid, cut}});
945  }
946  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
947  double mid = settings_.benddecode(ibend, layerdisk, true);
948  double cut = settings_.bendcutme(ibend, layerdisk, true);
949  bend_cuts_PS.push_back({{mid, cut}});
950  }
951  }
952 
953  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) {
954  double projbend = 0.5 * (iprojbend - rinvhalf);
955  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
956  double mid = bend_cuts_2S[ibend][0];
957  double cut = bend_cuts_2S[ibend][1];
958 
959  double pass = mid + cut > projbend && mid - cut < projbend;
960 
961  table_.push_back(pass);
962  }
963  }
964  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) { //Should this be binned in r?
965  double projbend = 0.5 * (iprojbend - rinvhalf);
966  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
967  double mid = bend_cuts_PS[ibend][0];
968  double cut = bend_cuts_PS[ibend][1];
969 
970  double pass = mid + cut > projbend && mid - cut < projbend;
971 
972  table_.push_back(pass);
973  }
974  }
975  }
976 
977  positive_ = false;
978 
979  name_ = "METable_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
980 
981  writeTable();
982 }
double sensorSpacing2S() const
Definition: Settings.h:286
double bendcutME(unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:483
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:437
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:419
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
bool useCalcBendCuts
Definition: Settings.h:473
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:171
int nbitsrinv() const
Definition: Settings.h:368
double stripPitch(bool isPSmodule) const
Definition: Settings.h:282
double bendcutme(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:467
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:465
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
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:115
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:14
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 189 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_, 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().

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

◆ initPhiCorrTable()

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

Definition at line 1322 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_, table_, to_string(), trklet::Settings::useCalcBendCuts, and writeTable().

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

1322  {
1323  bool psmodule = layerdisk < N_PSLAYER;
1324 
1325  unsigned int bendbits = psmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
1326 
1327  unsigned int rbins = (1 << rbits);
1328 
1329  double rmean = settings_.rmean(layerdisk);
1330  double drmax = settings_.drmax();
1331 
1332  double dr = 2.0 * drmax / rbins;
1333 
1334  std::vector<std::array<double, 2>> bend_vals;
1335 
1336  if (settings_.useCalcBendCuts) {
1337  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, psmodule);
1338  bend_vals = getBendCut(layerdisk, sm, psmodule);
1339 
1340  } else {
1341  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1342  bend_vals.push_back({{settings_.benddecode(ibend, layerdisk, layerdisk < N_PSLAYER), 0}});
1343  }
1344  }
1345 
1346  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1347  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1348  double bend = -bend_vals[ibend][0];
1349  int value = getphiCorrValue(layerdisk, bend, irbin, rmean, dr, drmax);
1350  table_.push_back(value);
1351  }
1352  }
1353 
1354  name_ = "VMPhiCorrL" + std::to_string(layerdisk + 1) + ".tab";
1355  nbits_ = 14;
1356  positive_ = false;
1357 
1358  writeTable();
1359 }
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:437
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:473
std::string name_
Definition: TrackletLUT.h:142
double rmean(unsigned int iLayer) const
Definition: Settings.h:171
Definition: value.py:1
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double drmax() const
Definition: Settings.h:135
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:115
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:14
void writeTable() const

◆ initProjectionBend()

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

Definition at line 789 of file TrackletLUT.cc.

References trklet::bendstrip(), trklet::Settings::combined(), trklet::Settings::krprojshiftdisk(), trklet::TrackletConfigBuilder::LayerName(), trklet::N_LAYER, name_, 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().

792  {
793  unsigned int nsignbins = 2;
794  unsigned int nrbins = 1 << (nrbits);
795  unsigned int nphiderbins = 1 << (nphiderbits);
796 
797  for (unsigned int isignbin = 0; isignbin < nsignbins; isignbin++) {
798  for (unsigned int irbin = 0; irbin < nrbins; irbin++) {
799  int ir = irbin;
800  if (ir > (1 << (nrbits - 1)))
801  ir -= (1 << nrbits);
802  ir = ir << (settings_.nrbitsstub(N_LAYER) - nrbits);
803  for (unsigned int iphiderbin = 0; iphiderbin < nphiderbins; iphiderbin++) {
804  int iphider = iphiderbin;
805  if (iphider > (1 << (nphiderbits - 1)))
806  iphider -= (1 << nphiderbits);
807  iphider = iphider << (settings_.nbitsphiprojderL123() - nphiderbits);
808 
809  double rproj = ir * settings_.krprojshiftdisk();
810  double phider = iphider * k_phider;
811  double t = settings_.zmean(idisk) / rproj;
812 
813  if (isignbin)
814  t = -t;
815 
816  double rinv = -phider * (2.0 * t);
817 
818  double stripPitch = (rproj < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
819  double bendproj = bendstrip(rproj, rinv, stripPitch, settings_.sensorSpacing2S());
820 
821  constexpr double maxbend = (1 << NRINVBITS) - 1;
822 
823  int ibendproj = 2.0 * bendproj + 0.5 * maxbend;
824  if (ibendproj < 0)
825  ibendproj = 0;
826  if (ibendproj > maxbend)
827  ibendproj = maxbend;
828 
829  table_.push_back(ibendproj);
830  }
831  }
832  }
833 
834  positive_ = false;
835  name_ = settings_.combined() ? "MP_" : "PR_";
836  name_ += "ProjectionBend_" + TrackletConfigBuilder::LayerName(N_LAYER + idisk) + ".tab";
837 
838  writeTable();
839 }
double sensorSpacing2S() const
Definition: Settings.h:286
unsigned int nrbitsstub(unsigned int layerdisk) const
Definition: Settings.h:91
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
bool combined() const
Definition: Settings.h:268
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:282
double zmean(unsigned int iDisk) const
Definition: Settings.h:174
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:94
std::vector< int > table_
Definition: TrackletLUT.h:144
double krprojshiftdisk() const
Definition: Settings.h:435
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:321

◆ initProjectionDiskRadius()

void TrackletLUT::initProjectionDiskRadius ( int  nrbits)

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

841  {
842  //When a projection to a disk is considered this offset and added and subtracted to calculate
843  //the bin the projection is pointing to. This is to account for resolution effects such that
844  //projections that are near a bin boundary will be assigned to both bins. The value (3 cm) should
845  //cover the uncertanty in the resolution.
846  double roffset = 3.0;
847 
848  for (unsigned int ir = 0; ir < (1u << nrbits); ir++) {
849  double r = ir * settings_.rmaxdisk() / (1u << nrbits);
850 
851  int rbin1 =
852  (1 << N_RZBITS) * (r - roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
853  int rbin2 =
854  (1 << N_RZBITS) * (r + roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
855 
856  if (rbin1 < 0) {
857  rbin1 = 0;
858  }
859  rbin2 = clamp(rbin2, 0, ((1 << N_RZBITS) - 1));
860 
861  assert(rbin1 <= rbin2);
862  assert(rbin2 - rbin1 <= 1);
863 
864  int d = rbin1 != rbin2;
865 
866  int finer =
867  (1 << (N_RZBITS + NFINERZBITS)) *
868  ((r - settings_.rmindiskvm()) - rbin1 * (settings_.rmaxdisk() - settings_.rmindiskvm()) / (1 << N_RZBITS)) /
870 
871  finer = clamp(finer, 0, ((1 << (NFINERZBITS + 1)) - 1));
872 
873  //Pack the data in a 8 bit word (ffffrrrd) where f is finer, r is rbin1, and d is difference
874  int N_DIFF_FLAG = 1; // Single bit for bool flag
875 
876  int word = (finer << (N_RZBITS + N_DIFF_FLAG)) + (rbin1 << N_DIFF_FLAG) + d;
877 
878  table_.push_back(word);
879  }
880 
881  //Size of the data word from above (8 bits)
882  nbits_ = NFINERZBITS + 1 + N_RZBITS + 1;
883  positive_ = true;
884  name_ = "ProjectionDiskRadius.tab";
885  writeTable();
886 }
constexpr unsigned int N_RZBITS
Definition: Settings.h:39
const Settings & settings_
Definition: TrackletLUT.h:120
double rmindiskvm() const
Definition: Settings.h:349
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:132
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 548 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_, 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().

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

◆ initTPlut()

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

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

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

◆ 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 491 of file TrackletLUT.cc.

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

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

498  {
499  int nirbits = 0;
500  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
501  nirbits = 3;
502  }
503 
504  unsigned int nbendbitsinner = 3;
505 
506  if (iSeed == Seed::L5L6) {
507  nbendbitsinner = 4;
508  }
509 
510  for (int innerfinephi = 0; innerfinephi < (1 << nbitsfinephi); innerfinephi++) {
511  for (int innerbend = 0; innerbend < (1 << nbendbitsinner); innerbend++) {
512  for (int ir = 0; ir < (1 << nirbits); ir++) {
513  unsigned int usereg = 0;
514  for (unsigned int ireg = 0; ireg < settings_.nvmte(1, iSeed); ireg++) {
515  bool match = false;
516  for (int ifinephiouter = 0; ifinephiouter < (1 << settings_.nfinephi(1, iSeed)); ifinephiouter++) {
517  int outerfinephi = iAllStub * (1 << (nbitsfinephi - settings_.nbitsallstubs(layerdisk2))) +
518  ireg * (1 << settings_.nfinephi(1, iSeed)) + ifinephiouter;
519  int idphi = outerfinephi - innerfinephi;
520  bool inrange = (idphi < (1 << (nbitsfinephidiff - 1))) && (idphi >= -(1 << (nbitsfinephidiff - 1)));
521  if (idphi < 0)
522  idphi = idphi + (1 << nbitsfinephidiff);
523  int idphi1 = idphi;
524  if (iSeed >= 4)
525  idphi1 = (idphi << 3) + ir;
526  int ptinnerindexnew = (idphi1 << nbendbitsinner) + innerbend;
527  match = match || (inrange && tplutinner.lookup(ptinnerindexnew));
528  }
529  if (match) {
530  usereg = usereg | (1 << ireg);
531  }
532  }
533 
534  table_.push_back(usereg);
535  }
536  }
537  }
538 
539  positive_ = false;
540  char cTP = 'A' + iTP;
541 
542  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk1) + TrackletConfigBuilder::LayerName(layerdisk2) + cTP +
543  "_usereg.tab";
544 
545  writeTable();
546 }
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:113
std::string name_
Definition: TrackletLUT.h:142
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:108
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:140
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 984 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().

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

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

1380  {
1381  if (!settings_.writeTable()) {
1382  return;
1383  }
1384 
1385  if (name_.empty()) {
1386  return;
1387  }
1388 
1389  ofstream out = openfile(settings_.tablePath(), name_, __FILE__, __LINE__);
1390 
1391  out << "{" << endl;
1392  for (unsigned int i = 0; i < table_.size(); i++) {
1393  if (i != 0) {
1394  out << "," << endl;
1395  }
1396 
1397  int itable = table_[i];
1398  if (positive_) {
1399  if (table_[i] < 0) {
1400  itable = (1 << nbits_) - 1;
1401  }
1402  }
1403 
1404  out << itable;
1405  }
1406  out << endl << "};" << endl;
1407  out.close();
1408 
1409  string name = name_;
1410 
1411  name[name_.size() - 3] = 'd';
1412  name[name_.size() - 2] = 'a';
1413  name[name_.size() - 1] = 't';
1414 
1415  out = openfile(settings_.tablePath(), name, __FILE__, __LINE__);
1416 
1417  int width = (nbits_ + 3) / 4;
1418 
1419  for (unsigned int i = 0; i < table_.size(); i++) {
1420  int itable = table_[i];
1421  if (positive_) {
1422  if (table_[i] < 0) {
1423  itable = (1 << nbits_) - 1;
1424  }
1425  }
1426 
1427  out << uppercase << setfill('0') << setw(width) << hex << itable << dec << endl;
1428  }
1429 
1430  out.close();
1431 }
bool writeTable() const
Definition: Settings.h:199
const Settings & settings_
Definition: TrackletLUT.h:120
std::string tablePath() const
Definition: Settings.h:203
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