CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::TrackletProcessorDisplaced Class Reference

#include <TrackletProcessorDisplaced.h>

Inheritance diagram for trklet::TrackletProcessorDisplaced:
trklet::TrackletCalculatorDisplaced trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void addOutputProjection (TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
 
void execute (unsigned int iSector, double phimin, double phimax)
 
 TrackletProcessorDisplaced (std::string name, Settings const &settings, Globals *globals)
 
 ~TrackletProcessorDisplaced () override=default
 
- Public Member Functions inherited from trklet::TrackletCalculatorDisplaced
void addDiskProj (Tracklet *tracklet, int disk)
 
bool addLayerProj (Tracklet *tracklet, int layer)
 
void addOutputProjection (TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
 
void addProjection (int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
void addProjectionDisk (int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
 
void approxproj (double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double rmean, double &phiproj, double &phiprojder, double &zproj, double &zprojder)
 
void approxprojdisk (double halfRinv, double phi0, double d0, double t, double z0, double halfRinv_0, double d0_0, double zmean, double &phiproj, double &phiprojder, double &rproj, double &rprojder)
 
void approxtracklet (double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, bool take3, unsigned ndisks, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[4], double zproj[4], double phider[4], double zder[4], double phiprojdisk[5], double rprojdisk[5], double phiderdisk[5], double rderdisk[5])
 
bool DDLSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
void exactproj (double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
 
void exactprojdisk (double zproj, double rinv, double, double, double t, double z0, double x0, double y0, double &phiproj, double &rproj, double &phider, double &rder)
 
void exacttracklet (double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
 
void execute (unsigned int iSector, double phimin, double phimax)
 
bool LLDSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
bool LLLSeeding (const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
 
 TrackletCalculatorDisplaced (std::string name, Settings const &settings, Globals *global)
 
 ~TrackletCalculatorDisplaced () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global)
 
virtual ~ProcessBase ()=default
 

Private Attributes

int count_
 
int disk1_
 
int disk2_
 
int disk3_
 
int firstphibits_
 
int iAllStub_
 
TrackletLUT innerOverlapTable_
 
TrackletLUT innerTable_
 
TrackletLUT innerThirdTable_
 
std::vector< VMStubsTEMemory * > innervmstubs_
 
int iTC_
 
int layer1_
 
int layer2_
 
int layer3_
 
unsigned int layerdisk_
 
unsigned int maxStep_
 
int nbitsrfinebintable_
 
int nbitszfinebintable_
 
std::vector< VMStubsTEMemory * > outervmstubs_
 
int secondphibits_
 
std::map< std::string, std::vector< std::map< std::string, unsigned > > > spTable_
 
std::vector< StubPairsMemory * > stubpairs_
 
StubTripletsMemorystubtriplets_
 
std::vector< bool > table_
 
int thirdphibits_
 
std::map< std::string, std::vector< std::vector< std::string > > > tmpSPTable_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::TrackletCalculatorDisplaced
int disk_
 
int dproj_ [N_DISK - 2]
 
std::vector< AllStubsMemory * > innerallstubs_
 
unsigned int iSector_
 
unsigned int iSeed_
 
int layer_
 
int lproj_ [N_LAYER - 2]
 
std::vector< AllStubsMemory * > middleallstubs_
 
std::vector< AllStubsMemory * > outerallstubs_
 
double phimax_
 
double phimin_
 
double rproj_ [N_LAYER - 2]
 
double rzmeanInv_ [N_DISK - 2]
 
std::vector< StubTripletsMemory * > stubtriplets_
 
int TCIndex_
 
std::vector< double > toR_
 
std::vector< double > toZ_
 
TrackletParametersMemorytrackletpars_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
 
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
 
double zproj_ [N_DISK - 2]
 
- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 27 of file TrackletProcessorDisplaced.h.

Constructor & Destructor Documentation

◆ TrackletProcessorDisplaced()

TrackletProcessorDisplaced::TrackletProcessorDisplaced ( std::string  name,
Settings const &  settings,
Globals globals 
)

Definition at line 21 of file TrackletProcessorDisplaced.cc.

References cms::cuda::assert(), trklet::D3, disk1_, disk2_, disk3_, trklet::TrackletCalculatorDisplaced::disk_, trklet::ProcessBase::initLayerDisk(), trklet::TrackletLUT::initVMRTable(), SurfaceOrientation::inner, trklet::TrackletCalculatorDisplaced::innerallstubs_, innerOverlapTable_, innerTable_, innerThirdTable_, innervmstubs_, trklet::TrackletCalculatorDisplaced::iSeed_, PixelRegions::L1, PixelRegions::L2, PixelRegions::L3, trklet::L5, layer1_, layer2_, layer3_, trklet::TrackletCalculatorDisplaced::layer_, layerdisk_, trklet::TrackletCalculatorDisplaced::middleallstubs_, trklet::N_DISK, trklet::N_LAYER, trklet::Settings::nallstubs(), Skims_PA_cff::name, nbitsrfinebintable_, nbitszfinebintable_, trklet::TrackletCalculatorDisplaced::outerallstubs_, outervmstubs_, nano_mu_digi_cff::region, trklet::ProcessBase::settings_, stubpairs_, trklet::TrackletCalculatorDisplaced::TCIndex_, createJobs::tmp, trklet::TrackletCalculatorDisplaced::trackletprojdisks_, trklet::TrackletCalculatorDisplaced::trackletprojlayers_, trklet::Settings::vmrlutrbits(), and trklet::Settings::vmrlutzbits().

22  : TrackletCalculatorDisplaced(name, settings, globals),
23  innerTable_(settings),
24  innerOverlapTable_(settings),
25  innerThirdTable_(settings) {
26  innerallstubs_.clear();
27  middleallstubs_.clear();
28  outerallstubs_.clear();
29  stubpairs_.clear();
30  innervmstubs_.clear();
31  outervmstubs_.clear();
32 
33  const unsigned layerdiskPosInName = 4;
34  const unsigned regionPosInName1 = 9;
35 
36  // iAllStub_ = -1;
37  layerdisk_ = initLayerDisk(layerdiskPosInName);
38 
39  unsigned int region = name.substr(1)[regionPosInName1] - 'A';
40  // assert(region < settings_.nallstubs(layerdisk_));
41 
45  }
46 
49  layerdisk_, TrackletLUT::VMRTableType::inneroverlap, region); //projection to disk from layer
50  }
51 
55  layerdisk_, TrackletLUT::VMRTableType::innerthird, region); //projection to third layer/disk
56  }
57 
60 
61  for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
62  vector<TrackletProjectionsMemory*> tmp(settings_.nallstubs(ilayer), nullptr);
63  trackletprojlayers_.push_back(tmp);
64  }
65 
66  for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
67  vector<TrackletProjectionsMemory*> tmp(settings_.nallstubs(idisk + N_LAYER), nullptr);
68  trackletprojdisks_.push_back(tmp);
69  }
70 
71  // initLayerDisksandISeed(layerdisk1_, layerdisk2_, iSeed_);
72 
73  layer_ = 0;
74  disk_ = 0;
75  layer1_ = 0;
76  layer2_ = 0;
77  layer3_ = 0;
78  disk1_ = 0;
79  disk2_ = 0;
80  disk3_ = 0;
81 
82  constexpr unsigned layerPosInName1 = 4;
83  constexpr unsigned diskPosInName1 = 4;
84  constexpr unsigned layer1PosInName1 = 4;
85  constexpr unsigned disk1PosInName1 = 4;
86  constexpr unsigned layer2PosInName1 = 6;
87  constexpr unsigned disk2PosInName1 = 6;
88 
89  string name1 = name.substr(1); //this is to correct for "TPD" having one more letter then "TP"
90  if (name1[3] == 'L')
91  layer_ = name1[layerPosInName1] - '0';
92  if (name1[3] == 'D')
93  disk_ = name1[diskPosInName1] - '0';
94 
95  if (name1[3] == 'L')
96  layer1_ = name1[layer1PosInName1] - '0';
97  if (name1[3] == 'D')
98  disk1_ = name1[disk1PosInName1] - '0';
99  if (name1[5] == 'L')
100  layer2_ = name1[layer2PosInName1] - '0';
101  if (name1[5] == 'D')
102  disk2_ = name1[disk2PosInName1] - '0';
103 
104  // set TC index
105  iSeed_ = 0;
106 
107  int iTC = name1[regionPosInName1] - 'A';
108 
109  if (name1.substr(3, 6) == "L3L4L2") {
110  iSeed_ = 8;
111  layer3_ = 2;
112  } else if (name1.substr(3, 6) == "L5L6L4") {
113  iSeed_ = 9;
114  layer3_ = 4;
115  } else if (name1.substr(3, 6) == "L2L3D1") {
116  iSeed_ = 10;
117  disk3_ = 1;
118  } else if (name1.substr(3, 6) == "D1D2L2") {
119  iSeed_ = 11;
120  layer3_ = 2;
121  }
122  assert(iSeed_ != 0);
123 
124  constexpr int TCIndexMin = 128;
125  constexpr int TCIndexMax = 191;
126 
127  TCIndex_ = (iSeed_ << 4) + iTC;
128  assert(TCIndex_ >= TCIndexMin && TCIndex_ < TCIndexMax);
129 
130  assert((layer_ != 0) || (disk_ != 0));
131 }
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:189
std::vector< AllStubsMemory * > middleallstubs_
constexpr int N_DISK
Definition: Settings.h:26
std::vector< AllStubsMemory * > innerallstubs_
Settings const & settings_
Definition: ProcessBase.h:40
std::vector< VMStubsTEMemory * > innervmstubs_
assert(be >=bs)
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
Divides< A, C > D1
Definition: Factorize.h:136
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: ProcessBase.cc:33
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:114
std::vector< StubPairsMemory * > stubpairs_
TrackletCalculatorDisplaced(std::string name, Settings const &settings, Globals *global)
std::vector< AllStubsMemory * > outerallstubs_
tmp
align.sh
Definition: createJobs.py:716
std::vector< VMStubsTEMemory * > outervmstubs_
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
Definition: TrackletLUT.cc:984
unsigned int vmrlutzbits(unsigned int layerdisk) const
Definition: Settings.h:188
constexpr int N_LAYER
Definition: Settings.h:25

