CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::InputRouter Class Reference

#include <InputRouter.h>

Inheritance diagram for trklet::InputRouter:
trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void execute ()
 
 InputRouter (std::string name, Settings const &settings, Globals *global)
 
 ~InputRouter () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global)
 
virtual ~ProcessBase ()=default
 

Private Attributes

DTCLinkMemorydtcstubs_
 
std::vector< std::pair< std::pair< unsigned int, unsigned int >, InputLinkMemory * > > irstubs_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 20 of file InputRouter.h.

Constructor & Destructor Documentation

◆ InputRouter()

InputRouter::InputRouter ( std::string  name,
Settings const &  settings,
Globals global 
)

Definition at line 15 of file InputRouter.cc.

16  : ProcessBase(name, settings, global) {}
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14

◆ ~InputRouter()

trklet::InputRouter::~InputRouter ( )
overridedefault

Member Function Documentation

◆ addInput()

void InputRouter::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 41 of file InputRouter.cc.

References cms::cuda::assert(), dtcstubs_, Exception, input, mps_setup::memory, trklet::ProcessBase::name_, trklet::ProcessBase::settings_, and trklet::Settings::writetrace().

41  {
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 }
Log< level::Info, true > LogVerbatim
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:195
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
DTCLinkMemory * dtcstubs_
Definition: InputRouter.h:33

◆ addOutput()

void InputRouter::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 18 of file InputRouter.cc.

References cms::cuda::assert(), Exception, irstubs_, mps_setup::memory, trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, createJobs::tmp, and trklet::Settings::writetrace().

18  {
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 }
Log< level::Info, true > LogVerbatim
constexpr int N_DISK
Definition: Settings.h:26
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:195
assert(be >=bs)
std::vector< std::pair< std::pair< unsigned int, unsigned int >, InputLinkMemory * > > irstubs_
Definition: InputRouter.h:36
Definition: output.py:1
tmp
align.sh
Definition: createJobs.py:716
constexpr int N_LAYER
Definition: Settings.h:25

◆ execute()

void InputRouter::execute ( void  )

Definition at line 54 of file InputRouter.cc.

References cms::cuda::assert(), dtcstubs_, trklet::DTCLinkMemory::getStub(), mps_fire::i, hcalRecHitTable_cff::iphi, irstubs_, trklet::Stub::l1tstub(), trklet::L1TStub::layerdisk(), trklet::Settings::maxStep(), trklet::Settings::nbitsallstubs(), trklet::DTCLinkMemory::nStubs(), trklet::Stub::phicorr(), trklet::Settings::reduced(), and trklet::ProcessBase::settings_.

54  {
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 }
unsigned int maxStep(std::string module) const
Definition: Settings.h:125
Settings const & settings_
Definition: ProcessBase.h:40
bool reduced() const
Definition: Settings.h:272
assert(be >=bs)
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:115
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

Member Data Documentation

◆ dtcstubs_

DTCLinkMemory* trklet::InputRouter::dtcstubs_
private

Definition at line 33 of file InputRouter.h.

Referenced by addInput(), and execute().

◆ irstubs_

std::vector<std::pair<std::pair<unsigned int, unsigned int>, InputLinkMemory*> > trklet::InputRouter::irstubs_
private

Definition at line 36 of file InputRouter.h.

Referenced by addOutput(), and execute().