CMS 3D CMS Logo

CandidateMatchMemory.cc
Go to the documentation of this file.
5 #include <iomanip>
8 
9 using namespace std;
10 using namespace trklet;
11 
12 CandidateMatchMemory::CandidateMatchMemory(string name, Settings const& settings, unsigned int iSector)
13  : MemoryBase(name, settings, iSector) {}
14 
15 void CandidateMatchMemory::addMatch(std::pair<Tracklet*, int> tracklet, const Stub* stub) {
16  std::pair<std::pair<Tracklet*, int>, const Stub*> tmp(tracklet, stub);
17 
18  //Check for consistency
19  for (auto& match : matches_) {
20  if (tracklet.first->TCID() < match.first.first->TCID()) {
21  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " In " << getName() << " adding tracklet "
22  << tracklet.first << " with lower TCID : " << tracklet.first->TCID()
23  << " than earlier TCID " << match.first.first->TCID();
24  }
25  }
26  matches_.push_back(tmp);
27 }
28 
30  std::ostringstream oss;
31  oss << "../data/MemPrints/Matches/CandidateMatches_" << getName() << "_" << std::setfill('0') << std::setw(2)
32  << (iSector_ + 1) << ".dat";
33  auto const& fname = oss.str();
34 
35  if (first) {
36  bx_ = 0;
37  event_ = 1;
38  out_.open(fname.c_str());
39  } else
40  out_.open(fname.c_str(), std::ofstream::app);
41 
42  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
43 
44  for (unsigned int j = 0; j < matches_.size(); j++) {
45  string stubid = matches_[j].second->stubindex().str(); // stub ID
46  int projindex = matches_[j].first.second; // Allproj index
47  FPGAWord tmp;
48  if (projindex >= (1 << 7)) {
49  projindex = (1 << 7) - 1;
50  }
51  tmp.set(projindex, 7, true, __LINE__, __FILE__);
52  out_ << "0x";
53  out_ << std::setfill('0') << std::setw(2);
54  out_ << hex << j << dec;
55  out_ << " " << tmp.str() << "|" << stubid << " " << trklet::hexFormat(tmp.str() + stubid) << endl;
56  }
57  out_.close();
58 
59  bx_++;
60  event_++;
61  if (bx_ > 7)
62  bx_ = 0;
63 }
Settings.h
MessageLogger.h
CandidateMatchMemory.h
trklet::Settings
Definition: Settings.h:26
trklet::CandidateMatchMemory::addMatch
void addMatch(std::pair< Tracklet *, int > tracklet, const Stub *stub)
Definition: CandidateMatchMemory.cc:15
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
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::Stub
Definition: Stub.h:16
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::MemoryBase
Definition: MemoryBase.h:13
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
trklet
Definition: AllProjectionsMemory.h:9
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::CandidateMatchMemory::writeCM
void writeCM(bool first)
Definition: CandidateMatchMemory.cc:29
Exception.h
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
Stub.h
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::CandidateMatchMemory::matches_
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > matches_
Definition: CandidateMatchMemory.h:34
Tracklet.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44