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 
31 
32 // Configuration via EventSetup
35 
36 
38 {
39  config_ = conf;
40 
41  // if false, parameters will be read in from DB using EventSetup mechanism
42  // else will use all parameters from the config file
43  debugParameters_ = conf.getParameter<bool>("debugParameters");
44 
45  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
46  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
47  gemPadDigiProducer_ = conf.existsAs<edm::InputTag>("GEMPadDigiProducer")?conf.getParameter<edm::InputTag>("GEMPadDigiProducer"):edm::InputTag("");
48  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
49 
50  // check whether you need to run the integrated local triggers
51  const edm::ParameterSet commonParam(conf.getParameter<edm::ParameterSet>("commonParam"));
52  runME11ILT_ = commonParam.existsAs<bool>("runME11ILT")?commonParam.getParameter<bool>("runME11ILT"):false;
53  runME21ILT_ = commonParam.existsAs<bool>("runME21ILT")?commonParam.getParameter<bool>("runME21ILT"):false;
54 
55  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
56  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
57  gem_pad_token_ = consumes<GEMPadDigiCollection>(gemPadDigiProducer_);
58  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
59 
60  // register what this produces
61  produces<CSCALCTDigiCollection>();
62  produces<CSCCLCTDigiCollection>();
63  produces<CSCCLCTPreTriggerDigiCollection>();
64  produces<CSCCLCTPreTriggerCollection>();
65  produces<CSCCorrelatedLCTDigiCollection>();
66  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
68  produces<GEMCoPadDigiCollection>();
69 }
70 
72 {
73 }
74 
76 {
77  // Remark: access builder using "streamCache(iID)"
78 
79  // get the csc geometry
81  setup.get<MuonGeometryRecord>().get(h);
82  streamCache(iID)->setCSCGeometry(&*h);
83 
84  // get the gem geometry if it's there
86  setup.get<MuonGeometryRecord>().get(h_gem);
87  if (h_gem.isValid()) {
88  streamCache(iID)->setGEMGeometry(&*h_gem);
89  } else {
90  edm::LogInfo("L1CSCTPEmulatorNoGEMGeometry")
91  << "+++ Info: GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
92  }
93 
94  // Find conditions data for bad chambers.
95  edm::ESHandle<CSCBadChambers> pBadChambers;
96  setup.get<CSCBadChambersRcd>().get(pBadChambers);
97 
98  // If !debugParameters then get config parameters using EventSetup mechanism.
99  // This must be done in produce() for every event and not in beginJob()
100  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
101  if (!debugParameters_) {
103  setup.get<CSCDBL1TPParametersRcd>().get(conf);
104  if (conf.product() == nullptr) {
105  edm::LogError("L1CSCTPEmulatorConfigError")
106  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
107  << "+++ Cannot continue emulation without these parameters +++\n";
108  return;
109  }
110  streamCache(iID)->setConfigParameters(conf.product());
111  }
112 
113  // temporary hack to run on data
114  streamCache(iID)->runOnData(ev.eventAuxiliary().isRealData());
115 
116  // Get the collections of comparator & wire digis from event.
119  ev.getByToken(comp_token_, compDigis);
120  ev.getByToken(wire_token_, wireDigis);
121 
122  // input GEM pad collection for upgrade scenarios
123  const GEMPadDigiCollection *gemPads = nullptr;
124  if (!gemPadDigiProducer_.label().empty()) {
126  ev.getByToken(gem_pad_token_, gemPadDigis);
127  gemPads = gemPadDigis.product();
128  }
129 
130  // input GEM pad cluster collection for upgrade scenarios
131  const GEMPadDigiClusterCollection *gemPadClusters = nullptr;
132  if (!gemPadDigiClusterProducer_.label().empty()) {
133  edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
134  ev.getByToken(gem_pad_cluster_token_, gemPadDigiClusters);
135  gemPadClusters = gemPadDigiClusters.product();
136  }
137 
138  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
139  // and downstream of MPC.
140  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
141  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
142  std::unique_ptr<CSCCLCTPreTriggerDigiCollection> oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection);
143  std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
144  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
145  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
146  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
147 
148  if (!wireDigis.isValid()) {
149  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
150  << "+++ Warning: Collection of wire digis with label "
152  << " requested in configuration, but not found in the event..."
153  << " Skipping production of CSC TP digis +++\n";
154  }
155  if (!compDigis.isValid()) {
156  edm::LogWarning("L1CSCTPEmulatorNoInputCollection")
157  << "+++ Warning: Collection of comparator digis with label "
159  << " requested in configuration, but not found in the event..."
160  << " Skipping production of CSC TP digis +++\n";
161  }
162  // Fill output collections if valid input collections are available.
163  if (wireDigis.isValid() && compDigis.isValid()) {
164  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
165  streamCache(iID)->build(temp,
166  wireDigis.product(), compDigis.product(),
167  gemPads, gemPadClusters,
168  *oc_alct, *oc_clct,
169  *oc_clctpretrigger, *oc_pretrig,
170  *oc_lct, *oc_sorted_lct, *oc_gemcopad);
171  if (!checkBadChambers_)
172  delete temp;
173  }
174 
175  // Put collections in event.
176  ev.put(std::move(oc_alct));
177  ev.put(std::move(oc_clct));
178  ev.put(std::move(oc_clctpretrigger));
179  ev.put(std::move(oc_pretrig));
180  ev.put(std::move(oc_lct));
181  ev.put(std::move(oc_sorted_lct),"MPCSORTED");
182  // only put GEM copad collections in the event when the
183  // integrated local triggers are running
185  ev.put(std::move(oc_gemcopad));
186 }
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:59
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