CMS 3D CMS Logo

TrackletParametersMemory.cc
Go to the documentation of this file.
5 #include <iomanip>
6 
7 using namespace std;
8 using namespace trklet;
9 
10 TrackletParametersMemory::TrackletParametersMemory(string name, Settings const& settings, unsigned int iSector)
11  : MemoryBase(name, settings, iSector) {}
12 
14  for (auto& tracklet : tracklets_) {
15  delete tracklet;
16  }
17  tracklets_.clear();
18 }
19 
20 void TrackletParametersMemory::writeMatches(Globals* globals, int& matchesL1, int& matchesL3, int& matchesL5) {
21  ofstream& out = globals->ofstream("nmatches.txt");
22  for (auto& tracklet : tracklets_) {
23  if ((tracklet->nMatches() + tracklet->nMatchesDisk()) > 0) {
24  if (tracklet->layer() == 1)
25  matchesL1++;
26  if (tracklet->layer() == 3)
27  matchesL3++;
28  if (tracklet->layer() == 5)
29  matchesL5++;
30  }
31  out << tracklet->layer() << " " << tracklet->disk() << " " << tracklet->nMatches() << " "
32  << tracklet->nMatchesDisk() << endl;
33  }
34 }
35 
37  std::ostringstream oss;
38  oss << "../data/MemPrints/TrackletParameters/TrackletParameters_" << getName() << "_" << std::setfill('0')
39  << std::setw(2) << (iSector_ + 1) << ".dat";
40  auto const& fname = oss.str();
41 
42  if (first) {
43  bx_ = 0;
44  event_ = 1;
45  out_.open(fname.c_str());
46  } else
47  out_.open(fname.c_str(), std::ofstream::app);
48 
49  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
50 
51  for (unsigned int j = 0; j < tracklets_.size(); j++) {
52  string tpar = tracklets_[j]->trackletparstr();
53  out_ << "0x";
54  out_ << std::setfill('0') << std::setw(2);
55  out_ << hex << j << dec;
56  out_ << " " << tpar << " " << trklet::hexFormat(tpar) << endl;
57  }
58  out_.close();
59 
60  bx_++;
61  event_++;
62  if (bx_ > 7)
63  bx_ = 0;
64 }
Settings.h
trklet::Settings
Definition: Settings.h:26
TrackletParametersMemory.h
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::TrackletParametersMemory::writeTPAR
void writeTPAR(bool first)
Definition: TrackletParametersMemory.cc:36
trklet::Globals
Definition: Globals.h:32
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::TrackletParametersMemory::writeMatches
void writeMatches(Globals *globals, int &matchesL1, int &matchesL3, int &matchesL5)
Definition: TrackletParametersMemory.cc:20
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::MemoryBase
Definition: MemoryBase.h:13
Globals.h
trklet::TrackletParametersMemory::clean
void clean() override
Definition: TrackletParametersMemory.cc:13
trklet
Definition: AllProjectionsMemory.h:9
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
trklet::Globals::ofstream
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
Tracklet.h
trklet::TrackletParametersMemory::tracklets_
std::vector< Tracklet * > tracklets_
Definition: TrackletParametersMemory.h:36
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44