CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::CleanTrackMemory Class Reference

#include <CleanTrackMemory.h>

Inheritance diagram for trklet::CleanTrackMemory:
trklet::MemoryBase

Public Member Functions

void addTrack (Tracklet *tracklet)
 
void clean () override
 
 CleanTrackMemory (std::string name, Settings const &settings, double phimin, double phimax)
 
unsigned int nTracks () const
 
void writeCT (bool first, unsigned int iSector)
 
 ~CleanTrackMemory () override=default
 
- Public Member Functions inherited from trklet::MemoryBase
void findAndReplaceAll (std::string &data, std::string toSearch, std::string replaceStr)
 
std::string getLastPartOfName () const
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initSpecialSeeding (unsigned int pos, bool &overlap, bool &extra, bool &extended)
 
 MemoryBase (std::string name, Settings const &settings)
 
void openFile (bool first, std::string dirName, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

double phimax_
 
double phimin_
 
std::vector< Tracklet * > tracks_
 

Additional Inherited Members

- Static Public Member Functions inherited from trklet::MemoryBase
static size_t find_nth (const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
 
- Protected Attributes inherited from trklet::MemoryBase
int bx_
 
int event_
 
unsigned int iSector_
 
std::string name_
 
std::ofstream out_
 
Settings const & settings_
 

Detailed Description

Definition at line 13 of file CleanTrackMemory.h.

Constructor & Destructor Documentation

◆ CleanTrackMemory()

CleanTrackMemory::CleanTrackMemory ( std::string  name,
Settings const &  settings,
double  phimin,
double  phimax 
)

Definition at line 10 of file CleanTrackMemory.cc.

References phimax, phimax_, phimin, and phimin_.

11  : MemoryBase(name, settings) {
12  phimin_ = phimin;
13  phimax_ = phimax;
14 }
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13

◆ ~CleanTrackMemory()

trklet::CleanTrackMemory::~CleanTrackMemory ( )
overridedefault

Member Function Documentation

◆ addTrack()

void trklet::CleanTrackMemory::addTrack ( Tracklet tracklet)
inline

Definition at line 19 of file CleanTrackMemory.h.

References tracks_.

19 { tracks_.push_back(tracklet); }
std::vector< Tracklet * > tracks_

◆ clean()

void trklet::CleanTrackMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 23 of file CleanTrackMemory.h.

References tracks_.

23 { tracks_.clear(); }
std::vector< Tracklet * > tracks_

◆ nTracks()

unsigned int trklet::CleanTrackMemory::nTracks ( ) const
inline

Definition at line 21 of file CleanTrackMemory.h.

References tracks_.

21 { return tracks_.size(); }
std::vector< Tracklet * > tracks_

◆ writeCT()

void CleanTrackMemory::writeCT ( bool  first,
unsigned int  iSector 
)

Definition at line 16 of file CleanTrackMemory.cc.

References trklet::MemoryBase::bx_, TauDecayModes::dec, trklet::MemoryBase::event_, first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, trklet::MemoryBase::settings_, AlCaHLTBitMon_QueryRunRegistry::string, tracks_, and trklet::Settings::writeMonitorData().

16  {
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 }
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
Settings const & settings_
Definition: MemoryBase.h:50
std::ofstream out_
Definition: MemoryBase.h:46
std::string const & getName() const
Definition: MemoryBase.h:19
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
string fname
main script
std::vector< Tracklet * > tracks_
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:139

Member Data Documentation

◆ phimax_

double trklet::CleanTrackMemory::phimax_
private

Definition at line 29 of file CleanTrackMemory.h.

Referenced by CleanTrackMemory().

◆ phimin_

double trklet::CleanTrackMemory::phimin_
private

Definition at line 28 of file CleanTrackMemory.h.

Referenced by CleanTrackMemory().

◆ tracks_

std::vector<Tracklet*> trklet::CleanTrackMemory::tracks_
private

Definition at line 30 of file CleanTrackMemory.h.

Referenced by addTrack(), clean(), nTracks(), and writeCT().