CMS 3D CMS Logo

MatchEngineUnit.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace trklet;
5 
6 MatchEngineUnit::MatchEngineUnit(bool barrel, vector<bool> table, vector<bool> tablePS, vector<bool> table2S)
7  : candmatches_(5) {
8  idle_ = true;
9  barrel_ = barrel;
10  table_ = table;
11  tablePS_ = tablePS;
12  table2S_ = table2S;
13  slot_ = 1; //This makes it idle until initialized
14 }
15 
17  unsigned int slot,
18  int projrinv,
19  int projfinerz,
20  int projfinephi,
21  bool isPSseed,
22  Tracklet* proj) {
23  vmstubsmemory_ = vmstubsmemory;
24  idle_ = false;
25  slot_ = slot;
26  istub_ = 0;
27  projrinv_ = projrinv;
28  projfinerz_ = projfinerz;
29  projfinephi_ = projfinephi;
30  isPSseed_ = isPSseed;
31  proj_ = proj;
32 }
33 
35  if (idle() || candmatches_.almostfull())
36  return;
37 
39 
40  istub_++;
42  idle_ = true;
43 
44  bool isPSmodule = vmstub.isPSmodule();
45  int stubfinerz = vmstub.finerz().value();
46  int stubfinephi = vmstub.finephi().value();
47 
48  int deltaphi = stubfinephi - projfinephi_;
49 
50  bool dphicut = (abs(deltaphi) < 3) || (abs(deltaphi) > 5); //TODO - need better implementations
51  dphicut = true; //Not used until cuts cleaned up
52 
53  if (!barrel_)
54  dphicut = true;
55 
56  int nbits = isPSmodule ? 3 : 4;
57 
58  unsigned int index = (projrinv_ << nbits) + vmstub.bend().value();
59 
60  //Check if stub z position consistent
61  int idrz = stubfinerz - projfinerz_;
62  bool pass;
63 
64  if (barrel_) {
65  if (isPSseed_) {
66  pass = idrz >= -2 && idrz <= 2;
67  } else {
68  pass = idrz >= -5 && idrz <= 5;
69  }
70  } else {
71  if (isPSmodule) {
72  pass = idrz >= -1 && idrz <= 1;
73  } else {
74  pass = idrz >= -5 && idrz <= 5;
75  }
76  }
77 
78  //Check if stub bend and proj rinv consistent
79  if ((pass && dphicut) && (barrel_ ? table_[index] : (isPSmodule ? tablePS_[index] : table2S_[index]))) {
80  std::pair<Tracklet*, const Stub*> tmp(proj_, vmstub.stub());
81  candmatches_.store(tmp);
82  }
83 }
trklet::MatchEngineUnit::init
void init(VMStubsMEMemory *vmstubsmemory, unsigned int slot, int projrinv, int projfinerz, int projfinephi, bool isPSseed, Tracklet *proj)
Definition: MatchEngineUnit.cc:16
trklet::VMStubsMEMemory
Definition: VMStubsMEMemory.h:16
Reference_intrackfit_cff.barrel
list barrel
Definition: Reference_intrackfit_cff.py:37
trklet::VMStubME::isPSmodule
bool isPSmodule() const
Definition: VMStubME.h:30
trklet::VMStubsMEMemory::getVMStubMEBin
const VMStubME & getVMStubMEBin(unsigned int bin, unsigned int i) const
Definition: VMStubsMEMemory.h:33
trklet::MatchEngineUnit::projrinv_
int projrinv_
Definition: MatchEngineUnit.h:52
trklet::MatchEngineUnit::tablePS_
std::vector< bool > tablePS_
Definition: MatchEngineUnit.h:64
trklet::VMStubME::bend
const FPGAWord & bend() const
Definition: VMStubME.h:26
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::Tracklet
Definition: Tracklet.h:28
trklet::MatchEngineUnit::istub_
unsigned int istub_
Definition: MatchEngineUnit.h:49
trklet::MatchEngineUnit::table_
std::vector< bool > table_
Definition: MatchEngineUnit.h:61
trklet::VMStubME::stub
const Stub * stub() const
Definition: VMStubME.h:28
trklet::MatchEngineUnit::candmatches_
CircularBuffer< std::pair< Tracklet *, const Stub * > > candmatches_
Definition: MatchEngineUnit.h:68
trklet::MatchEngineUnit::table2S_
std::vector< bool > table2S_
Definition: MatchEngineUnit.h:65
trklet::MatchEngineUnit::barrel_
bool barrel_
Definition: MatchEngineUnit.h:51
trklet::MatchEngineUnit::step
void step()
Definition: MatchEngineUnit.cc:34
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
trklet::MatchEngineUnit::proj_
Tracklet * proj_
Definition: MatchEngineUnit.h:56
trklet::MatchEngineUnit::idle_
bool idle_
Definition: MatchEngineUnit.h:58
trklet::MatchEngineUnit::vmstubsmemory_
VMStubsMEMemory * vmstubsmemory_
Definition: MatchEngineUnit.h:45
MatchEngineUnit.h
trklet
Definition: AllProjectionsMemory.h:9
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
std
Definition: JetResolutionObject.h:76
trklet::MatchEngineUnit::isPSseed_
bool isPSseed_
Definition: MatchEngineUnit.h:55
trklet::MatchEngineUnit::projfinephi_
int projfinephi_
Definition: MatchEngineUnit.h:54
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::MatchEngineUnit::projfinerz_
int projfinerz_
Definition: MatchEngineUnit.h:53
trklet::MatchEngineUnit::idle
bool idle() const
Definition: MatchEngineUnit.h:40
trklet::VMStubME::finerz
const FPGAWord & finerz() const
Definition: VMStubME.h:24
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::VMStubME::finephi
const FPGAWord & finephi() const
Definition: VMStubME.h:23
TableParser.table
table
Definition: TableParser.py:111
trklet::VMStubME
Definition: VMStubME.h:15
trklet::VMStubsMEMemory::nStubsBin
unsigned int nStubsBin(unsigned int bin) const
Definition: VMStubsMEMemory.h:28
trklet::MatchEngineUnit::slot_
unsigned int slot_
Definition: MatchEngineUnit.h:48