CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCTriggerPrimitivesProducer.cc
Go to the documentation of this file.
1 #ifndef L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h
2 #define L1Trigger_CSCTriggerPrimitives_CSCTriggerPrimitivesProducer_h
3 
34 
57 
58 // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
60 public:
63 
64  void produce(edm::Event&, const edm::EventSetup&) override;
65 
66 private:
67  // master configuration
69 
70  // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
71  std::unique_ptr<CSCTriggerPrimitivesBuilder> builder_;
72 
73  // input tags for input collections
77 
78  // tokens
89  // switch to force the use of parameters from config file rather then from DB
91 
92  // switch to for enabling checking against the list of bad chambers
94 
95  // Write out pre-triggers
98 
99  // write out showrs
101 
102  // switches to enable the Run-3 pattern finding
103  bool runCCLUT_; // 'OR' of the two options below
104  bool runCCLUT_TMB_; // ME1/2, ME1/3, ME2/2, ME3/2, ME4/2
105  bool runCCLUT_OTMB_; // ME1/1, ME2/1, ME3/1, ME4/1
106 
107  bool runILT_; // // 'OR' of the two options below
110 };
111 
112 #endif
113 
115  config_ = conf;
116 
117  // if false, parameters will be read in from DB using EventSetup mechanism
118  // else will use all parameters from the config file
119  debugParameters_ = conf.getParameter<bool>("debugParameters");
120 
121  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
122  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
123  gemPadDigiClusterProducer_ = conf.getParameter<edm::InputTag>("GEMPadDigiClusterProducer");
124 
125  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
126 
127  keepCLCTPreTriggers_ = conf.getParameter<bool>("keepCLCTPreTriggers");
128  keepALCTPreTriggers_ = conf.getParameter<bool>("keepALCTPreTriggers");
129  keepShowers_ = conf.getParameter<bool>("keepShowers");
130 
131  // check whether you need to run the integrated local triggers
132  const edm::ParameterSet commonParam(conf.getParameter<edm::ParameterSet>("commonParam"));
133  runCCLUT_TMB_ = commonParam.getParameter<bool>("runCCLUT_TMB");
134  runCCLUT_OTMB_ = commonParam.getParameter<bool>("runCCLUT_OTMB");
136 
137  runME11ILT_ = commonParam.getParameter<bool>("runME11ILT");
138  runME21ILT_ = commonParam.getParameter<bool>("runME21ILT");
140 
141  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
142  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
143  if (runILT_)
144  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
145  cscToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
146  gemToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
147  pBadChambersToken_ = esConsumes<CSCBadChambers, CSCBadChambersRcd>();
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  confToken_ = esConsumes<CSCDBL1TPParameters, CSCDBL1TPParametersRcd>();
156 
157  // register what this produces
158  produces<CSCALCTDigiCollection>();
159  produces<CSCCLCTDigiCollection>();
160  produces<CSCCLCTPreTriggerCollection>();
161  if (keepCLCTPreTriggers_) {
162  produces<CSCCLCTPreTriggerDigiCollection>();
163  }
164  if (keepALCTPreTriggers_) {
165  produces<CSCALCTPreTriggerDigiCollection>();
166  }
167  produces<CSCCorrelatedLCTDigiCollection>();
168  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
169  if (keepShowers_) {
170  produces<CSCShowerDigiCollection>();
171  produces<CSCShowerDigiCollection>("Anode");
172  produces<CSCShowerDigiCollection>("Cathode");
173  }
174  if (runILT_) {
175  produces<GEMCoPadDigiCollection>();
176  }
177  // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
178  builder_ = std::make_unique<CSCTriggerPrimitivesBuilder>(config_);
179 }
180 
182 
184  // get the csc geometry
185  builder_->setCSCGeometry(&setup.getData(cscToken_));
186 
187  // get the gem geometry if it's there
189  if (runILT_) {
190  if (h_gem.isValid()) {
191  builder_->setGEMGeometry(&*h_gem);
192  } else {
193  edm::LogWarning("CSCTriggerPrimitivesProducer|NoGEMGeometry")
194  << "GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
195  }
196  }
197 
198  // Find conditions data for bad chambers.
200 
201  if (runCCLUT_) {
203  if (conf.product() == nullptr) {
204  edm::LogError("CSCTriggerPrimitivesProducer")
205  << "Failed to find a CSCL1TPLookupTableCCLUTRcd in EventSetup with runCCLUT_ on";
206  return;
207  }
208  builder_->setESLookupTables(conf.product());
209  }
210 
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  builder_->setESLookupTables(conf.product());
219  }
220 
221  if (runME21ILT_) {
223  if (conf.product() == nullptr) {
224  edm::LogError("CSCTriggerPrimitivesProducer")
225  << "Failed to find a CSCL1TPLookupTableME21ILTRcd in EventSetup with runME21ILT_ on";
226  return;
227  }
228  builder_->setESLookupTables(conf.product());
229  }
230 
231  // If !debugParameters then get config parameters using EventSetup mechanism.
232  // This must be done in produce() for every event and not in beginJob()
233  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
234  if (!debugParameters_) {
236  if (conf.product() == nullptr) {
237  edm::LogError("CSCTriggerPrimitivesProducer|ConfigError")
238  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
239  << "+++ Cannot continue emulation without these parameters +++\n";
240  return;
241  }
242  builder_->setConfigParameters(conf.product());
243  }
244 
245  // Get the collections of comparator & wire digis from event.
248  ev.getByToken(comp_token_, compDigis);
249  ev.getByToken(wire_token_, wireDigis);
250 
251  // input GEM pad cluster collection for upgrade scenarios
252  const GEMPadDigiClusterCollection* gemPadClusters = nullptr;
253  if (runILT_) {
254  if (!gemPadDigiClusterProducer_.label().empty()) {
255  edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
256  ev.getByToken(gem_pad_cluster_token_, gemPadDigiClusters);
257  gemPadClusters = gemPadDigiClusters.product();
258  }
259  }
260 
261  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
262  // and downstream of MPC.
263  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
264  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
265  std::unique_ptr<CSCCLCTPreTriggerDigiCollection> oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection);
266  std::unique_ptr<CSCALCTPreTriggerDigiCollection> oc_alctpretrigger(new CSCALCTPreTriggerDigiCollection);
267  std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
268  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
269  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
270  std::unique_ptr<CSCShowerDigiCollection> oc_shower(new CSCShowerDigiCollection);
271  std::unique_ptr<CSCShowerDigiCollection> oc_shower_anode(new CSCShowerDigiCollection);
272  std::unique_ptr<CSCShowerDigiCollection> oc_shower_cathode(new CSCShowerDigiCollection);
273  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
274 
275  if (!wireDigis.isValid()) {
276  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
277  << "+++ Warning: Collection of wire digis with label " << wireDigiProducer_.label()
278  << " requested in configuration, but not found in the event..."
279  << " Skipping production of CSC TP digis +++\n";
280  }
281  if (!compDigis.isValid()) {
282  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
283  << "+++ Warning: Collection of comparator digis with label " << compDigiProducer_.label()
284  << " requested in configuration, but not found in the event..."
285  << " Skipping production of CSC TP digis +++\n";
286  }
287  // Fill output collections if valid input collections are available.
288  if (wireDigis.isValid() && compDigis.isValid()) {
289  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
290  builder_->build(temp,
291  wireDigis.product(),
292  compDigis.product(),
293  gemPadClusters,
294  *oc_alct,
295  *oc_clct,
296  *oc_alctpretrigger,
297  *oc_clctpretrigger,
298  *oc_pretrig,
299  *oc_lct,
300  *oc_sorted_lct,
301  *oc_shower_anode,
302  *oc_shower_cathode,
303  *oc_shower,
304  *oc_gemcopad);
305  if (!checkBadChambers_)
306  delete temp;
307  }
308 
309  // Put collections in event.
310  ev.put(std::move(oc_alct));
311  ev.put(std::move(oc_clct));
312  if (keepALCTPreTriggers_) {
313  ev.put(std::move(oc_alctpretrigger));
314  }
315  if (keepCLCTPreTriggers_) {
316  ev.put(std::move(oc_clctpretrigger));
317  }
318  ev.put(std::move(oc_pretrig));
319  ev.put(std::move(oc_lct));
320  ev.put(std::move(oc_sorted_lct), "MPCSORTED");
321  if (keepShowers_) {
322  ev.put(std::move(oc_shower));
323  ev.put(std::move(oc_shower_anode), "Anode");
324  ev.put(std::move(oc_shower_cathode), "Cathode");
325  }
326  // only put GEM copad collections in the event when the
327  // integrated local triggers are running
328  if (runILT_)
329  ev.put(std::move(oc_gemcopad));
330 }
331 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
bool ev
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
Log< level::Error, false > LogError
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscToken_
void produce(edm::Event &, const edm::EventSetup &) override
bool getData(T &iHolder) const
Definition: EventSetup.h:128
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_pad_cluster_token_
edm::ESGetToken< CSCL1TPLookupTableME21ILT, CSCL1TPLookupTableME21ILTRcd > pLookupTableME21ILTToken_
def move
Definition: eostools.py:511
edm::ESGetToken< CSCDBL1TPParameters, CSCDBL1TPParametersRcd > confToken_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< CSCComparatorDigiCollection > comp_token_
edm::ESGetToken< CSCL1TPLookupTableME11ILT, CSCL1TPLookupTableME11ILTRcd > pLookupTableME11ILTToken_
T const * product() const
Definition: Handle.h:70
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::unique_ptr< CSCTriggerPrimitivesBuilder > builder_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< CSCWireDigiCollection > wire_token_
edm::ESGetToken< CSCL1TPLookupTableCCLUT, CSCL1TPLookupTableCCLUTRcd > pLookupTableCCLUTToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
Log< level::Warning, false > LogWarning
bool isValid() const
Definition: ESHandle.h:44
edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > pBadChambersToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken_
A container for a generic type of digis indexed by some index, implemented with a map&lt;IndexType...