CMS 3D CMS Logo

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

#include <TripletEngine.h>

Inheritance diagram for trklet::TripletEngine:
trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void execute ()
 
void readTables ()
 
 TripletEngine (std::string name, Settings const &settings, Globals *global)
 
void writeTables ()
 
 ~TripletEngine () override
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global)
 
virtual ~ProcessBase ()=default
 

Private Attributes

int count_
 
int dct1_
 
int dct2_
 
int dct3_
 
int disk1_
 
int disk2_
 
int disk3_
 
int iSeed_
 
int layer1_
 
int layer2_
 
int layer3_
 
int phi1_
 
int phi2_
 
int phi3_
 
int r1_
 
int r2_
 
int r3_
 
int secondphibits_
 
std::map< std::string, std::vector< std::map< std::string, unsigned > > > spTable_
 
std::vector< StubPairsMemory * > stubpairs_
 
StubTripletsMemorystubtriplets_
 
std::vector< bool > table_
 
int thirdphibits_
 
std::vector< VMStubsTEMemory * > thirdvmstubs_
 
std::map< std::string, std::vector< std::vector< std::string > > > tmpSPTable_
 
int z1_
 
int z2_
 
int z3_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 18 of file TripletEngine.h.

Constructor & Destructor Documentation

◆ TripletEngine()

TripletEngine::TripletEngine ( std::string  name,
Settings const &  settings,
Globals global 
)

Definition at line 13 of file TripletEngine.cc.

References dct1_, dct2_, dct3_, disk1_, disk2_, disk3_, trklet::Settings::enableTripletTables(), Exception, iSeed_, layer1_, layer2_, layer3_, trklet::ProcessBase::name_, trklet::Settings::nfinephi(), phi1_, phi2_, phi3_, r1_, r2_, r3_, readTables(), secondphibits_, trklet::ProcessBase::settings_, stubpairs_, thirdphibits_, thirdvmstubs_, trklet::Settings::writeTripletTables(), z1_, z2_, and z3_.

14  : ProcessBase(name, settings, global) {
15  stubpairs_.clear();
16  thirdvmstubs_.clear();
17  layer1_ = 0;
18  layer2_ = 0;
19  layer3_ = 0;
20  disk1_ = 0;
21  disk2_ = 0;
22  disk3_ = 0;
23  dct1_ = 0;
24  dct2_ = 0;
25  dct3_ = 0;
26  phi1_ = 0;
27  phi2_ = 0;
28  phi3_ = 0;
29  z1_ = 0;
30  z2_ = 0;
31  z3_ = 0;
32  r1_ = 0;
33  r2_ = 0;
34  r3_ = 0;
35 
36  if (name_[4] == 'L')
37  layer1_ = name_[5] - '0';
38  if (name_[4] == 'D')
39  disk1_ = name_[5] - '0';
40  if (name_[7] == 'L')
41  layer2_ = name_[8] - '0';
42  if (name_[7] == 'D')
43  disk2_ = name_[8] - '0';
44 
45  if (layer1_ == 3 && layer2_ == 4) {
46  layer3_ = 2;
47  iSeed_ = 8;
48  } else if (layer1_ == 5 && layer2_ == 6) {
49  layer3_ = 4;
50  iSeed_ = 9;
51  } else if (layer1_ == 2 && layer2_ == 3) {
52  disk3_ = 1;
53  iSeed_ = 10;
54  } else if (disk1_ == 1 && disk2_ == 2) {
55  layer3_ = 2;
56  iSeed_ = 11;
57  } else
58  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
59 
60  if ((layer2_ == 4 && layer3_ == 2) || (layer2_ == 6 && layer3_ == 4)) {
63  }
64  if ((layer2_ == 3 && disk3_ == 1) || (disk2_ == 2 && layer3_ == 2)) {
67  }
69  readTables();
70 }
std::string name_
Definition: ProcessBase.h:38
bool enableTripletTables() const
Definition: Settings.h:202
Settings const & settings_
Definition: ProcessBase.h:40
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14
std::vector< VMStubsTEMemory * > thirdvmstubs_
Definition: TripletEngine.h:54
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:133
std::vector< StubPairsMemory * > stubpairs_
Definition: TripletEngine.h:55
bool writeTripletTables() const
Definition: Settings.h:203

