CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TTStubBuilder.h
Go to the documentation of this file.
1 
17 #ifndef L1_TRACK_TRIGGER_STUB_BUILDER_H
18 #define L1_TRACK_TRIGGER_STUB_BUILDER_H
19 
28 
31 
34 
36 
37 #include <memory>
38 #include <map>
39 #include <vector>
40 
43 
44 template <typename T>
45 class TTStubBuilder : public edm::one::EDProducer<edm::one::WatchRuns> {
46 public:
48  explicit TTStubBuilder(const edm::ParameterSet& iConfig);
49 
51  ~TTStubBuilder() override;
52 
53  // TTStub bendOffset has this added to it, if stub truncated by FE, to indicate reason.
54  enum FEreject { CBCFailOffset = 500, CICFailOffset = 1000 };
55 
56 private:
64 
66  void beginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
67  void endRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
68  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
69 
72  static bool SortStubBendPairs(const std::pair<unsigned int, double>& left,
73  const std::pair<unsigned int, double>& right);
74  static bool SortStubsBend(const TTStub<T>& left, const TTStub<T>& right);
75 
77  template <typename TT>
78  void fill(edmNew::DetSetVector<TT>& outputEP, const DetId& detId, const std::vector<TT>& inputVec) const {
80  typename edmNew::DetSetVector<TT>::FastFiller outputFiller(outputEP, detId);
81  outputFiller.resize(inputVec.size());
82  std::copy(inputVec.begin(), inputVec.end(), outputFiller.begin());
83  }
84 
89 
91 
92  bool applyFE; // Turn ON (true) or OFF (false) the dynamic FE stub truncation.
93 
94  // Tuncation cut-offs
95  unsigned int maxStubs_2S; // CBC chip limit (in stubs/chip/BX)
96  unsigned int maxStubs_PS; // MPA chip limit (in stubs/chip/2BX)
97  unsigned int maxStubs_2S_CIC_5; // 2S 5G chip limit (in stubs/CIC/8BX)
98  unsigned int maxStubs_PS_CIC_5; // PS 5G chip limit (in stubs/CIC/8BX)
99  unsigned int maxStubs_PS_CIC_10; // PS 10G chip limit (in stubs/CIC/8BX)
100 
101  // Which modules read by 10Gb/s links instead of 5Gb/s
102  // (Unlike TkLayout, CMSSW starts ring count at 1 for the innermost physically present ring in each disk)
103  // sviret comment (221217): this info should be made available in conddb at some point
104  // (not in TrackerTopology, as modules may switch between 10G & 5G transmission schems during running?)
105  unsigned int high_rate_max_ring[5]; //Outermost ring with 10Gb/s link vs disk.
106  unsigned int high_rate_max_layer; // Outermost barrel layer with 10Gb/s link.
107 
109  int ievt;
110  std::unordered_map<int, std::vector<TTStub<Ref_Phase2TrackerDigi_>>> moduleStubs_CIC;
111  std::unordered_map<int, int> moduleStubs_MPA;
112  std::unordered_map<int, int> moduleStubs_CBC;
113 
114 };
115 
123 template <typename T>
126  clustersToken = consumes<edmNew::DetSetVector<TTCluster<T>>>(iConfig.getParameter<edm::InputTag>("TTClusters"));
127  tTopoToken = esConsumes<TrackerTopology, TrackerTopologyRcd>();
128  tGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
129  ttStubToken = esConsumes<TTStubAlgorithm<T>, TTStubAlgorithmRecord, edm::Transition::BeginRun>();
130  ForbidMultipleStubs = iConfig.getParameter<bool>("OnlyOnePerInputCluster");
131  applyFE = iConfig.getParameter<bool>("FEineffs");
132  maxStubs_2S = iConfig.getParameter<uint32_t>("CBClimit");
133  maxStubs_PS = iConfig.getParameter<uint32_t>("MPAlimit");
134  maxStubs_2S_CIC_5 = iConfig.getParameter<uint32_t>("SS5GCIClimit");
135  maxStubs_PS_CIC_5 = iConfig.getParameter<uint32_t>("PS5GCIClimit");
136  maxStubs_PS_CIC_10 = iConfig.getParameter<uint32_t>("PS10GCIClimit");
137  unsigned int tedd1_max10Gring = iConfig.getParameter<uint32_t>("TEDD1Max10GRing");
138  unsigned int tedd2_max10Gring = iConfig.getParameter<uint32_t>("TEDD2Max10GRing");
139  high_rate_max_layer = iConfig.getParameter<uint32_t>("BarrelMax10GLay");
140  // Stubs passing & failing FE chip cuts, plus associated clusters.
141  produces<edmNew::DetSetVector<TTCluster<T>>>("ClusterAccepted");
142  produces<edmNew::DetSetVector<TTCluster<T>>>("ClusterRejected");
143  produces<edmNew::DetSetVector<TTStub<T>>>("StubAccepted");
144  produces<edmNew::DetSetVector<TTStub<T>>>("StubRejected");
145 
146  high_rate_max_ring[0] = tedd1_max10Gring;
147  high_rate_max_ring[1] = tedd1_max10Gring;
148  high_rate_max_ring[2] = tedd2_max10Gring;
149  high_rate_max_ring[3] = tedd2_max10Gring;
150  high_rate_max_ring[4] = tedd2_max10Gring;
151 }
152 
154 template <typename T>
156 
158 template <typename T>
161  theStubFindingAlgoHandle = iSetup.getHandle(ttStubToken);
162  ievt = 0;
163  moduleStubs_CIC.clear();
164  moduleStubs_MPA.clear();
165  moduleStubs_CBC.clear();
166 }
167 
169 template <typename T>
170 void TTStubBuilder<T>::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {}
171 
173 template <typename T>
174 bool TTStubBuilder<T>::SortStubBendPairs(const std::pair<unsigned int, double>& left,
175  const std::pair<unsigned int, double>& right) {
176  return std::abs(left.second) < std::abs(right.second);
177 }
178 
180 template <typename T>
181 bool TTStubBuilder<T>::SortStubsBend(const TTStub<T>& left, const TTStub<T>& right) {
182  return std::abs(left.bendFE()) < std::abs(right.bendFE());
183 }
184 
186 template <>
188 
189 #endif
unsigned int maxStubs_PS_CIC_10
Definition: TTStubBuilder.h:99
unsigned int high_rate_max_layer
edm::ESHandle< TTStubAlgorithm< T > > theStubFindingAlgoHandle
Data members.
Definition: TTStubBuilder.h:58
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
void updateStubs(const edm::OrphanHandle< edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ >>> &clusterHandle, const edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ >> &inputEDstubs, edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ >> &outputEDstubs) const
Update output stubs with Refs to cluster collection that is associated to stubs.
unsigned int high_rate_max_ring[5]
~TTStubBuilder() override
Destructor;.
bool ForbidMultipleStubs
Definition: TTStubBuilder.h:63
static bool SortStubBendPairs(const std::pair< unsigned int, double > &left, const std::pair< unsigned int, double > &right)
Sort routine for stub ordering.
int ievt
Temporary storage for stubs over several events for truncation use.
static bool SortStubsBend(const TTStub< T > &left, const TTStub< T > &right)
Analogous sorting routine directly from stubs.
unsigned int maxStubs_2S_CIC_5
Definition: TTStubBuilder.h:97
int iEvent
Definition: GenABIO.cc:224
unsigned int maxStubs_2S
Definition: TTStubBuilder.h:95
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< edmNew::DetSetVector< TTCluster< T > > > clustersToken
Definition: TTStubBuilder.h:59
Class to store the TTStubAlgorithm used in TTStubBuilder.
Class to store the L1 Track Trigger stubs.
Definition: TTStub.h:22
std::unordered_map< int, int > moduleStubs_MPA
unsigned int maxStubs_PS
Definition: TTStubBuilder.h:96
std::unordered_map< int, int > moduleStubs_CBC
TTStubBuilder(const edm::ParameterSet &iConfig)
Constructor.
Definition: DetId.h:17
void fill(edmNew::DetSetVector< TT > &outputEP, const DetId &detId, const std::vector< TT > &inputVec) const
Fill output cluster &amp; stub collections.
Definition: TTStubBuilder.h:78
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
double bendFE() const
BendFE(): In FULL-STRIP units from FE! Rename of getTriggerBend()
Definition: TTStub.h:203
unsigned int maxStubs_PS_CIC_5
Definition: TTStubBuilder.h:98
std::unordered_map< int, std::vector< TTStub< Ref_Phase2TrackerDigi_ > > > moduleStubs_CIC
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
Definition: TTStubBuilder.h:60
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
bool applyFE
FE truncation.
Definition: TTStubBuilder.h:92
edm::ESGetToken< TTStubAlgorithm< T >, TTStubAlgorithmRecord > ttStubToken
Definition: TTStubBuilder.h:62
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken
Definition: TTStubBuilder.h:61
Definition: Run.h:45
void endRun(const edm::Run &run, const edm::EventSetup &iSetup) override
End run.
Plugin to load the Stub finding algorithm and produce the collection of Stubs that goes in the event ...
Definition: TTStubBuilder.h:45
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
Mandatory methods.