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 | Private Attributes
trklet::CandidateMatchMemory Class Reference

#include <CandidateMatchMemory.h>

Inheritance diagram for trklet::CandidateMatchMemory:
trklet::MemoryBase

Public Member Functions

void addMatch (std::pair< Tracklet *, int > tracklet, const Stub *stub)
 
 CandidateMatchMemory (std::string name, Settings const &settings)
 
void clean () override
 
std::pair< std::pair< Tracklet
*, int >, const Stub * > 
getMatch (unsigned int i)
 
unsigned int nMatches () const
 
void writeCM (bool first, unsigned int iSector)
 
 ~CandidateMatchMemory () 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::pair
< std::pair< Tracklet *, int >
, const Stub * > > 
matches_
 

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 17 of file CandidateMatchMemory.h.

Constructor & Destructor Documentation

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

Definition at line 14 of file CandidateMatchMemory.cc.

14 : MemoryBase(name, settings) {}
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
trklet::CandidateMatchMemory::~CandidateMatchMemory ( )
overridedefault

Member Function Documentation

void CandidateMatchMemory::addMatch ( std::pair< Tracklet *, int >  tracklet,
const Stub stub 
)

Definition at line 16 of file CandidateMatchMemory.cc.

References Exception, trklet::MemoryBase::getName(), match(), matches_, and createJobs::tmp.

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

16  {
17  std::pair<std::pair<Tracklet*, int>, const Stub*> tmp(tracklet, stub);
18 
19  //Check for consistency
20  for (auto& match : matches_) {
21  if (tracklet.first->TCID() < match.first.first->TCID()) {
22  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " In " << getName() << " adding tracklet "
23  << tracklet.first << " with lower TCID : " << tracklet.first->TCID()
24  << " than earlier TCID " << match.first.first->TCID();
25  }
26  }
27  matches_.push_back(tmp);
28 }
std::string const & getName() const
Definition: MemoryBase.h:19
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
tmp
align.sh
Definition: createJobs.py:716
void trklet::CandidateMatchMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 29 of file CandidateMatchMemory.h.

References matches_.

29 { matches_.clear(); }
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
std::pair<std::pair<Tracklet*, int>, const Stub*> trklet::CandidateMatchMemory::getMatch ( unsigned int  i)
inline

Definition at line 27 of file CandidateMatchMemory.h.

References mps_fire::i, and matches_.

27 { return matches_[i]; }
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
unsigned int trklet::CandidateMatchMemory::nMatches ( ) const
inline

Definition at line 25 of file CandidateMatchMemory.h.

References matches_.

25 { return matches_.size(); }
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
void CandidateMatchMemory::writeCM ( bool  first,
unsigned int  iSector 
)

Definition at line 30 of file CandidateMatchMemory.cc.

References trklet::MemoryBase::bx_, TauDecayModes::dec, trklet::MemoryBase::event_, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, matches_, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, trklet::FPGAWord::set(), trklet::MemoryBase::settings_, trklet::FPGAWord::str(), and createJobs::tmp.

30  {
31  iSector_ = iSector;
32  const string dirM = settings_.memPath() + "Matches/";
33 
34  std::ostringstream oss;
35  oss << dirM << "CandidateMatches_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1)
36  << ".dat";
37  auto const& fname = oss.str();
38 
39  openfile(out_, first, dirM, fname, __FILE__, __LINE__);
40 
41  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
42 
43  for (unsigned int j = 0; j < matches_.size(); j++) {
44  string stubid = matches_[j].second->stubindex().str(); // stub ID
45  int projindex = matches_[j].first.second; // Allproj index
46  FPGAWord tmp;
47  if (projindex >= (1 << 7)) {
48  projindex = (1 << 7) - 1;
49  }
50  tmp.set(projindex, 7, true, __LINE__, __FILE__);
51  out_ << "0x";
52  out_ << std::setfill('0') << std::setw(2);
53  out_ << hex << j << dec;
54  out_ << " " << tmp.str() << "|" << stubid << " " << trklet::hexFormat(tmp.str() + stubid) << endl;
55  }
56  out_.close();
57 
58  bx_++;
59  event_++;
60  if (bx_ > 7)
61  bx_ = 0;
62 }
std::string memPath() const
Definition: Settings.h:192
unsigned int iSector_
Definition: MemoryBase.h:44
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
std::string const & getName() const
Definition: MemoryBase.h:19
Settings const & settings_
Definition: MemoryBase.h:50
std::ofstream out_
Definition: MemoryBase.h:46
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
Definition: FPGAWord.cc:14
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
string fname
main script
std::string str() const
Definition: FPGAWord.cc:54
tmp
align.sh
Definition: createJobs.py:716
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:139

Member Data Documentation

std::vector<std::pair<std::pair<Tracklet*, int>, const Stub*> > trklet::CandidateMatchMemory::matches_
private

Definition at line 34 of file CandidateMatchMemory.h.

Referenced by addMatch(), clean(), getMatch(), nMatches(), and writeCM().