◆ ~TripletEngine()

TripletEngine::~TripletEngine ( )
override

Definition at line 72 of file TripletEngine.cc.

References trklet::ProcessBase::settings_, writeTables(), and trklet::Settings::writeTripletTables().

72  {
74  writeTables();
75 }
Settings const & settings_
Definition: ProcessBase.h:40
bool writeTripletTables() const
Definition: Settings.h:203

Member Function Documentation

◆ addInput()

void TripletEngine::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 91 of file TripletEngine.cc.

References cms::cuda::assert(), Exception, input, mps_setup::memory, trklet::ProcessBase::name_, trklet::ProcessBase::settings_, stubpairs_, thirdvmstubs_, createJobs::tmp, and trklet::Settings::writetrace().

91  {
92  if (settings_.writetrace()) {
93  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
94  << input;
95  }
96  if (input == "thirdvmstubin") {
97  auto *tmp = dynamic_cast<VMStubsTEMemory *>(memory);
98  assert(tmp != nullptr);
99  thirdvmstubs_.push_back(tmp);
100  return;
101  }
102  if (input.substr(0, 8) == "stubpair") {
103  auto *tmp = dynamic_cast<StubPairsMemory *>(memory);
104  assert(tmp != nullptr);
105  stubpairs_.push_back(tmp);
106  return;
107  }
108  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
109 }
Log< level::Info, true > LogVerbatim
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:183
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:47
std::vector< VMStubsTEMemory * > thirdvmstubs_
Definition: TripletEngine.h:54
std::vector< StubPairsMemory * > stubpairs_
Definition: TripletEngine.h:55
tmp
align.sh
Definition: createJobs.py:716

◆ addOutput()

void TripletEngine::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 77 of file TripletEngine.cc.

References cms::cuda::assert(), Exception, mps_setup::memory, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, stubtriplets_, createJobs::tmp, and trklet::Settings::writetrace().

77  {
78  if (settings_.writetrace()) {
79  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
80  << output;
81  }
82  if (output == "stubtripout") {
83  auto *tmp = dynamic_cast<StubTripletsMemory *>(memory);
84  assert(tmp != nullptr);
86  return;
87  }
88  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
89 }
Log< level::Info, true > LogVerbatim
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:183
assert(be >=bs)
StubTripletsMemory * stubtriplets_
Definition: TripletEngine.h:57
tmp
align.sh
Definition: createJobs.py:716

◆ execute()

void TripletEngine::execute ( void  )

Definition at line 111 of file TripletEngine.cc.

References trklet::StubTripletsMemory::addStubs(), cms::cuda::assert(), trklet::VMStubTE::bend(), trklet::Settings::benddecode(), newFWLiteAna::bin, count_, trklet::Settings::debugTracklet(), disk2_, disk3_, trklet::Settings::enableTripletTables(), mps_splice::entry, trklet::VMStubTE::finephi(), groupFilesInBlocks::fout, trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, mps_fire::i, if(), createfilelist::int, iSeed_, trklet::VMStubTE::isPSmodule(), dqmiolumiharvest::j, dqmdumpme::k, cmsLHEtoEOSManager::l, dqmdumpme::last, layer2_, layer3_, trklet::Settings::maxStep(), trklet::Settings::nallstubs(), trklet::ProcessBase::name_, trklet::ProcessBase::nbits(), trklet::FPGAWord::nbits(), trklet::Settings::NLONGVMBINS(), trklet::Settings::nvmte(), trklet::Globals::ofstream(), print(), alignCSCRings::s, secondphibits_, trklet::ProcessBase::settings_, jetUpdater_cfi::sort, spTable_, AlCaHLTBitMon_QueryRunRegistry::string, trklet::VMStubTE::stub(), stubpairs_, stubtriplets_, table_, thirdphibits_, thirdvmstubs_, tmpSPTable_, cond::impl::to_string(), tier0::unique(), trklet::FPGAWord::value(), trklet::Settings::writeMonitorData(), and trklet::Settings::writeTripletTables().

