15 Stub::Stub(
Settings const& settings) : settings_(settings) {}
18 const string& stubwordhex = stub.
stubword();
37 assert(nbendbits + nalphabits + nrbits + nzbits + nphibits == 36);
39 bitset<32> rbits(stubwordbin.substr(0, nrbits));
40 bitset<32> zbits(stubwordbin.substr(nrbits, nzbits));
41 bitset<32> phibits(stubwordbin.substr(nrbits + nzbits, nphibits));
42 bitset<32> alphabits(stubwordbin.substr(nphibits + nzbits + nrbits, nalphabits));
43 bitset<32> bendbits(stubwordbin.substr(nphibits + nzbits + nrbits + nalphabits, nbendbits));
45 int newbend = bendbits.to_ulong();
47 int newr = rbits.to_ulong();
49 if (newr >= (1 << (nrbits - 1)))
50 newr = newr - (1 << nrbits);
53 int newz = zbits.to_ulong();
54 if (newz >= (1 << (nzbits - 1)))
55 newz = newz - (1 << nzbits);
57 int newphi = phibits.to_ulong();
59 int newalpha = alphabits.to_ulong();
60 if (newalpha >= (1 << (nalphabits - 1)))
61 newalpha = newalpha - (1 << nalphabits);
65 bend_.
set(newbend, nbendbits,
true, __LINE__, __FILE__);
67 phi_.
set(newphi, nphibits,
true, __LINE__, __FILE__);
68 phicorr_.
set(newphi, nphibits,
true, __LINE__, __FILE__);
77 alpha_.
set(newalpha, nalphabits,
false, __LINE__, __FILE__);
83 disk_.
set(0, 4,
false, __LINE__, __FILE__);
86 r_.
set(newr, nrbits,
pos, __LINE__, __FILE__);
87 z_.
set(newz, nzbits,
false, __LINE__, __FILE__);
92 for (
unsigned int isimtrk = 0; isimtrk < nsimtrks; isimtrk++) {
98 double bend = stub.
r() * dr * 0.5 *
rinv / pitch;
101 << simtrk.
pt() * simtrk.
charge() <<
" " <<
bend <<
" " << newbend <<
" " 111 return FPGAWord(finephi, finebits,
true, __LINE__, __FILE__);
128 return phiregion.
str();
unsigned int nrbitsstub(unsigned int layerdisk) const
double rDSSinner(unsigned int iBin) const
const FPGAWord & negdisk() const
constexpr T reduceRange(T x)
double phiapprox(double phimin, double) const
Stub(Settings const &settings)
constexpr unsigned int N_BENDBITS_2S
const FPGAWord & bend() const
std::string phiregionaddressstr() const
constexpr unsigned int N_BENDBITS_PS
unsigned int isPSmodule() const
const FPGAWord & disk() const
FPGAWord iphivmFineBins(int VMbits, int finebits) const
const L1SimTrack & simtrack(int i) const
unsigned int nbitsallstubs(unsigned int layerdisk) const
unsigned int nzbitsstub(unsigned int layerdisk) const
unsigned int nphibitsstub(unsigned int layerdisk) const
double rmean(unsigned int iLayer) const
double rDSSouter(unsigned int iBin) const
void setAllStubIndex(int nstub)
double stripPitch(bool isPSmodule) const
Abs< T >::type abs(const T &t)
unsigned int phiregionaddress() const
bool tpmatch2(int tp) const
bool writeMonitorData(std::string module) const
unsigned int layerdisk() const
double zmean(unsigned int iDisk) const
bool debugTracklet() const
void setPhiCorr(int phiCorr)
double bendcut(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const
double rinv(double phi1, double phi2, double r1, double r2)
const std::string & stubword() const
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
unsigned int nsimtracks() const
std::ofstream & ofstream(std::string fname)
Settings const & settings_
std::string convertHexToBin(const std::string &stubwordhex)
std::string phiregionstr() const
constexpr unsigned int N_BITSMEMADDRESS
double benddecode(unsigned int ibend, unsigned int layerdisk, bool isPSmodule) const