CMS 3D CMS Logo

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

#include <DTCLinkMemory.h>

Inheritance diagram for trklet::DTCLinkMemory:
trklet::MemoryBase

Public Member Functions

void addStub (const L1TStub &al1stub, const Stub &stub)
 
void clean () override
 
 DTCLinkMemory (std::string name, Settings const &settings, double, double)
 
StubgetStub (unsigned int i)
 
unsigned int nStubs () const
 
void writeStubs (bool first, unsigned int iSector)
 
 ~DTCLinkMemory () override=default
 
- Public Member Functions inherited from trklet::MemoryBase
void findAndReplaceAll (std::string &data, std::string toSearch, std::string replaceStr)
 
std::string getLastPartOfName () const
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initSpecialSeeding (unsigned int pos, bool &overlap, bool &extra, bool &extended)
 
 MemoryBase (std::string name, Settings const &settings)
 
void openFile (bool first, std::string dirName, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

std::vector< Stub * > stubs_
 

Additional Inherited Members

- Static Public Member Functions inherited from trklet::MemoryBase
static size_t find_nth (const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
 
static std::string hexstr (unsigned int index)
 
- Protected Attributes inherited from trklet::MemoryBase
int bx_
 
int event_
 
unsigned int iSector_
 
std::string name_
 
std::ofstream out_
 
Settings const & settings_
 

Detailed Description

Definition at line 17 of file DTCLinkMemory.h.

Constructor & Destructor Documentation

◆ DTCLinkMemory()

DTCLinkMemory::DTCLinkMemory ( std::string  name,
Settings const &  settings,
double  ,
double   
)

Definition at line 17 of file DTCLinkMemory.cc.

17 : MemoryBase(name, settings) {}
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:14

◆ ~DTCLinkMemory()

trklet::DTCLinkMemory::~DTCLinkMemory ( )
overridedefault

Member Function Documentation

◆ addStub()

void DTCLinkMemory::addStub ( const L1TStub al1stub,
const Stub stub 
)

Definition at line 19 of file DTCLinkMemory.cc.

References trklet::Settings::maxStep(), trklet::Stub::setl1tstub(), trklet::MemoryBase::settings_, and stubs_.

19  {
20  //Make new objects owned by the dtclink memory and save in list of stubs
21  if (stubs_.size() < settings_.maxStep("IR")) {
22  Stub* stubptr = new Stub(stub);
23  stubptr->setl1tstub(new L1TStub(al1stub));
24 
25  stubs_.emplace_back(stubptr);
26  }
27 }
unsigned int maxStep(std::string module) const
Definition: Settings.h:125
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
Settings const & settings_
Definition: MemoryBase.h:53
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:85

◆ clean()

void DTCLinkMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 63 of file DTCLinkMemory.cc.

References stubs_.

63  {
64  for (auto& stub : stubs_) {
65  delete stub->l1tstub();
66  delete stub;
67  }
68  stubs_.clear();
69 }
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34

◆ getStub()

Stub* trklet::DTCLinkMemory::getStub ( unsigned int  i)
inline

Definition at line 27 of file DTCLinkMemory.h.

References mps_fire::i, and stubs_.

Referenced by trklet::InputRouter::execute().

27 { return stubs_[i]; }
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34

◆ nStubs()

unsigned int trklet::DTCLinkMemory::nStubs ( ) const
inline

Definition at line 25 of file DTCLinkMemory.h.

References stubs_.

Referenced by trklet::InputRouter::execute().

25 { return stubs_.size(); }
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34

◆ writeStubs()

void DTCLinkMemory::writeStubs ( bool  first,
unsigned int  iSector 
)

Definition at line 29 of file DTCLinkMemory.cc.

References cms::cuda::assert(), trklet::Settings::dtcLayers(), dqmdumpme::first, trklet::hexFormat(), trklet::MemoryBase::hexstr(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, hgcalTBTopologyTester_cfi::layers, trklet::Settings::memPath(), trklet::MemoryBase::openFile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, isotrackNtupler::start, trklet::FPGAWord::str(), and stubs_.

29  {
30  iSector_ = iSector;
31 
32  const string dirIS = settings_.memPath() + "InputStubs/";
33  openFile(first, dirIS, "Link_");
34 
35  for (unsigned int j = 0; j < stubs_.size(); j++) {
36  string dtcname = stubs_[j]->l1tstub()->DTClink();
37  int layerdisk = stubs_[j]->l1tstub()->layerdisk();
38 
39  //If the string starts with 'neg' skip the first three character
40  int start = dtcname.substr(0, 3) == "neg" ? 3 : 0;
41 
42  //For the dtcbase name remove the leading 'neg' if in the name and the trailing '_A' or '_B'
43  string dtcbase = dtcname.substr(start, dtcname.size() - 2 - start);
44 
45  const vector<int>& layers = settings_.dtcLayers(dtcbase);
46 
47  int lcode = -1;
48  for (unsigned int index = 0; index < layers.size(); index++) {
49  if (layerdisk == layers[index]) {
50  lcode = index;
51  }
52  }
53  assert(lcode != -1);
54 
55  FPGAWord ldcode(lcode, 2, true);
56 
57  string stub = stubs_[j]->str() + "|" + ldcode.str() + "|1";
58  out_ << hexstr(j) << " " << stub << " " << trklet::hexFormat(stub) << endl;
59  }
60  out_.close();
61 }
Definition: start.py:1
const std::vector< int > & dtcLayers(const std::string &dtcName) const
Definition: Settings.h:472
unsigned int iSector_
Definition: MemoryBase.h:47
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
void openFile(bool first, std::string dirName, std::string filebase)
Definition: MemoryBase.cc:75
assert(be >=bs)
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
std::string memPath() const
Definition: Settings.h:204
Settings const & settings_
Definition: MemoryBase.h:53
std::ofstream out_
Definition: MemoryBase.h:49
static std::string hexstr(unsigned int index)
Definition: MemoryBase.cc:111

Member Data Documentation

◆ stubs_

std::vector<Stub*> trklet::DTCLinkMemory::stubs_
private

Definition at line 34 of file DTCLinkMemory.h.

Referenced by addStub(), clean(), getStub(), nStubs(), and writeStubs().