111  {
112  unsigned int countall = 0;
113  unsigned int countpass = 0;
114  unsigned int nThirdStubs = 0;
115  count_ = 0;
116 
117  for (unsigned int iThirdMem = 0; iThirdMem < thirdvmstubs_.size();
118  nThirdStubs += thirdvmstubs_.at(iThirdMem)->nVMStubs(), iThirdMem++)
119  ;
120 
121  assert(!thirdvmstubs_.empty());
122  assert(!stubpairs_.empty());
123 
124  bool print = false && (getName().substr(0, 10) == "TRE_L2cL3c");
125 
126  print = print && nThirdStubs > 0;
127 
128  int hacksum = 0;
129  if (print) {
130  edm::LogVerbatim("Tracklet") << "In TripletEngine::execute : " << getName() << " " << nThirdStubs << ":";
131  for (unsigned int i = 0; i < thirdvmstubs_.size(); ++i) {
132  edm::LogVerbatim("Tracklet") << thirdvmstubs_.at(i)->getName() << " " << thirdvmstubs_.at(i)->nVMStubs();
133  }
134  int s = 0;
135  std::string oss = "";
136  for (unsigned int i = 0; i < stubpairs_.size(); ++i) {
137  oss += std::to_string(stubpairs_.at(i)->nStubPairs());
138  oss += " ";
139  s += stubpairs_.at(i)->nStubPairs();
140  }
141  hacksum += nThirdStubs * s;
142  edm::LogVerbatim("Tracklet") << oss;
143  for (unsigned int i = 0; i < stubpairs_.size(); ++i) {
144  edm::LogVerbatim("Tracklet") << " " << stubpairs_.at(i)->getName();
145  }
146  }
147 
148  tmpSPTable_.clear();
149 
150  for (unsigned int i = 0; i < stubpairs_.size(); ++i) {
151  for (unsigned int j = 0; j < stubpairs_.at(i)->nStubPairs(); ++j) {
152  if (print)
153  edm::LogVerbatim("Tracklet") << " ***** " << stubpairs_.at(i)->getName() << " "
154  << stubpairs_.at(i)->nStubPairs();
155 
156  auto firstvmstub = stubpairs_.at(i)->getVMStub1(j);
157  auto secondvmstub = stubpairs_.at(i)->getVMStub2(j);
158 
159  if ((layer2_ == 4 && layer3_ == 2) || (layer2_ == 6 && layer3_ == 4)) {
160  constexpr unsigned int vmbitshift = 10;
161  int lookupbits = (int)((firstvmstub.vmbits().value() >> vmbitshift) & 1023); //1023=2^vmbitshift-1
162  int newbin = (lookupbits & 127);
163  int bin = newbin / 8;
164 
165  int start = (bin >> 1);
166  int last = start + (bin & 1);
167 
168  for (int ibin = start; ibin <= last; ibin++) {
169  for (unsigned int k = 0; k < thirdvmstubs_.size(); k++) {
170  string vmsteSuffix = thirdvmstubs_.at(k)->getLastPartOfName();
171  vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of('n'));
172  if (stubpairs_.at(i)->getLastPartOfName() != vmsteSuffix)
173  continue;
174  for (unsigned int l = 0; l < thirdvmstubs_.at(k)->nVMStubsBinned(ibin); l++) {
175  if (settings_.debugTracklet()) {
176  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub";
177  }
178 
179  if (countall >= settings_.maxStep("TRE"))
180  break;
181  countall++;
182 
183  const VMStubTE &thirdvmstub = thirdvmstubs_.at(k)->getVMStubTEBinned(ibin, l);
184 
185  assert(secondphibits_ != -1);
186  assert(thirdphibits_ != -1);
187 
188  unsigned int nvmsecond = settings_.nallstubs(layer2_ - 1) * settings_.nvmte(1, iSeed_);
189  unsigned int nvmbitssecond = nbits(nvmsecond);
190 
191  FPGAWord iphisecondbin = secondvmstub.stub()->iphivmFineBins(nvmbitssecond, secondphibits_);
192 
193  //currently not using same number of bits as in the TED
194  //assert(iphisecondbin==(int)secondvmstub.finephi());
195  FPGAWord iphithirdbin = thirdvmstub.finephi();
196 
197  unsigned int index = (iphisecondbin.value() << thirdphibits_) + iphithirdbin.value();
198 
199  FPGAWord secondbend = secondvmstub.bend();
200  FPGAWord thirdbend = thirdvmstub.bend();
201 
202  index = (index << secondbend.nbits()) + secondbend.value();
203  index = (index << thirdbend.nbits()) + thirdbend.value();
204 
206  (index >= table_.size() || !table_[index])) {
207  if (settings_.debugTracklet()) {
208  edm::LogVerbatim("Tracklet")
209  << "Stub pair rejected because of stub pt cut bends : "
210  << settings_.benddecode(secondvmstub.bend().value(), layer2_ - 1, secondvmstub.isPSmodule())
211  << " " << settings_.benddecode(thirdvmstub.bend().value(), layer3_ - 1, thirdvmstub.isPSmodule());
212  }
213 
214  //FIXME temporarily commented out until bend table fixed
215  //if (!settings_.writeTripletTables())
216  // continue;
217  }
219  if (index >= table_.size())
220  table_.resize(index + 1, false);
221  table_[index] = true;
222 
223  const unsigned spIndex = stubpairs_.at(i)->getIndex(j);
224  const string &tedName = stubpairs_.at(i)->getTEDName(j);
225  if (!tmpSPTable_.count(tedName))
226  tmpSPTable_[tedName];
227  if (spIndex >= tmpSPTable_.at(tedName).size())
228  tmpSPTable_.at(tedName).resize(spIndex + 1);
229  tmpSPTable_.at(tedName).at(spIndex).push_back(stubpairs_.at(i)->getName());
230  }
231 
232  if (settings_.debugTracklet())
233  edm::LogVerbatim("Tracklet") << "Adding layer-layer pair in " << getName();
234  if (settings_.writeMonitorData("Seeds")) {
235  ofstream fout("seeds.txt", ofstream::app);
236  fout << __FILE__ << ":" << __LINE__ << " " << name_ << " " << iSeed_ << endl;
237  fout.close();
238  }
239  stubtriplets_->addStubs(thirdvmstub.stub(),
240  (stubpairs_.at(i))->getVMStub1(j).stub(),
241  (stubpairs_.at(i))->getVMStub2(j).stub());
242 
243  countpass++;
244  }
245  }
246  }
247 
248  }
249 
250  else if (disk2_ == 2 && layer3_ == 2) {
251  int lookupbits = (int)((firstvmstub.vmbits().value() >> 10) & 1023);
252  int newbin = (lookupbits & 127);
253  int bin = newbin / 8;
254 
255  int start = (bin >> 1);
256  int last = start + (bin & 1);
257 
258  if (firstvmstub.stub()->disk().value() < 0) { //TODO - negative disk should come from memory
259  start = settings_.NLONGVMBINS() - last - 1;
260  last = settings_.NLONGVMBINS() - start - 1;
261  }
262 
263  for (int ibin = start; ibin <= last; ibin++) {
264  for (unsigned int k = 0; k < thirdvmstubs_.size(); k++) {
265  string vmsteSuffix = thirdvmstubs_.at(k)->getLastPartOfName();
266  vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of('n'));
267  if (stubpairs_.at(i)->getLastPartOfName() != vmsteSuffix)
268  continue;
269 
270  for (unsigned int l = 0; l < thirdvmstubs_.at(k)->nVMStubsBinned(ibin); l++) {
271  if (countall >= settings_.maxStep("TRE"))
272  break;
273  countall++;
274 
275  const VMStubTE &thirdvmstub = thirdvmstubs_.at(k)->getVMStubTEBinned(ibin, l);
276 
277  assert(secondphibits_ != -1);
278  assert(thirdphibits_ != -1);
279 
280  FPGAWord iphisecondbin = secondvmstub.finephi();
281  FPGAWord iphithirdbin = thirdvmstub.finephi();
282 
283  unsigned int index = (iphisecondbin.value() << thirdphibits_) + iphithirdbin.value();
284 
285  FPGAWord secondbend = secondvmstub.bend();
286  FPGAWord thirdbend = thirdvmstub.bend();
287 
288  index = (index << secondbend.nbits()) + secondbend.value();
289  index = (index << thirdbend.nbits()) + thirdbend.value();
290 
292  (index >= table_.size() || !table_[index])) {
293  if (settings_.debugTracklet()) {
294  edm::LogVerbatim("Tracklet")
295  << "Stub triplet rejected because of stub pt cut bends : "
296  << settings_.benddecode(secondvmstub.bend().value(), disk2_ + 5, secondvmstub.isPSmodule()) << " "
297  << settings_.benddecode(thirdvmstub.bend().value(), layer3_ - 1, thirdvmstub.isPSmodule());
298  }
299  continue;
300  }
302  if (index >= table_.size())
303  table_.resize(index + 1, false);
304  table_[index] = true;
305 
306  const unsigned spIndex = stubpairs_.at(i)->getIndex(j);
307  const string &tedName = stubpairs_.at(i)->getTEDName(j);
308  if (!tmpSPTable_.count(tedName))
309  tmpSPTable_[tedName];
310  if (spIndex >= tmpSPTable_.at(tedName).size())
311  tmpSPTable_.at(tedName).resize(spIndex + 1);
312  tmpSPTable_.at(tedName).at(spIndex).push_back(stubpairs_.at(i)->getName());
313  }
314 
315  if (settings_.debugTracklet())
316  edm::LogVerbatim("Tracklet") << "Adding layer-disk pair in " << getName();
317  if (settings_.writeMonitorData("Seeds")) {
318  ofstream fout("seeds.txt", ofstream::app);
319  fout << __FILE__ << ":" << __LINE__ << " " << name_ << " " << iSeed_ << endl;
320  fout.close();
321  }
322  stubtriplets_->addStubs(thirdvmstub.stub(),
323  (stubpairs_.at(i))->getVMStub1(j).stub(),
324  (stubpairs_.at(i))->getVMStub2(j).stub());
325  countpass++;
326  }
327  }
328  }
329  }
330 
331  else if (layer2_ == 3 && disk3_ == 1) {
332  int lookupbits = (int)((firstvmstub.vmbits().value() >> 10) & 1023);
333 
334  int newbin = (lookupbits & 127);
335  int bin = newbin / 8;
336 
337  int start = (bin >> 1);
338  int last = start + (bin & 1);
339 
340  for (int ibin = start; ibin <= last; ibin++) {
341  for (unsigned int k = 0; k < thirdvmstubs_.size(); k++) {
342  string vmsteSuffix = thirdvmstubs_.at(k)->getLastPartOfName();
343  vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of('n'));
344  if (stubpairs_.at(i)->getLastPartOfName() != vmsteSuffix)
345  continue;
346  for (unsigned int l = 0; l < thirdvmstubs_.at(k)->nVMStubsBinned(ibin); l++) {
347  if (countall >= settings_.maxStep("TRE"))
348  break;
349  countall++;
350 
351  const VMStubTE &thirdvmstub = thirdvmstubs_.at(k)->getVMStubTEBinned(ibin, l);
352 
353  assert(secondphibits_ != -1);
354  assert(thirdphibits_ != -1);
355 
356  unsigned int nvmsecond;
357 
358  nvmsecond = settings_.nallstubs(layer2_ - 1) * settings_.nvmte(1, iSeed_);
359  unsigned int nvmbitssecond = nbits(nvmsecond);
360 
361  FPGAWord iphisecondbin = secondvmstub.stub()->iphivmFineBins(nvmbitssecond, secondphibits_);
362 
363  //currentlty not using same number of bits as in the TED
364  //assert(iphisecondbin==(int)secondvmstub.finephi());
365  FPGAWord iphithirdbin = thirdvmstub.finephi();
366 
367  unsigned int index = (iphisecondbin.value() << thirdphibits_) + iphithirdbin.value();
368 
369  FPGAWord secondbend = secondvmstub.bend();
370  FPGAWord thirdbend = thirdvmstub.bend();
371 
372  index = (index << secondbend.nbits()) + secondbend.value();
373  index = (index << thirdbend.nbits()) + thirdbend.value();
374 
376  (index >= table_.size() || !table_[index])) {
377  if (settings_.debugTracklet()) {
378  edm::LogVerbatim("Tracklet")
379  << "Stub pair rejected because of stub pt cut bends : "
380  << settings_.benddecode(secondvmstub.bend().value(), layer2_ - 1, secondvmstub.isPSmodule())
381  << " " << settings_.benddecode(thirdvmstub.bend().value(), disk3_ + 5, thirdvmstub.isPSmodule());
382  }
383  continue;
384  }
386  if (index >= table_.size())
387  table_.resize(index + 1, false);
388  table_[index] = true;
389 
390  const unsigned spIndex = stubpairs_.at(i)->getIndex(j);
391  const string &tedName = stubpairs_.at(i)->getTEDName(j);
392  if (!tmpSPTable_.count(tedName))
393  tmpSPTable_[tedName];
394  if (spIndex >= tmpSPTable_.at(tedName).size())
395  tmpSPTable_.at(tedName).resize(spIndex + 1);
396  tmpSPTable_.at(tedName).at(spIndex).push_back(stubpairs_.at(i)->getName());
397  }
398 
399  if (settings_.debugTracklet())
400  edm::LogVerbatim("Tracklet") << "Adding layer-disk pair in " << getName();
401  if (settings_.writeMonitorData("Seeds")) {
402  ofstream fout("seeds.txt", ofstream::app);
403  fout << __FILE__ << ":" << __LINE__ << " " << name_ << " " << iSeed_ << endl;
404  fout.close();
405  }
406  stubtriplets_->addStubs(thirdvmstub.stub(),
407  (stubpairs_.at(i))->getVMStub1(j).stub(),
408  (stubpairs_.at(i))->getVMStub2(j).stub());
409  countpass++;
410  }
411  }
412  }
413  }
414  }
415  }
416 
417  for (const auto &tedName : tmpSPTable_) {
418  for (unsigned spIndex = 0; spIndex < tedName.second.size(); spIndex++) {
419  if (tedName.second.at(spIndex).empty())
420  continue;
421  vector<string> entry(tedName.second.at(spIndex));
422  sort(entry.begin(), entry.end());
423  entry.erase(unique(entry.begin(), entry.end()), entry.end());
424  const string &spName = entry.at(0);
425 
426  if (!spTable_.count(tedName.first))
427  spTable_[tedName.first];
428  if (spIndex >= spTable_.at(tedName.first).size())
429  spTable_.at(tedName.first).resize(spIndex + 1);
430  if (!spTable_.at(tedName.first).at(spIndex).count(spName))
431  spTable_.at(tedName.first).at(spIndex)[spName] = 0;
432  spTable_.at(tedName.first).at(spIndex)[spName]++;
433  }
434  }
435 
436  if (settings_.writeMonitorData("TRE")) {
437  globals_->ofstream("tripletengine.txt") << getName() << " " << countall << " " << countpass << endl;
438  }
439 }
Definition: start.py:1
Log< level::Info, true > LogVerbatim
std::map< std::string, std::vector< std::vector< std::string > > > tmpSPTable_
Definition: TripletEngine.h:59
unsigned int maxStep(std::string module) const
Definition: Settings.h:116
bool isPSmodule() const
Definition: VMStubTE.h:31
std::string name_
Definition: ProcessBase.h:38
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:402
bool enableTripletTables() const
Definition: Settings.h:202
const FPGAWord & bend() const
Definition: VMStubTE.h:25
Settings const & settings_
Definition: ProcessBase.h:40
Globals * globals_
Definition: ProcessBase.h:41
std::string to_string(const V &value)
Definition: OMSAccess.h:71
assert(be >=bs)
unsigned int NLONGVMBINS() const
Definition: Settings.h:329
const Stub * stub() const
Definition: VMStubTE.h:29
unsigned int nbits(unsigned int power)
Definition: ProcessBase.cc:17
std::vector< bool > table_
Definition: TripletEngine.h:61
std::vector< VMStubsTEMemory * > thirdvmstubs_
Definition: TripletEngine.h:54
def unique(seq, keepstr=True)
Definition: tier0.py:24
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
int value() const
Definition: FPGAWord.h:24
void addStubs(const Stub *stub1, const Stub *stub2, const Stub *stub3)
StubTripletsMemory * stubtriplets_
Definition: TripletEngine.h:57
bool writeMonitorData(std::string module) const
Definition: Settings.h:109
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:101
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:107
const FPGAWord & finephi() const
Definition: VMStubTE.h:23
bool debugTracklet() const
Definition: Settings.h:182
std::map< std::string, std::vector< std::map< std::string, unsigned > > > spTable_
Definition: TripletEngine.h:60
int nbits() const
Definition: FPGAWord.h:25
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
std::vector< StubPairsMemory * > stubpairs_
Definition: TripletEngine.h:55
std::string const & getName() const
Definition: ProcessBase.h:22
bool writeTripletTables() const
Definition: Settings.h:203

