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)
 
void writeTPROJ (bool first, unsigned int iSector)
 
 ~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)
 
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)
 
- 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 
)

Definition at line 10 of file TrackletProjectionsMemory.cc.

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

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 17 of file TrackletProjectionsMemory.cc.

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

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

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 35 of file TrackletProjectionsMemory.cc.

35 { 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,
unsigned int  iSector 
)

Definition at line 37 of file TrackletProjectionsMemory.cc.

37  {
38  iSector_ = iSector;
39  const string dirTP = settings_.memPath() + "TrackletProjections/";
40 
41  std::ostringstream oss;
42  oss << dirTP << "TrackletProjections_" << getName() << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1)
43  << ".dat";
44  auto const& fname = oss.str();
45 
46  openfile(out_, first, dirTP, fname, __FILE__, __LINE__);
47 
48  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
49 
50  for (unsigned int j = 0; j < tracklets_.size(); j++) {
51  string proj = (layer_ > 0 && tracklets_[j]->validProj(layer_ - 1)) ? tracklets_[j]->trackletprojstrlayer(layer_)
52  : tracklets_[j]->trackletprojstrdisk(disk_);
53  out_ << "0x";
54  out_ << std::setfill('0') << std::setw(2);
55  out_ << hex << j << dec;
56  out_ << " " << proj << " " << trklet::hexFormat(proj) << endl;
57  }
58  out_.close();
59 
60  bx_++;
61  event_++;
62  if (bx_ > 7)
63  bx_ = 0;
64 }

References trklet::MemoryBase::bx_, TauDecayModes::dec, disk_, trklet::MemoryBase::event_, first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, layer_, trklet::Settings::memPath(), trklet::openfile(), trklet::MemoryBase::out_, amptDefault_cfi::proj, trklet::MemoryBase::settings_, 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().

trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
mps_fire.i
i
Definition: mps_fire.py:428
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:103
trklet::openfile
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:138
pos
Definition: PixelAliasList.h:18
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
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:19
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::Tracklet::validProj
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:21
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::TrackletProjectionsMemory::disk_
int disk_
Definition: TrackletProjectionsMemory.h:38
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
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:19
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44
trklet::TrackletProjectionsMemory::layer_
int layer_
Definition: TrackletProjectionsMemory.h:37