CMS 3D CMS Logo

CleanTrackMemory.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 CleanTrackMemory::CleanTrackMemory(string name, Settings const& settings, double phimin, double phimax)
11  : MemoryBase(name, settings) {
12  phimin_ = phimin;
13  phimax_ = phimax;
14 }
15 
16 void CleanTrackMemory::writeCT(bool first, unsigned int iSector) {
17  iSector_ = iSector;
18  const string dirCT = settings_.memPath() + "CleanTrack/";
19 
20  std::ostringstream oss;
21  oss << dirCT << "CleanTrack_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
22  auto const& fname = oss.str();
23 
24  openfile(out_, first, dirCT, fname, __FILE__, __LINE__);
25 
26  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
27 
28  for (unsigned int j = 0; j < tracks_.size(); j++) {
29  out_ << "0x";
30  out_ << std::setfill('0') << std::setw(2);
31  out_ << hex << j << dec << " ";
32  out_ << tracks_[j]->trackfitstr() << " " << trklet::hexFormat(tracks_[j]->trackfitstr());
33  out_ << "\n";
34  }
35  out_.close();
36 
37  // --------------------------------------------------------------
38  // print separately ALL cleaned tracks in single file
39  if (settings_.writeMonitorData("CT")) {
40  std::string fnameAll = "CleanTracksAll.dat";
41  if (first && getName() == "CT_L1L2" && iSector_ == 0)
42  out_.open(fnameAll);
43  else
44  out_.open(fnameAll, std::ofstream::app);
45 
46  if (!tracks_.empty())
47  out_ << "BX= " << (bitset<3>)bx_ << " event= " << event_ << " seed= " << getName()
48  << " phisector= " << iSector_ + 1 << endl;
49 
50  for (unsigned int j = 0; j < tracks_.size(); j++) {
51  if (j < 16)
52  out_ << "0";
53  out_ << hex << j << dec << " ";
54  out_ << tracks_[j]->trackfitstr();
55  out_ << "\n";
56  }
57  out_.close();
58  }
59  // --------------------------------------------------------------
60 
61  bx_++;
62  event_++;
63  if (bx_ > 7)
64  bx_ = 0;
65 }
trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
phimin
float phimin
Definition: ReggeGribovPartonMCHadronizer.h:107
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
CleanTrackMemory.h
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::CleanTrackMemory::phimin_
double phimin_
Definition: CleanTrackMemory.h:28
SLHCEvent.h
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
trklet::CleanTrackMemory::phimax_
double phimax_
Definition: CleanTrackMemory.h:29
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::CleanTrackMemory::writeCT
void writeCT(bool first, unsigned int iSector)
Definition: CleanTrackMemory.cc:16
trklet::CleanTrackMemory::tracks_
std::vector< Tracklet * > tracks_
Definition: CleanTrackMemory.h:30
trklet
Definition: AllInnerStubsMemory.h:10
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
phimax
float phimax
Definition: ReggeGribovPartonMCHadronizer.h:106
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
std
Definition: JetResolutionObject.h:76
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
Tracklet.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44