CMS 3D CMS Logo

CSCTriggerPrimitivesProducer.cc
Go to the documentation of this file.
1 
33 
56 
57 // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
59 public:
62 
63  void produce(edm::Event&, const edm::EventSetup&) override;
64 
65 private:
66  // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
67  std::unique_ptr<CSCTriggerPrimitivesBuilder> builder_;
68 
69  // input tags for input collections
73 
74  // tokens
85 
86  std::unique_ptr<CSCBadChambers const> dummyBadChambers_;
87  // switch to force the use of parameters from config file rather then from DB
89 
90  // switch to for enabling checking against the list of bad chambers
92 
93  // Write out pre-triggers
96 
97  // write out showrs
99 
100  // switches to enable the Run-3 pattern finding
101  bool runCCLUT_; // 'OR' of the two options below
102  bool runCCLUT_TMB_; // ME1/2, ME1/3, ME2/2, ME3/2, ME4/2
103  bool runCCLUT_OTMB_; // ME1/1, ME2/1, ME3/1, ME4/1
104 
105  bool runILT_; // // 'OR' of the two options below
108 };
109 
111  // if false, parameters will be read in from DB using EventSetup mechanism
112  // else will use all parameters from the config file
113  debugParameters_ = conf.getParameter<bool>("debugParameters");
114 
115  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
116  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
117  gemPadDigiClusterProducer_ = conf.getParameter<edm::InputTag>("GEMPadDigiClusterProducer");
118 
119  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
120  if (not checkBadChambers_) {
121  dummyBadChambers_ = std::make_unique<CSCBadChambers>();
122  } else {
123  pBadChambersToken_ = esConsumes<CSCBadChambers, CSCBadChambersRcd>();
124  }
125 
126  keepCLCTPreTriggers_ = conf.getParameter<bool>("keepCLCTPreTriggers");
127  keepALCTPreTriggers_ = conf.getParameter<bool>("keepALCTPreTriggers");
128  keepShowers_ = conf.getParameter<bool>("keepShowers");
129 
130  // check whether you need to run the integrated local triggers
131  const edm::ParameterSet& commonParam = conf.getParameter<edm::ParameterSet>("commonParam");
132  runCCLUT_TMB_ = commonParam.getParameter<bool>("runCCLUT_TMB");
133  runCCLUT_OTMB_ = commonParam.getParameter<bool>("runCCLUT_OTMB");
135 
136  runME11ILT_ = commonParam.getParameter<bool>("runME11ILT");
137  runME21ILT_ = commonParam.getParameter<bool>("runME21ILT");
139 
140  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
141  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
142  if (runILT_) {
143  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
144  gemToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
145  }
146 
147  cscToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
148  // consume lookup tables only when flags are set
149  if (runCCLUT_)
150  pLookupTableCCLUTToken_ = esConsumes<CSCL1TPLookupTableCCLUT, CSCL1TPLookupTableCCLUTRcd>();
151  if (runME11ILT_)
152  pLookupTableME11ILTToken_ = esConsumes<CSCL1TPLookupTableME11ILT, CSCL1TPLookupTableME11ILTRcd>();
153  if (runME21ILT_)
154  pLookupTableME21ILTToken_ = esConsumes<CSCL1TPLookupTableME21ILT, CSCL1TPLookupTableME21ILTRcd>();
155  if (not debugParameters_)
156  confToken_ = esConsumes<CSCDBL1TPParameters, CSCDBL1TPParametersRcd>();
157 
158  // register what this produces
159  produces<CSCALCTDigiCollection>();
160  produces<CSCCLCTDigiCollection>();
161  produces<CSCCLCTPreTriggerCollection>();
162  if (keepCLCTPreTriggers_) {
163  produces<CSCCLCTPreTriggerDigiCollection>();
164  }
165  if (keepALCTPreTriggers_) {
166  produces<CSCALCTPreTriggerDigiCollection>();
167  }
168  produces<CSCCorrelatedLCTDigiCollection>();
169  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
170  if (keepShowers_) {
171  produces<CSCShowerDigiCollection>();
172  produces<CSCShowerDigiCollection>("Anode");
173  produces<CSCShowerDigiCollection>("Cathode");
174  }
175  if (runILT_) {
176  produces<GEMCoPadDigiCollection>();
177  }
178 
179  builder_ = std::make_unique<CSCTriggerPrimitivesBuilder>(conf);
180 }
181 
183 
185  auto* builder = builder_.get();
186 
187  // get the gem geometry if it's there
188  GEMGeometry const* gemGeometry = nullptr;
189  if (runILT_) {
190  edm::ESHandle<GEMGeometry> h_gem = setup.getHandle(gemToken_);
191  if (h_gem.isValid()) {
192  gemGeometry = &*h_gem;
193  } else {
194  edm::LogWarning("CSCTriggerPrimitivesProducer|NoGEMGeometry")
195  << "GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
196  }
197  }
198 
199  CSCL1TPLookupTableCCLUT const* cclut = nullptr;
200  if (runCCLUT_) {
202  if (conf.product() == nullptr) {
203  edm::LogError("CSCTriggerPrimitivesProducer")
204  << "Failed to find a CSCL1TPLookupTableCCLUTRcd in EventSetup with runCCLUT_ on";
205  return;
206  }
207  cclut = conf.product();
208  }
209 
210  CSCL1TPLookupTableME11ILT const* me11ilt = nullptr;
211  if (runME11ILT_) {
213  if (conf.product() == nullptr) {
214  edm::LogError("CSCTriggerPrimitivesProducer")
215  << "Failed to find a CSCL1TPLookupTableME11ILTRcd in EventSetup with runME11ILT_ on";
216  return;
217  }
218  me11ilt = conf.product();
219  }
220 
221  CSCL1TPLookupTableME21ILT const* me21ilt = nullptr;
222  if (runME21ILT_) {
224  if (conf.product() == nullptr) {
225  edm::LogError("CSCTriggerPrimitivesProducer")
226  << "Failed to find a CSCL1TPLookupTableME21ILTRcd in EventSetup with runME21ILT_ on";
227  return;
228  }
229  me21ilt = conf.product();
230  }
231 
232  // If !debugParameters then get config parameters using EventSetup mechanism.
233  // This must be done in produce() for every event and not in beginJob()
234  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
235  CSCDBL1TPParameters const* parameters = nullptr;
236  if (!debugParameters_) {
238  if (conf.product() == nullptr) {
239  edm::LogError("CSCTriggerPrimitivesProducer|ConfigError")
240  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
241  << "+++ Cannot continue emulation without these parameters +++\n";
242  return;
243  }
244  parameters = conf.product();
245  }
246 
248  cclut, me11ilt, me21ilt, &setup.getData(cscToken_), gemGeometry, parameters};
249 
250  // Get the collections of comparator & wire digis from event.
253  ev.getByToken(comp_token_, compDigis);
254  ev.getByToken(wire_token_, wireDigis);
255 
256  // input GEM pad cluster collection for upgrade scenarios
257  edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
258  const GEMPadDigiClusterCollection* gemPadClusters = nullptr;
259 
260  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
261  // and downstream of MPC.
262  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
263  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
264  std::unique_ptr<CSCCLCTPreTriggerDigiCollection> oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection);
265  std::unique_ptr<CSCALCTPreTriggerDigiCollection> oc_alctpretrigger(new CSCALCTPreTriggerDigiCollection);
266  std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
267  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
268  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
269  std::unique_ptr<CSCShowerDigiCollection> oc_shower(new CSCShowerDigiCollection);
270  std::unique_ptr<CSCShowerDigiCollection> oc_shower_anode(new CSCShowerDigiCollection);
271  std::unique_ptr<CSCShowerDigiCollection> oc_shower_cathode(new CSCShowerDigiCollection);
272  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
273 
274  if (!wireDigis.isValid()) {
275  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
276  << "+++ Warning: Collection of wire digis with label " << wireDigiProducer_.label()
277  << " requested in configuration, but not found in the event..."
278  << " Skipping production of CSC TP digis +++\n";
279  }
280  if (!compDigis.isValid()) {
281  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
282  << "+++ Warning: Collection of comparator digis with label " << compDigiProducer_.label()
283  << " requested in configuration, but not found in the event..."
284  << " Skipping production of CSC TP digis +++\n";
285  }
286  // the GEM-CSC trigger flag is set, so GEM clusters are expected in the event data
287  if (runILT_) {
288  // no valid label, let the user know that GEM clusters are missing
289  // the algorithm should not crash. instead it should just produce the regular CSC LCTs
290  // in ME1/1 and/or ME2/1
291  ev.getByToken(gem_pad_cluster_token_, gemPadDigiClusters);
292  if (!gemPadDigiClusters.isValid()) {
293  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
294  << "+++ Warning: Collection of GEM clusters with label " << gemPadDigiClusterProducer_.label()
295  << " requested in configuration, but not found in the event..."
296  << " Running CSC-only trigger algorithm +++\n";
297  } else {
298  // when the GEM-CSC trigger should be run and the label is not empty, set a valid pointer
299  gemPadClusters = gemPadDigiClusters.product();
300  }
301  }
302 
303  // Fill output collections if valid input collections are available.
304  if (wireDigis.isValid() && compDigis.isValid()) {
305  const CSCBadChambers* temp = nullptr;
306  if (checkBadChambers_) {
307  // Find conditions data for bad chambers.
308  temp = &setup.getData(pBadChambersToken_);
309  } else {
310  temp = dummyBadChambers_.get();
311  }
312  builder->build(temp,
313  wireDigis.product(),
314  compDigis.product(),
315  gemPadClusters,
316  buildContext,
317  *oc_alct,
318  *oc_clct,
319  *oc_alctpretrigger,
320  *oc_clctpretrigger,
321  *oc_pretrig,
322  *oc_lct,
323  *oc_sorted_lct,
324  *oc_shower_anode,
325  *oc_shower_cathode,
326  *oc_shower,
327  *oc_gemcopad);
328  }
329 
330  // Put collections in event.
331  ev.put(std::move(oc_alct));
332  ev.put(std::move(oc_clct));
333  if (keepALCTPreTriggers_) {
334  ev.put(std::move(oc_alctpretrigger));
335  }
336  if (keepCLCTPreTriggers_) {
337  ev.put(std::move(oc_clctpretrigger));
338  }
339  ev.put(std::move(oc_pretrig));
340  ev.put(std::move(oc_lct));
341  ev.put(std::move(oc_sorted_lct), "MPCSORTED");
342  if (keepShowers_) {
343  ev.put(std::move(oc_shower));
344  ev.put(std::move(oc_shower_anode), "Anode");
345  ev.put(std::move(oc_shower_cathode), "Cathode");
346  }
347  // only put GEM copad collections in the event when the
348  // integrated local triggers are running
349  if (runILT_)
350  ev.put(std::move(oc_gemcopad));
351 }
352 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T const * product() const
Definition: Handle.h:70
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
std::string const & label() const
Definition: InputTag.h:36
Log< level::Error, false > LogError
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscToken_
void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_pad_cluster_token_
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< CSCL1TPLookupTableME21ILT, CSCL1TPLookupTableME21ILTRcd > pLookupTableME21ILTToken_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::ESGetToken< CSCDBL1TPParameters, CSCDBL1TPParametersRcd > confToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< CSCComparatorDigiCollection > comp_token_
std::unique_ptr< CSCBadChambers const > dummyBadChambers_
bool isValid() const
Definition: ESHandle.h:44
edm::ESGetToken< CSCL1TPLookupTableME11ILT, CSCL1TPLookupTableME11ILTRcd > pLookupTableME11ILTToken_
bool isValid() const
Definition: HandleBase.h:70
std::unique_ptr< CSCTriggerPrimitivesBuilder > builder_
edm::EDGetTokenT< CSCWireDigiCollection > wire_token_
edm::ESGetToken< CSCL1TPLookupTableCCLUT, CSCL1TPLookupTableCCLUTRcd > pLookupTableCCLUTToken_
Log< level::Warning, false > LogWarning
edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > pBadChambersToken_
def move(src, dest)
Definition: eostools.py:511
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken_
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...