CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
- 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 ( std::string  name,
Settings const &  settings 
)

Definition at line 10 of file TrackletProjectionsMemory.cc.

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

11  : MemoryBase(name, settings) {
12  size_t pos = find_nth(name, 0, "_", 1);
13  assert(pos != string::npos);
14  initLayerDisk(pos + 1, layer_, disk_);
15 }
static size_t find_nth(const std::string &haystack, size_t pos, const std::string &needle, size_t nth)
Definition: MemoryBase.cc:103
MemoryBase(std::string name, Settings const &settings)
Definition: MemoryBase.cc:13
assert(be >=bs)
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: MemoryBase.cc:19
trklet::TrackletProjectionsMemory::~TrackletProjectionsMemory ( )
overridedefault

Member Function Documentation

void TrackletProjectionsMemory::addProj ( Tracklet tracklet)

Definition at line 17 of file TrackletProjectionsMemory.cc.

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().

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 }
assert(be >=bs)
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
std::string const & getName() const
Definition: MemoryBase.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Log< level::Warning, true > LogPrint
constexpr int N_LAYER
Definition: Settings.h:21
void TrackletProjectionsMemory::clean ( )
overridevirtual

Implements trklet::MemoryBase.

Definition at line 35 of file TrackletProjectionsMemory.cc.

References tracklets_.

35 { tracklets_.clear(); }
int trklet::TrackletProjectionsMemory::disk ( ) const
inline

Definition at line 32 of file TrackletProjectionsMemory.h.

References disk_.

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

Definition at line 25 of file TrackletProjectionsMemory.h.

References mps_fire::i, and tracklets_.

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

25 { return tracklets_[i]; }
int trklet::TrackletProjectionsMemory::layer ( ) const
inline
unsigned int trklet::TrackletProjectionsMemory::nTracklets ( ) const
inline

Definition at line 23 of file TrackletProjectionsMemory.h.

References tracklets_.

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

23 { return tracklets_.size(); }
void TrackletProjectionsMemory::writeTPROJ ( bool  first,
unsigned int  iSector 
)

Definition at line 37 of file TrackletProjectionsMemory.cc.

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

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 }
std::string memPath() const
Definition: Settings.h:192
unsigned int iSector_
Definition: MemoryBase.h:44
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
std::string const & getName() const
Definition: MemoryBase.h:19
Settings const & settings_
Definition: MemoryBase.h:50
std::ofstream out_
Definition: MemoryBase.h:46
string fname
main script
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:139

Member Data Documentation

int trklet::TrackletProjectionsMemory::disk_
private

Definition at line 38 of file TrackletProjectionsMemory.h.

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

int trklet::TrackletProjectionsMemory::layer_
private

Definition at line 37 of file TrackletProjectionsMemory.h.

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

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

Definition at line 35 of file TrackletProjectionsMemory.h.

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