File indexing completed on 2024-04-06 12:21:56
0001 #ifndef L1Trigger_TrackFindingTracklet_interface_VMStubsMEMemory_h
0002 #define L1Trigger_TrackFindingTracklet_interface_VMStubsMEMemory_h
0003
0004 #include "L1Trigger/TrackFindingTracklet/interface/MemoryBase.h"
0005 #include "L1Trigger/TrackFindingTracklet/interface/VMStubME.h"
0006
0007 #include <string>
0008 #include <vector>
0009
0010 namespace trklet {
0011
0012 class Settings;
0013 class Stub;
0014 class L1TStub;
0015
0016 class VMStubsMEMemory : public MemoryBase {
0017 public:
0018 VMStubsMEMemory(std::string name, Settings const& settings);
0019
0020 ~VMStubsMEMemory() override = default;
0021
0022 void addStub(VMStubME stub, unsigned int bin) {
0023 if (binnedstubs_[bin].size() < settings_.maxStubsPerBin()) {
0024 binnedstubs_[bin].push_back(stub);
0025 }
0026 }
0027
0028 void resize(int nbins) { binnedstubs_.resize(nbins); }
0029
0030 unsigned int nStubsBin(unsigned int bin) const {
0031 assert(bin < binnedstubs_.size());
0032 return binnedstubs_[bin].size();
0033 }
0034
0035 const VMStubME& getVMStubMEBin(unsigned int bin, unsigned int i) const {
0036 assert(bin < binnedstubs_.size());
0037 assert(i < binnedstubs_[bin].size());
0038 return binnedstubs_[bin][i];
0039 }
0040
0041 const Stub* getStubBin(unsigned int bin, unsigned int i) const {
0042 assert(bin < binnedstubs_.size());
0043 assert(i < binnedstubs_[bin].size());
0044 return binnedstubs_[bin][i].stub();
0045 }
0046
0047 void clean() override {
0048 for (auto& binnedstub : binnedstubs_) {
0049 binnedstub.clear();
0050 }
0051 }
0052
0053 void writeStubs(bool first, unsigned int iSector);
0054
0055 private:
0056 std::vector<std::vector<VMStubME> > binnedstubs_;
0057 };
0058
0059 };
0060 #endif