|
|
Go to the documentation of this file.
14 MatchProcessor::MatchProcessor(
string name,
Settings const& settings,
Globals* global,
unsigned int iSector)
15 :
ProcessBase(
name, settings, global, iSector), fullmatches_(12), inputProjBuffer_(3) {
47 for (
unsigned int iSeed = 0; iSeed < 12; iSeed++) {
63 outphicut.open(
getName() +
"_phicut.tab");
64 outphicut <<
"{" << endl;
65 for (
unsigned int seedindex = 0; seedindex < 12; seedindex++) {
67 outphicut <<
"," << endl;
70 outphicut << endl <<
"};" << endl;
74 outzcut.open(
getName() +
"_zcut.tab");
75 outzcut <<
"{" << endl;
76 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
78 outzcut <<
"," << endl;
81 outzcut << endl <<
"};" << endl;
86 unsigned int nbits = 3;
90 for (
unsigned int irinv = 0; irinv < 32; irinv++) {
95 for (
unsigned int ibend = 0; ibend < (
unsigned int)(1 <<
nbits); ibend++) {
104 char layer =
'0' +
layer_;
105 string fname =
"METable_L";
110 for (
unsigned int i = 0;
i <
table_.size();
i++) {
122 for (
unsigned int iprojbend = 0; iprojbend < 32; iprojbend++) {
123 double projbend = 0.5 * (iprojbend - 15.0);
124 for (
unsigned int ibend = 0; ibend < 8; ibend++) {
129 for (
unsigned int ibend = 0; ibend < 16; ibend++) {
170 if (
output.find(
"matchout") != std::string::npos) {
171 auto*
tmp = dynamic_cast<FullMatchMemory*>(
memory);
179 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output: " <<
output;
187 if (
input ==
"allstubin") {
188 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
193 if (
input ==
"vmstubin") {
194 auto*
tmp = dynamic_cast<VMStubsMEMemory*>(
memory);
199 if (
input ==
"projin") {
200 auto*
tmp = dynamic_cast<TrackletProjectionsMemory*>(
memory);
205 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input: " <<
input;
231 unsigned int countall = 0;
232 unsigned int countsel = 0;
234 unsigned int iprojmem = 0;
235 unsigned int iproj = 0;
247 }
else if (iproj < projMem->nTracklets()) {
260 projrinv = 16 + (
proj->fpgarinv().value() >> (
proj->fpgarinv().nbits() - 5));
273 int signindex = (
proj->fpgarprojderdisk(
disk_).value() < 0);
289 bool isPSseed =
proj->PSseed() == 1;
312 bool addedProjection =
false;
331 addedProjection =
true;
340 bool bestInPipeline =
false;
348 bestTCID = currentTCID;
349 bestInPipeline =
empty;
354 std::pair<Tracklet*, const Stub*> candmatch =
matchengines_[iMEbest].read();
356 const Stub* fpgastub = candmatch.second;
357 Tracklet* tracklet = candmatch.first;
359 if (oldTracklet !=
nullptr) {
363 oldTracklet = tracklet;
387 int ir = fpgastub->
r().
value();
396 int ideltaz = fpgastub->
z().
value() - iz;
401 double phi = stub->
phi();
402 double r = stub->
r();
403 double z = stub->
z();
429 int seedindex = tracklet->
getISeed();
451 <<
layer_ <<
" " << seedindex <<
" " <<
pt <<
" "
468 edm::LogPrint(
"Tracklet") <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox;
502 assert(stub->
z() * tracklet->
t() > 0.0);
504 int sign = (tracklet->
t() > 0.0) ? 1 : -1;
510 int iz = fpgastub->
z().
value();
529 int irstub = fpgastub->
r().
value();
547 ideltaphi += iphialphacor;
552 double phi = stub->
phi();
553 double z = stub->
z();
554 double r = stub->
r();
581 double dr = stub->
r() - rproj;
588 double drphi = dphi * stub->
r();
589 double drphiapprox = dphiapprox * stub->
r();
601 int seedindex = tracklet->
getISeed();
604 int idrcut =
rcutPS_[seedindex];
618 <<
" " << ideltaphi *
settings_.
kphi() * stub->
r() <<
" " << drphiapprox <<
" " << drphicut <<
" "
623 bool imatch = (
std::abs(ideltaphi * irstub) < idrphicut) && (
std::abs(ideltar) < idrcut);
647 drphiapprox / stub->
r(),
constexpr unsigned int N_PSLAYER
bool stubtruthmatch(const L1TStub *stub)
const FPGAWord & fpgaphiprojder(int layer) const
double rphimatchcut(unsigned int iSeed, unsigned int ilayer) const
static const std::string input
double krprojshiftdisk() const
std::vector< VMStubsMEMemory * > vmstubs_
const FPGAWord & fpgaphiprojdisk(int disk) const
const FPGAWord & phi() const
double rprojderdisk(int disk) const
int ialphafactouter_[N_DSS_MOD *2]
unsigned int zmatchcut_[N_SEED]
void addMatch(int layer, int ideltaphi, int ideltaz, double dphi, double dz, double dphiapprox, double dzapprox, int stubid, double rstub, const trklet::Stub *stubptr)
U second(std::pair< T, U > const &p)
double rphicutPS(unsigned int iSeed, unsigned int idisk) const
double rmean(unsigned int iLayer) const
unsigned int nbits(unsigned int power)
Settings const & settings_
double phiapprox(double phimin, double) const
double rDSSinner(unsigned int iBin) const
double half2SmoduleWidth() const
unsigned int projfinephi() const
void addInput(MemoryBase *memory, std::string input) override
const FPGAWord & r() const
const FPGAWord & fpgarprojderdisk(int disk) const
unsigned int nrbitsstub(unsigned int layerdisk) const
const FPGAWord & fpgazprojder(int layer) const
double rDSSouter(unsigned int iBin) const
unsigned int iphi() const
std::vector< FullMatchMemory * > fullmatches_
void addMatchDisk(int disk, int ideltaphi, int ideltar, double dphi, double dr, double dphiapprox, double drapprox, double alpha, int stubid, double zstub, const trklet::Stub *stubptr)
const FPGAWord & fpgazproj(int layer) const
const FPGAWord & z() const
std::string const & getName() const
double rprojdisk(int disk) const
unsigned int isPSmodule() const
unsigned int projrinv() const
CircularBuffer< ProjectionTemp > inputProjBuffer_
double rcut2S(unsigned int iSeed, unsigned int idisk) const
std::vector< TrackletProjectionsMemory * > inputprojs_
unsigned int rcutPS_[N_SEED]
double phiprojder(int layer) const
double zmean(unsigned int iDisk) const
double phiprojderapprox(int layer) const
double rproj(int layer) const
double zproj(int layer) const
unsigned int rphicut2S_[N_SEED]
double phiprojderapproxdisk(int disk) const
bool matchCalculator(Tracklet *tracklet, const Stub *fpgastub)
double zprojderapprox(int layer) const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
double bendcutme(unsigned int layerdisk) const
unsigned int rphicutPS_[N_SEED]
constexpr unsigned int N_SEED
int ialphafactinner_[N_DSS_MOD *2]
unsigned int rcut2S_[N_SEED]
double rcutPS(unsigned int iSeed, unsigned int idisk) const
const FPGAWord & alphanew() const
double rinv(double phi1, double phi2, double r1, double r2)
constexpr unsigned int N_DSS_MOD
Tracklet * getTracklet(unsigned int i)
unsigned int nzbitsstub(unsigned int layerdisk) const
unsigned int nvmme(unsigned int layerdisk) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::vector< bool > tablePS_
double phiprojdisk(int disk) const
unsigned int nMatchEngines_
unsigned int slot() const
double phiprojapproxdisk(int disk) const
std::vector< bool > table2S_
double rprojderapproxdisk(int disk) const
double alpha(double pitch) const
unsigned int nTracklets() const
int bendLoookup(int diskindex, int bendindex)
double stripPitch(bool isPSmodule) const
ProjectionRouterBendTable *& projectionRouterBendTable()
bool writeMonitorData(std::string module) const
int SS_zderL_shift() const
std::ofstream & ofstream(std::string fname)
unsigned int getISeed(std::string name)
std::vector< bool > table_
double bend(double r, double rinv, double stripPitch)
AllStubsMemory * allstubs_
double zprojder(int layer) const
double phiproj(int layer) const
std::string const & getName() const
const FPGAWord & fpgaphiproj(int layer) const
const FPGAWord & stubindex() const
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
double zmatchcut(unsigned int iSeed, unsigned int ilayer) const
void addOutput(MemoryBase *memory, std::string output) override
double rphicut2S(unsigned int iSeed, unsigned int idisk) const
const FPGAWord & fpgarprojdisk(int disk) const
unsigned int maxStep(std::string module) const
int PS_zderL_shift() const
double rprojapproxdisk(int disk) const
double benddecode(int ibend, bool isPS)
Abs< T >::type abs(const T &t)
const FPGAWord & fpgaphiprojderdisk(int disk) const
double phiprojderdisk(int disk) const
unsigned int phimatchcut_[N_SEED]
unsigned int nStubsBin(unsigned int bin) const
double phiprojapprox(int layer) const
double zprojapprox(int layer) const
std::vector< MatchEngineUnit > matchengines_
constexpr T reduceRange(T x)