◆ ~TrackletProcessorDisplaced()

trklet::TrackletProcessorDisplaced::~TrackletProcessorDisplaced ( )
overridedefault

Member Function Documentation

◆ addInput()

void TrackletProcessorDisplaced::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Reimplemented from trklet::TrackletCalculatorDisplaced.

Definition at line 184 of file TrackletProcessorDisplaced.cc.

References cms::cuda::assert(), Exception, trklet::TrackletCalculatorDisplaced::innerallstubs_, innervmstubs_, input, mps_setup::memory, trklet::TrackletCalculatorDisplaced::middleallstubs_, trklet::ProcessBase::name_, trklet::TrackletCalculatorDisplaced::outerallstubs_, outervmstubs_, trklet::ProcessBase::settings_, stubpairs_, createJobs::tmp, and trklet::Settings::writetrace().

184  {
185  if (settings_.writetrace()) {
186  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
187  << input;
188  }
189 
190  if (input == "thirdallstubin") {
191  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
192  assert(tmp != nullptr);
193  innerallstubs_.push_back(tmp);
194  return;
195  }
196  if (input == "firstallstubin") {
197  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
198  assert(tmp != nullptr);
199  middleallstubs_.push_back(tmp);
200  return;
201  }
202  if (input == "secondallstubin") {
203  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
204  assert(tmp != nullptr);
205  outerallstubs_.push_back(tmp);
206  return;
207  }
208  if (input.substr(0, 8) == "stubpair") {
209  auto* tmp = dynamic_cast<StubPairsMemory*>(memory);
210  assert(tmp != nullptr);
211  stubpairs_.push_back(tmp);
212  return;
213  }
214 
215  if (input == "thirdvmstubin") {
216  auto* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
217  assert(tmp != nullptr);
218  innervmstubs_.push_back(tmp);
219  return;
220  }
221  if (input == "secondvmstubin") {
222  auto* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
223  assert(tmp != nullptr);
224  // outervmstubs_ = tmp;
225  outervmstubs_.push_back(tmp);
226  return;
227  }
228 
229  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
230 }
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
std::string name_
Definition: ProcessBase.h:38
std::vector< AllStubsMemory * > innerallstubs_
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:193
std::vector< VMStubsTEMemory * > innervmstubs_
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
std::vector< StubPairsMemory * > stubpairs_
std::vector< AllStubsMemory * > outerallstubs_
tmp
align.sh
Definition: createJobs.py:716
std::vector< VMStubsTEMemory * > outervmstubs_

