CMS 3D CMS Logo

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

#include <VMRouterTable.h>

Public Member Functions

int getLookup (unsigned int layerdisk, double z, double r, int iseed=-1)
 
void init (unsigned int layerdisk)
 
int lookup (int zbin, int rbin)
 
int lookupdisk (int zbin, int rbin)
 
int lookupinner (int zbin, int rbin)
 
int lookupinneroverlap (int zbin, int rbin)
 
int lookupinnerThird (int zbin, int rbin)
 
 VMRouterTable (Settings const &settings)
 
 VMRouterTable (Settings const &settings, unsigned int layerdisk)
 
 ~VMRouterTable ()=default
 

Private Attributes

double dr_
 
double dz_
 
int rbins_
 
int rbits_
 
double rmax_
 
double rmin_
 
Settings const & settings_
 
std::vector< int > vmrtable_
 
std::vector< int > vmrtabletedisk_
 
std::vector< int > vmrtableteinner_
 
std::vector< int > vmrtableteinneroverlap_
 
std::vector< int > vmrtableteinnerThird_
 
int zbins_
 
int zbits_
 
double zmax_
 
double zmin_
 

Detailed Description

Definition at line 16 of file VMRouterTable.h.

Constructor & Destructor Documentation

◆ VMRouterTable() [1/2]

VMRouterTable::VMRouterTable ( Settings const &  settings)

Definition at line 10 of file VMRouterTable.cc.

10 : settings_(settings) {}

◆ VMRouterTable() [2/2]

VMRouterTable::VMRouterTable ( Settings const &  settings,
unsigned int  layerdisk 
)

Definition at line 12 of file VMRouterTable.cc.

12  : settings_(settings) {
13  init(layerdisk);
14 }

References init().

◆ ~VMRouterTable()

trklet::VMRouterTable::~VMRouterTable ( )
default

Member Function Documentation

◆ getLookup()

int VMRouterTable::getLookup ( unsigned int  layerdisk,
double  z,
double  r,
int  iseed = -1 
)

Definition at line 103 of file VMRouterTable.cc.

