CMS 3D CMS Logo

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

#include <TrackletParametersMemory.h>

Inheritance diagram for trklet::TrackletParametersMemory:
trklet::MemoryBase

Public Member Functions

void addTracklet (Tracklet *tracklet)
 
void clean () override
 
TrackletgetTracklet (unsigned int i)
 
unsigned int nTracklets () const
 
 TrackletParametersMemory (std::string name, Settings const &settings, unsigned int iSector)
 
void writeMatches (Globals *globals, int &matchesL1, int &matchesL3, int &matchesL5)
 
void writeTPAR (bool first)
 
 ~TrackletParametersMemory () 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
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initSpecialSeeding (unsigned int pos, bool &overlap, bool &extra, bool &extended)
 
 MemoryBase (std::string name, Settings const &settings, unsigned int iSector)
 
void openFile (bool first, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

std::vector< Tracklet * > tracklets_
 

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 17 of file TrackletParametersMemory.h.

Constructor & Destructor Documentation

◆ TrackletParametersMemory()

TrackletParametersMemory::TrackletParametersMemory ( std::string  name,
Settings const &  settings,
unsigned int  iSector 
)

Definition at line 10 of file TrackletParametersMemory.cc.

11  : MemoryBase(name, settings, iSector) {}

◆ ~TrackletParametersMemory()

trklet::TrackletParametersMemory::~TrackletParametersMemory ( )
overridedefault

Member Function Documentation

◆ addTracklet()

void trklet::TrackletParametersMemory::addTracklet ( Tracklet tracklet)
inline

◆ clean()

void TrackletParametersMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 13 of file TrackletParametersMemory.cc.

13  {
14  for (auto& tracklet : tracklets_) {
15  delete tracklet;
16  }
17  tracklets_.clear();
18 }

References tracklets_.

◆ getTracklet()

Tracklet* trklet::TrackletParametersMemory::getTracklet ( unsigned int  i)
inline

Definition at line 27 of file TrackletParametersMemory.h.

27 { return tracklets_[i]; }

References mps_fire::i, and tracklets_.

◆ nTracklets()

unsigned int trklet::TrackletParametersMemory::nTracklets ( ) const
inline

◆ writeMatches()

void TrackletParametersMemory::writeMatches ( Globals globals,
int &  matchesL1,
int &  matchesL3,
int &  matchesL5 
)

Definition at line 20 of file TrackletParametersMemory.cc.

20  {
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 }

References trklet::Globals::ofstream(), MillePedeFileConverter_cfg::out, and tracklets_.

◆ writeTPAR()

void TrackletParametersMemory::writeTPAR ( bool  first)

Definition at line 36 of file TrackletParametersMemory.cc.

36  {
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 }

References trklet::MemoryBase::bx_, TauDecayModes::dec, trklet::MemoryBase::event_, dqmdumpme::first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, trklet::MemoryBase::out_, and tracklets_.

Member Data Documentation

◆ tracklets_

std::vector<Tracklet *> trklet::TrackletParametersMemory::tracklets_
private
mps_fire.i
i
Definition: mps_fire.py:355
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
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings, unsigned int iSector)
Definition: MemoryBase.cc:11
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
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
trklet::TrackletParametersMemory::tracklets_
std::vector< Tracklet * > tracklets_
Definition: TrackletParametersMemory.h:36
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44