CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTRecHitInAllL1RegionsProducer< RecHitType > Class Template Reference
Inheritance diagram for HLTRecHitInAllL1RegionsProducer< RecHitType >:
edm::stream::EDProducer<>

Public Member Functions

 HLTRecHitInAllL1RegionsProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTRecHitInAllL1RegionsProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

using RecHitCollectionType = edm::SortedCollection< RecHitType >
 

Private Member Functions

L1RegionDataBasecreateL1RegionData (const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
 

Private Attributes

const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
 
std::vector< std::string > productLabels_
 
std::vector< edm::InputTagrecHitLabels_
 
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename RecHitType>
class HLTRecHitInAllL1RegionsProducer< RecHitType >

Definition at line 110 of file HLTRecHitInAllL1RegionsProducer.cc.

Member Typedef Documentation

◆ RecHitCollectionType

template<typename RecHitType >
using HLTRecHitInAllL1RegionsProducer< RecHitType >::RecHitCollectionType = edm::SortedCollection<RecHitType>
private

Definition at line 111 of file HLTRecHitInAllL1RegionsProducer.cc.

Constructor & Destructor Documentation

◆ HLTRecHitInAllL1RegionsProducer()

template<typename RecHitType >
HLTRecHitInAllL1RegionsProducer< RecHitType >::HLTRecHitInAllL1RegionsProducer ( const edm::ParameterSet ps)

Definition at line 136 of file HLTRecHitInAllL1RegionsProducer.cc.

References deDxTools::esConsumes().

138  const std::vector<edm::ParameterSet> l1InputRegions =
139  para.getParameter<std::vector<edm::ParameterSet>>("l1InputRegions");
140  for (auto& pset : l1InputRegions) {
141  const std::string type = pset.getParameter<std::string>("type");
142  // meh I was going to use a factory but it was going to be overly complex for my needs
143  l1RegionData_.emplace_back(createL1RegionData(type, pset, consumesCollector()));
144  }
145  recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>("recHitLabels");
146  productLabels_ = para.getParameter<std::vector<std::string>>("productLabels");
147 
148  for (unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
149  recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
150  produces<RecHitCollectionType>(productLabels_[collNr]);
151  }
152 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
L1RegionDataBase * createL1RegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)

◆ ~HLTRecHitInAllL1RegionsProducer()

template<typename RecHitType >
HLTRecHitInAllL1RegionsProducer< RecHitType >::~HLTRecHitInAllL1RegionsProducer ( )
inlineoverride

Definition at line 115 of file HLTRecHitInAllL1RegionsProducer.cc.

115 {}

Member Function Documentation

◆ createL1RegionData()

template<typename RecHitType >
L1RegionDataBase * HLTRecHitInAllL1RegionsProducer< RecHitType >::createL1RegionData ( const std::string &  type,
const edm::ParameterSet para,
edm::ConsumesCollector &&  consumesColl 
)
private

Definition at line 262 of file HLTRecHitInAllL1RegionsProducer.cc.

References Exception.

263  {
264  if (type == "L1EmParticle") {
265  return new L1RegionData<l1extra::L1EmParticleCollection>(para, consumesColl);
266  } else if (type == "L1JetParticle") {
267  return new L1RegionData<l1extra::L1JetParticleCollection>(para, consumesColl);
268  } else if (type == "L1MuonParticle") {
269  return new L1RegionData<l1extra::L1MuonParticleCollection>(para, consumesColl);
270  } else if (type == "EGamma") {
271  return new L1RegionData<l1t::EGammaBxCollection>(para, consumesColl);
272  } else if (type == "Jet") {
273  return new L1RegionData<l1t::JetBxCollection>(para, consumesColl);
274  } else if (type == "Muon") {
275  return new L1RegionData<l1t::MuonBxCollection>(para, consumesColl);
276  } else if (type == "Tau") {
277  return new L1RegionData<l1t::TauBxCollection>(para, consumesColl);
278  } else {
279  //this is a major issue and could lead to rather subtle efficiency losses, so if its incorrectly configured, we're aborting the job!
280  throw cms::Exception("InvalidConfig")
281  << " type " << type
282  << " is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this "
283  "error as it can lead to hard to find efficiency loses"
284  << std::endl;
285  }
286 }

◆ fillDescriptions()

template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 155 of file HLTRecHitInAllL1RegionsProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSet::addParameter(), defaultModuleLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, JetMonitor_cfi::jetPSet, HLT_2023v12_cff::l1InputRegions, HLT_2023v12_cff::recHitLabels, and AlCaHLTBitMon_QueryRunRegistry::string.

