CMS 3D CMS Logo

InputRouter.cc
Go to the documentation of this file.
8 
11 
12 using namespace std;
13 using namespace trklet;
14 
15 InputRouter::InputRouter(string name, Settings const& settings, Globals* global)
16  : ProcessBase(name, settings, global) {}
17 
19  if (settings_.writetrace()) {
20  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
21  << output;
22  }
23 
24  if (output == "stubout") {
25  InputLinkMemory* tmp = dynamic_cast<InputLinkMemory*>(memory);
26  assert(tmp != nullptr);
27  unsigned int layerdisk = tmp->getName()[4] - '1';
28  if (tmp->getName()[3] == 'D') {
29  layerdisk += N_LAYER;
30  }
31  assert(layerdisk < N_LAYER + N_DISK);
32  unsigned int phireg = tmp->getName()[8] - 'A';
33  std::pair<unsigned int, unsigned int> layerphireg(layerdisk, phireg);
34  irstubs_.emplace_back(layerphireg, tmp);
35  return;
36  }
37 
38  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
39 }
40 
42  if (settings_.writetrace()) {
43  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
44  << input;
45  }
46  if (input == "stubin") {
47  dtcstubs_ = dynamic_cast<DTCLinkMemory*>(memory);
48  assert(dtcstubs_ != nullptr);
49  return;
50  }
51  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
52 }
53 
55  for (unsigned int i = 0; i < settings_.maxStep("IR"); i++) {
56  if (i >= dtcstubs_->nStubs()) {
57  break;
58  }
59 
60  Stub* stub = dtcstubs_->getStub(i);
61 
62  unsigned int layerdisk = stub->l1tstub()->layerdisk();
63 
64  FPGAWord iphi = stub->phicorr();
65  unsigned int iphipos = iphi.value() >> (iphi.nbits() - settings_.nbitsallstubs(layerdisk));
66 
67  std::pair<unsigned int, unsigned int> layerphireg(layerdisk, iphipos);
68 
69  //Fill inner allstubs memories - in HLS this is the same write to multiple memories
70  int iadd = 0;
71  for (auto& irstubmem : irstubs_) {
72  if (layerphireg == irstubmem.first) {
73  irstubmem.second->addStub(stub);
74  iadd++;
75  }
76  }
77  if (!(settings_.reduced()))
78  assert(iadd == 1);
79  }
80 }
Log< level::Info, true > LogVerbatim
constexpr int N_DISK
Definition: Settings.h:26
unsigned int maxStep(std::string module) const
Definition: Settings.h:125
std::string name_
Definition: ProcessBase.h:38
void addOutput(MemoryBase *memory, std::string output) override
Definition: InputRouter.cc:18
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:195
bool reduced() const
Definition: Settings.h:272
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:115
void addInput(MemoryBase *memory, std::string input) override
Definition: InputRouter.cc:41
Stub * getStub(unsigned int i)
Definition: DTCLinkMemory.h:27
unsigned int nStubs() const
Definition: DTCLinkMemory.h:25
int layerdisk() const
Definition: L1TStub.h:119
L1TStub * l1tstub()
Definition: Stub.h:83
std::vector< std::pair< std::pair< unsigned int, unsigned int >, InputLinkMemory * > > irstubs_
Definition: InputRouter.h:36
DTCLinkMemory * dtcstubs_
Definition: InputRouter.h:33
const FPGAWord & phicorr() const
Definition: Stub.h:69
Definition: output.py:1
tmp
align.sh
Definition: createJobs.py:716
constexpr int N_LAYER
Definition: Settings.h:25