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
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
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) {}

◆ ~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.

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 }

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

◆ addOutput()

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

Implements trklet::ProcessBase.

Definition at line 18 of file InputRouter.cc.

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 }

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

◆ execute()

void InputRouter::execute ( void  )

Definition at line 54 of file InputRouter.cc.

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  assert(iadd == 1);
78  }
79 }

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

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().

trklet::ProcessBase::ProcessBase
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14
mps_fire.i
i
Definition: mps_fire.py:428
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:183
input
static const std::string input
Definition: EdmProvDump.cc:48
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
memory
Definition: HGCRecHitSoA.h:20
trklet::Settings::nbitsallstubs
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:106
cms::cuda::assert
assert(be >=bs)
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:22
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:40
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
trklet::InputLinkMemory
Definition: InputLinkMemory.h:16
trklet::DTCLinkMemory::getStub
Stub * getStub(unsigned int i)
Definition: DTCLinkMemory.h:27
trklet::Stub
Definition: Stub.h:18
trklet::DTCLinkMemory::nStubs
unsigned int nStubs() const
Definition: DTCLinkMemory.h:25
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:21
trklet::L1TStub::layerdisk
int layerdisk() const
Definition: L1TStub.h:104
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::InputRouter::irstubs_
std::vector< std::pair< std::pair< unsigned int, unsigned int >, InputLinkMemory * > > irstubs_
Definition: InputRouter.h:36
trklet::Stub::phicorr
const FPGAWord & phicorr() const
Definition: Stub.h:63
trklet::Stub::l1tstub
L1TStub * l1tstub()
Definition: Stub.h:77
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:245
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
trklet::InputRouter::dtcstubs_
DTCLinkMemory * dtcstubs_
Definition: InputRouter.h:33