CMS 3D CMS Logo

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

#include <VMProjectionsMemory.h>

Inheritance diagram for trklet::VMProjectionsMemory:
trklet::MemoryBase

Public Member Functions

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

int disk_
 
int layer_
 
std::vector< std::pair< Tracklet *, unsigned int > > 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 14 of file VMProjectionsMemory.h.

Constructor & Destructor Documentation

◆ VMProjectionsMemory()

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

Definition at line 10 of file VMProjectionsMemory.cc.

11  : MemoryBase(name, settings, iSector) {
13 }

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

◆ ~VMProjectionsMemory()

trklet::VMProjectionsMemory::~VMProjectionsMemory ( )
overridedefault

Member Function Documentation

◆ addTracklet()

void VMProjectionsMemory::addTracklet ( Tracklet tracklet,
unsigned int  allprojindex 
)

Definition at line 15 of file VMProjectionsMemory.cc.

15  {
16  std::pair<Tracklet*, unsigned int> tmp(tracklet, allprojindex);
17  //Check that order of TCID is correct
18  if (!tracklets_.empty()) {
19  assert(tracklets_[tracklets_.size() - 1].first->TCID() <= tracklet->TCID());
20  }
21  tracklets_.push_back(tmp);
22 }

References cms::cuda::assert(), trklet::Tracklet::TCID(), createJobs::tmp, and tracklets_.

◆ clean()

void trklet::VMProjectionsMemory::clean ( )
inlineoverridevirtual

Implements trklet::MemoryBase.

Definition at line 29 of file VMProjectionsMemory.h.

29 { tracklets_.clear(); }

References tracklets_.

◆ disk()

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

Definition at line 32 of file VMProjectionsMemory.h.

32 { return disk_; }

References disk_.

◆ getAllProjIndex()

int trklet::VMProjectionsMemory::getAllProjIndex ( unsigned int  i) const
inline

Definition at line 25 of file VMProjectionsMemory.h.

25 { return tracklets_[i].second; }

References mps_fire::i, and tracklets_.

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

◆ getTracklet()

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

Definition at line 24 of file VMProjectionsMemory.h.

24 { return tracklets_[i].first; }

References mps_fire::i, and tracklets_.

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

◆ layer()

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

Definition at line 31 of file VMProjectionsMemory.h.

31 { return layer_; }

References layer_.

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

◆ nTracklets()

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

Definition at line 22 of file VMProjectionsMemory.h.

22 { return tracklets_.size(); }

References tracklets_.

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

◆ writeVMPROJ()

void VMProjectionsMemory::writeVMPROJ ( bool  first)

Definition at line 24 of file VMProjectionsMemory.cc.

24  {
25  const string dirVM = settings_.memPath() + "VMProjections/";
26 
27  std::ostringstream oss;
28  oss << dirVM + "VMProjections_" << getName();
29  //get rid of duplicates
30  auto const& tmp = oss.str();
31  int len = tmp.size();
32  if (tmp[len - 2] == 'n' && tmp[len - 1] > '1' && tmp[len - 1] <= '9')
33  return;
34  oss << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
35  auto const& fname = oss.str();
36 
37  if (first) {
38  bx_ = 0;
39  event_ = 1;
40 
41  if (not std::filesystem::exists(dirVM)) {
42  int fail = system((string("mkdir -p ") + dirVM).c_str());
43  if (fail)
44  throw cms::Exception("BadDir") << __FILE__ << " " << __LINE__ << " could not create directory " << dirVM;
45  }
46  out_.open(fname);
47  if (out_.fail())
48  throw cms::Exception("BadFile") << __FILE__ << " " << __LINE__ << " could not create file " << fname;
49 
50  } else
51  out_.open(fname, std::ofstream::app);
52 
53  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
54 
55  for (unsigned int j = 0; j < tracklets_.size(); j++) {
56  string vmproj = (layer_ > 0) ? tracklets_[j].first->vmstrlayer(layer_, tracklets_[j].second)
57  : tracklets_[j].first->vmstrdisk(disk_, tracklets_[j].second);
58  out_ << "0x";
59  out_ << std::setfill('0') << std::setw(2);
60  out_ << hex << j << dec;
61  out_ << " " << vmproj << " " << trklet::hexFormat(vmproj) << endl;
62  }
63  out_.close();
64 
65  bx_++;
66  event_++;
67  if (bx_ > 7)
68  bx_ = 0;
69 }

References trklet::MemoryBase::bx_, TauDecayModes::dec, disk_, trklet::MemoryBase::event_, Exception, first, alignmentValidation::fname, trklet::MemoryBase::getName(), trklet::hexFormat(), trklet::MemoryBase::iSector_, dqmiolumiharvest::j, layer_, trklet::Settings::memPath(), trklet::MemoryBase::out_, edm::second(), trklet::MemoryBase::settings_, createJobs::tmp, and tracklets_.

Member Data Documentation

◆ disk_

int trklet::VMProjectionsMemory::disk_
private

Definition at line 36 of file VMProjectionsMemory.h.

Referenced by disk(), VMProjectionsMemory(), and writeVMPROJ().

◆ layer_

int trklet::VMProjectionsMemory::layer_
private

Definition at line 35 of file VMProjectionsMemory.h.

Referenced by layer(), VMProjectionsMemory(), and writeVMPROJ().

◆ tracklets_

std::vector<std::pair<Tracklet*, unsigned int> > trklet::VMProjectionsMemory::tracklets_
private
trklet::VMProjectionsMemory::tracklets_
std::vector< std::pair< Tracklet *, unsigned int > > tracklets_
Definition: VMProjectionsMemory.h:37
trklet::MemoryBase::settings_
Settings const & settings_
Definition: MemoryBase.h:50
mps_fire.i
i
Definition: mps_fire.py:428
trklet::VMProjectionsMemory::disk_
int disk_
Definition: VMProjectionsMemory.h:36
trklet::Settings::memPath
std::string const & memPath() const
Definition: Settings.h:169
cms::cuda::assert
assert(be >=bs)
trklet::MemoryBase::event_
int event_
Definition: MemoryBase.h:48
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
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:18
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
trklet::Tracklet::TCID
int TCID() const
Definition: Tracklet.h:500
trklet::MemoryBase::MemoryBase
MemoryBase(std::string name, Settings const &settings, unsigned int iSector)
Definition: MemoryBase.cc:12
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
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
trklet::VMProjectionsMemory::layer_
int layer_
Definition: VMProjectionsMemory.h:35
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44