◆ addOutput()

void TrackletProcessorDisplaced::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Reimplemented from trklet::TrackletCalculatorDisplaced.

Definition at line 138 of file TrackletProcessorDisplaced.cc.

References cms::cuda::assert(), Exception, mps_setup::memory, trklet::N_DISK, trklet::N_LAYER, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, findQualityFiles::size, createJobs::tmp, trklet::TrackletCalculatorDisplaced::trackletpars_, trklet::TrackletCalculatorDisplaced::trackletprojdisks_, trklet::TrackletCalculatorDisplaced::trackletprojlayers_, and trklet::Settings::writetrace().

138  {
139  if (settings_.writetrace()) {
140  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
141  << output;
142  }
143 
144  if (output == "trackpar") {
145  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
146  assert(tmp != nullptr);
147  trackletpars_ = tmp;
148  return;
149  }
150 
151  if (output.substr(0, 7) == "projout") {
152  //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
153  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
154  assert(tmp != nullptr);
155 
156  constexpr unsigned layerdiskPosInprojout = 8;
157  constexpr unsigned phiPosInprojout = 12;
158 
159  unsigned int layerdisk = output[layerdiskPosInprojout] - '1'; //layer or disk counting from 0
160  unsigned int phiregion = output[phiPosInprojout] - 'A'; //phiregion counting from 0
161 
162  if (output[7] == 'L') {
163  assert(layerdisk < N_LAYER);
164  assert(phiregion < trackletprojlayers_[layerdisk].size());
165  //check that phiregion not already initialized
166  assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
167  trackletprojlayers_[layerdisk][phiregion] = tmp;
168  return;
169  }
170 
171  if (output[7] == 'D') {
172  assert(layerdisk < N_DISK);
173  assert(phiregion < trackletprojdisks_[layerdisk].size());
174  //check that phiregion not already initialized
175  assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
176  trackletprojdisks_[layerdisk][phiregion] = tmp;
177  return;
178  }
179  }
180 
181  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
182 }
size
Write out results.
Log< level::Info, true > LogVerbatim
constexpr int N_DISK
Definition: Settings.h:26
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:193
assert(be >=bs)
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
tmp
align.sh
Definition: createJobs.py:716
constexpr int N_LAYER
Definition: Settings.h:25

