CMS 3D CMS Logo

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

#include <StubPairsMemory.h>

Inheritance diagram for trklet::StubPairsMemory:
trklet::MemoryBase

Public Member Functions

void addStubPair (const VMStubTE &stub1, const VMStubTE &stub2, const unsigned index=0, const std::string &tedName="")
 
void clean () override
 
unsigned getIndex (const unsigned i) const
 
const std::string & getTEDName (const unsigned i) const
 
const VMStubTEgetVMStub1 (unsigned int i) const
 
const VMStubTEgetVMStub2 (unsigned int i) const
 
unsigned int nStubPairs () const
 
 StubPairsMemory (std::string name, Settings const &settings, unsigned int iSector)
 
void writeSP (bool first)
 
 ~StubPairsMemory () 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, unsigned int iSector)
 
void openFile (bool first, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

std::vector< unsigned > indices_
 
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
 
std::vector< std::string > tedNames_
 

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 13 of file StubPairsMemory.h.

Constructor & Destructor Documentation

◆ StubPairsMemory()

StubPairsMemory::StubPairsMemory ( std::string  name,
Settings const &  settings,
unsigned int  iSector 
)

Definition at line 8 of file StubPairsMemory.cc.

9  : MemoryBase(name, settings, iSector) {}

◆ ~StubPairsMemory()

trklet::StubPairsMemory::~StubPairsMemory ( )
overridedefault

Member Function Documentation

◆ addStubPair()

void trklet::StubPairsMemory::addStubPair ( const VMStubTE stub1,
const VMStubTE stub2,
const unsigned  index = 0,
const std::string &  tedName = "" 
)
inline

Definition at line 19 of file StubPairsMemory.h.

22  {
23  stubs_.emplace_back(stub1, stub2);
24  indices_.push_back(index);
25  tedNames_.push_back(tedName);
26  }

References indices_, stubs_, and tedNames_.

Referenced by trklet::TrackletEngine::execute(), and trklet::TrackletProcessor::execute().

◆ clean()

void trklet::StubPairsMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 36 of file StubPairsMemory.h.

36  {
37  stubs_.clear();
38  indices_.clear();
39  tedNames_.clear();
40  }

References indices_, stubs_, and tedNames_.

◆ getIndex()

unsigned trklet::StubPairsMemory::getIndex ( const unsigned  i) const
inline

Definition at line 33 of file StubPairsMemory.h.

33 { return indices_.at(i); }

References mps_fire::i, and indices_.

◆ getTEDName()

const std::string& trklet::StubPairsMemory::getTEDName ( const unsigned  i) const
inline

Definition at line 34 of file StubPairsMemory.h.

34 { return tedNames_.at(i); }

References mps_fire::i, and tedNames_.

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

◆ getVMStub1()

const VMStubTE& trklet::StubPairsMemory::getVMStub1 ( unsigned int  i) const
inline

Definition at line 30 of file StubPairsMemory.h.

30 { return stubs_[i].first; }

References mps_fire::i, and stubs_.

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

◆ getVMStub2()

const VMStubTE& trklet::StubPairsMemory::getVMStub2 ( unsigned int  i) const
inline

Definition at line 31 of file StubPairsMemory.h.

31 { return stubs_[i].second; }

References mps_fire::i, and stubs_.

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

◆ nStubPairs()

unsigned int trklet::StubPairsMemory::nStubPairs ( ) const
inline

Definition at line 28 of file StubPairsMemory.h.

28 { return stubs_.size(); }

References stubs_.

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

◆ writeSP()

void StubPairsMemory::writeSP ( bool  first)

Definition at line 11 of file StubPairsMemory.cc.

11  {
12  std::ostringstream oss;
13  oss << "../data/MemPrints/StubPairs/StubPairs_" << getName() << "_" << std::setfill('0') << std::setw(2)
14  << (iSector_ + 1) << ".dat";
15  auto const& fname = oss.str();
16 
17  if (first) {
18  bx_ = 0;
19  event_ = 1;
20  out_.open(fname.c_str());
21  } else
22  out_.open(fname.c_str(), std::ofstream::app);
23 
24  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
25 
26  for (unsigned int j = 0; j < stubs_.size(); j++) {
27  string stub1index = stubs_[j].first.stub()->stubindex().str();
28  string stub2index = stubs_[j].second.stub()->stubindex().str();
29  out_ << "0x";
30  out_ << std::setfill('0') << std::setw(2);
31  out_ << hex << j << dec;
32  out_ << " " << stub1index << "|" << stub2index << " " << trklet::hexFormat(stub1index + stub2index) << endl;
33  }
34  out_.close();
35 
36  bx_++;
37  event_++;
38  if (bx_ > 7)
39  bx_ = 0;
40 }

References trklet::MemoryBase::bx_, TauDecayModes::dec, trklet::MemoryBase::event_, dqmdumpme::first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, trklet::MemoryBase::out_, and stubs_.

Member Data Documentation

◆ indices_

std::vector<unsigned> trklet::StubPairsMemory::indices_
private

Definition at line 47 of file StubPairsMemory.h.

Referenced by addStubPair(), clean(), and getIndex().

◆ stubs_

std::vector<std::pair<const VMStubTE, const VMStubTE> > trklet::StubPairsMemory::stubs_
private

Definition at line 45 of file StubPairsMemory.h.

Referenced by addStubPair(), clean(), getVMStub1(), getVMStub2(), nStubPairs(), and writeSP().

◆ tedNames_

std::vector<std::string> trklet::StubPairsMemory::tedNames_
private

Definition at line 48 of file StubPairsMemory.h.

Referenced by addStubPair(), clean(), and getTEDName().

mps_fire.i
i
Definition: mps_fire.py:355
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::StubPairsMemory::indices_
std::vector< unsigned > indices_
Definition: StubPairsMemory.h:47
trklet::StubPairsMemory::stubs_
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
Definition: StubPairsMemory.h:45
trklet::StubPairsMemory::tedNames_
std::vector< std::string > tedNames_
Definition: StubPairsMemory.h:48
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings, unsigned int iSector)
Definition: MemoryBase.cc:11
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44