CMS 3D CMS Logo

StubTripletsMemory.cc
Go to the documentation of this file.
4 #include <iomanip>
5 #include <filesystem>
6 
7 using namespace std;
8 using namespace trklet;
9 
10 StubTripletsMemory::StubTripletsMemory(string name, Settings const& settings) : MemoryBase(name, settings) {}
11 
12 void StubTripletsMemory::writeST(bool first, unsigned int iSector) {
13  iSector_ = iSector;
14  const string dirSP = settings_.memPath() + "StubPairs/";
15 
16  std::ostringstream oss;
17  oss << dirSP << "StubTriplets_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
18  auto const& fname = oss.str();
19 
20  openfile(out_, first, dirSP, fname, __FILE__, __LINE__);
21 
22  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
23 
24  for (unsigned int j = 0; j < stubs1_.size(); j++) {
25  string stub1index = stubs1_[j]->stubindex().str();
26  string stub2index = stubs2_[j]->stubindex().str();
27  string stub3index = stubs3_[j]->stubindex().str();
28  out_ << hexstr(j) << " " << stub1index << "|" << stub2index << "|" << stub3index << endl;
29  }
30  out_.close();
31 
32  bx_++;
33  event_++;
34  if (bx_ > 7)
35  bx_ = 0;
36 }
unsigned int iSector_
Definition: MemoryBase.h:47
std::vector< const Stub * > stubs2_
std::string memPath() const
Definition: Settings.h:192
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
std::vector< const Stub * > stubs1_
void writeST(bool first, unsigned int iSector)
string fname
main script
std::vector< const Stub * > stubs3_
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:137