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
 
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< 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) {}
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13

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

References indices_, stubs_, and tedNames_.

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

22  {
23  stubs_.emplace_back(stub1, stub2);
24  indices_.push_back(index);
25  tedNames_.push_back(tedName);
26  }
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
std::vector< unsigned > indices_
std::vector< std::string > tedNames_

◆ clean()

void trklet::StubPairsMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 36 of file StubPairsMemory.h.

References indices_, stubs_, and tedNames_.

36  {
37  stubs_.clear();
38  indices_.clear();
39  tedNames_.clear();
40  }
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
std::vector< unsigned > indices_
std::vector< std::string > tedNames_

◆ getIndex()

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

Definition at line 33 of file StubPairsMemory.h.

References mps_fire::i, and indices_.

33 { return indices_.at(i); }
std::vector< unsigned > indices_

◆ getTEDName()

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

Definition at line 34 of file StubPairsMemory.h.

References mps_fire::i, and tedNames_.

34 { return tedNames_.at(i); }
std::vector< std::string > tedNames_

◆ getVMStub1()

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

Definition at line 30 of file StubPairsMemory.h.

References mps_fire::i, and stubs_.

30 { return stubs_[i].first; }
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_

◆ getVMStub2()

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

Definition at line 31 of file StubPairsMemory.h.

References mps_fire::i, and stubs_.

31 { return stubs_[i].second; }
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_

◆ nStubPairs()

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

Definition at line 28 of file StubPairsMemory.h.

References stubs_.

28 { return stubs_.size(); }
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_

◆ writeSP()

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

Definition at line 11 of file StubPairsMemory.cc.

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

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 }
unsigned int iSector_
Definition: MemoryBase.h:44
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
std::string memPath() const
Definition: Settings.h:192
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
Settings const & settings_
Definition: MemoryBase.h:50
std::ofstream out_
Definition: MemoryBase.h:46
std::string const & getName() const
Definition: MemoryBase.h:19
string fname
main script
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:139

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