16 using namespace trklet;
19 :
ProcessBase(name, settings, global), luttable_(settings) {
34 if (output ==
"matchout") {
40 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output: " <<
output;
48 if (input ==
"vmstubin") {
54 if (input ==
"vmprojin") {
60 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find input: " <<
input;
64 unsigned int countall = 0;
65 unsigned int countpass = 0;
70 constexpr
unsigned int kNBitsBuffer = 3;
74 std::pair<int, int> projbuffer[1 << kNBitsBuffer];
79 bool moreproj = iproj < nproj;
84 int projfinerzadj = 0;
85 unsigned int projfinephi = 0;
89 bool isPSseed =
false;
99 int writeindexplus = (writeindex + 1) % (1 << kNBitsBuffer);
100 int writeindexplusplus = (writeindex + 2) % (1 << kNBitsBuffer);
104 bool bufferfull = (writeindexplus == readindex) || (writeindexplusplus == readindex);
107 bool buffernotempty = (writeindex != readindex);
113 if ((!moreproj) && (!buffernotempty))
116 if (moreproj && (!bufferfull)) {
119 int iprojtmp = iproj;
122 moreproj = iproj < nproj;
125 unsigned int rzlast = rzfirst;
135 bool savefirst = nstubfirst != 0;
136 bool savelast = second && (nstublast != 0);
138 int writeindextmp = writeindex;
139 int writeindextmpplus = (writeindex + 1) % (1 << kNBitsBuffer);
141 if (savefirst && savelast) {
142 writeindex = writeindexplusplus;
143 }
else if (savefirst || savelast) {
144 writeindex = writeindexplus;
148 std::pair<int, int>
tmp(iprojtmp, rzfirst);
149 projbuffer[writeindextmp] =
tmp;
152 std::pair<int, int>
tmp(iprojtmp, rzlast + 100);
154 projbuffer[writeindextmpplus] =
tmp;
156 projbuffer[writeindextmp] =
tmp;
163 if (buffernotempty) {
164 int istubtmp = istub;
168 projindex = projbuffer[readindex].first;
169 rzbin = projbuffer[readindex].second;
180 projfinephi = fpgafinephi.
value();
194 projrinv = (1 <<
nrinv_) - 1;
198 isPSseed = proj->
PSseed();
204 projfinerzadj = projfinerz;
208 readindex = (readindex + 1) % (1 << kNBitsBuffer);
214 if (istub + 1 >= nstubs) {
216 readindex = (readindex + 1) % (1 << kNBitsBuffer);
233 constexpr
int mindeltaphicut = 3;
234 constexpr
int maxdeltaphicut = 5;
235 bool passphi = (
std::abs(deltaphi) < mindeltaphicut) || (
std::abs(deltaphi) > maxdeltaphicut);
243 int idrz = stubfinerz - projfinerzadj;
248 constexpr
int drzcut = 1;
251 constexpr
int drzcut = 5;
256 constexpr
int drzcut = 1;
259 constexpr
int drzcut = 3;
266 <<
" rzbin istubtmp : " << rzbin <<
" " << istubtmp <<
" dz " << stubfinerz <<
" "
267 << projfinerzadj <<
" dphi: " << deltaphi;
271 if (passz && passphi) {
276 ofstream
fout(
"seeds.txt", ofstream::app);
277 fout << __FILE__ <<
":" << __LINE__ <<
" " <<
name_ <<
" " << proj->
getISeed() << endl;
Log< level::Info, true > LogVerbatim
void initBendMatch(unsigned int layerdisk)
const FPGAWord & fpgafinerzvm() const
const FPGAWord & fpgaphiprojder() const
constexpr unsigned int NRINVBITS
VMStubsMEMemory * vmstubs_
Projection & proj(int layerdisk)
Settings const & settings_
constexpr unsigned int N_BENDBITS_2S
void addMatch(std::pair< Tracklet *, int > tracklet, const Stub *stub)
const FPGAWord & fpgafinephivm() const
const FPGAWord & getBendIndex() const
bool debugTracklet() const
constexpr unsigned int N_BENDBITS_PS
VMProjectionsMemory * vmprojs_
static std::string const input
unsigned int PSseed() const
U second(std::pair< T, U > const &p)
std::string const & getName() const
std::string const & getName() const
unsigned int nbits(unsigned int power)
CandidateMatchMemory * candmatches_
const FPGAWord & finephi() const
const FPGAWord & bend() const
void addOutput(MemoryBase *memory, std::string output) override
unsigned int nTracklets() const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Abs< T >::type abs(const T &t)
void addInput(MemoryBase *memory, std::string input) override
unsigned int maxStep(std::string module) const
const FPGAWord & fpgarzbin1projvm() const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
constexpr unsigned int NFINERZBITS
int lookup(unsigned int index) const
const VMStubME & getVMStubMEBin(unsigned int bin, unsigned int i) const
int getAllProjIndex(unsigned int i) const
const FPGAWord & finerz() const
std::ofstream & ofstream(std::string fname)
const FPGAWord & fpgarzbin2projvm() const
const Stub * stub() const
Tracklet * getTracklet(unsigned int i)
unsigned int nStubsBin(unsigned int bin) const
bool writeMonitorData(std::string module) const