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 isPSmodule = ((rzbin & 7) < 3) || ((rzbin & 7) == 3 && stubfinerz <= 3);
235 isPSmodule = ((rzbin & 7) < 3) || ((rzbin & 7) == 3 && stubfinerz <= 2);
245 constexpr
int mindeltaphicut = 3;
246 constexpr
int maxdeltaphicut = 5;
247 bool passphi = (
std::abs(deltaphi) < mindeltaphicut) || (
std::abs(deltaphi) > maxdeltaphicut);
255 int idrz = stubfinerz - projfinerzadj;
260 constexpr
int drzcut = 1;
263 constexpr
int drzcut = 5;
268 constexpr
int drzcut = 1;
271 constexpr
int drzcut = 3;
278 <<
" rzbin istubtmp : " << rzbin <<
" " << istubtmp <<
" dz " << stubfinerz <<
" " 279 << projfinerzadj <<
" dphi: " << deltaphi;
283 if (passz && passphi) {
288 ofstream
fout(
"seeds.txt", ofstream::app);
289 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
constexpr unsigned int N_PSLAYER
const FPGAWord & finephi() const
void execute(unsigned int iSector)
std::ofstream & ofstream(std::string fname)
unsigned int nStubsBin(unsigned int bin) const
Tracklet * getTracklet(unsigned int i)
std::string const & getName() const