16 using namespace trklet;
30 globals_ = make_unique<Globals>(*settings_);
33 if (settings_->kphi0pars() !=
globals_->ITC_L1L2()->phi0_final.K()) {
34 throw cms::Exception(
"Inconsistency") <<
"phi0 conversion parameter inconsistency\n";
37 if (settings_->krinvpars() !=
globals_->ITC_L1L2()->rinv_final.K()) {
38 throw cms::Exception(
"Inconsistency") <<
"ring conversion parameter inconsistency\n";
41 if (settings_->ktpars() !=
globals_->ITC_L1L2()->t_final.K()) {
42 throw cms::Exception(
"Inconsistency") <<
"t conversion parameter inconsistency\n";
45 if (settings_->kphider() !=
globals_->ITC_L1L2()->der_phiL_final.K()) {
47 <<
"t conversion parameter inconsistency:" << settings_->kphider() /
globals_->ITC_L1L2()->der_phiL_final.K()
51 if (settings_->debugTracklet()) {
52 edm::LogVerbatim(
"Tracklet") <<
"========================================================= \n"
53 <<
"Conversion factors for global coordinates: \n"
54 <<
"z kz = " << settings_->kz() <<
"\n"
55 <<
"r kr = " << settings_->kr() <<
"\n"
56 <<
"phi kphi1 = " << settings_->kphi1() <<
"\n"
57 <<
"========================================================= \n"
58 <<
"Conversion factors for track(let) parameters: \n"
59 <<
"rinv krinvpars = " << settings_->krinvpars() <<
"\n"
60 <<
"phi0 kphi0pars = " << settings_->kphi0pars() <<
"\n"
61 <<
"d0 kd0pars = " << settings_->kd0pars() <<
"\n"
62 <<
"t ktpars = " << settings_->ktpars() <<
"\n"
63 <<
"z0 kz0pars = " << settings_->kz0pars() <<
"\n"
64 <<
"========================================================= \n"
65 <<
"phi0bitshift = " << settings_->phi0bitshift() <<
"\n"
66 <<
"d0bitshift = ??? \n"
67 <<
"=========================================================";
70 if (settings_->bookHistos()) {
83 if (settings_->extended()) {
84 ifstream inmem(settings_->memoryModulesFile().c_str());
87 ifstream inproc(settings_->processingModulesFile().c_str());
90 ifstream inwire(settings_->wiresFile().c_str());
99 if (settings_->writeConfig()) {
100 std::ofstream
wires =
openfile(settings_->tablePath(),
"wires.dat", __FILE__, __LINE__);
101 std::ofstream memorymodules =
openfile(settings_->tablePath(),
"memorymodules.dat", __FILE__, __LINE__);
102 std::ofstream processingmodules =
openfile(settings_->tablePath(),
"processingmodules.dat", __FILE__, __LINE__);
104 config.
writeAll(wires, memorymodules, processingmodules);
107 std::stringstream
wires;
108 std::stringstream memorymodules;
109 std::stringstream processingmodules;
111 config.
writeAll(wires, memorymodules, processingmodules);
112 configure(wires, memorymodules, processingmodules);
122 while (inmem.good()) {
123 string memType, memName,
size;
124 inmem >> memType >> memName >>
size;
128 edm::LogVerbatim(
"Tracklet") <<
"Read memory: " << memType <<
" " << memName;
130 sector_->addMem(memType, memName);
138 while (inproc.good()) {
139 string procType, procName;
140 inproc >> procType >> procName;
144 edm::LogVerbatim(
"Tracklet") <<
"Read process: " << procType <<
" " << procName;
146 sector_->addProc(procType, procName);
154 while (inwire.good()) {
156 getline(inwire, line);
162 stringstream
ss(line);
163 string mem, tmp1, procin, tmp2, procout;
164 ss >> mem >> tmp1 >> procin;
165 if (procin ==
"output=>") {
169 ss >> tmp2 >> procout;
172 sector_->addWire(mem, procin, procout);
194 vector<int> layerstubssector(N_SECTOR * (
N_LAYER +
N_DISK), 0);
198 unsigned int isector = stub.
region();
203 const string& dtc = stub.
DTClink();
212 for (
unsigned int index = 0;
index < layerstubssector.size();
index++) {
215 globals_->ofstream(
"stubslayersector.txt")
216 << layerdisk <<
" " << sector <<
" " << layerstubssector[
index] << endl;
221 for (
unsigned int layerdisk = 0; layerdisk < layerstubs.size(); layerdisk++) {
222 globals_->ofstream(
"stubslayer.txt") << layerdisk <<
" " << layerstubs[layerdisk] << endl;
282 int nTP =
globals_->event()->nsimtracks();
283 for (
int iTP = 0; iTP < nTP; iTP++) {
285 if (simtrk.
pt() < 2.0)
289 if (hypot(simtrk.
vx(), simtrk.
vy()) > 0.1)
293 bool pion = (
abs(simtrk.
type()) == 211);
294 bool kaon = (
abs(simtrk.
type()) == 321);
295 bool proton = (
abs(simtrk.
type()) == 2212);
296 if (!(electron || muon || pion || kaon || proton))
300 int simtrackid = simtrk.
trackid();
301 unsigned int hitmask = ev.
layersHit(simtrackid, nlayers, ndisks);
302 if (nlayers + ndisks < 4)
306 static ofstream outhit(
"hiteff.txt");
307 outhit << simtrk.
eta() <<
" " << (hitmask & 1) <<
" " << (hitmask & 2) <<
" " << (hitmask & 4) <<
" "
308 << (hitmask & 8) <<
" " << (hitmask & 16) <<
" " << (hitmask & 32) <<
" " << (hitmask & 64) <<
" "
309 << (hitmask & 128) <<
" " << (hitmask & 256) <<
" " << (hitmask & 512) <<
" " << (hitmask & 1024)
313 std::unordered_set<int> matchseed;
314 std::unordered_set<int> matchseedtmp =
sector_->seedMatch(iTP);
315 matchseed.insert(matchseedtmp.begin(), matchseedtmp.end());
318 bool eff = matchseed.find(
iseed) != matchseed.end();
389 edm::LogVerbatim(
"Tracklet") <<
"Process Times called Average time (ms) Total time (s)"
405 << setprecision(3) <<
TPTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
408 << setprecision(3) <<
MPTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
412 << setprecision(3) <<
TETimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
416 << setprecision(3) <<
TEDTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
419 << setprecision(3) <<
TRETimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
421 <<
"TrackletCalculatorDisplaced" << setw(10) <<
TCDTimer_.
ntimes() << setw(20)
422 << setprecision(3) <<
TCDTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
426 << setprecision(3) <<
TCTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
428 <<
"ProjectionRouter " << setw(10) <<
PRTimer_.
ntimes() << setw(20)
429 << setprecision(3) <<
PRTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
432 << setprecision(3) <<
METimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
434 <<
"MatchCalculator " << setw(10) <<
MCTimer_.
ntimes() << setw(20)
435 << setprecision(3) <<
MCTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
439 << setprecision(3) <<
FTTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
442 << setprecision(3) <<
PDTimer_.
avgtime() * 1000.0 << setw(20) << setprecision(3)
Log< level::Info, true > LogVerbatim
std::vector< Track > tracks_
~TrackletEventProcessor()
unsigned int writememsect() const
std::unique_ptr< Sector > sector_
void writeAll(std::ostream &wires, std::ostream &memories, std::ostream &modules)
const Settings * settings_
virtual void bookDiskResidual()
void event(SLHCEvent &ev)
virtual void bookLayerResidual()
std::unique_ptr< Globals > globals_
bool debugTracklet() const
const std::string & DTClink() const
unsigned int ntimes() const
void init(Settings const &theSettings)
const L1TStub & stub(int i) const
Abs< T >::type abs(const T &t)
virtual void bookSeedEff()
uint16_t mem[nChs][nEvts]
constexpr unsigned int N_SECTOR
void configure(std::istream &inwire, std::istream &inmem, std::istream &inproc)
unsigned int layersHit(int tpid, int &nlayers, int &ndisks)
tuple config
parse the configuration file
virtual void bookTrackletParams()
tuple size
Write out results.
bool writeMonitorData(std::string module) const
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)