CMS 3D CMS Logo

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

#include <TrackletProjectionsMemory.h>

Inheritance diagram for trklet::TrackletProjectionsMemory:
trklet::MemoryBase

Public Member Functions

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

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)
 
- 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 TrackletProjectionsMemory.h.

Constructor & Destructor Documentation

◆ TrackletProjectionsMemory()

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

Definition at line 9 of file TrackletProjectionsMemory.cc.

10  : MemoryBase(name, settings, iSector) {
11  size_t pos = find_nth(name, 0, "_", 1);
12  assert(pos != string::npos);
14 }

References cms::cuda::assert(), disk_, trklet::MemoryBase::find_nth(), trklet::MemoryBase::initLayerDisk(), layer_, and Skims_PA_cff::name.

◆ ~TrackletProjectionsMemory()

trklet::TrackletProjectionsMemory::~TrackletProjectionsMemory ( )
overridedefault

Member Function Documentation

◆ addProj()

void TrackletProjectionsMemory::addProj ( Tracklet tracklet)

Definition at line 16 of file TrackletProjectionsMemory.cc.

16  {
17  if (layer_ != 0 && disk_ == 0)
18  assert(tracklet->validProj(layer_));
19  if (layer_ == 0 && disk_ != 0)
20  assert(tracklet->validProjDisk(disk_));
21  if (layer_ != 0 && disk_ != 0)
22  assert(tracklet->validProj(layer_) || tracklet->validProjDisk(disk_));
23 
24  for (auto& itracklet : tracklets_) {
25  if (itracklet == tracklet) {
26  edm::LogPrint("Tracklet") << "Adding same tracklet " << tracklet << " twice in " << getName();
27  }
28  assert(itracklet != tracklet);
29  }
30 
31  tracklets_.push_back(tracklet);
32 }

References cms::cuda::assert(), disk_, trklet::MemoryBase::getName(), layer_, tracklets_, trklet::Tracklet::validProj(), and trklet::Tracklet::validProjDisk().

Referenced by trklet::TrackletCalculatorDisplaced::addProjection(), trklet::TrackletCalculatorBase::addProjection(), trklet::TrackletCalculatorDisplaced::addProjectionDisk(), and trklet::TrackletCalculatorBase::addProjectionDisk().

◆ clean()

void TrackletProjectionsMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 34 of file TrackletProjectionsMemory.cc.

34 { tracklets_.clear(); }

References tracklets_.

◆ disk()

int trklet::TrackletProjectionsMemory::disk ( ) const
inline

Definition at line 32 of file TrackletProjectionsMemory.h.

32 { return disk_; }

References disk_.

◆ getTracklet()

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

Definition at line 25 of file TrackletProjectionsMemory.h.

25 { return tracklets_[i]; }

References mps_fire::i, and tracklets_.

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

◆ layer()

int trklet::TrackletProjectionsMemory::layer ( ) const
inline

Definition at line 31 of file TrackletProjectionsMemory.h.

31 { return layer_; }

References layer_.

Referenced by geometryXMLparser.DTAlignable::index(), and geometryXMLparser.CSCAlignable::index().

◆ nTracklets()

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

Definition at line 23 of file TrackletProjectionsMemory.h.

23 { return tracklets_.size(); }

References tracklets_.

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

◆ writeTPROJ()

void TrackletProjectionsMemory::writeTPROJ ( bool  first)

Definition at line 36 of file TrackletProjectionsMemory.cc.

36  {
37  std::ostringstream oss;
38  oss << "../data/MemPrints/TrackletProjections/TrackletProjections_" << 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 proj = (layer_ > 0 && tracklets_[j]->validProj(layer_)) ? tracklets_[j]->trackletprojstrlayer(layer_)
53  : tracklets_[j]->trackletprojstrdisk(disk_);
54  out_ << "0x";
55  out_ << std::setfill('0') << std::setw(2);
56  out_ << hex << j << dec;
57  out_ << " " << proj << " " << trklet::hexFormat(proj) << endl;
58  }
59  out_.close();
60 
61  bx_++;
62  event_++;
63  if (bx_ > 7)
64  bx_ = 0;
65 }

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

Member Data Documentation

◆ disk_

int trklet::TrackletProjectionsMemory::disk_
private

Definition at line 38 of file TrackletProjectionsMemory.h.

Referenced by addProj(), disk(), TrackletProjectionsMemory(), and writeTPROJ().

◆ layer_

int trklet::TrackletProjectionsMemory::layer_
private

Definition at line 37 of file TrackletProjectionsMemory.h.

Referenced by addProj(), layer(), TrackletProjectionsMemory(), and writeTPROJ().

◆ tracklets_

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

Definition at line 35 of file TrackletProjectionsMemory.h.

Referenced by addProj(), clean(), getTracklet(), nTracklets(), and writeTPROJ().

mps_fire.i
i
Definition: mps_fire.py:355
trklet::MemoryBase::find_nth
static size_t find_nth(const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
Definition: MemoryBase.cc:108
pos
Definition: PixelAliasList.h:18
cms::cuda::assert
assert(be >=bs)
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
trklet::MemoryBase::out_
std::ofstream out_
Definition: MemoryBase.h:46
trklet::MemoryBase::initLayerDisk
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:17
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::Tracklet::validProj
bool validProj(int layer) const
Definition: Tracklet.h:89
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
trklet::TrackletProjectionsMemory::disk_
int disk_
Definition: TrackletProjectionsMemory.h:38
edm::LogPrint
Definition: MessageLogger.h:342
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::TrackletProjectionsMemory::tracklets_
std::vector< Tracklet * > tracklets_
Definition: TrackletProjectionsMemory.h:35
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:14
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::Tracklet::validProjDisk
bool validProjDisk(int disk) const
Definition: Tracklet.h:206
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44
trklet::TrackletProjectionsMemory::layer_
int layer_
Definition: TrackletProjectionsMemory.h:37