◆ readTables()

void TripletEngine::readTables ( )

Definition at line 441 of file TripletEngine.cc.

References Exception, groupFilesInBlocks::fin, recoMuon::in, trklet::ProcessBase::name_, EgammaValidation_cff::num, trklet::ProcessBase::settings_, table_, HLT_2022v12_cff::tableName, and trklet::Settings::tableTREFile().

Referenced by TripletEngine().

441  {
442  ifstream fin;
443  string tableName, word;
444  unsigned num;
445 
446  string tablePath = settings_.tableTREFile();
447  unsigned int finddir = tablePath.find("table_TRE_");
448  tableName = tablePath.substr(0, finddir) + "table_" + name_ + ".txt";
449 
450  fin.open(tableName, ifstream::in);
451  if (!fin) {
452  throw cms::Exception("BadConfig") << "TripletEngine::readTables, file " << tableName << " not known";
453  }
454  while (!fin.eof()) {
455  fin >> word;
456  num = atoi(word.c_str());
457  table_.push_back(num > 0 ? true : false);
458  }
459  fin.close();
460 }
std::string name_
Definition: ProcessBase.h:38
std::string const & tableTREFile() const
Definition: Settings.h:71
Settings const & settings_
Definition: ProcessBase.h:40
uint64_t word
std::vector< bool > table_
Definition: TripletEngine.h:61

