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;
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>("kmtf");
55  produces<l1t::MuonStubCollection>("tps");
56  edm::ConsumesCollector consumesColl(consumesCollector());
57  translator_ = new L1TMuon::GeometryTranslator(consumesColl);
58 }
59 
61  // do anything here that needs to be done at destruction time
62  // (e.g. close files, deallocate resources etc.)
63  if (procEndcap_ != nullptr)
64  delete procEndcap_;
65  if (procBarrel_ != nullptr)
66  delete procBarrel_;
67  if (translator_ != nullptr)
68  delete translator_;
69 }
70 
71 //
72 // member functions
73 //
74 
77  stub.phiRegion(),
78  stub.depthRegion(),
79  stub.tfLayer(),
80  stub.coord1() / 256, //for track matching was 1024
81  stub.coord2() / 256, //for track matching was 1024
82  stub.id(),
83  stub.bxNum(),
84  0x3, //for track matching
85  stub.eta1(),
86  stub.eta2(),
87  stub.etaQuality(),
88  stub.type());
89  hybrid.setOfflineQuantities(stub.offline_coord1(), stub.offline_coord2(), stub.offline_eta1(), stub.offline_eta2());
90  return hybrid;
91 }
92 
93 // ------------ method called to produce the data ------------
95  using namespace edm;
97 
99  iEvent.getByToken(srcCSC_, cscDigis);
100 
101  Handle<RPCDigiCollection> rpcDigis;
102  iEvent.getByToken(srcRPC_, rpcDigis);
103 
105  iEvent.getByToken(srcDT_, dtDigis);
106 
107  Handle<L1MuDTChambThContainer> dtThetaDigis;
108  iEvent.getByToken(srcDTTheta_, dtThetaDigis);
109 
110  //Generate a unique stub ID
112  l1t::MuonStubCollection stubsKMTF;
113 
114  l1t::MuonStubCollection stubsEndcap = procEndcap_->makeStubs(*cscDigis, *rpcDigis, translator_, iSetup);
115  for (auto& stub : stubsEndcap) {
116  stubs.push_back(stub);
117  }
118  l1t::MuonStubCollection stubsBarrel = procBarrel_->makeStubs(dtDigis.product(), dtThetaDigis.product());
119  for (auto& stub : stubsBarrel) {
120  //convert to Hybrid
121  stubs.push_back(convertToHybrid(stub));
122  stubsKMTF.push_back(stub);
123  }
124 
125  iEvent.put(std::make_unique<l1t::MuonStubCollection>(stubs), "tps");
126  iEvent.put(std::make_unique<l1t::MuonStubCollection>(stubsKMTF), "kmtf");
127 }
128 
129 // ------------ method called once each stream before processing any runs, lumis or events ------------
131 
132 // ------------ method called once each stream after processing all runs, lumis and events ------------
134 
136  // gmtStubs
138  desc.add<int>("verbose", 0);
139  desc.add<edm::InputTag>("srcCSC", edm::InputTag("simCscTriggerPrimitiveDigis"));
140  desc.add<edm::InputTag>("srcDT", edm::InputTag("dtTriggerPhase2PrimitiveDigis"));
141  desc.add<edm::InputTag>("srcDTTheta", edm::InputTag("simDtTriggerPrimitiveDigis"));
142  desc.add<edm::InputTag>("srcRPC", edm::InputTag("simMuonRPCDigis"));
143  {
145  psd0.add<unsigned int>("verbose", 0);
146  psd0.add<int>("minBX", 0);
147  psd0.add<int>("maxBX", 0);
148  psd0.add<double>("coord1LSB", 0.02453124992);
149  psd0.add<double>("eta1LSB", 0.024586688);
150  psd0.add<double>("coord2LSB", 0.02453124992);
151  psd0.add<double>("eta2LSB", 0.024586688);
152  psd0.add<double>("phiMatch", 0.05);
153  psd0.add<double>("etaMatch", 0.1);
154  desc.add<edm::ParameterSetDescription>("Endcap", psd0);
155  }
156  {
158  psd0.add<int>("verbose", 0);
159  psd0.add<int>("minPhiQuality", 0);
160  psd0.add<int>("minThetaQuality", 0);
161  psd0.add<int>("minBX", 0);
162  psd0.add<int>("maxBX", 0);
163  psd0.add<double>("phiLSB", 0.02453124992);
164  psd0.add<int>("phiBDivider", 16);
165  psd0.add<double>("etaLSB", 0.024586688);
166  psd0.add<std::vector<int>>(
167  "eta_1",
168  {
169  -46, -45, -43, -41, -39, -37, -35, -30, -28, -26, -23, -20, -18, -15, -9, -6, -3, -1,
170  1, 3, 6, 9, 15, 18, 20, 23, 26, 28, 30, 35, 37, 39, 41, 43, 45, 1503,
171  });
172  psd0.add<std::vector<int>>(
173  "eta_2",
174  {
175  -41, -39, -38, -36, -34, -32, -30, -26, -24, -22, -20, -18, -15, -13, -8, -5, -3, -1,
176  1, 3, 5, 8, 13, 15, 18, 20, 22, 24, 26, 30, 32, 34, 36, 38, 39, 1334,
177  });
178  psd0.add<std::vector<int>>(
179  "eta_3",
180  {
181  -35, -34, -32, -31, -29, -27, -26, -22, -20, -19, -17, -15, -13, -11, -6, -4, -2, -1,
182  1, 2, 4, 6, 11, 13, 15, 17, 19, 20, 22, 26, 27, 29, 31, 32, 34, 1148,
183  });
184  psd0.add<std::vector<int>>("coarseEta_1",
185  {
186  0,
187  23,
188  41,
189  });
190  psd0.add<std::vector<int>>("coarseEta_2",
191  {
192  0,
193  20,
194  36,
195  });
196  psd0.add<std::vector<int>>("coarseEta_3",
197  {
198  0,
199  17,
200  31,
201  });
202  psd0.add<std::vector<int>>("coarseEta_4",
203  {
204  0,
205  14,
206  27,
207  });
208  psd0.add<std::vector<int>>("phiOffset",
209  {
210  1,
211  0,
212  0,
213  0,
214  });
215  desc.add<edm::ParameterSetDescription>("Barrel", psd0);
216  }
217  descriptions.add("gmtStubs", desc);
218 }
219 
220 //define this as a plug-in
double offline_eta1() const
Definition: MuonStub.h:120
Phase2L1TGMTStubProducer(const edm::ParameterSet &)
edm::EDGetTokenT< RPCDigiCollection > srcRPC_
double offline_eta2() const
Definition: MuonStub.h:121
L1TMuon::GeometryTranslator * translator_
double offline_coord1() const
Definition: MuonStub.h:118
edm::EDGetTokenT< MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > > srcCSC_
T const * product() const
Definition: Handle.h:70
int coord1() const
return phi
Definition: MuonStub.h:75
int etaRegion() const
return wheel
Definition: MuonStub.h:67
int id() const
return tag (second TS tag)
Definition: MuonStub.h:81
int depthRegion() const
return station
Definition: MuonStub.h:71
L1TPhase2GMTEndcapStubProcessor * procEndcap_
int coord2() const
return phib
Definition: MuonStub.h:77
l1t::MuonStubCollection makeStubs(const MuonDigiCollection< CSCDetId, CSCCorrelatedLCTDigi > &csc, const MuonDigiCollection< RPCDetId, RPCDigi > &rpc, const L1TMuon::GeometryTranslator *t, const edm::EventSetup &iSetup)
l1t::MuonStub convertToHybrid(const l1t::MuonStub &stub)
int iEvent
Definition: GenABIO.cc:224
L1TMuon::GeometryTranslator GeometryTranslator
Definition: Common.h:30
void checkAndUpdateGeometry(const edm::EventSetup &)
int eta1() const
return eta
Definition: MuonStub.h:108
void beginStream(edm::StreamID) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int etaQuality() const
return first eta quality
Definition: MuonStub.h:111
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_
int eta2() const
Definition: MuonStub.h:109
edm::EDGetTokenT< L1MuDTChambThContainer > srcDTTheta_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
int phiRegion() const
return sector
Definition: MuonStub.h:69
double offline_coord2() const
Definition: MuonStub.h:119
int type() const
Definition: MuonStub.h:113
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< L1Phase2MuDTPhContainer > srcDT_
HLT enums.
uint tfLayer() const
return track finder layer
Definition: MuonStub.h:73
int bxNum() const
return bunch crossing
Definition: MuonStub.h:105
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...