33 throw cms::Exception(
"Inconsistency") <<
"phi0 conversion parameter inconsistency\n";
37 throw cms::Exception(
"Inconsistency") <<
"ring conversion parameter inconsistency\n";
41 throw cms::Exception(
"Inconsistency") <<
"t conversion parameter inconsistency\n";
45 edm::LogVerbatim(
"Tracklet") <<
"========================================================= \n"
46 <<
"Conversion factors for global coordinates: \n"
50 <<
"========================================================= \n"
51 <<
"Conversion factors for track(let) parameters: \n"
57 <<
"========================================================= \n"
59 <<
"d0bitshift = ??? \n"
60 <<
"=========================================================";
89 while (inmem.good()) {
90 string memType, memName,
size;
91 inmem >> memType >> memName >>
size;
95 edm::LogVerbatim(
"Tracklet") <<
"Read memory: " << memType <<
" " << memName;
98 sector->addMem(memType, memName);
110 while (inproc.good()) {
111 string procType, procName;
112 inproc >> procType >> procName;
116 edm::LogVerbatim(
"Tracklet") <<
"Read process: " << procType <<
" " << procName;
119 sector->addProc(procType, procName);
131 while (inwire.good()) {
133 getline(inwire,
line);
140 string mem, tmp1, procin, tmp2, procout;
141 ss >>
mem >> tmp1 >> procin;
142 if (procin ==
"output=>") {
146 ss >> tmp2 >> procout;
150 sector->addWire(
mem, procin, procout);
159 while (indtc.good()) {
164 while (layerdisk > 0) {
190 for (
int j = 0;
j <
ev.nstubs();
j++) {
195 int module = stub.
module();
198 string dtcbase = dtc.substr(2, dtc.size() - 2);
200 dtcbase = dtc.substr(0, 4) + dtc.substr(6, dtc.size() - 6);
210 int diff =
k - isector;
219 double dphi = stub.
phi() - phiminsect;
228 static std::map<string, ofstream*> dtcstubs;
231 vector<string> dtcs =
cabling_->DTCs();
232 for (
const auto& dtc : dtcs) {
233 string dtcbase = dtc.substr(2, dtc.size() - 2);
235 dtcbase = dtc.substr(0, 4) + dtc.substr(6, dtc.size() - 6);
239 string fname = dirIS +
"Link_";
241 if (dtcstubs.find(dtcbase +
"A") != dtcstubs.end())
245 if (not std::filesystem::exists(dirIS)) {
246 int fail = system((
string(
"mkdir -p ") + dirIS).c_str());
248 throw cms::Exception(
"BadDir") << __FILE__ <<
" " << __LINE__ <<
" could not create directory " << dirIS;
251 ofstream*
out =
new ofstream;
254 throw cms::Exception(
"BadFile") << __FILE__ <<
" " << __LINE__ <<
" could not create file " <<
fname;
255 dtcstubs[dtcbase +
"A"] =
out;
257 fname = dirIS +
"Link_";
259 if (dtcstubs.find(dtcbase +
"B") != dtcstubs.end())
265 throw cms::Exception(
"BadFile") << __FILE__ <<
" " << __LINE__ <<
" could not create file " <<
fname;
266 dtcstubs[dtcbase +
"B"] =
out;
269 static int oldevent = -1;
272 for (
auto& dtcstub : dtcstubs) {
275 (*(dtcstub.second)) <<
"BX " <<
tmp.str() <<
" Event : " <<
eventnum_ + 1 << endl;
283 int topbit = phi.value() >> (phi.nbits() - 1);
285 int layerdisk = stub.
layer() + 1;
286 if (layerdisk > 999) {
287 layerdisk = 10 +
abs(stub.
disk());
289 int layerdiskcode = -1;
290 for (
unsigned int i = 0;
i <
tmp.size();
i++) {
291 if (
tmp[
i] == layerdisk)
294 if (layerdiskcode == -1) {
295 edm::LogVerbatim(
"Tracklet") <<
"dtcbase layerdisk layer disk : " << dtcbase <<
" " << layerdisk <<
" "
296 << stub.
layer() + 1 <<
" " << stub.
disk();
298 assert(layerdiskcode >= 0);
299 assert(layerdiskcode < 4);
301 ldcode.
set(layerdiskcode, 2);
302 string dataword = fpgastub.
str() +
"|" + ldcode.
str() +
"|1";
304 (*dtcstubs[dtcbase +
"A"]) << dataword <<
" " <<
trklet::hexFormat(dataword) << endl;
306 (*dtcstubs[dtcbase +
"B"]) << dataword <<
" " <<
trklet::hexFormat(dataword) << endl;
374 int nTP =
globals_->event()->nsimtracks();
375 for (
int iTP = 0; iTP < nTP; iTP++) {
377 if (simtrk.
pt() < 2.0)
381 if (hypot(simtrk.
vx(), simtrk.
vy()) > 0.1)
385 bool pion = (
abs(simtrk.
type()) == 211);
386 bool kaon = (
abs(simtrk.
type()) == 321);
387 bool proton = (
abs(simtrk.
type()) == 2212);
392 int simtrackid = simtrk.
trackid();
393 unsigned int hitmask =
ev.layersHit(simtrackid,
nlayers, ndisks);
398 static ofstream outhit(
"hiteff.txt");
399 outhit << simtrk.
eta() <<
" " << (hitmask & 1) <<
" " << (hitmask & 2) <<
" " << (hitmask & 4) <<
" "
400 << (hitmask & 8) <<
" " << (hitmask & 16) <<
" " << (hitmask & 32) <<
" " << (hitmask & 64) <<
" "
401 << (hitmask & 128) <<
" " << (hitmask & 256) <<
" " << (hitmask & 512) <<
" " << (hitmask & 1024) << endl;
404 std::unordered_set<int> matchseed;
406 std::unordered_set<int> matchseedtmp =
sectors_[
k]->seedMatch(iTP);
407 matchseed.insert(matchseedtmp.begin(), matchseedtmp.end());
411 bool eff = matchseed.find(
iseed) != matchseed.end();
476 #ifndef USEHYBRID //don't try to print these memories if running hybrid
488 #ifndef USEHYBRID //don't try to print these memories if running hybrid
507 edm::LogVerbatim(
"Tracklet") <<
"Process Times called Average time (ms) Total time (s)"
520 << setprecision(3) <<
TPTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
523 << setprecision(3) <<
MPTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
527 <<
"TrackletEngine " << setw(10) <<
TETimer_.
ntimes() << setw(20) << setprecision(3)
529 <<
"TrackletEngineDisplaced" << setw(10) <<
TEDTimer_.
ntimes() << setw(20) << setprecision(3)
531 <<
"TripletEngine " << setw(10) <<
TRETimer_.
ntimes() << setw(20) << setprecision(3)
533 <<
"TrackletCalculator " << setw(10) <<
TCTimer_.
ntimes() << setw(20) << setprecision(3)
535 <<
"TrackletCalculatorDisplaced" << setw(10) <<
TCDTimer_.
ntimes() << setw(20) << setprecision(3)
537 <<
"ProjectionRouter " << setw(10) <<
PRTimer_.
ntimes() << setw(20) << setprecision(3)
539 <<
"MatchEngine " << setw(10) <<
METimer_.
ntimes() << setw(20) << setprecision(3)
541 <<
"MatchCalculator " << setw(10) <<
MCTimer_.
ntimes() << setw(20) << setprecision(3)
545 << setprecision(3) <<
FTTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
548 << setprecision(3) <<
PDTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)