CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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)
 
- 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 ( 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:13
trklet::DTCLinkMemory::~DTCLinkMemory ( )
overridedefault

Member Function Documentation

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 }
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
Settings const & settings_
Definition: MemoryBase.h:50
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
void setl1tstub(L1TStub *l1tstub)
Definition: Stub.h:79
void DTCLinkMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 65 of file DTCLinkMemory.cc.

References stubs_.

65  {
66  for (auto& stub : stubs_) {
67  delete stub->l1tstub();
68  delete stub;
69  }
70  stubs_.clear();
71 }
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
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
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
void DTCLinkMemory::writeStubs ( bool  first,
unsigned int  iSector 
)

Definition at line 29 of file DTCLinkMemory.cc.

References cms::cuda::assert(), TauDecayModes::dec, trklet::Settings::dtcLayers(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, LayerTriplets::layers(), trklet::Settings::memPath(), trklet::MemoryBase::openFile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, command_line::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_ << std::setfill('0') << std::setw(2);
59  out_ << hex << j << dec;
60  out_ << " " << stub << " " << trklet::hexFormat(stub) << endl;
61  }
62  out_.close();
63 }
std::string memPath() const
Definition: Settings.h:192
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
unsigned int iSector_
Definition: MemoryBase.h:44
std::vector< Stub * > stubs_
Definition: DTCLinkMemory.h:34
void openFile(bool first, std::string dirName, std::string filebase)
Definition: MemoryBase.cc:74
assert(be >=bs)
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
Settings const & settings_
Definition: MemoryBase.h:50
std::ofstream out_
Definition: MemoryBase.h:46
const std::vector< int > & dtcLayers(const std::string &dtcName) const
Definition: Settings.h:420

Member Data Documentation

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

Definition at line 34 of file DTCLinkMemory.h.

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