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 
27 
28 // Configuration via EventSetup
30 
32  config_ = conf;
33 
34  // if false, parameters will be read in from DB using EventSetup mechanism
35  // else will use all parameters from the config file
36  debugParameters_ = conf.getParameter<bool>("debugParameters");
37 
38  wireDigiProducer_ = conf.getParameter<edm::InputTag>("CSCWireDigiProducer");
39  compDigiProducer_ = conf.getParameter<edm::InputTag>("CSCComparatorDigiProducer");
40  gemPadDigiClusterProducer_ = conf.getParameter<edm::InputTag>("GEMPadDigiClusterProducer");
41 
42  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
43 
44  writeOutAllCLCTs_ = conf.getParameter<bool>("writeOutAllCLCTs");
45  writeOutAllALCTs_ = conf.getParameter<bool>("writeOutAllALCTs");
46  savePreTriggers_ = conf.getParameter<bool>("savePreTriggers");
47 
48  // check whether you need to run the integrated local triggers
49  const edm::ParameterSet commonParam(conf.getParameter<edm::ParameterSet>("commonParam"));
50  runME11ILT_ = commonParam.getParameter<bool>("runME11ILT");
51  runME21ILT_ = commonParam.getParameter<bool>("runME21ILT");
52 
53  wire_token_ = consumes<CSCWireDigiCollection>(wireDigiProducer_);
54  comp_token_ = consumes<CSCComparatorDigiCollection>(compDigiProducer_);
55  gem_pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(gemPadDigiClusterProducer_);
56  cscToken_ = esConsumes<CSCGeometry, MuonGeometryRecord>();
57  gemToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
58  pBadChambersToken_ = esConsumes<CSCBadChambers, CSCBadChambersRcd>();
59  confToken_ = esConsumes<CSCDBL1TPParameters, CSCDBL1TPParametersRcd>();
60 
61  // register what this produces
62  produces<CSCALCTDigiCollection>();
63  produces<CSCCLCTDigiCollection>();
64  // for experimental simulation studies
65  if (writeOutAllCLCTs_) {
66  produces<CSCCLCTDigiCollection>("All");
67  }
68  if (writeOutAllALCTs_) {
69  produces<CSCALCTDigiCollection>("All");
70  }
71  produces<CSCCLCTPreTriggerCollection>();
72  if (savePreTriggers_) {
73  produces<CSCCLCTPreTriggerDigiCollection>();
74  produces<CSCALCTPreTriggerDigiCollection>();
75  }
76  produces<CSCCorrelatedLCTDigiCollection>();
77  produces<CSCCorrelatedLCTDigiCollection>("MPCSORTED");
79  produces<GEMCoPadDigiCollection>();
80 
81  // temporarily switch to a "one" module with a CSCTriggerPrimitivesBuilder data member
82  builder_ = std::make_unique<CSCTriggerPrimitivesBuilder>(config_);
83 }
84 
86 
88  // get the csc geometry
89  builder_->setCSCGeometry(&setup.getData(cscToken_));
90 
91  // get the gem geometry if it's there
92  edm::ESHandle<GEMGeometry> h_gem = setup.getHandle(gemToken_);
93  if (h_gem.isValid()) {
94  builder_->setGEMGeometry(&*h_gem);
95  } else {
96  edm::LogInfo("CSCTriggerPrimitivesProducer|NoGEMGeometry")
97  << "+++ Info: GEM geometry is unavailable. Running CSC-only trigger algorithm. +++\n";
98  }
99 
100  // Find conditions data for bad chambers.
101  edm::ESHandle<CSCBadChambers> pBadChambers = setup.getHandle(pBadChambersToken_);
102 
103  // If !debugParameters then get config parameters using EventSetup mechanism.
104  // This must be done in produce() for every event and not in beginJob()
105  // (see mail from Jim Brooke sent to hn-cms-L1TrigEmulator on July 30, 2007).
106  if (!debugParameters_) {
108  if (conf.product() == nullptr) {
109  edm::LogError("CSCTriggerPrimitivesProducer|ConfigError")
110  << "+++ Failed to find a CSCDBL1TPParametersRcd in EventSetup! +++\n"
111  << "+++ Cannot continue emulation without these parameters +++\n";
112  return;
113  }
114  builder_->setConfigParameters(conf.product());
115  }
116 
117  // Get the collections of comparator & wire digis from event.
120  ev.getByToken(comp_token_, compDigis);
121  ev.getByToken(wire_token_, wireDigis);
122 
123  // input GEM pad cluster collection for upgrade scenarios
124  const GEMPadDigiClusterCollection* gemPadClusters = nullptr;
125  if (!gemPadDigiClusterProducer_.label().empty()) {
126  edm::Handle<GEMPadDigiClusterCollection> gemPadDigiClusters;
127  ev.getByToken(gem_pad_cluster_token_, gemPadDigiClusters);
128  gemPadClusters = gemPadDigiClusters.product();
129  }
130 
131  // Create empty collections of ALCTs, CLCTs, and correlated LCTs upstream
132  // and downstream of MPC.
133  std::unique_ptr<CSCALCTDigiCollection> oc_alct(new CSCALCTDigiCollection);
134  std::unique_ptr<CSCALCTDigiCollection> oc_alct_all(new CSCALCTDigiCollection);
135  std::unique_ptr<CSCCLCTDigiCollection> oc_clct(new CSCCLCTDigiCollection);
136  std::unique_ptr<CSCCLCTDigiCollection> oc_clct_all(new CSCCLCTDigiCollection);
137  std::unique_ptr<CSCCLCTPreTriggerDigiCollection> oc_clctpretrigger(new CSCCLCTPreTriggerDigiCollection);
138  std::unique_ptr<CSCALCTPreTriggerDigiCollection> oc_alctpretrigger(new CSCALCTPreTriggerDigiCollection);
139  std::unique_ptr<CSCCLCTPreTriggerCollection> oc_pretrig(new CSCCLCTPreTriggerCollection);
140  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_lct(new CSCCorrelatedLCTDigiCollection);
141  std::unique_ptr<CSCCorrelatedLCTDigiCollection> oc_sorted_lct(new CSCCorrelatedLCTDigiCollection);
142  std::unique_ptr<GEMCoPadDigiCollection> oc_gemcopad(new GEMCoPadDigiCollection);
143 
144  if (!wireDigis.isValid()) {
145  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
146  << "+++ Warning: Collection of wire digis with label " << wireDigiProducer_.label()
147  << " requested in configuration, but not found in the event..."
148  << " Skipping production of CSC TP digis +++\n";
149  }
150  if (!compDigis.isValid()) {
151  edm::LogWarning("CSCTriggerPrimitivesProducer|NoInputCollection")
152  << "+++ Warning: Collection of comparator digis with label " << compDigiProducer_.label()
153  << " requested in configuration, but not found in the event..."
154  << " Skipping production of CSC TP digis +++\n";
155  }
156  // Fill output collections if valid input collections are available.
157  if (wireDigis.isValid() && compDigis.isValid()) {
158  const CSCBadChambers* temp = checkBadChambers_ ? pBadChambers.product() : new CSCBadChambers;
159  builder_->build(temp,
160  wireDigis.product(),
161  compDigis.product(),
162  gemPadClusters,
163  *oc_alct,
164  *oc_alct_all,
165  *oc_clct,
166  *oc_clct_all,
167  *oc_alctpretrigger,
168  *oc_clctpretrigger,
169  *oc_pretrig,
170  *oc_lct,
171  *oc_sorted_lct,
172  *oc_gemcopad);
173  if (!checkBadChambers_)
174  delete temp;
175  }
176 
177  // Put collections in event.
178  ev.put(std::move(oc_alct));
179  if (writeOutAllALCTs_) {
180  ev.put(std::move(oc_alct_all), "All");
181  }
182  ev.put(std::move(oc_clct));
183  if (writeOutAllCLCTs_) {
184  ev.put(std::move(oc_clct_all), "All");
185  }
186  if (savePreTriggers_) {
187  ev.put(std::move(oc_alctpretrigger));
188  ev.put(std::move(oc_clctpretrigger));
189  }
190  ev.put(std::move(oc_pretrig));
191  ev.put(std::move(oc_lct));
192  ev.put(std::move(oc_sorted_lct), "MPCSORTED");
193  // only put GEM copad collections in the event when the
194  // integrated local triggers are running
196  ev.put(std::move(oc_gemcopad));
197 }
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:87
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:85
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
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
CSCBadChambers
Definition: CSCBadChambers.h:9
CSCTriggerPrimitivesProducer::writeOutAllCLCTs_
bool writeOutAllCLCTs_
Definition: CSCTriggerPrimitivesProducer.h:84
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:94
edm::ESHandle< GEMGeometry >
GEMPadDigiClusterCollection
CSCTriggerPrimitivesProducer::wire_token_
edm::EDGetTokenT< CSCWireDigiCollection > wire_token_
Definition: CSCTriggerPrimitivesProducer.h:71
CSCTriggerPrimitivesProducer::writeOutAllALCTs_
bool writeOutAllALCTs_
Definition: CSCTriggerPrimitivesProducer.h:87
edm::ParameterSet
Definition: ParameterSet.h:47
CSCTriggerPrimitivesProducer::cscToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscToken_
Definition: CSCTriggerPrimitivesProducer.h:73
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:59
edm::EventSetup
Definition: EventSetup.h:57
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
CSCTriggerPrimitivesBuilder.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
CSCTriggerPrimitivesProducer::runME11ILT_
bool runME11ILT_
Definition: CSCTriggerPrimitivesProducer.h:93
CSCALCTPreTriggerDigiCollection.h
CSCCLCTDigiCollection
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
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
CSCTriggerPrimitivesProducer::savePreTriggers_
bool savePreTriggers_
Definition: CSCTriggerPrimitivesProducer.h:90
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::gemPadDigiClusterProducer_
edm::InputTag gemPadDigiClusterProducer_
Definition: CSCTriggerPrimitivesProducer.h:67
edm::InputTag
Definition: InputTag.h:15
CSCTriggerPrimitivesProducer::CSCTriggerPrimitivesProducer
CSCTriggerPrimitivesProducer(const edm::ParameterSet &)
Definition: CSCTriggerPrimitivesProducer.cc:31