◆ writeTables()

void TripletEngine::writeTables ( )

Definition at line 462 of file TripletEngine.cc.

References mps_splice::entry, groupFilesInBlocks::fout, trklet::ProcessBase::name_, MillePedeFileConverter_cfg::out, spTable_, table_, and HLT_2022v12_cff::tableName.

Referenced by ~TripletEngine().

462  {
463  ofstream fout;
464  stringstream tableName;
465 
466  tableName << "table/table_" << name_ << ".txt";
467 
468  fout.open(tableName.str(), ofstream::out);
469  for (const auto entry : table_)
470  fout << entry << endl;
471  fout.close();
472 
473  for (const auto &tedName : spTable_) {
474  tableName.str("");
475  tableName << "table/table_" << tedName.first << "_" << name_ << ".txt";
476 
477  fout.open(tableName.str(), ofstream::out);
478  for (const auto &entry : tedName.second) {
479  for (const auto &spName : entry)
480  fout << spName.first << ":" << spName.second << " ";
481  fout << endl;
482  }
483  fout.close();
484  }
485 }
std::string name_
Definition: ProcessBase.h:38
std::vector< bool > table_
Definition: TripletEngine.h:61
std::map< std::string, std::vector< std::map< std::string, unsigned > > > spTable_
Definition: TripletEngine.h:60

