CMS 3D CMS Logo

StubPairsMemory.cc
Go to the documentation of this file.
3 #include <iomanip>
4 #include <filesystem>
5 
6 using namespace std;
7 using namespace trklet;
8 
9 StubPairsMemory::StubPairsMemory(string name, Settings const& settings) : MemoryBase(name, settings) {}
10 
11 void StubPairsMemory::writeSP(bool first, unsigned int iSector) {
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_ << hexstr(j) << " " << stub1index << "|" << stub2index << " " << trklet::hexFormat(stub1index + stub2index)
27  << endl;
28  }
29  out_.close();
30 
31  bx_++;
32  event_++;
33  if (bx_ > 7)
34  bx_ = 0;
35 }
unsigned int iSector_
Definition: MemoryBase.h:47
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
std::string memPath() const
Definition: Settings.h:204
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
Settings const & settings_
Definition: MemoryBase.h:53
std::ofstream out_
Definition: MemoryBase.h:49
std::string const & getName() const
Definition: MemoryBase.h:19
static std::string hexstr(unsigned int index)
Definition: MemoryBase.cc:111
string fname
main script
void writeSP(bool first, unsigned int iSector)
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:154