13 using namespace trklet;
15 TrackletEngineDisplaced::TrackletEngineDisplaced(
string name,
Settings const& settings,
Globals* global)
24 string name1 = name.substr(1);
25 if (name1[3] ==
'L') {
28 if (name1[3] ==
'D') {
31 if (name1[11] ==
'L') {
34 if (name1[11] ==
'D') {
37 if (name1[12] ==
'L') {
40 if (name1[12] ==
'D') {
65 if (output ==
"stubpairout") {
71 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
79 if (input ==
"firstvmstubin") {
85 if (input ==
"secondvmstubin") {
91 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
101 unsigned int countall = 0;
102 unsigned int countpass = 0;
103 unsigned int nInnerStubs = 0;
105 for (
unsigned int iInnerMem = 0; iInnerMem <
firstvmstubs_.size();
106 nInnerStubs +=
firstvmstubs_.at(iInnerMem)->nVMStubs(), iInnerMem++)
113 assert(iInnerMem->nVMStubs() == iInnerMem->nVMStubs());
114 for (
unsigned int i = 0;
i < iInnerMem->nVMStubs();
i++) {
115 const VMStubTE& firstvmstub = iInnerMem->getVMStubTE(
i);
121 int lookupbits = firstvmstub.
vmbits().
value() & 1023;
122 int zdiffmax = (lookupbits >> 7);
123 int newbin = (lookupbits & 127);
124 int bin = newbin / 8;
126 int zbinfirst = newbin & 7;
128 int start = (bin >> 1);
129 int last = start + (bin & 1);
136 for (
int ibin = start; ibin <=
last; ibin++) {
150 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
168 index = (index << firstbend.
nbits()) + firstbend.
value();
169 index = (index << secondbend.
nbits()) + secondbend.
value();
175 <<
"Stub pair rejected because of stub pt cut bends : "
187 for (
unsigned int isp = 0; isp <
stubpairs_.size(); ++isp) {
190 ofstream
fout(
"seeds.txt", ofstream::app);
191 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
203 int lookupbits = firstvmstub.
vmbits().
value() & 1023;
204 int zdiffmax = (lookupbits >> 7);
205 int newbin = (lookupbits & 127);
206 int bin = newbin / 8;
208 int zbinfirst = newbin & 7;
210 int start = (bin >> 1);
211 int last = start + (bin & 1);
218 for (
int ibin = start; ibin <=
last; ibin++) {
233 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
251 index = (index << firstbend.
nbits()) + firstbend.
value();
252 index = (index << secondbend.
nbits()) + secondbend.
value();
258 <<
"Stub pair rejected because of stub pt cut bends : "
267 for (
unsigned int isp = 0; isp <
stubpairs_.size(); ++isp) {
269 (index <
table_.size() &&
table_.at(index).count(isp))) {
271 ofstream
fout(
"seeds.txt", ofstream::app);
272 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
287 int lookupbits = firstvmstub.
vmbits().
value() & 511;
289 int rdiffmax = (lookupbits >> 6);
290 int newbin = (lookupbits & 63);
291 int bin = newbin / 8;
293 int rbinfirst = newbin & 7;
295 int start = (bin >> 1);
298 int last = start + (bin & 1);
300 for (
int ibin = start; ibin <=
last; ibin++) {
316 if (rbin < rbinfirst)
318 if (rbin - rbinfirst > rdiffmax)
321 unsigned int irsecondbin = secondvmstub.
vmbits().
value() >> 2;
332 index = (index << firstbend.
nbits()) + firstbend.
value();
333 index = (index << secondbend.
nbits()) + secondbend.
value();
339 <<
"Stub pair rejected because of stub pt cut bends : "
349 for (
unsigned int isp = 0; isp <
stubpairs_.size(); ++isp) {
351 (index <
table_.size() &&
table_.at(index).count(isp))) {
353 ofstream
fout(
"seeds.txt", ofstream::app);
354 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " <<
iSeed_ << endl;
366 if (countall > 5000) {
367 edm::LogVerbatim(
"Tracklet") <<
"In TrackletEngineDisplaced::execute : " <<
getName() <<
" " << nInnerStubs <<
" "
369 for (
auto& iInnerMem : firstvmstubs_) {
370 for (
unsigned int i = 0;
i < iInnerMem->nVMStubs();
i++) {
371 const VMStubTE& firstvmstub = iInnerMem->getVMStubTE(
i);
372 edm::LogVerbatim(
"Tracklet") <<
"In TrackletEngineDisplaced::execute first stub : "
381 edm::LogVerbatim(
"Tracklet") <<
"In TrackletEngineDisplaced::execute second stub : "
399 unsigned int finddir = tablePath.find(
"table_TED_");
400 tableName = tablePath.substr(0, finddir) +
"table_" +
name_ +
".txt";
404 throw cms::Exception(
"BadConfig") <<
"TripletEngine::readTables, file " << tableName <<
" not known";
407 while (getline(fin, line)) {
408 istringstream iss(line);
418 for (
unsigned int isp = 0; isp <
stubpairs_.size(); ++isp)
Log< level::Info, true > LogVerbatim
const FPGAWord & disk() const
short memNameToIndex(const std::string &name)
void addOutput(MemoryBase *memory, std::string output) override
const VMStubTE & getVMStubTEBinned(unsigned int bin, unsigned int i) const
Settings const & settings_
std::string const & tableTEDFile() const
void addInput(MemoryBase *memory, std::string input) override
bool debugTracklet() const
static std::string const input
bool writeTripletTables() const
unsigned int nVMStubsBinned(unsigned int bin) const
std::string const & getName() const
std::string const & getName() const
~TrackletEngineDisplaced() override
const FPGAWord & vmbits() const
const Stub * stub() const
unsigned int maxStep(std::string module) const
VMStubsTEMemory * secondvmstubs_
std::vector< VMStubsTEMemory * > firstvmstubs_
const FPGAWord & finephi() const
unsigned int nVMStubs() const
std::vector< std::set< short > > table_
bool enableTripletTables() const
std::ofstream & ofstream(std::string fname)
std::vector< StubPairsMemory * > stubpairs_
int nfinephi(unsigned int inner, unsigned int iSeed) const
bool useSeed(unsigned int iSeed) const
const VMStubTE & getVMStubTE(unsigned int i) const
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
const FPGAWord & bend() const
bool writeMonitorData(std::string module) const