CMS 3D CMS Logo

LayerProjection.cc
Go to the documentation of this file.
3 
5 
6 using namespace std;
7 using namespace trklet;
8 
9 void LayerProjection::init(Settings const& settings,
10  int projlayer,
11  double rproj,
12  int iphiproj,
13  int izproj,
14  int iphider,
15  int izder,
16  double phiproj,
17  double zproj,
18  double phiprojder,
19  double zprojder,
20  double phiprojapprox,
21  double zprojapprox,
22  double phiprojderapprox,
23  double zprojderapprox,
24  bool isPSseed) {
25  assert(projlayer > 0);
26  assert(projlayer <= N_LAYER);
27 
28  valid_ = true;
29 
30  rproj_ = rproj;
31 
32  projlayer_ = projlayer;
33 
34  assert(iphiproj >= 0);
35 
36  if (rproj < settings.rPS2S()) {
37  fpgaphiproj_.set(iphiproj, settings.nphibitsstub(0), true, __LINE__, __FILE__);
38  int iphivm = (iphiproj >> (settings.nphibitsstub(0) - 5)) & 0x7;
39  if ((projlayer_ % 2) == 1) {
40  iphivm ^= 4;
41  }
42  fpgaphiprojvm_.set(iphivm, 3, true, __LINE__, __FILE__);
43  fpgazproj_.set(izproj, settings.nzbitsstub(0), false, __LINE__, __FILE__);
44  int izvm = izproj >> (12 - 7) & 0xf;
45  fpgazprojvm_.set(izvm, 4, true, __LINE__, __FILE__);
46  fpgaphiprojder_.set(iphider, settings.nbitsphiprojderL123(), false, __LINE__, __FILE__);
47  fpgazprojder_.set(izder, settings.nbitszprojderL123(), false, __LINE__, __FILE__);
48  } else {
49  fpgaphiproj_.set(iphiproj, settings.nphibitsstub(5), true, __LINE__, __FILE__);
50  int iphivm = (iphiproj >> (settings.nphibitsstub(5) - 5)) & 0x7;
51  if ((projlayer_ % 2) == 1) {
52  iphivm ^= 4;
53  }
54  fpgaphiprojvm_.set(iphivm, 3, true, __LINE__, __FILE__);
55  fpgazproj_.set(izproj, settings.nzbitsstub(5), false, __LINE__, __FILE__);
56  int izvm = izproj >> (8 - 7) & 0xf;
57  fpgazprojvm_.set(izvm, 4, true, __LINE__, __FILE__);
58  fpgaphiprojder_.set(iphider, settings.nbitsphiprojderL456(), false, __LINE__, __FILE__);
59  fpgazprojder_.set(izder, settings.nbitszprojderL456(), false, __LINE__, __FILE__);
60  }
61 
66  int offset = 4;
67  if (isPSseed) {
68  offset = 1;
69  }
70  unsigned int zbin1 = (1 << (settings.MEBinsBits() - 1)) +
71  (((fpgazproj_.value() >> (fpgazproj_.nbits() - settings.MEBinsBits() - 3)) - offset) >> 3);
72  unsigned int zbin2 = (1 << (settings.MEBinsBits() - 1)) +
73  (((fpgazproj_.value() >> (fpgazproj_.nbits() - settings.MEBinsBits() - 3)) + offset) >> 3);
74  if (zbin1 >= settings.MEBins()) {
75  zbin1 = 0; //note that zbin1 is unsigned
76  }
77  if (zbin2 >= settings.MEBins())
78  zbin2 = settings.MEBins() - 1;
79  assert(zbin1 <= zbin2);
80  assert(zbin2 - zbin1 <= 1);
81  fpgazbin1projvm_.set(zbin1, settings.MEBinsBits(), true, __LINE__, __FILE__); // first z bin
82  if (zbin1 == zbin2)
83  fpgazbin2projvm_.set(0, 1, true, __LINE__, __FILE__); // don't need to check adjacent z bin
84  else
85  fpgazbin2projvm_.set(1, 1, true, __LINE__, __FILE__); // do need to check next z bin
86 
87  //fine vm z bits. Use 4 bits for fine position. starting at zbin 1
88  int finez = ((1 << (settings.MEBinsBits() + 2)) +
89  (fpgazproj_.value() >> (fpgazproj_.nbits() - (settings.MEBinsBits() + 3)))) -
90  (zbin1 << 3);
91 
92  fpgafinezvm_.set(finez, 4, true, __LINE__, __FILE__); // fine z postions starting at zbin1 //FIXME using 3 bits
93 
94  phiproj_ = phiproj;
95  zproj_ = zproj;
96  phiprojder_ = phiprojder;
97  zprojder_ = zprojder;
98 
99  phiprojapprox_ = phiprojapprox;
100  zprojapprox_ = zprojapprox;
101  phiprojderapprox_ = phiprojderapprox;
102  zprojderapprox_ = zprojderapprox;
103 }
Settings.h
init
int init
Definition: HydjetWrapper.h:64
MessageLogger.h
trklet::Settings
Definition: Settings.h:31
cms::cuda::assert
assert(be >=bs)
trklet::Settings::nbitszprojderL123
unsigned int nbitszprojderL123() const
Definition: Settings.h:76
sistrip::valid_
static const uint16_t valid_
Definition: Constants.h:17
trklet::Settings::MEBins
unsigned int MEBins() const
Definition: Settings.h:199
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::Settings::nbitszprojderL456
unsigned int nbitszprojderL456() const
Definition: Settings.h:77
trklet::Settings::nbitsphiprojderL456
unsigned int nbitsphiprojderL456() const
Definition: Settings.h:75
trklet::Settings::nzbitsstub
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:69
trklet::Settings::nphibitsstub
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:70
LayerProjection.h
trklet
Definition: AllProjectionsMemory.h:9
std
Definition: JetResolutionObject.h:76
trklet::Settings::MEBinsBits
unsigned int MEBinsBits() const
Definition: Settings.h:198
trklet::Settings::nbitsphiprojderL123
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:74
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
trklet::Settings::rPS2S
double rPS2S() const
Definition: Settings.h:288