File indexing completed on 2024-04-06 12:21:48
0001 #ifndef L1Trigger_TrackFindingTMTT_HTcell_h
0002 #define L1Trigger_TrackFindingTMTT_HTcell_h
0003
0004 #include "L1Trigger/TrackFindingTMTT/interface/Utility.h"
0005 #include "L1Trigger/TrackFindingTMTT/interface/Stub.h"
0006 #include "FWCore/Utilities/interface/Exception.h"
0007
0008 #include <vector>
0009 #include <map>
0010 #include <algorithm>
0011 #include <utility>
0012
0013
0014
0015 namespace tmtt {
0016
0017 class Settings;
0018 class Stub;
0019
0020 class HTcell {
0021 public:
0022
0023
0024
0025
0026 HTcell(const Settings* settings,
0027 unsigned int iPhiSec,
0028 unsigned int iEtaReg,
0029 float etaMinSector,
0030 float etaMaxSector,
0031 float qOverPt,
0032 unsigned int ibin_qOverPt,
0033 bool mergedCell,
0034 bool miniHTcell = false);
0035
0036
0037 void store(Stub* stub) { vStubs_.push_back(stub); }
0038
0039
0040 void store(Stub* stub, const std::vector<bool>& inSubSecs) {
0041 this->store(stub);
0042 subSectors_[stub] = inSubSecs;
0043 if (inSubSecs.size() != numSubSecs_)
0044 throw cms::Exception("LogicError") << "HTcell: Wrong number of subsectors!";
0045 }
0046
0047
0048 void end();
0049
0050
0051
0052
0053 bool mergedCell() const { return mergedCell_; }
0054
0055
0056
0057
0058
0059
0060 const std::vector<Stub*>& stubs() const { return vFilteredStubs_; }
0061
0062
0063 bool stubInCell(const Stub* stub) const {
0064 return (std::count(vFilteredStubs_.begin(), vFilteredStubs_.end(), stub) > 0);
0065 }
0066
0067
0068 bool stubStoredInCell(const Stub* stub) const { return (std::count(vStubs_.begin(), vStubs_.end(), stub) > 0); }
0069
0070
0071
0072 unsigned int numStubs() const { return vFilteredStubs_.size(); }
0073
0074 unsigned int numLayers() const { return numFilteredLayersInCell_; }
0075
0076 unsigned int numLayersSubSec() const { return numFilteredLayersInCellBestSubSec_; }
0077
0078
0079 unsigned int numUnfilteredStubs() const { return vStubs_.size(); }
0080
0081
0082
0083
0084
0085
0086 bool trackCandFound() const {
0087 return (numFilteredLayersInCellBestSubSec_ >=
0088 Utility::numLayerCut(Utility::AlgoStep::HT, settings_, iPhiSec_, iEtaReg_, std::abs(qOverPtCell_)));
0089 }
0090
0091
0092
0093 void disableBendFilter() { useBendFilter_ = false; }
0094
0095 private:
0096
0097 unsigned int calcNumFilteredLayers() const { return Utility::countLayers(settings_, vFilteredStubs_); }
0098
0099
0100
0101 unsigned int calcNumFilteredLayers(unsigned int iSubSec) const;
0102
0103
0104 float dphi(float rad) const { return (invPtToDphi_ * rad * qOverPtCell_); }
0105
0106
0107 std::vector<Stub*> bendFilter(const std::vector<Stub*>& stubs) const;
0108
0109
0110
0111 std::vector<Stub*> maxStubCountFilter(const std::vector<Stub*>& stubs) const;
0112
0113 private:
0114
0115
0116 const Settings* settings_;
0117
0118 unsigned int iPhiSec_;
0119 unsigned int iEtaReg_;
0120
0121 float etaMinSector_;
0122 float etaMaxSector_;
0123
0124 float qOverPtCell_;
0125
0126
0127 unsigned int ibin_qOverPt_;
0128
0129 bool mergedCell_;
0130
0131
0132 bool miniHTcell_;
0133
0134 float invPtToDphi_;
0135
0136
0137 bool useBendFilter_;
0138
0139 unsigned int maxStubsInCell_;
0140
0141
0142 unsigned int numSubSecs_;
0143
0144
0145
0146 std::vector<Stub*> vStubs_;
0147 std::vector<Stub*> vFilteredStubs_;
0148
0149 unsigned int numFilteredLayersInCell_;
0150 unsigned int numFilteredLayersInCellBestSubSec_;
0151 std::map<const Stub*, std::vector<bool>> subSectors_;
0152 };
0153
0154 }
0155 #endif