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 
20 
29 
30 // Configuration via EventSetup
32 
34  config_ = conf;
35 
36  // if false, parameters will be read in from DB using EventSetup mechanism
37  // else will use all parameters from the config file
38  debugParameters_ = conf.getParameter<bool>("debugParameters");
39 
40  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
41  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
42  gemPadDigiClusterProducer_ = conf.getParameter<edm::InputTag>("GEMPadDigiClusterProducer");
43 
44  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
45 
46  keepCLCTPreTriggers_ = conf.getParameter<bool>("keepCLCTPreTriggers");
47  keepALCTPreTriggers_ = conf.getParameter<bool>("keepALCTPreTriggers");
48  keepShowers_ = conf.getParameter<bool>("keepShowers");
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.getParameter<bool>("runME11ILT");
53  runME21ILT_ = commonParam.getParameter<bool>("runME21ILT");
54 
55  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
56  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
58  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
59  cscToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
60  gemToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
61  pBadChambersToken_ = esConsumes<CSCBadChambers, CSCBadChambersRcd>();
62  confToken_ = esConsumes<CSCDBL1TPParameters, CSCDBL1TPParametersRcd>();
63 
64  // register what this produces
65  produces<CSCALCTDigiCollection>();
66  produces<CSCCLCTDigiCollection>();
67  produces<CSCCLCTPreTriggerCollection>();
69  produces<CSCCLCTPreTriggerDigiCollection>();
70  }
72  produces<CSCALCTPreTriggerDigiCollection>();
73  }
74  produces<CSCCorrelatedLCTDigiCollection>();
75  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
76  if (keepShowers_) {
77  produces<CSCShowerDigiCollection>();
78  produces<CSCShowerDigiCollection>("Anode");
79  }
81  produces<GEMCoPadDigiCollection>();
82  }
83  // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
84  builder_ = std::make_unique<CSCTriggerPrimitivesBuilder>(config_);
85 }
86 
88 
90  // get the csc geometry
91  builder_->setCSCGeometry(&setup.getData(cscToken_));
92 
93  // get the gem geometry if it's there
94  edm::ESHandle<GEMGeometry> h_gem = setup.getHandle(gemToken_);
96  if (h_gem.isValid()) {
97  builder_->setGEMGeometry(&*h_gem);
98  } else {
99  edm::LogWarning("CSCTriggerPrimitivesProducer|NoGEMGeometry")
100  << "GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
101  }
102  }
103 
104  // Find conditions data for bad chambers.
105  edm::ESHandle<CSCBadChambers> pBadChambers = setup.getHandle(pBadChambersToken_);
106 
107  // If !debugParameters then get config parameters using EventSetup mechanism.
108  // This must be done in produce() for every event and not in beginJob()
109  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
110  if (!debugParameters_) {
112  if (conf.product() == nullptr) {
113  edm::LogError("CSCTriggerPrimitivesProducer|ConfigError")
114  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
115  << "+++ Cannot continue emulation without these parameters +++\n";
116  return;
117  }
118  builder_->setConfigParameters(conf.product());
119  }
120 
121  // Get the collections of comparator & wire digis from event.
124  ev.getByToken(comp_token_, compDigis);
125  ev.getByToken(wire_token_, wireDigis);
126 
127  // input GEM pad cluster collection for upgrade scenarios
128  const GEMPadDigiClusterCollection* gemPadClusters = nullptr;
129  if (runME11ILT_ or runME21ILT_) {
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 
137  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
138  // and downstream of MPC.
139  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
140  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
141  std::unique_ptr<CSCCLCTPreTriggerDigiCollection> oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection);
142  std::unique_ptr<CSCALCTPreTriggerDigiCollection> oc_alctpretrigger(new CSCALCTPreTriggerDigiCollection);
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<CSCShowerDigiCollection> oc_shower(new CSCShowerDigiCollection);
147  std::unique_ptr<CSCShowerDigiCollection> oc_shower_anode(new CSCShowerDigiCollection);
148  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
149 
150  if (!wireDigis.isValid()) {
151  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
152  << "+++ Warning: Collection of wire digis with label " << wireDigiProducer_.label()
153  << " requested in configuration, but not found in the event..."
154  << " Skipping production of CSC TP digis +++\n";
155  }
156  if (!compDigis.isValid()) {
157  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
158  << "+++ Warning: Collection of comparator digis with label " << compDigiProducer_.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  builder_->build(temp,
166  wireDigis.product(),
167  compDigis.product(),
168  gemPadClusters,
169  *oc_alct,
170  *oc_clct,
171  *oc_alctpretrigger,
172  *oc_clctpretrigger,
173  *oc_pretrig,
174  *oc_lct,
175  *oc_sorted_lct,
176  *oc_shower,
177  *oc_shower_anode,
178  *oc_gemcopad);
179  if (!checkBadChambers_)
180  delete temp;
181  }
182 
183  // Put collections in event.
184  ev.put(std::move(oc_alct));
185  ev.put(std::move(oc_clct));
186  if (keepALCTPreTriggers_) {
187  ev.put(std::move(oc_alctpretrigger));
188  }
189  if (keepCLCTPreTriggers_) {
190  ev.put(std::move(oc_clctpretrigger));
191  }
192  ev.put(std::move(oc_pretrig));
193  ev.put(std::move(oc_lct));
194  ev.put(std::move(oc_sorted_lct), "MPCSORTED");
195  if (keepShowers_) {
196  ev.put(std::move(oc_shower));
197  ev.put(std::move(oc_shower_anode), "Anode");
198  }
199  // only put GEM copad collections in the event when the
200  // integrated local triggers are running
202  ev.put(std::move(oc_gemcopad));
203 }
CSCCLCTPreTriggerCollection
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CSCTriggerPrimitivesProducer::builder_
std::unique_ptr< CSCTriggerPrimitivesBuilder > builder_
Definition: CSCTriggerPrimitivesProducer.h:62
Handle.h
CSCCorrelatedLCTDigiCollection.h
GEMCoPadDigiCollection
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CSCTriggerPrimitivesProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: CSCTriggerPrimitivesProducer.cc:89
MuonDigiCollection
A container for a generic type of digis indexed by some index, implemented with a map<IndexType,...
Definition: MuonDigiCollection.h:87
CSCTriggerPrimitivesProducer::~CSCTriggerPrimitivesProducer
~CSCTriggerPrimitivesProducer() override
Definition: CSCTriggerPrimitivesProducer.cc:87
GEMCoPadDigiCollection.h
CSCTriggerPrimitivesProducer::comp_token_
edm::EDGetTokenT< CSCComparatorDigiCollection > comp_token_
Definition: CSCTriggerPrimitivesProducer.h:70
CSCTriggerPrimitivesProducer::confToken_
edm::ESGetToken< CSCDBL1TPParameters, CSCDBL1TPParametersRcd > confToken_
Definition: CSCTriggerPrimitivesProducer.h:76
CSCTriggerPrimitivesProducer.h
CSCBadChambers
Definition: CSCBadChambers.h:9
edm::Handle< CSCComparatorDigiCollection >
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CSCDBL1TPParameters.h
CSCCLCTPreTriggerDigiCollection.h
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
CSCTriggerPrimitivesProducer::debugParameters_
bool debugParameters_
Definition: CSCTriggerPrimitivesProducer.h:78
CSCTriggerPrimitivesProducer::runME21ILT_
bool runME21ILT_
Definition: CSCTriggerPrimitivesProducer.h:92
edm::ESHandle< GEMGeometry >
GEMPadDigiClusterCollection
CSCTriggerPrimitivesProducer::wire_token_
edm::EDGetTokenT< CSCWireDigiCollection > wire_token_
Definition: CSCTriggerPrimitivesProducer.h:71
edm::ParameterSet
Definition: ParameterSet.h:47
CSCTriggerPrimitivesProducer::cscToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscToken_
Definition: CSCTriggerPrimitivesProducer.h:73
CSCTriggerPrimitivesProducer::keepCLCTPreTriggers_
bool keepCLCTPreTriggers_
Definition: CSCTriggerPrimitivesProducer.h:84
CSCTriggerPrimitivesProducer::gemToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemToken_
Definition: CSCTriggerPrimitivesProducer.h:74
CSCALCTDigiCollection
CSCTriggerPrimitivesProducer::checkBadChambers_
bool checkBadChambers_
Definition: CSCTriggerPrimitivesProducer.h:81
L1TStage2Emulator_cff.commonParam
commonParam
Definition: L1TStage2Emulator_cff.py:64
edm::EventSetup
Definition: EventSetup.h:58
CSCTriggerPrimitivesProducer::pBadChambersToken_
edm::ESGetToken< CSCBadChambers, CSCBadChambersRcd > pBadChambersToken_
Definition: CSCTriggerPrimitivesProducer.h:75
CSCCorrelatedLCTDigiCollection
CSCTriggerPrimitivesProducer::gem_pad_cluster_token_
edm::EDGetTokenT< GEMPadDigiClusterCollection > gem_pad_cluster_token_
Definition: CSCTriggerPrimitivesProducer.h:72
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
CSCTriggerPrimitivesProducer::keepShowers_
bool keepShowers_
Definition: CSCTriggerPrimitivesProducer.h:88
CSCTriggerPrimitivesBuilder.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
CSCTriggerPrimitivesProducer::runME11ILT_
bool runME11ILT_
Definition: CSCTriggerPrimitivesProducer.h:91
CSCALCTPreTriggerDigiCollection.h
CSCCLCTDigiCollection
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
CSCTriggerPrimitivesProducer::compDigiProducer_
edm::InputTag compDigiProducer_
Definition: CSCTriggerPrimitivesProducer.h:65
or
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::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCALCTPreTriggerDigiCollection
CSCALCTDigiCollection.h
CSCCLCTDigiCollection.h
CSCTriggerPrimitivesProducer::config_
edm::ParameterSet config_
Definition: CSCTriggerPrimitivesProducer.h:59
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
CSCTriggerPrimitivesProducer::wireDigiProducer_
edm::InputTag wireDigiProducer_
Definition: CSCTriggerPrimitivesProducer.h:66
edm::Event
Definition: Event.h:73
CSCTriggerPrimitivesProducer::keepALCTPreTriggers_
bool keepALCTPreTriggers_
Definition: CSCTriggerPrimitivesProducer.h:85
CSCTriggerPrimitivesProducer::gemPadDigiClusterProducer_
edm::InputTag gemPadDigiClusterProducer_
Definition: CSCTriggerPrimitivesProducer.h:67
edm::InputTag
Definition: InputTag.h:15
CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
Definition: CSCTriggerPrimitivesProducer.cc:33
CSCShowerDigiCollection.h