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()) {
219 if (allstubindex >= (1 << 7)) {
220 edm::LogPrint(
"Tracklet") <<
"Warning projection number too large!";
221 index.set((1 << 7) - 1, 7,
true, __LINE__, __FILE__);
223 index.set(allstubindex, 7,
true, __LINE__, __FILE__);
235 int irinvvm = 16 + (tmp_irinv >> (nbits_irinv - 5));
238 edm::LogPrint(
"Tracklet") <<
"Warning irinvvm too large:" << irinvvm;
245 tmp.set(irinvvm, 5,
true, __LINE__, __FILE__);
254 if (allstubindex >= (1 << 7)) {
255 edm::LogPrint(
"Tracklet") <<
"Warning projection number too large!";
256 index.set((1 << 7) - 1, 7,
true, __LINE__, __FILE__);
258 index.set(allstubindex, 7,
true, __LINE__, __FILE__);
313 resid_[layerdisk].
init(
settings_, layerdisk, ideltaphi, ideltarz, stubid, dphi, drz, dphiapprox, drzapprox, stubptr);
345 (isPS ? stubr.
str() : (
"00000000" + stubr.
str())) +
"|" +
352 std::vector<const L1TStub*>
tmp;
361 for (
const auto& iresid :
resid_) {
363 tmp.push_back(iresid.stubptr()->l1tstub());
370 std::map<int, int> stubIDs;
535 double chisqrphifitexact,
536 double chisqrzfitexact,
545 const vector<const L1TStub*>& l1stubs) {
583 std::stringstream oss(
"");
585 oss <<
"0|0000000|0000000000|0000000|000000000000|000000000";
593 oss <<
tmp.str() <<
"|";
606 std::stringstream oss(
"");
608 oss <<
"0|0000000|0000000000|000000000000|000000000000|0000000";
618 oss <<
tmp.str() <<
"|";
620 oss << (isPS ? stubr.str() : (
"00000000" + stubr.str())) <<
"|";
629 const unsigned maxNHits = 8;
630 const unsigned nBitsPerHit = 3;
631 vector<string> stub(maxNHits,
"0");
632 string hitmap(maxNHits * nBitsPerHit,
'0');
721 for (
unsigned i = 0;
i < maxNHits;
i++)
722 hitmap[
i * nBitsPerHit + 2] = stub[
i][0];
730 oss +=
tmp.str() +
"|";
747 for (
unsigned i = 0;
i < maxNHits;
i++)
751 oss +=
"|" + stub[
i];
770 vector<const L1TStub*>
tmp = l1stubs.empty() ?
getL1Stubs() : l1stubs;
772 vector<L1TStub> tmp2;
774 tmp2.reserve(
tmp.size());
775 for (
auto stub :
tmp) {
776 tmp2.push_back(*stub);
779 Track tmpTrack(ipars,
798 return (
l < 999 ?
l : 0);
812 return (
d < 999 ?
d : 0);
828 assert(iTC >= 0 && iTC <= 14);
TrackPars< FPGAWord > fpgapars_
unsigned int seedIndex() const
double d0fitexact() const
const FPGAWord & fpgafinerzvm() const
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 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
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
static std::string to_string(const XMLCh *ch)
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
double phi0approx() const
const FPGAWord & getBendIndex() const
double z0fitexact() const
const FPGAWord & id0fit() const
TrackPars< FPGAWord > fpgafitpars_
const Stub * outerFPGAStub() const
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
const Stub * middleFPGAStub() 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
std::string phiregionstr() 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
const Stub * innerFPGAStub() const