Member Data Documentation

◆ count_

int trklet::TripletEngine::count_
private

Definition at line 33 of file TripletEngine.h.

Referenced by execute().

◆ dct1_

int trklet::TripletEngine::dct1_
private

Definition at line 41 of file TripletEngine.h.

Referenced by TripletEngine().

◆ dct2_

int trklet::TripletEngine::dct2_
private

Definition at line 42 of file TripletEngine.h.

Referenced by TripletEngine().

◆ dct3_

int trklet::TripletEngine::dct3_
private

Definition at line 43 of file TripletEngine.h.

Referenced by TripletEngine().

◆ disk1_

int trklet::TripletEngine::disk1_
private

Definition at line 38 of file TripletEngine.h.

Referenced by TripletEngine().

◆ disk2_

int trklet::TripletEngine::disk2_
private

Definition at line 39 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ disk3_

int trklet::TripletEngine::disk3_
private

Definition at line 40 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ iSeed_

int trklet::TripletEngine::iSeed_
private

Definition at line 66 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ layer1_

int trklet::TripletEngine::layer1_
private

Definition at line 35 of file TripletEngine.h.

Referenced by TripletEngine().

◆ layer2_

int trklet::TripletEngine::layer2_
private

Definition at line 36 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ layer3_

int trklet::TripletEngine::layer3_
private

