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

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

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 }

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

◆ clean()

void DTCLinkMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 65 of file DTCLinkMemory.cc.

65  {
66  for (auto& stub : stubs_) {
67  delete stub->l1tstub();
68  delete stub;
69  }
70  stubs_.clear();
71 }

References stubs_.

◆ getStub()

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

Definition at line 27 of file DTCLinkMemory.h.

27 { return stubs_[i]; }

References mps_fire::i, and stubs_.

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

◆ nStubs()

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

Definition at line 25 of file DTCLinkMemory.h.

25 { return stubs_.size(); }

References stubs_.

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

◆ writeStubs()

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

Definition at line 29 of file DTCLinkMemory.cc.

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_ << std::setfill('0') << std::setw(2);
59  out_ << hex << j << dec;
60  out_ << " " << stub << " " << trklet::hexFormat(stub) << endl;
61  }
62  out_.close();
63 }

References cms::cuda::assert(), TauDecayModes::dec, trklet::Settings::dtcLayers(), first, trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, hgcalTopologyTester_cfi::layers, trklet::Settings::memPath(), trklet::MemoryBase::openFile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, command_line::start, trklet::FPGAWord::str(), and stubs_.

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

trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
mps_fire.i
i
Definition: mps_fire.py:428
start
Definition: start.py:1
trklet::DTCLinkMemory::stubs_
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
trklet::L1TStub
Definition: L1TStub.h:14
cms::cuda::assert
assert(be >=bs)
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::MemoryBase::openFile
void openFile(bool first, std::string dirName, std::string filebase)
Definition: MemoryBase.cc:74
trklet::Stub
Definition: Stub.h:18
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
trklet::Stub::setl1tstub
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:79
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
trklet::Settings::dtcLayers
const std::vector< int > & dtcLayers(const std::string &dtcName) const
Definition: Settings.h:420
command_line.start
start
Definition: command_line.py:167
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44