CMS 3D CMS Logo

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

#include <AllProjectionsMemory.h>

Inheritance diagram for trklet::AllProjectionsMemory:
trklet::MemoryBase

Public Member Functions

void addTracklet (Tracklet *tracklet)
 
 AllProjectionsMemory (std::string name, Settings const &settings)
 
void clean () override
 
const TrackletgetTracklet (unsigned int i) const
 
unsigned int nTracklets () const
 
void writeAP (bool first, unsigned int iSector)
 
 ~AllProjectionsMemory () 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

int disk_
 
int layer_
 
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)
 
static std::string hexstr (unsigned int index)
 
- 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 14 of file AllProjectionsMemory.h.

Constructor & Destructor Documentation

◆ AllProjectionsMemory()

AllProjectionsMemory::AllProjectionsMemory ( std::string  name,
Settings const &  settings 
)

Definition at line 13 of file AllProjectionsMemory.cc.

References disk_, trklet::MemoryBase::initLayerDisk(), and layer_.

13  : MemoryBase(name, settings) {
15 }
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:14
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:20

◆ ~AllProjectionsMemory()

trklet::AllProjectionsMemory::~AllProjectionsMemory ( )
overridedefault

Member Function Documentation

◆ addTracklet()

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

Definition at line 20 of file AllProjectionsMemory.h.

References tracklets_.

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

20 { tracklets_.push_back(tracklet); }
std::vector< Tracklet * > tracklets_

◆ clean()

void trklet::AllProjectionsMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 26 of file AllProjectionsMemory.h.

References tracklets_.

26 { tracklets_.clear(); }
std::vector< Tracklet * > tracklets_

◆ getTracklet()

const Tracklet* trklet::AllProjectionsMemory::getTracklet ( unsigned int  i) const
inline

Definition at line 24 of file AllProjectionsMemory.h.

References mps_fire::i, and tracklets_.

24 { return tracklets_[i]; }
std::vector< Tracklet * > tracklets_

◆ nTracklets()

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

Definition at line 22 of file AllProjectionsMemory.h.

References tracklets_.

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

22 { return tracklets_.size(); }
std::vector< Tracklet * > tracklets_

◆ writeAP()

void AllProjectionsMemory::writeAP ( bool  first,
unsigned int  iSector 
)

Definition at line 17 of file AllProjectionsMemory.cc.

References trklet::MemoryBase::bx_, disk_, trklet::MemoryBase::event_, first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::hexstr(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, layer_, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, amptDefault_cfi::proj, trklet::MemoryBase::settings_, and tracklets_.

17  {
18  iSector_ = iSector;
19  const string dirTP = settings_.memPath() + "TrackletProjections/";
20 
21  std::ostringstream oss;
22  oss << dirTP << "AllProj_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
23  auto const& fname = oss.str();
24 
25  openfile(out_, first, dirTP, fname, __FILE__, __LINE__);
26 
27  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
28 
29  for (unsigned int j = 0; j < tracklets_.size(); j++) {
30  string proj =
31  (layer_ > 0) ? tracklets_[j]->trackletprojstrlayer(layer_) : tracklets_[j]->trackletprojstrdisk(disk_);
32  out_ << hexstr(j) << " " << proj << " " << trklet::hexFormat(proj) << endl;
33  }
34  out_.close();
35 
36  bx_++;
37  event_++;
38  if (bx_ > 7)
39  bx_ = 0;
40 }
unsigned int iSector_
Definition: MemoryBase.h:47
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:53
std::ofstream out_
Definition: MemoryBase.h:49
std::vector< Tracklet * > tracklets_
std::string const & getName() const
Definition: MemoryBase.h:19
static std::string hexstr(unsigned int index)
Definition: MemoryBase.cc:111
string fname
main script
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:137

Member Data Documentation

◆ disk_

int trklet::AllProjectionsMemory::disk_
private

Definition at line 34 of file AllProjectionsMemory.h.

Referenced by AllProjectionsMemory(), and writeAP().

◆ layer_

int trklet::AllProjectionsMemory::layer_
private

Definition at line 33 of file AllProjectionsMemory.h.

Referenced by AllProjectionsMemory(), and writeAP().

◆ tracklets_

std::vector<Tracklet*> trklet::AllProjectionsMemory::tracklets_
private

Definition at line 31 of file AllProjectionsMemory.h.

Referenced by addTracklet(), clean(), getTracklet(), nTracklets(), and writeAP().