Definition at line 37 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ phi1_

int trklet::TripletEngine::phi1_
private

Definition at line 44 of file TripletEngine.h.

Referenced by TripletEngine().

◆ phi2_

int trklet::TripletEngine::phi2_
private

Definition at line 45 of file TripletEngine.h.

Referenced by TripletEngine().

◆ phi3_

int trklet::TripletEngine::phi3_
private

Definition at line 46 of file TripletEngine.h.

Referenced by TripletEngine().

◆ r1_

int trklet::TripletEngine::r1_
private

Definition at line 50 of file TripletEngine.h.

Referenced by TripletEngine().

◆ r2_

int trklet::TripletEngine::r2_
private

Definition at line 51 of file TripletEngine.h.

Referenced by TripletEngine().

◆ r3_

int trklet::TripletEngine::r3_
private

Definition at line 52 of file TripletEngine.h.

Referenced by TripletEngine().

◆ secondphibits_

int trklet::TripletEngine::secondphibits_
private

Definition at line 63 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ spTable_

std::map<std::string, std::vector<std::map<std::string, unsigned> > > trklet::TripletEngine::spTable_
private

Definition at line 60 of file TripletEngine.h.

Referenced by execute(), and writeTables().

◆ stubpairs_

std::vector<StubPairsMemory*> trklet::TripletEngine::stubpairs_
private

