34 if (
output ==
"matchout") {
35 auto*
tmp = dynamic_cast<CandidateMatchMemory*>(
memory);
40 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" could not find output: " <<
output;
48 if (
input ==
"vmstubin") {
49 auto*
tmp = dynamic_cast<VMStubsMEMemory*>(
memory);
54 if (
input ==
"vmprojin") {
55 auto*
tmp = dynamic_cast<VMProjectionsMemory*>(
memory);
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;
124 unsigned int rzfirst =
proj->proj(
layerdisk_).fpgarzbin1projvm().value();
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;