23 phimatchcuttable_(settings),
24 zmatchcuttable_(settings),
25 rphicutPStable_(settings),
26 rphicut2Stable_(settings),
27 rcutPStable_(settings),
28 rcut2Stable_(settings) {
80 if (
output.substr(0, 8) ==
"matchout") {
87 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output " <<
output;
95 if (
input ==
"allstubin") {
101 if (
input ==
"allprojin") {
107 if (
input.substr(0, 5) ==
"match" &&
input.substr(
input.size() - 2, 2) ==
"in") {
113 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input " <<
input;
117 unsigned int countall = 0;
118 unsigned int countsel = 0;
124 for (
unsigned int j = 0;
j < mergedMatches.size();
j++) {
131 const Stub* fpgastub = mergedMatches[
j].second;
132 Tracklet* tracklet = mergedMatches[
j].first.first;
137 if (oldTracklet !=
nullptr) {
140 oldTracklet = tracklet;
147 int ir = fpgastub->
r().
value();
148 int iphi =
proj.fpgaphiproj().value();
152 int iz =
proj.fpgarzproj().value();
156 int ideltaz = fpgastub->
z().
value() - iz;
161 double phi = stub->
phi() - phioffset;
162 double r = stub->
r();
163 double z = stub->
z();
181 double dz = z - (
proj.rzproj() +
dr *
proj.rzprojder());
185 double dzapprox = z - (
proj.rzprojapprox() +
dr *
proj.rzprojderapprox());
187 int seedindex = tracklet->
getISeed();
208 <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox << endl;
215 <<
layerdisk_ + 1 <<
" " << seedindex <<
" " <<
pt <<
" " 243 mergedMatches[
j].second);
254 assert(stub->
z() * tracklet->
t() > 0.0);
256 int sign = (tracklet->
t() > 0.0) ? 1 : -1;
264 int iz = fpgastub->
z().
value();
265 int iphi =
proj.fpgaphiproj().value();
269 int iphicorr = (iz *
proj.fpgaphiprojder().value()) >> shifttmp;
273 int ir =
proj.fpgarzproj().value();
277 int ircorr = (iz *
proj.fpgarzprojder().value()) >> shifttmp2;
283 int irstub = fpgastub->
r().
value();
287 if (
abs(disk) <= 2) {
297 int ideltar = (irstub >> 1) - ir;
302 ideltaphi += iphialphacor;
307 double phi = stub->
phi() - phioffset;
308 double z = stub->
z();
309 double r = stub->
r();
326 <<
"\n stub " << stub->
z() <<
" disk " << disk <<
" " <<
dz;
329 double phiproj =
proj.phiproj() +
dz *
proj.phiprojder();
331 double rproj =
proj.rzproj() +
dz *
proj.rzprojder();
335 double dr = stub->
r() - rproj;
341 double drapprox = stub->
r() - (
proj.rzprojapprox() +
dz *
proj.rzprojderapprox());
343 double drphi = dphi * stub->
r();
344 double drphiapprox = dphiapprox * stub->
r();
355 int seedindex = tracklet->
getISeed();
375 <<
pt <<
" " << ideltaphi *
settings_.
kphi() * stub->
r() <<
" " << drphiapprox <<
" " << drphicut <<
" " 381 imatch = (
std::abs(ideltaphi * irstub) < idrphicut) && (
std::abs(ideltar) < idrcut);
383 edm::LogProblem(
"Tracklet") <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox
384 <<
"dphi " << dphi <<
" Seed / ISeed " << tracklet->
getISeed() << endl;
406 drphiapprox / stub->
r(),
428 vector<CandidateMatchMemory*>& candmatch) {
429 std::vector<std::pair<std::pair<Tracklet*, int>,
const Stub*> >
tmp;
431 std::vector<unsigned int> indexArray;
432 indexArray.reserve(candmatch.size());
433 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
434 indexArray.push_back(0);
439 int bestSector = 100;
442 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
443 if (indexArray[
i] >= candmatch[
i]->nMatches()) {
447 int TCID = candmatch[
i]->getMatch(indexArray[
i]).first.first->TCID();
456 if (dSector < bestSector) {
457 bestSector = dSector;
461 if (dSector == bestSector) {
462 if (TCID < bestTCID || bestTCID < 0) {
468 if (bestIndex != -1) {
469 tmp.push_back(candmatch[bestIndex]->getMatch(indexArray[bestIndex]));
470 indexArray[bestIndex]++;
472 }
while (bestIndex != -1);
479 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
480 if (lastTCID >
tmp[
i].
first.first->TCID()) {
481 edm::LogProblem(
"Tracklet") <<
"Wrong TCID ordering for projections in " <<
getName() <<
" last " << lastTCID
482 <<
" " <<
tmp[
i].first.first->TCID();
485 lastTCID =
tmp[
i].first.first->TCID();
490 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
492 <<
" " <<
tmp[
i].first.first->TCID();
497 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
void execute(double phioffset)
unsigned int nrbitsstub(unsigned int layerdisk) const
TrackletLUT rphicut2Stable_
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 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
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_
std::ofstream & ofstream(std::string fname)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
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_