CMS 3D CMS Logo

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

#include <TrackFitMemory.h>

Inheritance diagram for trklet::TrackFitMemory:
trklet::MemoryBase

Public Member Functions

void addStubidsList (std::vector< std::pair< int, int >> stubidslist)
 
void addStubList (std::vector< const Stub * > stublist)
 
void addTrack (Tracklet *tracklet)
 
void clean () override
 
std::vector< std::pair< int, int > > getStubidslist (unsigned int i) const
 
std::vector< const Stub * > getStublist (unsigned int i) const
 
TrackletgetTrack (unsigned int i)
 
unsigned int nStubidslists () const
 
unsigned int nStublists () const
 
unsigned int nTracks () const
 
 TrackFitMemory (std::string name, Settings const &settings, unsigned int iSector, double phimin, double phimax)
 
void writeTF (bool first)
 
 ~TrackFitMemory () 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 dirName, std::string filebase)
 
virtual ~MemoryBase ()=default
 

Private Attributes

double phimax_
 
double phimin_
 
std::vector< std::vector< std::pair< int, int > > > stubidslists_
 
std::vector< std::vector< const Stub * > > stublists_
 
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 15 of file TrackFitMemory.h.

Constructor & Destructor Documentation

◆ TrackFitMemory()

TrackFitMemory::TrackFitMemory ( std::string  name,
Settings const &  settings,
unsigned int  iSector,
double  phimin,
double  phimax 
)

Definition at line 10 of file TrackFitMemory.cc.

11  : MemoryBase(name, settings, iSector) {
12  phimin_ = phimin;
13  phimax_ = phimax;
14 }

References phimax, phimax_, phimin, and phimin_.

◆ ~TrackFitMemory()

trklet::TrackFitMemory::~TrackFitMemory ( )
overridedefault

Member Function Documentation

◆ addStubidsList()

void trklet::TrackFitMemory::addStubidsList ( std::vector< std::pair< int, int >>  stubidslist)
inline

Definition at line 23 of file TrackFitMemory.h.

23 { stubidslists_.push_back(stubidslist); }

References stubidslists_.

Referenced by trklet::FitTrack::execute().

◆ addStubList()

void trklet::TrackFitMemory::addStubList ( std::vector< const Stub * >  stublist)
inline

Definition at line 22 of file TrackFitMemory.h.

22 { stublists_.push_back(stublist); }

References stublists_.

Referenced by trklet::FitTrack::execute().

◆ addTrack()

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

Definition at line 21 of file TrackFitMemory.h.

21 { tracks_.push_back(tracklet); }

References tracks_.

Referenced by trklet::FitTrack::execute().

◆ clean()

void trklet::TrackFitMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 33 of file TrackFitMemory.h.

33  {
34  tracks_.clear();
35  stublists_.clear();
36  stubidslists_.clear();
37  }

References stubidslists_, stublists_, and tracks_.

◆ getStubidslist()

std::vector<std::pair<int, int> > trklet::TrackFitMemory::getStubidslist ( unsigned int  i) const
inline

Definition at line 31 of file TrackFitMemory.h.

31 { return stubidslists_[i]; }

References mps_fire::i, and stubidslists_.

◆ getStublist()

std::vector<const Stub*> trklet::TrackFitMemory::getStublist ( unsigned int  i) const
inline

Definition at line 30 of file TrackFitMemory.h.

30 { return stublists_[i]; }

References mps_fire::i, and stublists_.

◆ getTrack()

Tracklet* trklet::TrackFitMemory::getTrack ( unsigned int  i)
inline

Definition at line 29 of file TrackFitMemory.h.

29 { return tracks_[i]; }

References mps_fire::i, and tracks_.

◆ nStubidslists()

unsigned int trklet::TrackFitMemory::nStubidslists ( ) const
inline

Definition at line 27 of file TrackFitMemory.h.

27 { return stubidslists_.size(); }

References stubidslists_.

◆ nStublists()