Definition at line 55 of file TripletEngine.h.

Referenced by addInput(), execute(), and TripletEngine().

◆ stubtriplets_

StubTripletsMemory* trklet::TripletEngine::stubtriplets_
private

Definition at line 57 of file TripletEngine.h.

Referenced by addOutput(), and execute().

◆ table_

std::vector<bool> trklet::TripletEngine::table_
private

Definition at line 61 of file TripletEngine.h.

Referenced by execute(), readTables(), and writeTables().

◆ thirdphibits_

int trklet::TripletEngine::thirdphibits_
private

Definition at line 64 of file TripletEngine.h.

Referenced by execute(), and TripletEngine().

◆ thirdvmstubs_

std::vector<VMStubsTEMemory*> trklet::TripletEngine::thirdvmstubs_
private

Definition at line 54 of file TripletEngine.h.

Referenced by addInput(), execute(), and TripletEngine().

◆ tmpSPTable_

std::map<std::string, std::vector<std::vector<std::string> > > trklet::TripletEngine::tmpSPTable_
private

Definition at line 59 of file TripletEngine.h.

Referenced by execute().

◆ z1_

int trklet::TripletEngine::z1_
private

Definition at line 47 of file TripletEngine.h.

Referenced by TripletEngine().

◆ z2_

int trklet::TripletEngine::z2_
private

Definition at line 48 of file TripletEngine.h.

Referenced by TripletEngine().

◆ z3_

int trklet::TripletEngine::z3_
private

Definition at line 49 of file TripletEngine.h.

Referenced by TripletEngine().