24 phimatchcuttable_(settings),
25 zmatchcuttable_(settings),
26 rphicutPStable_(settings),
27 rphicut2Stable_(settings),
28 rcutPStable_(settings),
29 rcut2Stable_(settings) {
81 if (
output.substr(0, 8) ==
"matchout") {
88 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output " <<
output;
96 if (
input ==
"allstubin") {
102 if (
input ==
"allprojin") {
108 if (
input.substr(0, 5) ==
"match" &&
input.substr(
input.size() - 2, 2) ==
"in") {
114 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input " <<
input;
118 unsigned int countall = 0;
119 unsigned int countsel = 0;
129 unsigned int mergedepth = 3;
133 for (
unsigned int j = 0;
j < maxProc;
j++) {
140 const Stub* fpgastub = mergedMatches[
j].second;
141 Tracklet* tracklet = mergedMatches[
j].first.first;
146 if (oldTracklet !=
nullptr) {
149 oldTracklet = tracklet;
156 int ir = fpgastub->
r().
value();
157 int iphi =
proj.fpgaphiproj().value();
161 int iz =
proj.fpgarzproj().value();
165 int ideltaz = fpgastub->
z().
value() - iz;
170 double phi = stub->
phi() - phioffset;
171 double r = stub->
r();
172 double z = stub->
z();
190 double dz = z - (
proj.rzproj() + dr *
proj.rzprojder());
194 double dzapprox = z - (
proj.rzprojapprox() + dr *
proj.rzprojderapprox());
196 int seedindex = tracklet->
getISeed();
217 <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox << endl;
224 <<
layerdisk_ + 1 <<
" " << seedindex <<
" " <<
pt <<
" " 267 mergedMatches[
j].second);
278 assert(stub->
z() * tracklet->
t() > 0.0);
280 int sign = (tracklet->
t() > 0.0) ? 1 : -1;
288 int iz = fpgastub->
z().
value();
289 int iphi =
proj.fpgaphiproj().value();
293 int iphicorr = (iz *
proj.fpgaphiprojder().value()) >> shifttmp;
297 int ir =
proj.fpgarzproj().value();
301 int ircorr = (iz *
proj.fpgarzprojder().value()) >> shifttmp2;
306 int irstub = fpgastub->
r().
value();
310 if (
abs(disk) <= 2) {
320 int ideltar = (irstub >> 1) - ir;
325 ideltaphi += iphialphacor;
330 double phi = stub->
phi() - phioffset;
331 double z = stub->
z();
332 double r = stub->
r();
349 <<
"\n stub " << stub->
z() <<
" disk " << disk <<
" " <<
dz;
352 double phiproj =
proj.phiproj() +
dz *
proj.phiprojder();
354 double rproj =
proj.rzproj() +
dz *
proj.rzprojder();
356 double deltar = r - rproj;
358 double dr = stub->
r() - rproj;
364 double drapprox = stub->
r() - (
proj.rzprojapprox() +
dz *
proj.rzprojderapprox());
366 double drphi = dphi * stub->
r();
367 double drphiapprox = dphiapprox * stub->
r();
378 int seedindex = tracklet->
getISeed();
398 <<
pt <<
" " << ideltaphi *
settings_.
kphi() * stub->
r() <<
" " << drphiapprox <<
" " << drphicut <<
" " 404 imatch = (
std::abs(ideltaphi * irstub) < idrphicut) && (
std::abs(ideltar) < idrcut);
406 edm::LogProblem(
"Tracklet") <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox
407 <<
"dphi " << dphi <<
" Seed / ISeed " << tracklet->
getISeed() << endl;
426 edm::LogVerbatim(
"Tracklet") <<
"imatch match disk: " << imatch <<
" " << match <<
" keep = " <<
keep <<
" " 429 <<
" r = " << stub->
r();
444 drphiapprox / stub->
r(),
466 vector<CandidateMatchMemory*>& candmatch) {
467 std::vector<std::pair<std::pair<Tracklet*, int>,
const Stub*> >
tmp;
469 std::vector<unsigned int> indexArray;
470 indexArray.reserve(candmatch.size());
471 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
472 indexArray.push_back(0);
477 int bestSector = 100;
480 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
481 if (indexArray[
i] >= candmatch[
i]->nMatches()) {
485 int TCID = candmatch[
i]->getMatch(indexArray[
i]).first.first->TCID();
494 if (dSector < bestSector) {
495 bestSector = dSector;
499 if (dSector == bestSector) {
500 if (TCID < bestTCID || bestTCID < 0) {
506 if (bestIndex != -1) {
507 tmp.push_back(candmatch[bestIndex]->getMatch(indexArray[bestIndex]));
508 indexArray[bestIndex]++;
510 }
while (bestIndex != -1);
517 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
518 if (lastTCID >
tmp[
i].
first.first->TCID()) {
519 edm::LogProblem(
"Tracklet") <<
"Wrong TCID ordering for projections in " <<
getName() <<
" last " << lastTCID
520 <<
" " <<
tmp[
i].first.first->TCID();
523 lastTCID =
tmp[
i].first.first->TCID();
528 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
530 <<
" " <<
tmp[
i].first.first->TCID();
535 for (
unsigned int i = 0;
i <
tmp.size();
i++) {
Log< level::Info, true > LogVerbatim
TrackletLUT rphicutPStable_
unsigned int maxStep(std::string module) const
const FPGAWord & r() const
int PS_zderL_shift() const
unsigned int nrbitsstub(unsigned int layerdisk) const
TrackletLUT rphicut2Stable_
const Residual & resid(unsigned int layerdisk)
void initmatchcut(unsigned int layerdisk, MatchType type, unsigned int region)
double rDSSinner(unsigned int iBin) const
constexpr T reduceRange(T x)
double phiapprox(double phimin, double) const
const FPGAWord & z() const
double dphisectorHG() const
Projection & proj(int layerdisk)
Settings const & settings_
int lookup(unsigned int index) const
constexpr unsigned int N_DSS_MOD
static std::string const input
unsigned int isPSmodule() const
void addMatch(unsigned int layerdisk, int ideltaphi, int ideltarz, double dphi, double drz, double dphiapprox, double drzapprox, int stubid, const trklet::Stub *stubptr)
U second(std::pair< T, U > const &p)
void addOutput(MemoryBase *memory, std::string output) override
double half2SmoduleWidth() const
unsigned int nzbitsstub(unsigned int layerdisk) const
double rmean(unsigned int iLayer) const
AllStubsMemory * allstubs_
std::vector< CandidateMatchMemory * > matches_
AllProjectionsMemory * allprojs_
double rDSSouter(unsigned int iBin) const
Abs< T >::type abs(const T &t)
bool doMultipleMatches() const
bool writeMonitorData(std::string module) const
double zmean(unsigned int iDisk) const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
const FPGAWord & stubindex() const
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
constexpr unsigned int N_SECTOR
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > mergeMatches(std::vector< CandidateMatchMemory *> &candmatch)
constexpr unsigned int N_PSLAYER
void execute(unsigned int iSector, double phioffset)
bool stubtruthmatch(const L1TStub *stub)
void addInput(MemoryBase *memory, std::string input) override
int ialphafactouter_[N_DSS_MOD *2]
unsigned int getISeed(const std::string &name)
const FPGAWord & alpha() const
TrackletLUT zmatchcuttable_
bool match(unsigned int layerdisk)
std::ofstream & ofstream(std::string fname)
double krprojshiftdisk() const
const FPGAWord & phi() const
int ialphafactinner_[N_DSS_MOD *2]
std::string const & getName() const
int SS_zderL_shift() const
std::vector< FullMatchMemory * > fullMatches_
Log< level::Error, true > LogProblem
TrackletLUT phimatchcuttable_