CMS 3D CMS Logo

Phase2L1TGMTStubProducer.cc
Go to the documentation of this file.
1 #include <memory>
4 
7 
10 
13 
18 //
19 // class declaration
20 //
21 
23 public:
25  ~Phase2L1TGMTStubProducer() override;
26 
27  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
28 
29 private:
30  void beginStream(edm::StreamID) override;
31  void produce(edm::Event&, const edm::EventSetup&) override;
32  void endStream() override;
33 
38 
42  int verbose_;
43 };
44 
46  : srcCSC_(
47  consumes<MuonDigiCollection<CSCDetId, CSCCorrelatedLCTDigi>>(iConfig.getParameter<edm::InputTag>("srcCSC"))),
48  srcDT_(consumes<L1Phase2MuDTPhContainer>(iConfig.getParameter<edm::InputTag>("srcDT"))),
49  srcDTTheta_(consumes<L1MuDTChambThContainer>(iConfig.getParameter<edm::InputTag>("srcDTTheta"))),
50  srcRPC_(consumes<RPCDigiCollection>(iConfig.getParameter<edm::InputTag>("srcRPC"))),
51  procEndcap_(new L1TPhase2GMTEndcapStubProcessor(iConfig.getParameter<edm::ParameterSet>("Endcap"))),
52  procBarrel_(new L1TPhase2GMTBarrelStubProcessor(iConfig.getParameter<edm::ParameterSet>("Barrel"))),
53  verbose_(iConfig.getParameter<int>("verbose")) {
54  produces<l1t::MuonStubCollection>();
55  edm::ConsumesCollector consumesColl(consumesCollector());
56  translator_ = new L1TMuon::GeometryTranslator(consumesColl);
57 }
58 
60  // do anything here that needs to be done at destruction time
61  // (e.g. close files, deallocate resources etc.)
62  if (procEndcap_ != nullptr)
63  delete procEndcap_;
64  if (procBarrel_ != nullptr)
65  delete procBarrel_;
66  if (translator_ != nullptr)
67  delete translator_;
68 }
69 
70 //
71 // member functions
72 //
73 
74 // ------------ method called to produce the data ------------
76  using namespace edm;
78 
80  iEvent.getByToken(srcCSC_, cscDigis);
81 
83  iEvent.getByToken(srcRPC_, rpcDigis);
84 
86  iEvent.getByToken(srcDT_, dtDigis);
87 
88  Handle<L1MuDTChambThContainer> dtThetaDigis;
89  iEvent.getByToken(srcDTTheta_, dtThetaDigis);
90 
91  //Generate a unique stub ID
93 
94  uint count0 = 0;
95  uint count1 = 0;
96  uint count2 = 0;
97  uint count3 = 0;
98  uint count4 = 0;
99 
100  l1t::MuonStubCollection stubsEndcap = procEndcap_->makeStubs(*cscDigis, *rpcDigis, translator_, iSetup);
101  for (auto& stub : stubsEndcap) {
102  if (stub.tfLayer() == 0) {
103  stub.setID(count0);
104  count0++;
105  } else if (stub.tfLayer() == 1) {
106  stub.setID(count1);
107  count1++;
108  } else if (stub.tfLayer() == 2) {
109  stub.setID(count2);
110  count2++;
111  } else if (stub.tfLayer() == 3) {
112  stub.setID(count3);
113  count3++;
114  } else {
115  stub.setID(count4);
116  count4++;
117  }
118  stubs.push_back(stub);
119  }
120  l1t::MuonStubCollection stubsBarrel = procBarrel_->makeStubs(dtDigis.product(), dtThetaDigis.product());
121  for (auto& stub : stubsBarrel) {
122  if (stub.tfLayer() == 0) {
123  stub.setID(count0);
124  count0++;
125  } else if (stub.tfLayer() == 1) {
126  stub.setID(count1);
127  count1++;
128  } else if (stub.tfLayer() == 2) {
129  stub.setID(count2);
130  count2++;
131  } else if (stub.tfLayer() == 3) {
132  stub.setID(count3);
133  count3++;
134  } else {
135  stub.setID(count4);
136  count4++;
137  }
138  stubs.push_back(stub);
139  }
140 
141  iEvent.put(std::make_unique<l1t::MuonStubCollection>(stubs));
142 }
143 
144 // ------------ method called once each stream before processing any runs, lumis or events ------------
146 
147 // ------------ method called once each stream after processing all runs, lumis and events ------------
149 
151  // gmtStubs
153  desc.add<int>("verbose", 0);
154  desc.add<edm::InputTag>("srcCSC", edm::InputTag("simCscTriggerPrimitiveDigis"));
155  desc.add<edm::InputTag>("srcDT", edm::InputTag("dtTriggerPhase2PrimitiveDigis"));
156  desc.add<edm::InputTag>("srcDTTheta", edm::InputTag("simDtTriggerPrimitiveDigis"));
157  desc.add<edm::InputTag>("srcRPC", edm::InputTag("simMuonRPCDigis"));
158  {
160  psd0.add<unsigned int>("verbose", 0);
161  psd0.add<int>("minBX", 0);
162  psd0.add<int>("maxBX", 0);
163  psd0.add<double>("coord1LSB", 0.02453124992);
164  psd0.add<double>("eta1LSB", 0.024586688);
165  psd0.add<double>("coord2LSB", 0.02453124992);
166  psd0.add<double>("eta2LSB", 0.024586688);
167  psd0.add<double>("phiMatch", 0.05);
168  psd0.add<double>("etaMatch", 0.1);
169  desc.add<edm::ParameterSetDescription>("Endcap", psd0);
170  }
171  {
173  psd0.add<int>("verbose", 0);
174  psd0.add<int>("minPhiQuality", 0);
175  psd0.add<int>("minThetaQuality", 0);
176  psd0.add<int>("minBX", 0);
177  psd0.add<int>("maxBX", 0);
178  psd0.add<double>("phiLSB", 0.02453124992);
179  psd0.add<int>("phiBDivider", 16);
180  psd0.add<double>("etaLSB", 0.024586688);
181  psd0.add<std::vector<int>>(
182  "eta_1",
183  {
184  -46, -45, -43, -41, -39, -37, -35, -30, -28, -26, -23, -20, -18, -15, -9, -6, -3, -1,
185  1, 3, 6, 9, 15, 18, 20, 23, 26, 28, 30, 35, 37, 39, 41, 43, 45, 1503,
186  });
187  psd0.add<std::vector<int>>(
188  "eta_2",
189  {
190  -41, -39, -38, -36, -34, -32, -30, -26, -24, -22, -20, -18, -15, -13, -8, -5, -3, -1,
191  1, 3, 5, 8, 13, 15, 18, 20, 22, 24, 26, 30, 32, 34, 36, 38, 39, 1334,
192  });
193  psd0.add<std::vector<int>>(
194  "eta_3",
195  {
196  -35, -34, -32, -31, -29, -27, -26, -22, -20, -19, -17, -15, -13, -11, -6, -4, -2, -1,
197  1, 2, 4, 6, 11, 13, 15, 17, 19, 20, 22, 26, 27, 29, 31, 32, 34, 1148,
198  });
199  psd0.add<std::vector<int>>("coarseEta_1",
200  {
201  0,
202  23,
203  41,
204  });
205  psd0.add<std::vector<int>>("coarseEta_2",
206  {
207  0,
208  20,
209  36,
210  });
211  psd0.add<std::vector<int>>("coarseEta_3",
212  {
213  0,
214  17,
215  31,
216  });
217  psd0.add<std::vector<int>>("coarseEta_4",
218  {
219  0,
220  14,
221  27,
222  });
223  psd0.add<std::vector<int>>("phiOffset",
224  {
225  1,
226  0,
227  0,
228  0,
229  });
230  desc.add<edm::ParameterSetDescription>("Barrel", psd0);
231  }
232  descriptions.add("gmtStubs", desc);
233 }
234 
235 //define this as a plug-in
Phase2L1TGMTStubProducer(const edm::ParameterSet &)
edm::EDGetTokenT< RPCDigiCollection > srcRPC_
L1TMuon::GeometryTranslator * translator_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > > srcCSC_
T const * product() const
Definition: Handle.h:70
L1TPhase2GMTEndcapStubProcessor * procEndcap_
l1t::MuonStubCollection makeStubs(const MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > &csc, const MuonDigiCollection< RPCDetId, RPCDigi > &rpc, const L1TMuon::GeometryTranslator *t, const edm::EventSetup &iSetup)
int iEvent
Definition: GenABIO.cc:224
L1TMuon::GeometryTranslator GeometryTranslator
Definition: Common.h:30
void checkAndUpdateGeometry(const edm::EventSetup &)
void beginStream(edm::StreamID) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< MuonStub > MuonStubCollection
Definition: MuonStub.h:40
void produce(edm::Event &, const edm::EventSetup &) override
l1t::MuonStubCollection makeStubs(const L1Phase2MuDTPhContainer *, const L1MuDTChambThContainer *)
L1TPhase2GMTBarrelStubProcessor * procBarrel_
edm::EDGetTokenT< L1MuDTChambThContainer > srcDTTheta_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< L1Phase2MuDTPhContainer > srcDT_
HLT enums.
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...