155  {
157  std::vector<std::string> productTags;
158  productTags.push_back("EcalRegionalRecHitsEB");
159  productTags.push_back("EcalRegionalRecHitsEE");
160  desc.add<std::vector<std::string>>("productLabels", productTags);
161  std::vector<edm::InputTag> recHitLabels;
162  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
163  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
164  recHitLabels.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
165  desc.add<std::vector<edm::InputTag>>("recHitLabels", recHitLabels);
166  std::vector<edm::ParameterSet> l1InputRegions;
167 
168  edm::ParameterSet emIsoPSet;
169  emIsoPSet.addParameter<std::string>("type", "L1EmParticle");
170  emIsoPSet.addParameter<double>("minEt", 5);
171  emIsoPSet.addParameter<double>("maxEt", 999);
172  emIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
173  emIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
174  emIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:NonIsolated"));
175  l1InputRegions.push_back(emIsoPSet);
176  edm::ParameterSet emNonIsoPSet;
177  emNonIsoPSet.addParameter<std::string>("type", "L1EmParticle");
178  emNonIsoPSet.addParameter<double>("minEt", 5);
179  emNonIsoPSet.addParameter<double>("maxEt", 999);
180  emNonIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
181  emNonIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
182  emNonIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:Isolated"));
183  l1InputRegions.push_back(emNonIsoPSet);
184 
185  // Why no Central Jets here? They are present in the python config, e.g. OnLine_HLT_GRun.py
186  // SHarper: because these are the default parameters designed to reproduce the original (no jets) behaviour
187  //
188  edm::ParameterSet egPSet;
189  egPSet.addParameter<std::string>("type", "EGamma");
190  egPSet.addParameter<double>("minEt", 5);
191  egPSet.addParameter<double>("maxEt", 999);
192  egPSet.addParameter<double>("regionEtaMargin", 0.4);
193  egPSet.addParameter<double>("regionPhiMargin", 0.5);
194  egPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
195  l1InputRegions.push_back(egPSet);
196 
198  jetPSet.addParameter<std::string>("type", "EGamma");
199  jetPSet.addParameter<double>("minEt", 200);
200  jetPSet.addParameter<double>("maxEt", 999);
201  jetPSet.addParameter<double>("regionEtaMargin", 0.4);
202  jetPSet.addParameter<double>("regionPhiMargin", 0.5);
203  jetPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
204  l1InputRegions.push_back(jetPSet);
205 
206  edm::ParameterSetDescription l1InputRegionDesc;
207  l1InputRegionDesc.add<std::string>("type");
208  l1InputRegionDesc.add<double>("minEt");
209  l1InputRegionDesc.add<double>("maxEt");
210  l1InputRegionDesc.add<double>("regionEtaMargin");
211  l1InputRegionDesc.add<double>("regionPhiMargin");
212  l1InputRegionDesc.add<edm::InputTag>("inputColl");
213  desc.addVPSet("l1InputRegions", l1InputRegionDesc, l1InputRegions);
214 
216 }
std::string defaultModuleLabel()
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 219 of file HLTRecHitInAllL1RegionsProducer.cc.

References edmPickEvents::event, input, eostools::move(), Skims_PA_cff::name, rpcPointValidation_cfi::recHit, FastTrackerRecHitMaskProducer_cfi::recHits, nano_mu_digi_cff::region, singleTopDQM_cfi::setup, and GeomDetEnumerators::subDetGeom.

219  {
220  // get the collection geometry:
221  auto const& caloGeom = setup.getData(caloGeometryToken_);
222 
223  std::vector<RectangularEtaPhiRegion> regions;
224  std::for_each(l1RegionData_.begin(),
225  l1RegionData_.end(),
226  [&event, &setup, &regions](const std::unique_ptr<L1RegionDataBase>& input) {
227  input->getEtaPhiRegions(event, setup, regions);
228  });
229 
230  for (size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
232  event.getByToken(recHitTokens_[recHitCollNr], recHits);
233 
234  if (!(recHits.isValid())) {
235  edm::LogError("ProductNotFound") << "could not get a handle on the " << typeid(RecHitCollectionType).name()
236  << " named " << recHitLabels_[recHitCollNr].encode() << std::endl;
237  continue;
238  }
239 
240  auto filteredRecHits = std::make_unique<RecHitCollectionType>();
241 
242  if (!recHits->empty()) {
243  const CaloSubdetectorGeometry* subDetGeom = caloGeom.getSubdetectorGeometry(recHits->front().id());
244  if (!regions.empty()) {
245  for (const RecHitType& recHit : *recHits) {
246  auto this_cell = subDetGeom->getGeometry(recHit.id());
247  for (const auto& region : regions) {
248  if (region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
249  filteredRecHits->push_back(recHit);
250  break;
251  }
252  }
253  }
254  } //end check of empty regions
255  } //end check of empty rec-hits
256  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
257  event.put(std::move(filteredRecHits), productLabels_[recHitCollNr]);
258  } //end loop over all rec hit collections
259 }
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
constexpr SubDetector subDetGeom[21]
Log< level::Error, false > LogError
edm::SortedCollection< RecHitType > RecHitCollectionType
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
static std::string const input
Definition: EdmProvDump.cc:50
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1

Member Data Documentation

◆ caloGeometryToken_

template<typename RecHitType >
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HLTRecHitInAllL1RegionsProducer< RecHitType >::caloGeometryToken_
private

Definition at line 132 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ l1RegionData_

template<typename RecHitType >
std::vector<std::unique_ptr<L1RegionDataBase> > HLTRecHitInAllL1RegionsProducer< RecHitType >::l1RegionData_
private

Definition at line 125 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ productLabels_

template<typename RecHitType >
std::vector<std::string> HLTRecHitInAllL1RegionsProducer< RecHitType >::productLabels_
private

Definition at line 128 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ recHitLabels_

template<typename RecHitType >
std::vector<edm::InputTag> HLTRecHitInAllL1RegionsProducer< RecHitType >::recHitLabels_
private

Definition at line 127 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ recHitTokens_

template<typename RecHitType >
std::vector<edm::EDGetTokenT<RecHitCollectionType> > HLTRecHitInAllL1RegionsProducer< RecHitType >::recHitTokens_
private

Definition at line 130 of file HLTRecHitInAllL1RegionsProducer.cc.