unsigned int trklet::TrackFitMemory::nStublists ( ) const
inline

Definition at line 26 of file TrackFitMemory.h.

26 { return stublists_.size(); }

References stublists_.

◆ nTracks()

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

Definition at line 25 of file TrackFitMemory.h.

25 { return tracks_.size(); }

References tracks_.

◆ writeTF()

void TrackFitMemory::writeTF ( bool  first)

Definition at line 16 of file TrackFitMemory.cc.

16  {
17  const string dirFT = settings_.memPath() + "FitTrack/";
18 
19  std::ostringstream oss;
20  oss << dirFT << "TrackFit_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
21  auto const& fname = oss.str();
22 
23  if (first) {
24  bx_ = 0;
25  event_ = 1;
26 
27  if (not std::filesystem::exists(dirFT)) {
28  int fail = system((string("mkdir -p ") + dirFT).c_str());
29  if (fail)
30  throw cms::Exception("BadDir") << __FILE__ << " " << __LINE__ << " could not create directory " << dirFT;
31  }
32  out_.open(fname);
33  if (out_.fail())
34  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
35 
36  } else
37  out_.open(fname, std::ofstream::app);
38 
39  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
40 
41  for (unsigned int j = 0; j < tracks_.size(); j++) {
42  out_ << "0x";
43  out_ << std::setfill('0') << std::setw(2);
44  out_ << hex << j << dec << " ";
45  out_ << tracks_[j]->trackfitstr() << " " << trklet::hexFormat(tracks_[j]->trackfitstr());
46  out_ << "\n";
47  }
48  out_.close();
49 
50  bx_++;
51  event_++;
52  if (bx_ > 7)
53  bx_ = 0;
54 }

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

Member Data Documentation

◆ phimax_

double trklet::TrackFitMemory::phimax_
private

Definition at line 43 of file TrackFitMemory.h.

Referenced by TrackFitMemory().

◆ phimin_

double trklet::TrackFitMemory::phimin_
private

Definition at line 42 of file TrackFitMemory.h.

Referenced by TrackFitMemory().

◆ stubidslists_

std::vector<std::vector<std::pair<int, int> > > trklet::TrackFitMemory::stubidslists_
private

Definition at line 46 of file TrackFitMemory.h.

Referenced by addStubidsList(), clean(), getStubidslist(), and nStubidslists().

◆ stublists_

std::vector<std::vector<const Stub*> > trklet::TrackFitMemory::stublists_
private

Definition at line 45 of file TrackFitMemory.h.

Referenced by addStubList(), clean(), getStublist(), and nStublists().

◆ tracks_

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

Definition at line 44 of file TrackFitMemory.h.

Referenced by addTrack(), clean(), getTrack(), nTracks(), and writeTF().

trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
trklet::TrackFitMemory::phimax_
double phimax_
Definition: TrackFitMemory.h:43
mps_fire.i
i
Definition: mps_fire.py:428
phimin
float phimin
Definition: ReggeGribovPartonMCHadronizer.h:107
trklet::TrackFitMemory::stublists_
std::vector< std::vector< const Stub * > > stublists_
Definition: TrackFitMemory.h:45
trklet::Settings::memPath
std::string const & memPath() const
Definition: Settings.h:169
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
trklet::TrackFitMemory::phimin_
double phimin_
Definition: TrackFitMemory.h:42
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings, unsigned int iSector)
Definition: MemoryBase.cc:12
phimax
float phimax
Definition: ReggeGribovPartonMCHadronizer.h:106
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
trklet::TrackFitMemory::tracks_
std::vector< Tracklet * > tracks_
Definition: TrackFitMemory.h:44
trklet::TrackFitMemory::stubidslists_
std::vector< std::vector< std::pair< int, int > > > stubidslists_
Definition: TrackFitMemory.h:46
Exception
Definition: hltDiff.cc:245
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:15
cms::Exception
Definition: Exception.h:70
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44