CMS 3D CMS Logo

VMStubsMEMemory.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_VMStubsMEMemory_h
2 #define L1Trigger_TrackFindingTracklet_interface_VMStubsMEMemory_h
3 
6 
7 #include <string>
8 #include <vector>
9 
10 namespace trklet {
11 
12  class Settings;
13  class Stub;
14  class L1TStub;
15 
16  class VMStubsMEMemory : public MemoryBase {
17  public:
18  VMStubsMEMemory(std::string name, Settings const& settings);
19 
20  ~VMStubsMEMemory() override = default;
21 
22  void addStub(VMStubME stub, unsigned int bin) {
23  if (binnedstubs_[bin].size() < settings_.maxStubsPerBin()) {
24  binnedstubs_[bin].push_back(stub);
25  }
26  }
27 
28  void resize(int nbins) { binnedstubs_.resize(nbins); }
29 
30  unsigned int nStubsBin(unsigned int bin) const {
31  assert(bin < binnedstubs_.size());
32  return binnedstubs_[bin].size();
33  }
34 
35  const VMStubME& getVMStubMEBin(unsigned int bin, unsigned int i) const {
36  assert(bin < binnedstubs_.size());
37  assert(i < binnedstubs_[bin].size());
38  return binnedstubs_[bin][i];
39  }
40 
41  const Stub* getStubBin(unsigned int bin, unsigned int i) const {
42  assert(bin < binnedstubs_.size());
43  assert(i < binnedstubs_[bin].size());
44  return binnedstubs_[bin][i].stub();
45  }
46 
47  void clean() override {
48  for (auto& binnedstub : binnedstubs_) {
49  binnedstub.clear();
50  }
51  }
52 
53  void writeStubs(bool first, unsigned int iSector);
54 
55  private:
56  std::vector<std::vector<VMStubME> > binnedstubs_;
57  };
58 
59 }; // namespace trklet
60 #endif
std::vector< std::vector< VMStubME > > binnedstubs_
void addStub(VMStubME stub, unsigned int bin)
assert(be >=bs)
void writeStubs(bool first, unsigned int iSector)
Settings const & settings_
Definition: MemoryBase.h:53
const VMStubME & getVMStubMEBin(unsigned int bin, unsigned int i) const
~VMStubsMEMemory() override=default
VMStubsMEMemory(std::string name, Settings const &settings)
unsigned int maxStubsPerBin() const
Definition: Settings.h:234
unsigned int nStubsBin(unsigned int bin) const
void resize(int nbins)
const Stub * getStubBin(unsigned int bin, unsigned int i) const