CMS 3D CMS Logo

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

#include <VMStubsMEMemory.h>

Inheritance diagram for trklet::VMStubsMEMemory:
trklet::MemoryBase

Public Member Functions

void addStub (VMStubME stub, unsigned int bin)
 
void clean () override
 
const StubgetStubBin (unsigned int bin, unsigned int i) const
 
const VMStubMEgetVMStubMEBin (unsigned int bin, unsigned int i) const
 
unsigned int nStubsBin (unsigned int bin) const
 
void resize (int nbins)
 
 VMStubsMEMemory (std::string name, Settings const &settings)
 
void writeStubs (bool first, unsigned int iSector)
 
 ~VMStubsMEMemory () 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< std::vector< VMStubME > > binnedstubs_
 

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 16 of file VMStubsMEMemory.h.

Constructor & Destructor Documentation

◆ VMStubsMEMemory()

VMStubsMEMemory::VMStubsMEMemory ( std::string  name,
Settings const &  settings 
)

Definition at line 9 of file VMStubsMEMemory.cc.

References binnedstubs_, trklet::MemoryBase::initLayerDisk(), trklet::N_LAYER, trklet::Settings::NLONGVMBINS(), and trklet::MemoryBase::settings_.

9  : MemoryBase(name, settings) {
10  unsigned int layerdisk = initLayerDisk(6);
11  if (layerdisk < N_LAYER) {
13  } else {
14  //For disks we have NLONGVMBITS on each disk
15  binnedstubs_.resize(2 * settings_.NLONGVMBINS());
16  }
17 }
std::vector< std::vector< VMStubME > > binnedstubs_
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:14
unsigned int NLONGVMBINS() const
Definition: Settings.h:369
Settings const & settings_
Definition: MemoryBase.h:53
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:20
constexpr int N_LAYER
Definition: Settings.h:25

◆ ~VMStubsMEMemory()

trklet::VMStubsMEMemory::~VMStubsMEMemory ( )
overridedefault

Member Function Documentation

◆ addStub()

void trklet::VMStubsMEMemory::addStub ( VMStubME  stub,
unsigned int  bin 
)
inline

Definition at line 22 of file VMStubsMEMemory.h.

References newFWLiteAna::bin, binnedstubs_, trklet::Settings::maxStubsPerBin(), and trklet::MemoryBase::settings_.

22  {
24  binnedstubs_[bin].push_back(stub);
25  }
26  }
size
Write out results.
std::vector< std::vector< VMStubME > > binnedstubs_
Settings const & settings_
Definition: MemoryBase.h:53
unsigned int maxStubsPerBin() const
Definition: Settings.h:236

◆ clean()

void trklet::VMStubsMEMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 47 of file VMStubsMEMemory.h.

References binnedstubs_.

47  {
48  for (auto& binnedstub : binnedstubs_) {
49  binnedstub.clear();
50  }
51  }
std::vector< std::vector< VMStubME > > binnedstubs_

◆ getStubBin()

const Stub* trklet::VMStubsMEMemory::getStubBin ( unsigned int  bin,
unsigned int  i 
) const
inline

Definition at line 41 of file VMStubsMEMemory.h.

References cms::cuda::assert(), newFWLiteAna::bin, binnedstubs_, and mps_fire::i.

41  {
42  assert(bin < binnedstubs_.size());
44  return binnedstubs_[bin][i].stub();
45  }
size
Write out results.
std::vector< std::vector< VMStubME > > binnedstubs_
assert(be >=bs)

◆ getVMStubMEBin()

const VMStubME& trklet::VMStubsMEMemory::getVMStubMEBin ( unsigned int  bin,
unsigned int  i 
) const
inline

Definition at line 35 of file VMStubsMEMemory.h.

References cms::cuda::assert(), newFWLiteAna::bin, binnedstubs_, and mps_fire::i.

Referenced by trklet::MatchEngine::execute(), and trklet::MatchEngineUnit::step().

35  {
36  assert(bin < binnedstubs_.size());
38  return binnedstubs_[bin][i];
39  }
size
Write out results.
std::vector< std::vector< VMStubME > > binnedstubs_
assert(be >=bs)

◆ nStubsBin()

unsigned int trklet::VMStubsMEMemory::nStubsBin ( unsigned int  bin) const
inline

Definition at line 30 of file VMStubsMEMemory.h.

References cms::cuda::assert(), newFWLiteAna::bin, and binnedstubs_.

Referenced by trklet::MatchEngine::execute(), trklet::MatchProcessor::execute(), and trklet::MatchEngineUnit::step().

30  {
31  assert(bin < binnedstubs_.size());
32  return binnedstubs_[bin].size();
33  }
std::vector< std::vector< VMStubME > > binnedstubs_
assert(be >=bs)

◆ resize()

void trklet::VMStubsMEMemory::resize ( int  nbins)
inline

Definition at line 28 of file VMStubsMEMemory.h.

References binnedstubs_, and LaserClient_cfi::nbins.

28 { binnedstubs_.resize(nbins); }
std::vector< std::vector< VMStubME > > binnedstubs_

◆ writeStubs()

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

Definition at line 19 of file VMStubsMEMemory.cc.

References binnedstubs_, trklet::MemoryBase::bx_, trklet::MemoryBase::event_, dqmdumpme::first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::hexstr(), mps_fire::i, trklet::MemoryBase::iSector_, dqmiolumiharvest::j, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, trklet::FPGAWord::str(), and createJobs::tmp.

19  {
20  iSector_ = iSector;
21  const string dirVM = settings_.memPath() + "VMStubsME/";
22 
23  std::ostringstream oss;
24  oss << dirVM << "VMStubs_" << getName();
25  //get rid of duplicates
26  auto const& tmp = oss.str();
27  int len = tmp.size();
28  if (tmp[len - 2] == 'n' && tmp[len - 1] > '1' && tmp[len - 1] <= '9')
29  return;
30  oss << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
31  auto const& fname = oss.str();
32 
33  openfile(out_, first, dirVM, fname, __FILE__, __LINE__);
34 
35  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
36 
37  for (unsigned int i = 0; i < binnedstubs_.size(); i++) {
38  for (unsigned int j = 0; j < binnedstubs_[i].size(); j++) {
39  string stub = binnedstubs_[i][j].stubindex().str();
40  stub += "|" + binnedstubs_[i][j].bend().str();
41 
42  FPGAWord finephipos = binnedstubs_[i][j].finephi();
43  stub += "|" + finephipos.str();
44  FPGAWord finepos = binnedstubs_[i][j].finerz();
45  stub += "|" + finepos.str();
46  out_ << hexstr(i) << " " << hexstr(j) << " " << stub << " " << trklet::hexFormat(stub) << endl;
47  }
48  }
49  out_.close();
50 
51  bx_++;
52  event_++;
53  if (bx_ > 7)
54  bx_ = 0;
55 }
std::vector< std::vector< VMStubME > > binnedstubs_
unsigned int iSector_
Definition: MemoryBase.h:47
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
std::string const & getName() const
Definition: MemoryBase.h:19
static std::string hexstr(unsigned int index)
Definition: MemoryBase.cc:111
string fname
main script
tmp
align.sh
Definition: createJobs.py:716
std::string str() const
Definition: FPGAWord.cc:54
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:154

Member Data Documentation

◆ binnedstubs_

std::vector<std::vector<VMStubME> > trklet::VMStubsMEMemory::binnedstubs_
private