◆ addOutputProjection()

void TrackletProcessorDisplaced::addOutputProjection ( TrackletProjectionsMemory *&  outputProj,
MemoryBase memory 
)

Definition at line 133 of file TrackletProcessorDisplaced.cc.

References cms::cuda::assert(), and mps_setup::memory.

133  {
134  outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
135  assert(outputProj != nullptr);
136 }
assert(be >=bs)

◆ execute()

void TrackletProcessorDisplaced::execute ( unsigned int  iSector,
double  phimin,
double  phimax 
)

Definition at line 232 of file TrackletProcessorDisplaced.cc.

References cms::cuda::assert(), newFWLiteAna::bin, count_, trklet::D1D2L2, trklet::Settings::debugTracklet(), trklet::Stub::disk(), disk1_, disk2_, disk3_, Exception, trklet::Settings::extended(), trklet::ProcessBase::getName(), SurfaceOrientation::inner, trklet::TrackletCalculatorDisplaced::innerallstubs_, innerOverlapTable_, innerTable_, innerThirdTable_, innervmstubs_, createfilelist::int, trklet::TrackletCalculatorDisplaced::iSector_, trklet::TrackletCalculatorDisplaced::iSeed_, trklet::Stub::isPSmodule(), dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, trklet::Stub::l1tstub(), trklet::L2D1, trklet::L2L3D1, trklet::L2L3L4, trklet::L4L5L6, dqmdumpme::last, layer1_, layer2_, layer3_, trklet::Stub::layerdisk(), layerdisk_, trklet::TrackletLUT::lookup(), trklet::Settings::lutwidthtab(), trklet::Settings::lutwidthtabextended(), visualization-live-secondInstance_cfg::m, trklet::TrackletCalculatorDisplaced::middleallstubs_, trklet::N_LAYER, trklet::FPGAWord::nbits(), nbitsrfinebintable_, nbitszfinebintable_, trklet::Settings::NLONGVMBINS(), trklet::TrackletCalculatorDisplaced::outerallstubs_, outervmstubs_, phimax, trklet::TrackletCalculatorDisplaced::phimax_, phimin, trklet::TrackletCalculatorDisplaced::phimin_, trklet::Stub::r(), trklet::ProcessBase::settings_, trklet::Stub::strbare(), trklet::VMStubTE::stub(), stubpairs_, trklet::L1TStub::stubword(), trklet::FPGAWord::value(), trklet::VMStubTE::vmbits(), and trklet::Stub::z().

