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