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_ << "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
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:139