18 const Stub* innerFPGAStub,
19 const Stub* middleFPGAStub,
20 const Stub* outerFPGAStub,
39 : settings_(settings) {
75 for (
unsigned int i = 0;
i <
N_LAYER - 2;
i++) {
80 for (
unsigned int i = 0;
i <
N_DISK;
i++) {
85 for (
unsigned int i = 0;
i <
N_LAYER - 2;
i++) {
94 for (
unsigned int i = 0;
i <
N_DISK;
i++) {
110 set<int> tpsetstubinner;
111 set<int> tpsetstubouter;
114 for (
auto tp : tps) {
116 tpsetstubinner.insert(
tp);
117 tpset.insert(
abs(
tp));
122 for (
auto tp : tps) {
124 tpsetstubouter.insert(
tp);
125 tpset.insert(
abs(
tp));
129 for (
auto&
tp : tpset) {
130 if (tpsetstubinner.find(
tp) != tpsetstubinner.end() && tpsetstubinner.find(-
tp) != tpsetstubinner.end() &&
131 tpsetstubouter.find(
tp) != tpsetstubouter.end() && tpsetstubouter.find(-
tp) != tpsetstubouter.end()) {
141 set<int> tpsetstubinner;
142 set<int> tpsetstubouter;
144 vector<int> tps = stub->
tps();
145 for (
auto tp : tps) {
147 tpsetstub.insert(
tp);
148 tpset.insert(
abs(
tp));
152 for (
auto tp : tps) {
154 tpsetstubinner.insert(
tp);
155 tpset.insert(
abs(
tp));
159 for (
auto tp : tps) {
161 tpsetstubouter.insert(
tp);
162 tpset.insert(
abs(
tp));
166 for (
auto tp : tpset) {
167 if (tpsetstub.find(
tp) != tpsetstub.end() && tpsetstub.find(-
tp) != tpsetstub.end() &&
168 tpsetstubinner.find(
tp) != tpsetstubinner.end() && tpsetstubinner.find(-
tp) != tpsetstubinner.end() &&
169 tpsetstubouter.find(
tp) != tpsetstubouter.end() && tpsetstubouter.find(-
tp) != tpsetstubouter.end()) {
211 if (allstubindex >= (1 << 7)) {
212 edm::LogPrint(
"Tracklet") <<
"Warning projection number too large!";
213 index.set((1 << 7) - 1, 7,
true, __LINE__, __FILE__);
215 index.set(allstubindex, 7,
true, __LINE__, __FILE__);
227 int irinvvm = 16 + (tmp_irinv >> (nbits_irinv - 5));
230 edm::LogPrint(
"Tracklet") <<
"Warning irinvvm too large:" << irinvvm;
237 tmp.set(irinvvm, 5,
true, __LINE__, __FILE__);
246 if (allstubindex >= (1 << 7)) {
247 edm::LogPrint(
"Tracklet") <<
"Warning projection number too large!";
248 index.set((1 << 7) - 1, 7,
true, __LINE__, __FILE__);
250 index.set(allstubindex, 7,
true, __LINE__, __FILE__);
305 resid_[layerdisk].
init(
settings_, layerdisk, ideltaphi, ideltarz, stubid, dphi, drz, dphiapprox, drzapprox, stubptr);
337 (isPS ? stubr.
str() : (
"00000000" + stubr.
str())) +
"|" +
344 std::vector<const L1TStub*>
tmp;
353 for (
const auto& iresid :
resid_) {
355 tmp.push_back(iresid.stubptr()->l1tstub());
362 std::map<int, int> stubIDs;
527 double chisqrphifitexact,
528 double chisqrzfitexact,
537 const vector<const L1TStub*>& l1stubs) {
575 std::stringstream oss(
"");
577 oss <<
"0|0000000|0000000000|0000000|000000000000|000000000";
585 oss <<
tmp.str() <<
"|";
598 std::stringstream oss(
"");
600 oss <<
"0|0000000|0000000000|000000000000|000000000000|0000000";
610 oss <<
tmp.str() <<
"|";
612 oss << (isPS ? stubr.str() : (
"00000000" + stubr.str())) <<
"|";
621 const unsigned maxNHits = 8;
622 const unsigned nBitsPerHit = 3;
623 vector<string> stub(maxNHits,
"0");
624 string hitmap(maxNHits * nBitsPerHit,
'0');
713 for (
unsigned i = 0;
i < maxNHits;
i++)
714 hitmap[
i * nBitsPerHit + 2] = stub[
i][0];
722 oss +=
tmp.str() +
"|";
728 for (
unsigned i = 0;
i < maxNHits;
i++)
732 oss +=
"|" + stub[
i];
751 vector<const L1TStub*>
tmp = l1stubs.empty() ?
getL1Stubs() : l1stubs;
753 vector<L1TStub> tmp2;
755 tmp2.reserve(
tmp.size());
756 for (
auto stub :
tmp) {
757 tmp2.push_back(*stub);
760 Track tmpTrack(ipars,
779 return (
l < 999 ?
l : 0);
793 return (
d < 999 ?
d : 0);
809 assert(iTC >= 0 && iTC <= 14);
TrackPars< FPGAWord > fpgapars_
unsigned int seedIndex() const
double d0fitexact() const
const FPGAWord & fpgafinerzvm() const
const Stub * innerFPGAStub()
const FPGAWord & iz0fit() const
Projection proj_[N_LAYER+N_DISK]
unsigned int layer() const
const FPGAWord & r() const
double rinvfitexact() const
std::string fullmatchdiskstr(int disk)
const Stub * outerFPGAStub()
const std::string layerstubstr(const unsigned layer) const
unsigned int nbitstrackletindex() const
std::string fullmatchstr(int layer)
const FPGAWord & fpgastubid() const
constexpr unsigned int N_SEED
const FPGAWord & fpgarzbin2projvm() const
std::string trackfitstr() const
const FPGAWord & fpgarzprojder() const
std::string vmstrlayer(int layer, unsigned int allstubindex)
const FPGAWord & fpgaphiresid() const
unsigned int nbitsseed() const
std::string to_string(const V &value)
TrackPars< double > trackparsapprox_
void init(Settings const &settings, unsigned int layerdisk, int iphiresid, int irzresid, int istubid, double phiresid, double rzresid, double phiresidapprox, double rzresidapprox, const Stub *stubptr)
std::string phiregionaddressstr() const
std::string vmstrdisk(int disk, unsigned int allstubindex)
void setTrackIndex(int index)
unsigned int nbitsd0() const
std::vector< const L1TStub * > getL1Stubs()
const FPGAWord & iphi0fit() const
const FPGAWord & fpgaphiproj() const
Settings const & settings_
const FPGAWord & disk() const
void addMatch(unsigned int layerdisk, int ideltaphi, int ideltarz, double dphi, double drz, double dphiapprox, double drzapprox, int stubid, const trklet::Stub *stubptr)
unsigned int projlayers(unsigned int iSeed, unsigned int i) const
TrackPars< double > fitpars_
const FPGAWord & fpgarzresid() const
const Stub * middleFPGAStub()
double phi0approx() const
const FPGAWord & getBendIndex() const
double z0fitexact() const
const FPGAWord & id0fit() const
TrackPars< FPGAWord > fpgafitpars_
int projlayer_[N_LAYER - 2]
std::string trackletprojstr(int layer) const
Abs< T >::type abs(const T &t)
std::unique_ptr< Track > fpgatrack_
unsigned int phiregionaddress() const
unsigned int projdisks(unsigned int iSeed, unsigned int i) const
unsigned int nbitsitc() const
double phi0fitexact() const
Log< level::Warning, true > LogPrint
unsigned int layerdisk() const
const FPGAWord & fpgarzbin1projvm() const
const FPGAWord & fpgaphiprojder() const
unsigned int nbitstcindex() const
const FPGAWord & stubindex() const
std::string trackletprojstrD(int disk) const
double rinvapprox() const
Residual resid_[N_LAYER+N_DISK]
static constexpr float d0
const std::string diskstubstr(const unsigned disk) const
bool stubtruthmatch(const L1TStub *stub)
void setTrackletIndex(unsigned int index)
double rinv(double phi1, double phi2, double r1, double r2)
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
const Stub * stubptr() const
const FPGAWord & fpgarzproj() const
TrackPars< double > fitparsexact_
const FPGAWord & itfit() const
bool writeoutReal() const
const Stub * outerFPGAStub_
unsigned int ntrackletmax() const
std::string trackletparstr()
void setFitPars(double rinvfit, double phi0fit, double d0fit, double tfit, double z0fit, double chisqrphifit, double chisqrzfit, double rinvfitexact, double phi0fitexact, double d0fitexact, double tfitexact, double z0fitexact, double chisqrphifitexact, double chisqrzfitexact, int irinvfit, int iphi0fit, int id0fit, int itfit, int iz0fit, int ichisqrphifit, int ichisqrzfit, int hitpattern, const std::vector< const L1TStub *> &l1stubs=std::vector< const L1TStub *>())
Track makeTrack(const std::vector< const L1TStub *> &l1stubs)
const FPGAWord & fpgafinephivm() const
const Stub * innerFPGAStub_
const FPGAWord & layer() const
const Stub * middleFPGAStub_
static constexpr float d1
unsigned int PSseed() const
TrackPars< double > trackpars_
double chisqrphifitexact_
const FPGAWord & irinvfit() const
constexpr unsigned int N_BITSMEMADDRESS
void init(T rinv, T phi0, T d0, T t, T z0)
std::map< int, int > getStubIDs()
std::vector< int > tps() const