58 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
82 if (
output ==
"stubtripout") {
88 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
96 if (
input ==
"thirdvmstubin") {
102 if (
input.substr(0, 8) ==
"stubpair") {
108 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
112 unsigned int countall = 0;
113 unsigned int countpass = 0;
114 unsigned int nThirdStubs = 0;
117 for (
unsigned int iThirdMem = 0; iThirdMem <
thirdvmstubs_.size();
118 nThirdStubs +=
thirdvmstubs_.at(iThirdMem)->nVMStubs(), iThirdMem++)
124 bool print =
false && (
getName().substr(0, 10) ==
"TRE_L2cL3c");
141 hacksum += nThirdStubs *
s;
151 for (
unsigned int j = 0;
j <
stubpairs_.at(
i)->nStubPairs(); ++
j) {
160 constexpr
unsigned int vmbitshift = 10;
161 int lookupbits = (
int)((firstvmstub.vmbits().value() >> vmbitshift) & 1023);
162 int newbin = (lookupbits & 127);
163 int bin = newbin / 8;
168 for (
int ibin =
start; ibin <=
last; ibin++) {
171 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
172 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
189 unsigned int nvmbitssecond =
nbits(nvmsecond);
199 FPGAWord secondbend = secondvmstub.bend();
209 <<
"Stub pair rejected because of stub pt cut bends : " 224 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
235 ofstream
fout(
"seeds.txt", ofstream::app);
236 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
251 int lookupbits = (
int)((firstvmstub.vmbits().value() >> 10) & 1023);
252 int newbin = (lookupbits & 127);
253 int bin = newbin / 8;
258 if (firstvmstub.stub()->disk().value() < 0) {
263 for (
int ibin =
start; ibin <=
last; ibin++) {
266 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
267 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
280 FPGAWord iphisecondbin = secondvmstub.finephi();
285 FPGAWord secondbend = secondvmstub.bend();
295 <<
"Stub triplet rejected because of stub pt cut bends : " 307 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
318 ofstream
fout(
"seeds.txt", ofstream::app);
319 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
332 int lookupbits = (
int)((firstvmstub.vmbits().value() >> 10) & 1023);
334 int newbin = (lookupbits & 127);
335 int bin = newbin / 8;
340 for (
int ibin =
start; ibin <=
last; ibin++) {
343 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
344 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
356 unsigned int nvmsecond;
359 unsigned int nvmbitssecond =
nbits(nvmsecond);
369 FPGAWord secondbend = secondvmstub.bend();
379 <<
"Stub pair rejected because of stub pt cut bends : " 391 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
402 ofstream
fout(
"seeds.txt", ofstream::app);
403 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
418 for (
unsigned spIndex = 0; spIndex < tedName.second.size(); spIndex++) {
419 if (tedName.second.at(spIndex).empty())
421 vector<string>
entry(tedName.second.at(spIndex));
424 const string &spName =
entry.at(0);
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]++;
447 unsigned int finddir = tablePath.find(
"table_TRE_");
448 tableName = tablePath.substr(0, finddir) +
"table_" +
name_ +
".txt";
457 table_.push_back(
num > 0 ?
true :
false);
473 for (
const auto &tedName :
spTable_) {
475 tableName <<
"table/table_" << tedName.first <<
"_" <<
name_ <<
".txt";
478 for (
const auto &
entry : tedName.second) {
479 for (
const auto &spName :
entry)
480 fout << spName.first <<
":" << spName.second <<
" ";
Log< level::Info, true > LogVerbatim
std::map< std::string, std::vector< std::vector< std::string > > > tmpSPTable_
unsigned int maxStep(std::string module) const
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
bool enableTripletTables() const
const FPGAWord & bend() const
std::string const & tableTREFile() const
Settings const & settings_
std::string to_string(const V &value)
void addInput(MemoryBase *memory, std::string input) override
static std::string const input
unsigned int NLONGVMBINS() const
const Stub * stub() const
unsigned int nbits(unsigned int power)
std::vector< bool > table_
void addOutput(MemoryBase *memory, std::string output) override
std::vector< VMStubsTEMemory * > thirdvmstubs_
def unique(seq, keepstr=True)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
void addStubs(const Stub *stub1, const Stub *stub2, const Stub *stub3)
StubTripletsMemory * stubtriplets_
bool writeMonitorData(std::string module) const
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
unsigned int nallstubs(unsigned int layerdisk) const
const FPGAWord & finephi() const
bool debugTracklet() const
std::map< std::string, std::vector< std::map< std::string, unsigned > > > spTable_
int nfinephi(unsigned int inner, unsigned int iSeed) const
std::ofstream & ofstream(std::string fname)
std::vector< StubPairsMemory * > stubpairs_
std::string const & getName() const
bool writeTripletTables() const
~TripletEngine() override