|
|
Go to the documentation of this file.
19 MatchCalculator::MatchCalculator(
string name,
Settings const& settings,
Globals* global,
unsigned int iSector)
46 for (
unsigned int iSeed = 0; iSeed <
N_SEED; iSeed++) {
61 outphicut.open(
getName() +
"_phicut.tab");
62 outphicut <<
"{" << endl;
63 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
65 outphicut <<
"," << endl;
68 outphicut << endl <<
"};" << endl;
72 outzcut.open(
getName() +
"_zcut.tab");
73 outzcut <<
"{" << endl;
74 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
76 outzcut <<
"," << endl;
79 outzcut << endl <<
"};" << endl;
85 outphicut.open(
getName() +
"_PSphicut.tab");
86 outphicut <<
"{" << endl;
87 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
89 outphicut <<
"," << endl;
92 outphicut << endl <<
"};" << endl;
95 outphicut.open(
getName() +
"_2Sphicut.tab");
96 outphicut <<
"{" << endl;
97 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
99 outphicut <<
"," << endl;
102 outphicut << endl <<
"};" << endl;
106 outzcut.open(
getName() +
"_PSrcut.tab");
107 outzcut <<
"{" << endl;
108 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
110 outzcut <<
"," << endl;
113 outzcut << endl <<
"};" << endl;
116 outzcut.open(
getName() +
"_2Srcut.tab");
117 outzcut <<
"{" << endl;
118 for (
unsigned int seedindex = 0; seedindex <
N_SEED; seedindex++) {
120 outzcut <<
"," << endl;
123 outzcut << endl <<
"};" << endl;
142 if (
output.substr(0, 8) ==
"matchout") {
143 auto*
tmp = dynamic_cast<FullMatchMemory*>(
memory);
149 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output " <<
output;
157 if (
input ==
"allstubin") {
158 auto*
tmp = dynamic_cast<AllStubsMemory*>(
memory);
163 if (
input ==
"allprojin") {
164 auto*
tmp = dynamic_cast<AllProjectionsMemory*>(
memory);
169 if (
input.substr(0, 5) ==
"match" &&
input.substr(
input.size() - 2, 2) ==
"in") {
170 auto*
tmp = dynamic_cast<CandidateMatchMemory*>(
memory);
175 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input " <<
input;
179 unsigned int countall = 0;
180 unsigned int countsel = 0;
186 for (
unsigned int j = 0;
j < mergedMatches.size();
j++) {
193 const Stub* fpgastub = mergedMatches[
j].second;
194 Tracklet* tracklet = mergedMatches[
j].first.first;
199 if (oldTracklet !=
nullptr) {
202 oldTracklet = tracklet;
207 int ir = fpgastub->
r().
value();
216 int ideltaz = fpgastub->
z().
value() - iz;
222 double r = stub->
r();
223 double z = stub->
z();
249 int seedindex = tracklet->
getISeed();
268 edm::LogProblem(
"Tracklet") <<
"WARNING dphi and/or dphiapprox too large : " << dphi <<
" " << dphiapprox
278 <<
layerdisk_ + 1 <<
" " << seedindex <<
" " <<
pt <<
" "
306 mergedMatches[
j].second);
318 assert(stub->
z() * tracklet->
t() > 0.0);
320 int sign = (tracklet->
t() > 0.0) ? 1 : -1;
326 int iz = fpgastub->
z().
value();
345 int irstub = fpgastub->
r().
value();
349 if (
abs(disk) <= 2) {
359 int ideltar = (irstub >> 1) - ir;
364 ideltaphi += iphialphacor;
370 double z = stub->
z();
371 double r = stub->
r();
389 <<
"\n stub " << stub->
z() <<
" disk " << disk <<
" " <<
dz;
398 double dr = stub->
r() - rproj;
407 double drphi = dphi * stub->
r();
408 double drphiapprox = dphiapprox * stub->
r();
419 int seedindex = tracklet->
getISeed();
422 int idrcut =
rcutPS_[seedindex];
436 <<
pt <<
" " << ideltaphi *
settings_.
kphi() * stub->
r() <<
" " << drphiapprox <<
" " << drphicut <<
" "
442 bool imatch = (
std::abs(ideltaphi * irstub) < idrphicut) && (
std::abs(ideltar) < idrcut);
468 drphiapprox / stub->
r(),
492 vector<CandidateMatchMemory*>& candmatch) {
493 std::vector<std::pair<std::pair<Tracklet*, int>,
const Stub*> >
tmp;
495 std::vector<unsigned int> indexArray;
496 indexArray.reserve(candmatch.size());
497 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
498 indexArray.push_back(0);
503 int bestSector = 100;
504 int bestTCID = (1 << 16);
506 for (
unsigned int i = 0;
i < candmatch.size();
i++) {
507 if (indexArray[
i] >= candmatch[
i]->nMatches()) {
511 int TCID = candmatch[
i]->getMatch(indexArray[
i]).first.first->TCID();
520 if (dSector < bestSector) {
521 bestSector = dSector;
525 if (dSector == bestSector) {
526 if (TCID < bestTCID) {
532 if (bestIndex != -1) {
533 tmp.push_back(candmatch[bestIndex]->getMatch(indexArray[bestIndex]));
534 indexArray[bestIndex]++;
536 }
while (bestIndex != -1);
543 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
544 if (lastTCID >
tmp[
i].
first.first->TCID()) {
545 edm::LogProblem(
"Tracklet") <<
"Wrong TCID ordering for projections in " <<
getName() <<
" last " << lastTCID
546 <<
" " <<
tmp[
i].first.first->TCID();
549 lastTCID =
tmp[
i].first.first->TCID();
554 for (
unsigned int i = 1;
i <
tmp.size();
i++) {
556 <<
" " <<
tmp[
i].first.first->TCID();
561 for (
unsigned int i = 0;
i <
tmp.size();
i++) {
constexpr unsigned int N_PSLAYER
bool stubtruthmatch(const L1TStub *stub)
const FPGAWord & fpgaphiprojder(int layer) const
unsigned int rphicutPS_[N_SEED]
double rphimatchcut(unsigned int iSeed, unsigned int ilayer) const
static const std::string input
double krprojshiftdisk() const
const FPGAWord & fpgaphiprojdisk(int disk) const
const FPGAWord & phi() const
double rprojderdisk(int disk) const
constexpr unsigned int N_SECTOR
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
Settings const & settings_
double phiapprox(double phimin, double) const
void addInput(MemoryBase *memory, std::string input) override
double rDSSinner(unsigned int iBin) const
double half2SmoduleWidth() const
unsigned int rphicut2S_[N_SEED]
unsigned int rcutPS_[N_SEED]
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
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)
AllProjectionsMemory * allprojs_
const FPGAWord & fpgazproj(int layer) const
const FPGAWord & z() const
double rprojdisk(int disk) const
unsigned int isPSmodule() const
Log< level::Error, true > LogProblem
double rcut2S(unsigned int iSeed, unsigned int idisk) const
int ialphafactouter_[N_DSS_MOD *2]
void addOutput(MemoryBase *memory, std::string output) override
double phiprojder(int layer) const
double zmean(unsigned int iDisk) const
std::vector< FullMatchMemory * > fullMatches_
double phiprojderapprox(int layer) const
double rproj(int layer) const
unsigned int phimatchcut_[N_SEED]
double zproj(int layer) const
double phiprojderapproxdisk(int disk) const
double zprojderapprox(int layer) const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
constexpr unsigned int N_SEED
double rcutPS(unsigned int iSeed, unsigned int idisk) const
const FPGAWord & alphanew() const
constexpr unsigned int N_DSS_MOD
std::vector< CandidateMatchMemory * > matches_
unsigned int nzbitsstub(unsigned int layerdisk) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
double phiprojdisk(int disk) const
double phiprojapproxdisk(int disk) const
double rprojderapproxdisk(int disk) const
double alpha(double pitch) const
double stripPitch(bool isPSmodule) const
bool writeMonitorData(std::string module) const
int SS_zderL_shift() const
std::ofstream & ofstream(std::string fname)
unsigned int getISeed(std::string name)
Log< level::Info, true > LogVerbatim
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
bool debugTracklet() const
double zmatchcut(unsigned int iSeed, unsigned int ilayer) const
int ialphafactinner_[N_DSS_MOD *2]
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
Abs< T >::type abs(const T &t)
const FPGAWord & fpgaphiprojderdisk(int disk) const
double phiprojderdisk(int disk) const
AllStubsMemory * allstubs_
unsigned int zmatchcut_[N_SEED]
unsigned int rcut2S_[N_SEED]
double phiprojapprox(int layer) const
std::vector< std::pair< std::pair< Tracklet *, int >, const Stub * > > mergeMatches(std::vector< CandidateMatchMemory * > &candmatch)
double zprojapprox(int layer) const
constexpr T reduceRange(T x)