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 | Static Public Member Functions | Protected Attributes
trklet::MemoryBase Class Referenceabstract

#include <MemoryBase.h>

Inheritance diagram for trklet::MemoryBase:
trklet::AllInnerStubsMemory trklet::AllProjectionsMemory trklet::AllStubsMemory trklet::CandidateMatchMemory trklet::CleanTrackMemory trklet::DTCLinkMemory trklet::FullMatchMemory trklet::InputLinkMemory trklet::StubPairsMemory trklet::StubTripletsMemory trklet::TrackFitMemory trklet::TrackletParametersMemory trklet::TrackletProjectionsMemory trklet::VMProjectionsMemory trklet::VMStubsMEMemory trklet::VMStubsTEMemory

Public Member Functions

virtual void clean ()=0
 
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
 

Static Public Member Functions

static size_t find_nth (const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
 

Protected Attributes

int bx_
 
int event_
 
unsigned int iSector_
 
std::string name_
 
std::ofstream out_
 
Settings const & settings_
 

Detailed Description

Definition at line 13 of file MemoryBase.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file MemoryBase.cc.

References bx_, event_, and iSector_.

13  : name_(name), settings_(settings) {
14  iSector_ = 0;
15  bx_ = 0;
16  event_ = 0;
17 }
unsigned int iSector_
Definition: MemoryBase.h:44
Settings const & settings_
Definition: MemoryBase.h:50
std::string name_
Definition: MemoryBase.h:43
virtual trklet::MemoryBase::~MemoryBase ( )
virtualdefault

Member Function Documentation

virtual void trklet::MemoryBase::clean ( )
pure virtual
size_t MemoryBase::find_nth ( const std::string &  haystack,
size_t  pos,
const std::string &  needle,
size_t  nth 
)
static

Definition at line 103 of file MemoryBase.cc.

Referenced by trklet::FullMatchMemory::FullMatchMemory(), and trklet::TrackletProjectionsMemory::TrackletProjectionsMemory().

103  {
104  size_t found_pos = haystack.find(needle, pos);
105  if (0 == nth || string::npos == found_pos)
106  return found_pos;
107  return find_nth(haystack, found_pos + 1, needle, nth - 1);
108 }
static size_t find_nth(const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
Definition: MemoryBase.cc:103
void MemoryBase::findAndReplaceAll ( std::string &  data,
std::string  toSearch,
std::string  replaceStr 
)

Definition at line 61 of file MemoryBase.cc.

Referenced by openFile().

61  {
62  // Get the first occurrence
63  size_t pos = data.find(toSearch);
64 
65  // Repeat till end is reached
66  while (pos != std::string::npos) {
67  // Replace this occurrence of Sub String
68  data.replace(pos, toSearch.size(), replaceStr);
69  // Get the next occurrence from the current position
70  pos = data.find(toSearch, pos + replaceStr.size());
71  }
72 }
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::string trklet::MemoryBase::getLastPartOfName ( ) const
inline

Definition at line 20 of file MemoryBase.h.

References name_.

20 { return name_.substr(name_.find_last_of('_') + 1); }
std::string name_
Definition: MemoryBase.h:43
std::string const& trklet::MemoryBase::getName ( void  ) const
inline

Definition at line 19 of file MemoryBase.h.

References name_.

Referenced by trklet::ProjectionRouter::addInput(), trklet::MatchEngine::addInput(), trklet::TrackletEngine::addInput(), trklet::TripletEngine::addInput(), trklet::FitTrack::addInput(), trklet::TrackletEngineDisplaced::addInput(), trklet::InputRouter::addInput(), trklet::PurgeDuplicate::addInput(), trklet::TrackletCalculator::addInput(), trklet::MatchCalculator::addInput(), trklet::TrackletCalculatorDisplaced::addInput(), trklet::MatchProcessor::addInput(), trklet::TrackletProcessor::addInput(), trklet::VMRouterCM::addInput(), trklet::VMRouter::addInput(), trklet::CandidateMatchMemory::addMatch(), trklet::FullMatchMemory::addMatch(), trklet::ProjectionRouter::addOutput(), trklet::MatchEngine::addOutput(), trklet::FitTrack::addOutput(), trklet::TripletEngine::addOutput(), trklet::TrackletEngine::addOutput(), trklet::InputRouter::addOutput(), trklet::TrackletEngineDisplaced::addOutput(), trklet::PurgeDuplicate::addOutput(), trklet::TrackletCalculator::addOutput(), trklet::MatchCalculator::addOutput(), trklet::TrackletCalculatorDisplaced::addOutput(), trklet::MatchProcessor::addOutput(), trklet::TrackletProcessor::addOutput(), trklet::VMRouterCM::addOutput(), trklet::VMRouter::addOutput(), trklet::TrackletProjectionsMemory::addProj(), trklet::TrackletCalculatorDisplaced::addProjectionDisk(), trklet::VMStubsTEMemory::addVMStub(), plotting.Plot::draw(), trklet::TrackletEngineDisplaced::execute(), trklet::MatchProcessor::execute(), openFile(), trklet::TrackletEngine::setVMPhiBin(), trklet::AllProjectionsMemory::writeAP(), trklet::CandidateMatchMemory::writeCM(), trklet::CleanTrackMemory::writeCT(), trklet::FullMatchMemory::writeMC(), trklet::StubPairsMemory::writeSP(), trklet::StubTripletsMemory::writeST(), trklet::VMStubsMEMemory::writeStubs(), trklet::TrackFitMemory::writeTF(), trklet::TrackletParametersMemory::writeTPAR(), trklet::TrackletProjectionsMemory::writeTPROJ(), and trklet::VMProjectionsMemory::writeVMPROJ().

19 { return name_; }
std::string name_
Definition: MemoryBase.h:43
void MemoryBase::initLayerDisk ( unsigned int  pos,
int &  layer,
int &  disk 
)

Definition at line 19 of file MemoryBase.cc.

References Exception, and name_.

Referenced by trklet::AllProjectionsMemory::AllProjectionsMemory(), trklet::FullMatchMemory::FullMatchMemory(), initLayerDisk(), trklet::TrackletProjectionsMemory::TrackletProjectionsMemory(), trklet::VMProjectionsMemory::VMProjectionsMemory(), trklet::VMStubsMEMemory::VMStubsMEMemory(), and trklet::VMStubsTEMemory::VMStubsTEMemory().

19  {
20  string subname = name_.substr(pos, 2);
21  layer = 0;
22  disk = 0;
23 
24  if (subname.substr(0, 1) == "L")
25  layer = stoi(subname.substr(1, 1));
26  else if (subname.substr(0, 1) == "D")
27  disk = stoi(subname.substr(1, 1));
28  else
29  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " name = " << name_ << " subname = " << subname
30  << " " << layer << " " << disk;
31 }
constexpr std::array< uint8_t, layerIndexSize > layer
std::string name_
Definition: MemoryBase.h:43
unsigned int MemoryBase::initLayerDisk ( unsigned int  pos)

Definition at line 33 of file MemoryBase.cc.

References initLayerDisk(), phase1PixelTopology::layer, and trklet::N_DISK.

33  {
34  int layer, disk;
35  initLayerDisk(pos, layer, disk);
36 
37  if (disk > 0)
38  return N_DISK + disk;
39  return layer - 1;
40 }
constexpr int N_DISK
Definition: Settings.h:22
constexpr std::array< uint8_t, layerIndexSize > layer
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:19
void MemoryBase::initSpecialSeeding ( unsigned int  pos,
bool &  overlap,
bool &  extra,
bool &  extended 
)

Definition at line 42 of file MemoryBase.cc.

References name_.

Referenced by trklet::VMStubsTEMemory::VMStubsTEMemory().

42  {
43  overlap = false;
44  extra = false;
45  extended = false;
46 
47  char subname = name_[pos];
48 
49  static const std::set<char> overlapset = {
50  'X', 'Y', 'W', 'Q', 'R', 'S', 'T', 'Z', 'x', 'y', 'w', 'q', 'r', 's', 't', 'z'};
51  overlap = overlapset.find(subname) != overlapset.end();
52 
53  static const std::set<char> extraset = {'I', 'J', 'K', 'L'};
54  extra = extraset.find(subname) != extraset.end();
55 
56  static const std::set<char> extendedset = {
57  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'x', 'y', 'z', 'w', 'q', 'r', 's', 't'};
58  extended = extendedset.find(subname) != extendedset.end();
59 }
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
std::string name_
Definition: MemoryBase.h:43
void MemoryBase::openFile ( bool  first,
std::string  dirName,
std::string  filebase 
)

Definition at line 74 of file MemoryBase.cc.

References bx_, event_, findAndReplaceAll(), alignmentValidation::fname, getName(), iSector_, trklet::openfile(), out_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by trklet::InputLinkMemory::writeStubs(), trklet::DTCLinkMemory::writeStubs(), trklet::AllStubsMemory::writeStubs(), trklet::AllInnerStubsMemory::writeStubs(), and trklet::VMStubsTEMemory::writeStubs().

74  {
75  std::string fname = filebase + getName();
76 
77  findAndReplaceAll(fname, "PHIa", "PHIaa");
78  findAndReplaceAll(fname, "PHIb", "PHIbb");
79  findAndReplaceAll(fname, "PHIc", "PHIcc");
80  findAndReplaceAll(fname, "PHId", "PHIdd");
81 
82  findAndReplaceAll(fname, "PHIx", "PHIxx");
83  findAndReplaceAll(fname, "PHIy", "PHIyy");
84  findAndReplaceAll(fname, "PHIz", "PHIzz");
85  findAndReplaceAll(fname, "PHIw", "PHIww");
86 
87  fname += "_";
88  if (iSector_ + 1 < 10)
89  fname += "0";
90  fname += std::to_string(iSector_ + 1);
91  fname += ".dat";
92 
93  openfile(out_, first, dirName, dirName + fname, __FILE__, __LINE__);
94 
95  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
96 
97  bx_++;
98  event_++;
99  if (bx_ > 7)
100  bx_ = 0;
101 }
unsigned int iSector_
Definition: MemoryBase.h:44
std::string const & getName() const
Definition: MemoryBase.h:19
void findAndReplaceAll(std::string &data, std::string toSearch, std::string replaceStr)
Definition: MemoryBase.cc:61
std::ofstream out_
Definition: MemoryBase.h:46
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

int trklet::MemoryBase::bx_
protected
int trklet::MemoryBase::event_
protected
unsigned int trklet::MemoryBase::iSector_
protected
std::string trklet::MemoryBase::name_
protected

Definition at line 43 of file MemoryBase.h.

Referenced by getLastPartOfName(), getName(), initLayerDisk(), and initSpecialSeeding().

std::ofstream trklet::MemoryBase::out_
protected
Settings const& trklet::MemoryBase::settings_
protected