CMS 3D CMS Logo

VMProjectionsMemory.cc
Go to the documentation of this file.
4 #include <iomanip>
5 #include <filesystem>
6 
7 using namespace std;
8 using namespace trklet;
9 
10 VMProjectionsMemory::VMProjectionsMemory(string name, Settings const& settings) : MemoryBase(name, settings) {
12 }
13 
14 void VMProjectionsMemory::addTracklet(Tracklet* tracklet, unsigned int allprojindex) {
15  std::pair<Tracklet*, unsigned int> tmp(tracklet, allprojindex);
16  //Check that order of TCID is correct
17  if (!tracklets_.empty()) {
18  assert(tracklets_[tracklets_.size() - 1].first->TCID() <= tracklet->TCID());
19  }
20  tracklets_.push_back(tmp);
21 }
22 
23 void VMProjectionsMemory::writeVMPROJ(bool first, unsigned int iSector) {
24  iSector_ = iSector;
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  openfile(out_, first, dirVM, fname, __FILE__, __LINE__);
38 
39  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
40 
41  for (unsigned int j = 0; j < tracklets_.size(); j++) {
42  string vmproj = (layer_ > 0) ? tracklets_[j].first->vmstrlayer(layer_, tracklets_[j].second)
43  : tracklets_[j].first->vmstrdisk(disk_, tracklets_[j].second);
44  out_ << "0x";
45  out_ << std::setfill('0') << std::setw(2);
46  out_ << hex << j << dec;
47  out_ << " " << vmproj << " " << trklet::hexFormat(vmproj) << endl;
48  }
49  out_.close();
50 
51  bx_++;
52  event_++;
53  if (bx_ > 7)
54  bx_ = 0;
55 }
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
trklet::VMProjectionsMemory::writeVMPROJ
void writeVMPROJ(bool first, unsigned int iSector)
Definition: VMProjectionsMemory.cc:23
MessageLogger.h
trklet::VMProjectionsMemory::disk_
int disk_
Definition: VMProjectionsMemory.h:36
trklet::openfile
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:138
trklet::Settings
Definition: Settings.h:52
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:19
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
trklet::Tracklet
Definition: Tracklet.h:27
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::Settings::memPath
std::string memPath() const
Definition: Settings.h:192
trklet::Tracklet::TCID
int TCID() const
Definition: Tracklet.h:212
trklet
Definition: AllInnerStubsMemory.h:10
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::hexFormat
std::string hexFormat(const std::string &binary)
Definition: Util.h:19
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::VMProjectionsMemory::addTracklet
void addTracklet(Tracklet *tracklet, unsigned int allprojindex)
Definition: VMProjectionsMemory.cc:14
trklet::VMProjectionsMemory::layer_
int layer_
Definition: VMProjectionsMemory.h:35
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
VMProjectionsMemory.h
Tracklet.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44