CMS 3D CMS Logo

CSCTriggerPrimitivesProducer.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: CSCTriggerPrimitivesProducer
4 //
5 // Description: Steering routine of the local Level-1 Cathode Strip Chamber
6 // trigger.
7 //
8 // Author List: S. Valuev, UCLA.
9 //
10 //
11 // Modifications:
12 //
13 //--------------------------------------------------
14 
17 
21 
25 
30 
31 // Configuration via EventSetup
34 
35 
37 {
38  config_ = conf;
39 
40  // if false, parameters will be read in from DB using EventSetup mechanism
41  // else will use all parameters from the config file
42  debugParameters_ = conf.getParameter<bool>("debugParameters");
43 
44  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
45  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
46  gemPadDigiProducer_ = conf.existsAs<edm::InputTag>("GEMPadDigiProducer")?conf.getParameter<edm::InputTag>("GEMPadDigiProducer"):edm::InputTag("");
47  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
48 
49  // check whether you need to run the integrated local triggers
50  const edm::ParameterSet commonParam(conf.getParameter<edm::ParameterSet>("commonParam"));
51  runME11ILT_ = commonParam.existsAs<bool>("runME11ILT")?commonParam.getParameter<bool>("runME11ILT"):false;
52  runME21ILT_ = commonParam.existsAs<bool>("runME21ILT")?commonParam.getParameter<bool>("runME21ILT"):false;
53 
54  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
55  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
56  gem_pad_token_ = consumes<GEMPadDigiCollection>(gemPadDigiProducer_);
57  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
58 
59  // register what this produces
60  produces<CSCALCTDigiCollection>();
61  produces<CSCCLCTDigiCollection>();
62  produces<CSCCLCTPreTriggerCollection>();
63  produces<CSCCorrelatedLCTDigiCollection>();
64  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
66  produces<GEMCoPadDigiCollection>();
67 }
68 
70 {
71 }
72 
74 {
75  // Remark: access builder using "streamCache(iID)"
76 
77  // get the csc geometry
79  setup.get<MuonGeometryRecord>().get(h);
80  streamCache(iID)->setCSCGeometry(&*h);
81 
82  // get the gem geometry if it's there
84  setup.get<MuonGeometryRecord>().get(h_gem);
85  if (h_gem.isValid()) {
86  streamCache(iID)->setGEMGeometry(&*h_gem);
87  } else {
88  edm::LogInfo("L1CSCTPEmulatorNoGEMGeometry")
89  << "+++ Info: GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
90  }
91 
92  // Find conditions data for bad chambers.
93  edm::ESHandle<CSCBadChambers> pBadChambers;
94  setup.get<CSCBadChambersRcd>().get(pBadChambers);
95 
96  // If !debugParameters then get config parameters using EventSetup mechanism.
97  // This must be done in produce() for every event and not in beginJob()
98  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
99  if (!debugParameters_) {
101  setup.get<CSCDBL1TPParametersRcd>().get(conf);
102  if (conf.product() == nullptr) {
103  edm::LogError("L1CSCTPEmulatorConfigError")
104  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
105  << "+++ Cannot continue emulation without these parameters +++\n";
106  return;
107  }
108  streamCache(iID)->setConfigParameters(conf.product());
109  }
110 
111  // temporary hack to run on data
112  streamCache(iID)->runOnData(ev.eventAuxiliary().isRealData());
113 
114  // Get the collections of comparator & wire digis from event.
117  ev.getByToken(comp_token_, compDigis);
118  ev.getByToken(wire_token_, wireDigis);
119 
120  // input GEM pad collection for upgrade scenarios
121  const GEMPadDigiCollection *gemPads = nullptr;
122  if (!gemPadDigiProducer_.label().empty()) {
124  ev.getByToken(gem_pad_token_, gemPadDigis);
125  gemPads = gemPadDigis.product();
126  }
127 
128  // input GEM pad cluster collection for upgrade scenarios
129  const GEMPadDigiClusterCollection *gemPadClusters = nullptr;
130  if (!gemPadDigiClusterProducer_.label().empty()) {
131  edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
132  ev.getByToken(gem_pad_cluster_token_, gemPadDigiClusters);
133  gemPadClusters = gemPadDigiClusters.product();
134  }
135 
136  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
137  // and downstream of MPC.
138  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
139  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
140  std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
141  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
142  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
143  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
144 
145  if (!wireDigis.isValid()) {
146  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
147  << "+++ Warning: Collection of wire digis with label "
149  << " requested in configuration, but not found in the event..."
150  << " Skipping production of CSC TP digis +++\n";
151  }
152  if (!compDigis.isValid()) {
153  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
154  << "+++ Warning: Collection of comparator digis with label "
156  << " requested in configuration, but not found in the event..."
157  << " Skipping production of CSC TP digis +++\n";
158  }
159  // Fill output collections if valid input collections are available.
160  if (wireDigis.isValid() && compDigis.isValid()) {
161  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
162  streamCache(iID)->build(temp,
163  wireDigis.product(), compDigis.product(), gemPads, gemPadClusters,
164  *oc_alct, *oc_clct, *oc_pretrig, *oc_lct, *oc_sorted_lct, *oc_gemcopad);
165  if (!checkBadChambers_)
166  delete temp;
167  }
168 
169  // Put collections in event.
170  ev.put(std::move(oc_alct));
171  ev.put(std::move(oc_clct));
172  ev.put(std::move(oc_pretrig));
173  ev.put(std::move(oc_lct));
174  ev.put(std::move(oc_sorted_lct),"MPCSORTED");
175  // only put GEM copad collections in the event when the
176  // integrated local triggers are running
178  ev.put(std::move(oc_gemcopad));
179 }
T getParameter(std::string const &) const
bool isRealData() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:92
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
bool ev
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_pad_cluster_token_
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
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< CSCComparatorDigiCollection > comp_token_
edm::EDGetTokenT< GEMPadDigiCollection > gem_pad_token_
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:58
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< CSCWireDigiCollection > wire_token_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
bool isValid() const
Definition: ESHandle.h:47
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510