CMS 3D CMS Logo

DiskProjection.cc
Go to the documentation of this file.
3 
5 
6 #include <algorithm>
7 #include <cassert>
8 
9 using namespace std;
10 using namespace trklet;
11 
12 void DiskProjection::init(Settings const& settings,
13  int projdisk,
14  double zproj,
15  int iphiproj,
16  int irproj,
17  int iphider,
18  int irder,
19  double phiproj,
20  double rproj,
21  double phiprojder,
22  double rprojder,
23  double phiprojapprox,
24  double rprojapprox,
25  double phiprojderapprox,
26  double rprojderapprox) {
27  assert(abs(projdisk) >= 0);
28  assert(abs(projdisk) <= N_DISK);
29 
30  valid_ = true;
31 
32  zproj_ = zproj;
33 
34  projdisk_ = projdisk;
35 
36  assert(iphiproj >= 0);
37 
38  fpgaphiproj_.set(iphiproj, settings.nphibitsstub(0), true, __LINE__, __FILE__);
39  int iphivm = (iphiproj >> (settings.nphibitsstub(0) - 5)) & 0x7;
40  if ((abs(projdisk_) % 2) == 1) {
41  iphivm ^= 4;
42  }
43  fpgaphiprojvm_.set(iphivm, 3, true, __LINE__, __FILE__);
44  fpgarproj_.set(irproj, settings.nrbitsstub(6), false, __LINE__, __FILE__);
45  int irvm = irproj >> (13 - 7) & 0xf;
46  fpgarprojvm_.set(irvm, 4, true, __LINE__, __FILE__);
47  fpgaphiprojder_.set(iphider, settings.nbitsphiprojderL123(), false, __LINE__, __FILE__);
48  fpgarprojder_.set(irder, settings.nrbitsprojderdisk(), false, __LINE__, __FILE__);
49 
50  //TODO the -3 and +3 should be evaluated and efficiency for matching hits checked.
51  //This code should be migrated in the ProjectionRouter
52  int rbin1 = 8.0 * (irproj * settings.krprojshiftdisk() - 3 - settings.rmindiskvm()) /
53  (settings.rmaxdisk() - settings.rmindiskvm());
54  int rbin2 = 8.0 * (irproj * settings.krprojshiftdisk() + 3 - settings.rmindiskvm()) /
55  (settings.rmaxdisk() - settings.rmindiskvm());
56 
57  if (irproj * settings.krprojshiftdisk() < 20.0) {
58  edm::LogPrint("Tracklet") << " WARNING : irproj = " << irproj << " " << irproj * settings.krprojshiftdisk() << " "
59  << projdisk_;
60  }
61 
62  if (rbin1 < 0)
63  rbin1 = 0;
64  rbin2 = clamp(rbin2, 0, 7);
65 
66  assert(rbin1 <= rbin2);
67  assert(rbin2 - rbin1 <= 1);
68 
69  int finer = 64 *
70  ((irproj * settings.krprojshiftdisk() - settings.rmindiskvm()) -
71  rbin1 * (settings.rmaxdisk() - settings.rmindiskvm()) / 8.0) /
72  (settings.rmaxdisk() - settings.rmindiskvm());
73 
74  finer = clamp(finer, 0, 15);
75 
76  int diff = rbin1 != rbin2;
77  if (irder < 0)
78  rbin1 += 8;
79 
80  fpgarbin1projvm_.set(rbin1, 4, true, __LINE__, __FILE__); // first r bin
81  fpgarbin2projvm_.set(diff, 1, true, __LINE__, __FILE__); // need to check adjacent r bin
82 
83  fpgafinervm_.set(finer, 4, true, __LINE__, __FILE__); // fine r postions starting at rbin1
84 
85  phiproj_ = phiproj;
86  rproj_ = rproj;
87  phiprojder_ = phiprojder;
88  rprojder_ = rprojder;
89 
90  phiprojapprox_ = phiprojapprox;
91  rprojapprox_ = rprojapprox;
92  phiprojderapprox_ = phiprojderapprox;
93  rprojderapprox_ = rprojderapprox;
94 }
Settings.h
change_name.diff
diff
Definition: change_name.py:13
init
int init
Definition: HydjetWrapper.h:64
trklet::Settings::rmindiskvm
double rmindiskvm() const
Definition: Settings.h:260
MessageLogger.h
trklet::Settings::krprojshiftdisk
double krprojshiftdisk() const
Definition: Settings.h:341
trklet::Settings
Definition: Settings.h:26
cms::cuda::assert
assert(be >=bs)
trklet::Settings::nrbitsprojderdisk
unsigned int nrbitsprojderdisk() const
Definition: Settings.h:68
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::Settings::nrbitsstub
unsigned int nrbitsstub(unsigned int layerdisk) const
Definition: Settings.h:66
sistrip::valid_
static const uint16_t valid_
Definition: Constants.h:17
trklet::Settings::rmaxdisk
double rmaxdisk() const
Definition: Settings.h:102
DiskProjection.h
trklet::Settings::nphibitsstub
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:65
edm::LogPrint
Definition: MessageLogger.h:342
trklet
Definition: AllProjectionsMemory.h:9
std
Definition: JetResolutionObject.h:76
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::Settings::nbitsphiprojderL123
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:69