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;
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;
Log< level::Info, true > LogVerbatim
unsigned int nTracklets() const
void initBendMatch(unsigned int layerdisk)
unsigned int maxStep(std::string module) const
const FPGAWord & bend() const
const FPGAWord & finerz() const
const Stub * stub() const
constexpr unsigned int NRINVBITS
VMStubsMEMemory * vmstubs_
Settings const & settings_
constexpr unsigned int N_BENDBITS_2S
int lookup(unsigned int index) const
void addMatch(std::pair< Tracklet *, int > tracklet, const Stub *stub)
constexpr unsigned int N_BENDBITS_PS
VMProjectionsMemory * vmprojs_
static std::string const input
U second(std::pair< T, U > const &p)
unsigned int nbits(unsigned int power)
CandidateMatchMemory * candmatches_
int getAllProjIndex(unsigned int i) const
const VMStubME & getVMStubMEBin(unsigned int bin, unsigned int i) const
void addOutput(MemoryBase *memory, std::string output) override
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
bool writeMonitorData(std::string module) const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
constexpr unsigned int NFINERZBITS
bool debugTracklet() const
const FPGAWord & finephi() const
std::ofstream & ofstream(std::string fname)
unsigned int nStubsBin(unsigned int bin) const
Tracklet * getTracklet(unsigned int i)
std::string const & getName() const