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)
 
void writeSP (bool first, unsigned int iSector)
 
 ~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)
 
void openFile (bool first, std::string dirName, 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 
)

Definition at line 9 of file StubPairsMemory.cc.

9 : MemoryBase(name, settings) {}

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

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

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

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

◆ nStubPairs()

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

Definition at line 28 of file StubPairsMemory.h.

28 { return stubs_.size(); }

References stubs_.

◆ writeSP()

void StubPairsMemory::writeSP ( bool  first,
unsigned int  iSector 
)

Definition at line 11 of file StubPairsMemory.cc.

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

References trklet::MemoryBase::bx_, TauDecayModes::dec, trklet::MemoryBase::event_, first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, 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().

trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
mps_fire.i
i
Definition: mps_fire.py:428
trklet::openfile
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:138
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
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::StubPairsMemory::indices_
std::vector< unsigned > indices_
Definition: StubPairsMemory.h:47
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
trklet::StubPairsMemory::stubs_
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
Definition: StubPairsMemory.h:45
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::StubPairsMemory::tedNames_
std::vector< std::string > tedNames_
Definition: StubPairsMemory.h:48
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
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:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44