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");
147 for (
unsigned int j = 0;
j <
stubpairs_.at(
i)->nStubPairs(); ++
j) {
157 int lookupbits = (
int)((firstvmstub.vmbits().value() >> vmbitshift) & 1023);
158 int newbin = (lookupbits & 127);
159 int bin = newbin / 8;
164 for (
int ibin =
start; ibin <=
last; ibin++) {
167 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
168 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
185 unsigned int nvmbitssecond =
nbits(nvmsecond);
195 FPGAWord secondbend = secondvmstub.bend();
205 <<
"Stub pair rejected because of stub pt cut bends : " 220 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
231 ofstream
fout(
"seeds.txt", ofstream::app);
232 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
247 int lookupbits = (
int)((firstvmstub.vmbits().value() >> 10) & 1023);
248 int newbin = (lookupbits & 127);
249 int bin = newbin / 8;
254 if (firstvmstub.stub()->disk().value() < 0) {
259 for (
int ibin =
start; ibin <=
last; ibin++) {
262 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
263 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
276 FPGAWord iphisecondbin = secondvmstub.finephi();
281 FPGAWord secondbend = secondvmstub.bend();
291 <<
"Stub triplet rejected because of stub pt cut bends : " 303 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
314 ofstream
fout(
"seeds.txt", ofstream::app);
315 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
328 int lookupbits = (
int)((firstvmstub.vmbits().value() >> 10) & 1023);
330 int newbin = (lookupbits & 127);
331 int bin = newbin / 8;
336 for (
int ibin =
start; ibin <=
last; ibin++) {
339 vmsteSuffix = vmsteSuffix.substr(0, vmsteSuffix.find_last_of(
'n'));
340 if (
stubpairs_.at(
i)->getLastPartOfName() != vmsteSuffix)
352 unsigned int nvmsecond;
355 unsigned int nvmbitssecond =
nbits(nvmsecond);
365 FPGAWord secondbend = secondvmstub.bend();
375 <<
"Stub pair rejected because of stub pt cut bends : " 387 const string &tedName =
stubpairs_.at(
i)->getTEDName(
j);
398 ofstream
fout(
"seeds.txt", ofstream::app);
399 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
414 for (
unsigned spIndex = 0; spIndex < tedName.second.size(); spIndex++) {
415 if (tedName.second.at(spIndex).empty())
417 vector<string>
entry(tedName.second.at(spIndex));
420 const string &spName =
entry.at(0);
424 if (spIndex >=
spTable_.at(tedName.first).size())
425 spTable_.at(tedName.first).resize(spIndex + 1);
426 if (!
spTable_.at(tedName.first).at(spIndex).count(spName))
427 spTable_.at(tedName.first).at(spIndex)[spName] = 0;
428 spTable_.at(tedName.first).at(spIndex)[spName]++;
443 unsigned int finddir = tablePath.find(
"table_TRE_");
444 tableName = tablePath.substr(0, finddir) +
"table_" +
name_ +
".txt";
453 table_.push_back(
num > 0 ?
true :
false);
469 for (
const auto &tedName :
spTable_) {
471 tableName <<
"table/table_" << tedName.first <<
"_" <<
name_ <<
".txt";
474 for (
const auto &
entry : tedName.second) {
475 for (
const auto &spName :
entry)
476 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
bool enableTripletTables() const
const FPGAWord & bend() const
std::string const & tableTREFile() const
Settings const & settings_
void addInput(MemoryBase *memory, std::string input) override
static std::string to_string(const XMLCh *ch)
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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
bool writeTripletTables() const
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
~TripletEngine() override