232  {
233  // unsigned int nThirdStubs = 0;
234  // unsigned int nOuterStubs = 0;
235  count_ = 0;
236 
237  phimin_ = phimin;
238  phimax_ = phimax;
239  iSector_ = iSector;
240 
241  assert(!innerallstubs_.empty());
242  assert(!middleallstubs_.empty());
243  assert(!outerallstubs_.empty());
244  assert(!innervmstubs_.empty());
245  assert(!outervmstubs_.empty());
246  assert(stubpairs_.empty());
247 
248  for (auto& iInnerMem : middleallstubs_) {
249  assert(iInnerMem->nStubs() == iInnerMem->nStubs());
250  for (unsigned int j = 0; j < iInnerMem->nStubs(); j++) {
251  const Stub* firstallstub = iInnerMem->getStub(j);
252 
253  if (settings_.debugTracklet()) {
254  edm::LogVerbatim("Tracklet") << "In " << getName() << " have first stub\n";
255  }
256 
257  int inner = 0;
258  bool negdisk = (firstallstub->disk().value() < 0);
259  int indexz = (((1 << (firstallstub->z().nbits() - 1)) + firstallstub->z().value()) >>
260  (firstallstub->z().nbits() - nbitszfinebintable_));
261  int indexr = -1;
262  if (layerdisk_ > (N_LAYER - 1)) {
263  if (negdisk) {
264  indexz = (1 << nbitszfinebintable_) - indexz;
265  }
266  indexr = firstallstub->r().value();
267  if (firstallstub->isPSmodule()) {
268  indexr = firstallstub->r().value() >> (firstallstub->r().nbits() - nbitsrfinebintable_);
269  }
270  } else {
271  //Take the top nbitsfinebintable_ bits of the z coordinate. The & is to handle the negative z values.
272  indexr = (((1 << (firstallstub->r().nbits() - 1)) + firstallstub->r().value()) >>
273  (firstallstub->r().nbits() - nbitsrfinebintable_));
274  }
275 
276  assert(indexz >= 0);
277  assert(indexr >= 0);
278  assert(indexz < (1 << nbitszfinebintable_));
279  assert(indexr < (1 << nbitsrfinebintable_));
280 
281  // int melut = meTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
282  // assert(melut >= 0);
283 
284  unsigned int lutwidth = settings_.lutwidthtab(inner, iSeed_);
285  if (settings_.extended()) {
287  }
288 
289  int lutval = -999;
290 
291  if (iSeed_ < Seed::L1D1 || iSeed_ > Seed::L2D1) {
292  lutval = innerTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
293  } else {
294  lutval = innerOverlapTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
295  }
296 
297  if (lutval == -1)
298  continue;
299  if (settings_.extended() &&
301  int lutval2 = innerThirdTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
302  if (lutval2 != -1)
303  lutval += (lutval2 << 10);
304  }
305 
306  assert(lutval >= 0);
307  // assert(lutwidth > 0);
308 
309  FPGAWord binlookup(lutval, lutwidth, true, __LINE__, __FILE__);
310 
311  if ((layer1_ == 3 && layer2_ == 4) || (layer1_ == 5 && layer2_ == 6)) {
312  if (settings_.debugTracklet()) {
313  edm::LogVerbatim("Tracklet") << getName() << " Layer-layer pair\n";
314  }
315 
316  constexpr int andlookupbits = 1023;
317  constexpr int shiftzdiffmax = 7;
318  constexpr int andnewbin = 127;
319  constexpr int divbin = 8;
320  constexpr int andzbinfirst = 7;
321  constexpr int shiftstart = 1;
322  constexpr int andlast = 1;
323  constexpr int maxlast = 8;
324 
325  int lookupbits = binlookup.value() & andlookupbits;
326  int zdiffmax = (lookupbits >> shiftzdiffmax);
327  int newbin = (lookupbits & andnewbin);
328  int bin = newbin / divbin;
329 
330  int zbinfirst = newbin & andzbinfirst;
331 
332  int start = (bin >> shiftstart);
333  int last = start + (bin & andlast);
334 
335  assert(last < maxlast);
336 
337  if (settings_.debugTracklet()) {
338  edm::LogVerbatim("Tracklet") << "Will look in zbins " << start << " to " << last << endl;
339  }
340 
341  for (int ibin = start; ibin <= last; ibin++) {
342  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
343  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
344  if (settings_.debugTracklet()) {
345  edm::LogVerbatim("Tracklet")
346  << "In " << getName() << " have second stub(1) " << ibin << " " << j << endl;
347  }
348 
349  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
350 
351  int zbin = (secondvmstub.vmbits().value() & 7);
352  if (start != ibin)
353  zbin += 8;
354  if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
355  if (settings_.debugTracklet()) {
356  edm::LogVerbatim("Tracklet") << "Stubpair rejected because of wrong zbin";
357  }
358  continue;
359  }
360 
361  if ((layer2_ == 4 && layer3_ == 2) || (layer2_ == 6 && layer3_ == 4)) {
362  constexpr int vmbitshift = 10;
363  constexpr int andlookupbits_ = 1023;
364  constexpr int andnewbin_ = 127;
365  constexpr int divbin_ = 8;
366  constexpr int shiftstart_ = 1;
367  constexpr int andlast_ = 1;
368 
369  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
370  int newbin_ = (lookupbits_ & andnewbin_);
371  int bin_ = newbin_ / divbin_;
372 
373  int start_ = (bin_ >> shiftstart_);
374  int last_ = start_ + (bin_ & andlast_);
375 
376  if (settings_.debugTracklet()) {
377  edm::LogVerbatim("Tracklet")
378  << "Will look in zbins for third stub" << start_ << " to " << last_ << endl;
379  }
380 
381  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
382  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
383  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
384  if (settings_.debugTracklet()) {
385  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub\n";
386  }
387 
388  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
389 
390  const Stub* innerFPGAStub = firstallstub;
391  const Stub* middleFPGAStub = secondvmstub.stub();
392  const Stub* outerFPGAStub = thirdvmstub.stub();
393 
394  const L1TStub* innerStub = innerFPGAStub->l1tstub();
395  const L1TStub* middleStub = middleFPGAStub->l1tstub();
396  const L1TStub* outerStub = outerFPGAStub->l1tstub();
397 
398  if (settings_.debugTracklet()) {
399  edm::LogVerbatim("Tracklet")
400  << "LLL seeding\n"
401  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
402  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
403  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
404  }
405 
406  if (settings_.debugTracklet()) {
407  edm::LogVerbatim("Tracklet")
408  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
409  }
410 
411  if (innerFPGAStub->layerdisk() >= N_LAYER && middleFPGAStub->layerdisk() >= N_LAYER &&
412  outerFPGAStub->layerdisk() >= N_LAYER) {
413  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
414  }
415 
416  if (settings_.debugTracklet()) {
417  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
418  }
419  }
420  }
421  }
422  }
423  }
424  }
425  }
426 
427  } else if (layer1_ == 2 && layer2_ == 3) {
428  if (settings_.debugTracklet()) {
429  edm::LogVerbatim("Tracklet") << getName() << " Layer-layer pair";
430  }
431 
432  constexpr int andlookupbits = 1023;
433  constexpr int shiftzdiffmax = 7;
434  constexpr int andnewbin = 127;
435  constexpr int divbin = 8;
436  constexpr int andzbinfirst = 7;
437  constexpr int shiftstart = 1;
438  constexpr int andlast = 1;
439  constexpr int maxlast = 8;
440 
441  int lookupbits = binlookup.value() & andlookupbits;
442  int zdiffmax = (lookupbits >> shiftzdiffmax);
443  int newbin = (lookupbits & andnewbin);
444  int bin = newbin / divbin;
445 
446  int zbinfirst = newbin & andzbinfirst;
447 
448  int start = (bin >> shiftstart);
449  int last = start + (bin & andlast);
450 
451  assert(last < maxlast);
452 
453  if (settings_.debugTracklet()) {
454  edm::LogVerbatim("Tracklet") << "Will look in zbins " << start << " to " << last;
455  }
456 
457  for (int ibin = start; ibin <= last; ibin++) {
458  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
459  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
460  if (settings_.debugTracklet()) {
461  edm::LogVerbatim("Tracklet") << "In " << getName() << " have second stub(1) " << ibin << " " << j;
462  }
463 
464  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
465 
466  int zbin = (secondvmstub.vmbits().value() & 7);
467  if (start != ibin)
468  zbin += 8;
469  if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
470  if (settings_.debugTracklet()) {
471  edm::LogVerbatim("Tracklet") << "Stubpair rejected because of wrong zbin";
472  }
473  continue;
474  }
475 
476  if (layer2_ == 3 && disk3_ == 1) {
477  constexpr int vmbitshift = 10;
478  constexpr int andlookupbits_ = 1023;
479  constexpr int andnewbin_ = 127;
480  constexpr int divbin_ = 8;
481  constexpr int shiftstart_ = 1;
482  constexpr int andlast_ = 1;
483 
484  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
485  int newbin_ = (lookupbits_ & andnewbin_);
486  int bin_ = newbin_ / divbin_;
487 
488  int start_ = (bin_ >> shiftstart_);
489  int last_ = start_ + (bin_ & andlast_);
490 
491  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
492  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
493  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
494  if (settings_.debugTracklet()) {
495  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub";
496  }
497 
498  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
499 
500  const Stub* innerFPGAStub = firstallstub;
501  const Stub* middleFPGAStub = secondvmstub.stub();
502  const Stub* outerFPGAStub = thirdvmstub.stub();
503 
504  const L1TStub* innerStub = innerFPGAStub->l1tstub();
505  const L1TStub* middleStub = middleFPGAStub->l1tstub();
506  const L1TStub* outerStub = outerFPGAStub->l1tstub();
507 
508  if (settings_.debugTracklet()) {
509  edm::LogVerbatim("Tracklet")
510  << "LLD seeding\n"
511  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
512  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
513  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
514  }
515 
516  if (settings_.debugTracklet()) {
517  edm::LogVerbatim("Tracklet")
518  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
519  }
520 
521  if (settings_.debugTracklet()) {
522  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
523  }
524  }
525  }
526  }
527  }
528  }
529  }
530  }
531 
532  } else if (disk1_ == 1 && disk2_ == 2) {
533  if (settings_.debugTracklet())
534  edm::LogVerbatim("Tracklet") << getName() << " Disk-disk pair";
535 
536  constexpr int andlookupbits = 511;
537  constexpr int shiftrdiffmax = 6;
538  constexpr int andnewbin = 63;
539  constexpr int divbin = 8;
540  constexpr int andrbinfirst = 7;
541  constexpr int shiftstart = 1;
542  constexpr int andlast = 1;
543  constexpr int maxlast = 8;
544 
545  int lookupbits = binlookup.value() & andlookupbits;
546  bool negdisk = firstallstub->disk().value() < 0;
547  int rdiffmax = (lookupbits >> shiftrdiffmax);
548  int newbin = (lookupbits & andnewbin);
549  int bin = newbin / divbin;
550 
551  int rbinfirst = newbin & andrbinfirst;
552 
553  int start = (bin >> shiftstart);
554  if (negdisk)
555  start += 4;
556  int last = start + (bin & andlast);
557  assert(last < maxlast);
558 
559  for (int ibin = start; ibin <= last; ibin++) {
560  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
561  if (settings_.debugTracklet()) {
562  edm::LogVerbatim("Tracklet")
563  << getName() << " looking for matching stub in " << outervmstubs_.at(m)->getName()
564  << " in bin = " << ibin << " with " << outervmstubs_.at(m)->nVMStubsBinned(ibin) << " stubs";
565  }
566 
567  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
568  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
569  int rbin = (secondvmstub.vmbits().value() & 7);
570  if (start != ibin)
571  rbin += 8;
572  if (rbin < rbinfirst)
573  continue;
574  if (rbin - rbinfirst > rdiffmax)
575  continue;
576 
577  if (disk2_ == 2 && layer3_ == 2) {
578  constexpr int vmbitshift = 10;
579  constexpr int andlookupbits_ = 1023;
580  constexpr int andnewbin_ = 127;
581  constexpr int divbin_ = 8;
582  constexpr int shiftstart_ = 1;
583  constexpr int andlast_ = 1;
584 
585  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
586  int newbin_ = (lookupbits_ & andnewbin_);
587  int bin_ = newbin_ / divbin_;
588 
589  int start_ = (bin_ >> shiftstart_);
590  int last_ = start_ + (bin_ & andlast_);
591 
592  if (firstallstub->disk().value() < 0) { //TODO - negative disk should come from memory
593  start_ = settings_.NLONGVMBINS() - last_ - 1;
594  last_ = settings_.NLONGVMBINS() - start_ - 1;
595  }
596 
597  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
598  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
599  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
600  if (settings_.debugTracklet()) {
601  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub";
602  }
603 
604  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
605 
606  const Stub* innerFPGAStub = firstallstub;
607  const Stub* middleFPGAStub = secondvmstub.stub();
608  const Stub* outerFPGAStub = thirdvmstub.stub();
609 
610  const L1TStub* innerStub = innerFPGAStub->l1tstub();
611  const L1TStub* middleStub = middleFPGAStub->l1tstub();
612  const L1TStub* outerStub = outerFPGAStub->l1tstub();
613 
614  if (settings_.debugTracklet()) {
615  edm::LogVerbatim("Tracklet")
616  << "DDL seeding\n"
617  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
618  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
619  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
620  }
621 
622  if (settings_.debugTracklet()) {
623  edm::LogVerbatim("Tracklet")
624  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
625  }
626 
627  if (settings_.debugTracklet()) {
628  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
629  }
630  }
631  }
632  }
633  }
634  }
635  }
636  }
637  }
638  }
639  }
640 }
Definition: start.py:1
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
const FPGAWord & r() const
Definition: Stub.h:60
double lutwidthtab(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:147
std::vector< AllStubsMemory * > innerallstubs_
const FPGAWord & z() const
Definition: Stub.h:61
std::string strbare() const
Definition: Stub.h:40
Settings const & settings_
Definition: ProcessBase.h:40
int lookup(unsigned int index) const
std::vector< VMStubsTEMemory * > innervmstubs_
assert(be >=bs)
unsigned int NLONGVMBINS() const
Definition: Settings.h:363
const FPGAWord & disk() const
Definition: Stub.h:68
const Stub * stub() const
Definition: VMStubTE.h:29
const FPGAWord & vmbits() const
Definition: VMStubTE.h:27
int value() const
Definition: FPGAWord.h:24
double lutwidthtabextended(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:148
L1TStub * l1tstub()
Definition: Stub.h:77
unsigned int layerdisk() const
Definition: Stub.cc:185
bool debugTracklet() const
Definition: Settings.h:192
std::vector< StubPairsMemory * > stubpairs_
int nbits() const
Definition: FPGAWord.h:25
const std::string & stubword() const
Definition: L1TStub.h:123
bool isPSmodule() const
Definition: Stub.h:71
bool extended() const
Definition: Settings.h:266
std::vector< AllStubsMemory * > outerallstubs_
std::vector< VMStubsTEMemory * > outervmstubs_
std::string const & getName() const
Definition: ProcessBase.h:22
constexpr int N_LAYER
Definition: Settings.h:25

Member Data Documentation

◆ count_

int trklet::TrackletProcessorDisplaced::count_
private

Definition at line 45 of file TrackletProcessorDisplaced.h.

Referenced by execute().

◆ disk1_

int trklet::TrackletProcessorDisplaced::disk1_
private

Definition at line 51 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ disk2_

int trklet::TrackletProcessorDisplaced::disk2_
private

Definition at line 52 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ disk3_

int trklet::TrackletProcessorDisplaced::disk3_
private

Definition at line 53 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ firstphibits_

int trklet::TrackletProcessorDisplaced::firstphibits_
private

Definition at line 55 of file TrackletProcessorDisplaced.h.

◆ iAllStub_

int trklet::TrackletProcessorDisplaced::iAllStub_
private

Definition at line 43 of file TrackletProcessorDisplaced.h.

◆ innerOverlapTable_

TrackletLUT trklet::TrackletProcessorDisplaced::innerOverlapTable_
private

Definition at line 63 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ innerTable_

TrackletLUT trklet::TrackletProcessorDisplaced::innerTable_
private

Definition at line 62 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ innerThirdTable_

TrackletLUT trklet::TrackletProcessorDisplaced::innerThirdTable_
private

Definition at line 64 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ innervmstubs_

std::vector<VMStubsTEMemory*> trklet::TrackletProcessorDisplaced::innervmstubs_
private

Definition at line 68 of file TrackletProcessorDisplaced.h.

Referenced by addInput(), execute(), and TrackletProcessorDisplaced().

◆ iTC_

int trklet::TrackletProcessorDisplaced::iTC_
private

Definition at line 42 of file TrackletProcessorDisplaced.h.

◆ layer1_

int trklet::TrackletProcessorDisplaced::layer1_
private

Definition at line 48 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ layer2_

int trklet::TrackletProcessorDisplaced::layer2_
private

Definition at line 49 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ layer3_

int trklet::TrackletProcessorDisplaced::layer3_
private

Definition at line 50 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ layerdisk_

unsigned int trklet::TrackletProcessorDisplaced::layerdisk_
private

Definition at line 46 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ maxStep_

unsigned int trklet::TrackletProcessorDisplaced::maxStep_
private

Definition at line 44 of file TrackletProcessorDisplaced.h.

◆ nbitsrfinebintable_

int trklet::TrackletProcessorDisplaced::nbitsrfinebintable_
private

Definition at line 60 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ nbitszfinebintable_

int trklet::TrackletProcessorDisplaced::nbitszfinebintable_
private

Definition at line 59 of file TrackletProcessorDisplaced.h.

Referenced by execute(), and TrackletProcessorDisplaced().

◆ outervmstubs_

std::vector<VMStubsTEMemory*> trklet::TrackletProcessorDisplaced::outervmstubs_
private

Definition at line 69 of file TrackletProcessorDisplaced.h.

Referenced by addInput(), execute(), and TrackletProcessorDisplaced().

◆ secondphibits_

int trklet::TrackletProcessorDisplaced::secondphibits_
private

Definition at line 56 of file TrackletProcessorDisplaced.h.

◆ spTable_

std::map<std::string, std::vector<std::map<std::string, unsigned> > > trklet::TrackletProcessorDisplaced::spTable_
private

Definition at line 74 of file TrackletProcessorDisplaced.h.

◆ stubpairs_

std::vector<StubPairsMemory*> trklet::TrackletProcessorDisplaced::stubpairs_
private

Definition at line 66 of file TrackletProcessorDisplaced.h.

Referenced by addInput(), execute(), and TrackletProcessorDisplaced().

◆ stubtriplets_

StubTripletsMemory* trklet::TrackletProcessorDisplaced::stubtriplets_
private

Definition at line 71 of file TrackletProcessorDisplaced.h.

◆ table_

std::vector<bool> trklet::TrackletProcessorDisplaced::table_
private

Definition at line 75 of file TrackletProcessorDisplaced.h.

◆ thirdphibits_

int trklet::TrackletProcessorDisplaced::thirdphibits_
private

Definition at line 57 of file TrackletProcessorDisplaced.h.

◆ tmpSPTable_

std::map<std::string, std::vector<std::vector<std::string> > > trklet::TrackletProcessorDisplaced::tmpSPTable_
private

Definition at line 73 of file TrackletProcessorDisplaced.h.