CMS 3D CMS Logo

VMProjectionsMemory.cc
Go to the documentation of this file.
3 #include <iomanip>
5 
6 using namespace std;
7 using namespace trklet;
8 
9 VMProjectionsMemory::VMProjectionsMemory(string name, Settings const& settings, unsigned int iSector)
10  : MemoryBase(name, settings, iSector) {
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 
24  std::ostringstream oss;
25  oss << "../data/MemPrints/VMProjections/VMProjections_" << getName();
26  //get rid of duplicates
27  auto const& tmp = oss.str();
28  int len = tmp.size();
29  if (tmp[len - 2] == 'n' && tmp[len - 1] > '1' && tmp[len - 1] <= '9')
30  return;
31  oss << "_" << std::setfill('0') << std::setw(2) << (iSector_ + 1) << ".dat";
32  auto const& fname = oss.str();
33 
34  if (first) {
35  bx_ = 0;
36  event_ = 1;
37  out_.open(fname.c_str());
38  } else
39  out_.open(fname.c_str(), std::ofstream::app);
40 
41  out_ << "BX = " << (bitset<3>)bx_ << " Event : " << event_ << endl;
42 
43  for (unsigned int j = 0; j < tracklets_.size(); j++) {
44  string vmproj = (layer_ > 0) ? tracklets_[j].first->vmstrlayer(layer_, tracklets_[j].second)
45  : tracklets_[j].first->vmstrdisk(disk_, tracklets_[j].second);
46  out_ << "0x";
47  out_ << std::setfill('0') << std::setw(2);
48  out_ << hex << j << dec;
49  out_ << " " << vmproj << " " << trklet::hexFormat(vmproj) << endl;
50  }
51  out_.close();
52 
53  bx_++;
54  event_++;
55  if (bx_ > 7)
56  bx_ = 0;
57 }
trklet::VMProjectionsMemory::tracklets_
std::vector< std::pair< Tracklet *, unsigned int > > tracklets_
Definition: VMProjectionsMemory.h:37
MessageLogger.h
trklet::VMProjectionsMemory::disk_
int disk_
Definition: VMProjectionsMemory.h:36
trklet::Settings
Definition: Settings.h:26
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:17
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::MemoryBase::bx_
int bx_
Definition: MemoryBase.h:47
dqmdumpme.first
first
Definition: dqmdumpme.py:55
trklet::Tracklet
Definition: Tracklet.h:28
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::Tracklet::TCID
int TCID() const
Definition: Tracklet.h:500
trklet
Definition: AllProjectionsMemory.h:9
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
std
Definition: JetResolutionObject.h:76
trklet::VMProjectionsMemory::writeVMPROJ
void writeVMPROJ(bool first)
Definition: VMProjectionsMemory.cc:23
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::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:143
VMProjectionsMemory.h
Tracklet.h
trklet::MemoryBase::iSector_
unsigned int iSector_
Definition: MemoryBase.h:44