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 }
trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
trklet::openfile
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:138
trklet::Settings
Definition: Settings.h:52
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::StubPairsMemory::stubs_
std::vector< std::pair< const VMStubTE, const VMStubTE > > stubs_
Definition: StubPairsMemory.h:45
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::StubPairsMemory::writeSP
void writeSP(bool first, unsigned int iSector)
Definition: StubPairsMemory.cc:11
StubPairsMemory.h
trklet
Definition: AllInnerStubsMemory.h:10
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
VMStubTE.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44