103  {
104  double z0cut = settings_.z0cut();
105 
106  if (layerdisk < N_LAYER) {
107  if (iseed == 1 && std::abs(z) < 52.0)
108  return -1;
109 
110  double rmean = settings_.rmean(layerdisk);
111 
112  double rratio1 = rmean / (r + 0.5 * dr_);
113  double rratio2 = rmean / (r - 0.5 * dr_);
114 
115  double z1 = (z - 0.5 * dz_) * rratio1 + z0cut * (rratio1 - 1.0);
116  double z2 = (z + 0.5 * dz_) * rratio1 + z0cut * (rratio1 - 1.0);
117  double z3 = (z - 0.5 * dz_) * rratio2 + z0cut * (rratio2 - 1.0);
118  double z4 = (z + 0.5 * dz_) * rratio2 + z0cut * (rratio2 - 1.0);
119  double z5 = (z - 0.5 * dz_) * rratio1 - z0cut * (rratio1 - 1.0);
120  double z6 = (z + 0.5 * dz_) * rratio1 - z0cut * (rratio1 - 1.0);
121  double z7 = (z - 0.5 * dz_) * rratio2 - z0cut * (rratio2 - 1.0);
122  double z8 = (z + 0.5 * dz_) * rratio2 - z0cut * (rratio2 - 1.0);
123 
124  double zmin = std::min({z1, z2, z3, z4, z5, z6, z7, z8});
125  double zmax = std::max({z1, z2, z3, z4, z5, z6, z7, z8});
126 
128 
129  int zbin1 = NBINS * (zmin + settings_.zlength()) / (2 * settings_.zlength());
130  int zbin2 = NBINS * (zmax + settings_.zlength()) / (2 * settings_.zlength());
131 
132  if (zbin1 >= NBINS)
133  return -1;
134  if (zbin2 < 0)
135  return -1;
136 
137  if (zbin2 >= NBINS)
138  zbin2 = NBINS - 1;
139  if (zbin1 < 0)
140  zbin1 = 0;
141 
142  // This is a 10 bit word:
143  // xxx|yyy|z|rrr
144  // xxx is the delta z window
145  // yyy is the z bin
146  // z is flag to look in next bin
147  // rrr first fine z bin
148  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
149  // and xxx is only 1,2, or 3
150  // should also reject xxx=0 as this means projection is outside range
151 
152  int value = zbin1 / 8;
153  value *= 2;
154  if (zbin2 / 8 - zbin1 / 8 > 0)
155  value += 1;
156  value *= 8;
157  value += (zbin1 & 7);
158  assert(value / 8 < 15);
159  int deltaz = zbin2 - zbin1;
160  if (deltaz > 7) {
161  deltaz = 7;
162  }
163  assert(deltaz < 8);
164  value += (deltaz << 7);
165 
166  return value;
167 
168  } else {
169  if (std::abs(z) < 2.0 * z0cut)
170  return -1;
171 
172  double zmean = settings_.zmean(layerdisk - N_LAYER);
173  if (z < 0.0)
174  zmean = -zmean;
175 
176  double r1 = (r + 0.5 * dr_) * (zmean + z0cut) / (z + 0.5 * dz_ + z0cut);
177  double r2 = (r - 0.5 * dr_) * (zmean - z0cut) / (z + 0.5 * dz_ - z0cut);
178  double r3 = (r + 0.5 * dr_) * (zmean + z0cut) / (z - 0.5 * dz_ + z0cut);
179  double r4 = (r - 0.5 * dr_) * (zmean - z0cut) / (z - 0.5 * dz_ - z0cut);
180  double r5 = (r + 0.5 * dr_) * (zmean - z0cut) / (z + 0.5 * dz_ - z0cut);
181  double r6 = (r - 0.5 * dr_) * (zmean + z0cut) / (z + 0.5 * dz_ + z0cut);
182  double r7 = (r + 0.5 * dr_) * (zmean - z0cut) / (z - 0.5 * dz_ - z0cut);
183  double r8 = (r - 0.5 * dr_) * (zmean + z0cut) / (z - 0.5 * dz_ + z0cut);
184 
185  double rmin = std::min({r1, r2, r3, r4, r5, r6, r7, r8});
186  double rmax = std::max({r1, r2, r3, r4, r5, r6, r7, r8});
187 
189 
190  double rmindisk = settings_.rmindiskvm();
191  double rmaxdisk = settings_.rmaxdiskvm();
192 
193  if (iseed == 6)
194  rmaxdisk = settings_.rmaxdiskl1overlapvm();
195  if (iseed == 7)
196  rmindisk = settings_.rmindiskl2overlapvm();
197  if (iseed == 10)
198  rmaxdisk = settings_.rmaxdisk();
199 
200  if (rmin > rmaxdisk)
201  return -1;
202  if (rmax > rmaxdisk)
203  rmax = rmaxdisk;
204 
205  if (rmax < rmindisk)
206  return -1;
207  if (rmin < rmindisk)
208  rmin = rmindisk;
209 
210  int rbin1 = NBINS * (rmin - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
211  int rbin2 = NBINS * (rmax - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
212 
213  if (iseed == 10) {
214  constexpr double rminspec = 40.0;
215  rbin1 = NBINS * (rmin - rminspec) / (settings_.rmaxdisk() - rminspec);
216  rbin2 = NBINS * (rmax - rminspec) / (settings_.rmaxdisk() - rminspec);
217  }
218 
219  if (rbin2 >= NBINS)
220  rbin2 = NBINS - 1;
221  if (rbin1 < 0)
222  rbin1 = 0;
223 
224  // This is a 9 bit word:
225  // xxx|yy|z|rrr
226  // xxx is the delta r window
227  // yy is the r bin yy is three bits for overlaps
228  // z is flag to look in next bin
229  // rrr fine r bin
230  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
231  // and xxx is only 1,2, or 3
232  // should also reject xxx=0 as this means projection is outside range
233 
234  bool overlap = iseed == 6 || iseed == 7 || iseed == 10;
235 
236  int value = rbin1 / 8;
237  if (overlap) {
238  if (z < 0.0)
239  value += 4;
240  }
241  value *= 2;
242  if (rbin2 / 8 - rbin1 / 8 > 0)
243  value += 1;
244  value *= 8;
245  value += (rbin1 & 7);
246  assert(value / 8 < 15);
247  int deltar = rbin2 - rbin1;
248  if (deltar > 7)
249  deltar = 7;
250  if (overlap) {
251  value += (deltar << 7);
252  } else {
253  value += (deltar << 6);
254  }
255 
256  return value;
257  }
258 }

References funct::abs(), cms::cuda::assert(), dr_, dz_, iseed, SiStripPI::max, min(), trklet::N_LAYER, NBINS, trklet::Settings::NLONGVMBINS(), goodZToMuMu_cfi::overlap, alignCSCRings::r, diffTwoXMLs::r1, diffTwoXMLs::r2, trklet::Settings::rmaxdisk(), trklet::Settings::rmaxdiskl1overlapvm(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), trklet::Settings::rmindiskl2overlapvm(), trklet::Settings::rmindiskvm(), settings_, relativeConstraints::value, trklet::Settings::z0cut(), testProducerWithPsetDescEmpty_cfi::z2, trklet::Settings::zlength(), SiStripMonitorCluster_cfi::zmax, trklet::Settings::zmean(), and SiStripMonitorCluster_cfi::zmin.

Referenced by init().

◆ init()

void VMRouterTable::init ( unsigned int  layerdisk)

Definition at line 16 of file VMRouterTable.cc.

16  {
17  zbits_ = settings_.vmrlutzbits(layerdisk);
18  rbits_ = settings_.vmrlutrbits(layerdisk);
19 
20  rbins_ = (1 << rbits_);
21  zbins_ = (1 << zbits_);
22 
23  if (layerdisk < N_LAYER) {
24  zmin_ = -settings_.zlength();
26  rmin_ = settings_.rmean(layerdisk) - settings_.drmax();
27  rmax_ = settings_.rmean(layerdisk) + settings_.drmax();
28  } else {
29  rmin_ = 0;
31  zmin_ = settings_.zmean(layerdisk - N_LAYER) - settings_.dzmax();
32  zmax_ = settings_.zmean(layerdisk - N_LAYER) + settings_.dzmax();
33  }
34 
35  dr_ = (rmax_ - rmin_) / rbins_;
36  dz_ = (zmax_ - zmin_) / zbins_;
37 
39 
40  for (int izbin = 0; izbin < zbins_; izbin++) {
41  for (int irbin = 0; irbin < rbins_; irbin++) {
42  double r = rmin_ + (irbin + 0.5) * dr_;
43  double z = zmin_ + (izbin + 0.5) * dz_;
44 
45  if (layerdisk > (N_LAYER - 1) && irbin < 10) //special case for the tabulated radii in 2S disks
46  r = (layerdisk <= 7) ? settings_.rDSSinner(irbin) : settings_.rDSSouter(irbin);
47 
48  int bin;
49  if (layerdisk < N_LAYER) {
50  double zproj = z * settings_.rmean(layerdisk) / r;
51  bin = NBINS * (zproj + settings_.zlength()) / (2 * settings_.zlength());
52  } else {
53  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
55  }
56  if (bin < 0)
57  bin = 0;
58  if (bin >= NBINS)
59  bin = NBINS - 1;
60  vmrtable_.push_back(bin);
61 
62  if (layerdisk >= N_LAYER) {
63  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
64  bin = 0.5 * NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
65  if (bin < 0)
66  bin = 0;
67  if (bin >= NBINS / 2)
68  bin = NBINS / 2 - 1;
69  vmrtabletedisk_.push_back(bin);
70  }
71 
72  if (layerdisk == 0 || layerdisk == 2 || layerdisk == 4 || layerdisk == 6 || layerdisk == 8) {
73  vmrtableteinner_.push_back(getLookup(layerdisk + 1, z, r));
74  }
75 
76  if (layerdisk == 1) {
77  vmrtableteinner_.push_back(getLookup(layerdisk + 1, z, r, 1));
78  }
79 
80  if (layerdisk == 1) { //projection from L2 to D1 for L2L3D1 seeding
81  vmrtableteinnerThird_.push_back(getLookup(6, z, r, 10));
82  }
83 
84  if (layerdisk == 4) { //projection from L5 to L4 for L5L6L4 seeding
85  vmrtableteinnerThird_.push_back(getLookup(3, z, r));
86  }
87 
88  if (layerdisk == 2) { //projection from L3 to L5 for L3L4L2 seeding
89  vmrtableteinnerThird_.push_back(getLookup(1, z, r));
90  }
91 
92  if (layerdisk == 6) { //projection from D1 to L2 for D1D2L2 seeding
93  vmrtableteinnerThird_.push_back(getLookup(1, z, r));
94  }
95 
96  if (layerdisk == 0 || layerdisk == 1) {
97  vmrtableteinneroverlap_.push_back(getLookup(6, z, r, layerdisk + 6));
98  }
99  }
100  }
101 }

References newFWLiteAna::bin, dr_, trklet::Settings::drmax(), dz_, trklet::Settings::dzmax(), getLookup(), trklet::N_LAYER, NBINS, trklet::Settings::NLONGVMBINS(), alignCSCRings::r, rbins_, rbits_, trklet::Settings::rDSSinner(), trklet::Settings::rDSSouter(), rmax_, trklet::Settings::rmaxdisk(), trklet::Settings::rmaxdiskvm(), trklet::Settings::rmean(), rmin_, trklet::Settings::rmindiskvm(), settings_, trklet::Settings::vmrlutrbits(), trklet::Settings::vmrlutzbits(), vmrtable_, vmrtabletedisk_, vmrtableteinner_, vmrtableteinneroverlap_, vmrtableteinnerThird_, zbins_, zbits_, trklet::Settings::zlength(), zmax_, trklet::Settings::zmean(), and zmin_.

Referenced by trklet::VMRouter::VMRouter(), and VMRouterTable().

◆ lookup()

int VMRouterTable::lookup ( int  zbin,
int  rbin 
)

Definition at line 260 of file VMRouterTable.cc.

260  {
261  int index = zbin * rbins_ + rbin;
262  assert(index >= 0 && index < (int)vmrtable_.size());
263  return vmrtable_[index];
264 }

References cms::cuda::assert(), rbins_, and vmrtable_.

Referenced by trklet::VMRouter::execute().

◆ lookupdisk()

int VMRouterTable::lookupdisk ( int  zbin,
int  rbin 
)

Definition at line 266 of file VMRouterTable.cc.

266  {
267  int index = zbin * rbins_ + rbin;
268  assert(index >= 0 && index < (int)vmrtabletedisk_.size());
269  return vmrtabletedisk_[index];
270 }

References cms::cuda::assert(), rbins_, and vmrtabletedisk_.

Referenced by trklet::VMRouter::execute().

◆ lookupinner()

int VMRouterTable::lookupinner ( int  zbin,
int  rbin 
)

Definition at line 272 of file VMRouterTable.cc.

272  {
273  int index = zbin * rbins_ + rbin;
274  assert(index >= 0 && index < (int)vmrtableteinner_.size());
275  return vmrtableteinner_[index];
276 }

References cms::cuda::assert(), rbins_, and vmrtableteinner_.

Referenced by trklet::VMRouter::execute().

◆ lookupinneroverlap()

int VMRouterTable::lookupinneroverlap ( int  zbin,
int  rbin 
)

Definition at line 278 of file VMRouterTable.cc.

278  {
279  int index = zbin * rbins_ + rbin;
280  assert(index >= 0 && index < (int)vmrtableteinneroverlap_.size());
282 }

References cms::cuda::assert(), rbins_, and vmrtableteinneroverlap_.

Referenced by trklet::VMRouter::execute().

◆ lookupinnerThird()

int VMRouterTable::lookupinnerThird ( int  zbin,
int  rbin 
)

Definition at line 284 of file VMRouterTable.cc.

284  {
285  int index = zbin * rbins_ + rbin;
286  assert(index >= 0 && index < (int)vmrtableteinnerThird_.size());
288 }

References cms::cuda::assert(), rbins_, and vmrtableteinnerThird_.

Referenced by trklet::VMRouter::execute().

Member Data Documentation

◆ dr_

double trklet::VMRouterTable::dr_
private

Definition at line 43 of file VMRouterTable.h.

Referenced by getLookup(), and init().

◆ dz_

double trklet::VMRouterTable::dz_
private

Definition at line 44 of file VMRouterTable.h.

Referenced by getLookup(), and init().

◆ rbins_

int trklet::VMRouterTable::rbins_
private

◆ rbits_

int trklet::VMRouterTable::rbits_
private

Definition at line 47 of file VMRouterTable.h.

Referenced by init().

◆ rmax_

double trklet::VMRouterTable::rmax_
private

Definition at line 38 of file VMRouterTable.h.

Referenced by init().

◆ rmin_

double trklet::VMRouterTable::rmin_
private

Definition at line 37 of file VMRouterTable.h.

Referenced by init().

◆ settings_

Settings const& trklet::VMRouterTable::settings_
private

Definition at line 35 of file VMRouterTable.h.

Referenced by getLookup(), and init().

◆ vmrtable_

std::vector<int> trklet::VMRouterTable::vmrtable_
private

Definition at line 53 of file VMRouterTable.h.

Referenced by init(), and lookup().

◆ vmrtabletedisk_

std::vector<int> trklet::VMRouterTable::vmrtabletedisk_
private

Definition at line 54 of file VMRouterTable.h.

Referenced by init(), and lookupdisk().

◆ vmrtableteinner_

std::vector<int> trklet::VMRouterTable::vmrtableteinner_
private

Definition at line 55 of file VMRouterTable.h.

Referenced by init(), and lookupinner().

◆ vmrtableteinneroverlap_

std::vector<int> trklet::VMRouterTable::vmrtableteinneroverlap_
private

Definition at line 56 of file VMRouterTable.h.

Referenced by init(), and lookupinneroverlap().

◆ vmrtableteinnerThird_

std::vector<int> trklet::VMRouterTable::vmrtableteinnerThird_
private

Definition at line 57 of file VMRouterTable.h.

Referenced by init(), and lookupinnerThird().

◆ zbins_

int trklet::VMRouterTable::zbins_
private

Definition at line 49 of file VMRouterTable.h.

Referenced by init().

◆ zbits_

int trklet::VMRouterTable::zbits_
private

Definition at line 46 of file VMRouterTable.h.

Referenced by init().

◆ zmax_

double trklet::VMRouterTable::zmax_
private

Definition at line 41 of file VMRouterTable.h.

Referenced by init().

◆ zmin_

double trklet::VMRouterTable::zmin_
private

Definition at line 40 of file VMRouterTable.h.

Referenced by init().

trklet::VMRouterTable::getLookup
int getLookup(unsigned int layerdisk, double z, double r, int iseed=-1)
Definition: VMRouterTable.cc:103
trklet::Settings::rmindiskvm
double rmindiskvm() const
Definition: Settings.h:260
trklet::VMRouterTable::vmrtable_
std::vector< int > vmrtable_
Definition: VMRouterTable.h:53
trklet::VMRouterTable::vmrtableteinneroverlap_
std::vector< int > vmrtableteinneroverlap_
Definition: VMRouterTable.h:56
NBINS
const int NBINS
Definition: CaloCachedShapeIntegrator.cc:3
trklet::VMRouterTable::zmax_
double zmax_
Definition: VMRouterTable.h:41
detailsBasic3DVector::z
float float float z
Definition: extBasic3DVector.h:14
trklet::Settings::dzmax
double dzmax() const
Definition: Settings.h:106
min
T min(T a, T b)
Definition: MathUtil.h:58
trklet::Settings::rmaxdiskl1overlapvm
double rmaxdiskl1overlapvm() const
Definition: Settings.h:263
trklet::Settings::vmrlutrbits
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:143
trklet::Settings::rmindiskl2overlapvm
double rmindiskl2overlapvm() const
Definition: Settings.h:264
cms::cuda::assert
assert(be >=bs)
trklet::VMRouterTable::rbits_
int rbits_
Definition: VMRouterTable.h:47
deltar
Definition: deltar.py:1
trklet::Settings::rmean
double rmean(unsigned int iLayer) const
Definition: Settings.h:128
trklet::Settings::rDSSinner
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:135
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
trklet::Settings::rDSSouter
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:138
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
trklet::VMRouterTable::settings_
Settings const & settings_
Definition: VMRouterTable.h:35
trklet::VMRouterTable::dz_
double dz_
Definition: VMRouterTable.h:44
trklet::VMRouterTable::dr_
double dr_
Definition: VMRouterTable.h:43
trklet::VMRouterTable::zbits_
int zbits_
Definition: VMRouterTable.h:46
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::Settings::zmean
double zmean(unsigned int iDisk) const
Definition: Settings.h:131
trklet::Settings::drmax
double drmax() const
Definition: Settings.h:105
trklet::Settings::rmaxdisk
double rmaxdisk() const
Definition: Settings.h:102
iseed
int iseed
Definition: AMPTWrapper.h:134
trklet::Settings::NLONGVMBINS
unsigned int NLONGVMBINS() const
Definition: Settings.h:272
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
trklet::VMRouterTable::rmin_
double rmin_
Definition: VMRouterTable.h:37
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
value
Definition: value.py:1
goodZToMuMu_cfi.overlap
overlap
Definition: goodZToMuMu_cfi.py:108
trklet::VMRouterTable::zmin_
double zmin_
Definition: VMRouterTable.h:40
trklet::VMRouterTable::rbins_
int rbins_
Definition: VMRouterTable.h:50
trklet::VMRouterTable::vmrtableteinnerThird_
std::vector< int > vmrtableteinnerThird_
Definition: VMRouterTable.h:57
trklet::VMRouterTable::vmrtabletedisk_
std::vector< int > vmrtabletedisk_
Definition: VMRouterTable.h:54
alignCSCRings.r
r
Definition: alignCSCRings.py:93
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
trklet::VMRouterTable::init
void init(unsigned int layerdisk)
Definition: VMRouterTable.cc:16
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
trklet::Settings::vmrlutzbits
unsigned int vmrlutzbits(unsigned int layerdisk) const
Definition: Settings.h:142
relativeConstraints.value
value
Definition: relativeConstraints.py:53
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::VMRouterTable::rmax_
double rmax_
Definition: VMRouterTable.h:38
trklet::Settings::z0cut
double z0cut() const
Definition: Settings.h:269
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::VMRouterTable::vmrtableteinner_
std::vector< int > vmrtableteinner_
Definition: VMRouterTable.h:55
trklet::VMRouterTable::zbins_
int zbins_
Definition: VMRouterTable.h:49
trklet::Settings::rmaxdiskvm
double rmaxdiskvm() const
Definition: Settings.h:261
trklet::Settings::zlength
double zlength() const
Definition: Settings.h:101