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 101 of file HLTRecHitInAllL1RegionsProducer.cc.

Member Typedef Documentation

◆ RecHitCollectionType

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

Definition at line 102 of file HLTRecHitInAllL1RegionsProducer.cc.

Constructor & Destructor Documentation

◆ HLTRecHitInAllL1RegionsProducer()

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

Definition at line 127 of file HLTRecHitInAllL1RegionsProducer.cc.

References deDxTools::esConsumes().

129  const std::vector<edm::ParameterSet> l1InputRegions =
130  para.getParameter<std::vector<edm::ParameterSet>>("l1InputRegions");
131  for (auto& pset : l1InputRegions) {
132  const std::string type = pset.getParameter<std::string>("type");
133  // meh I was going to use a factory but it was going to be overly complex for my needs
134  l1RegionData_.emplace_back(createL1RegionData(type, pset, consumesCollector()));
135  }
136  recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>("recHitLabels");
137  productLabels_ = para.getParameter<std::vector<std::string>>("productLabels");
138 
139  for (unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
140  recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
141  produces<RecHitCollectionType>(productLabels_[collNr]);
142  }
143 }
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 106 of file HLTRecHitInAllL1RegionsProducer.cc.

106 {}

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 253 of file HLTRecHitInAllL1RegionsProducer.cc.

References Exception.

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

◆ fillDescriptions()

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

Definition at line 146 of file HLTRecHitInAllL1RegionsProducer.cc.

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

146  {
148  std::vector<std::string> productTags;
149  productTags.push_back("EcalRegionalRecHitsEB");
150  productTags.push_back("EcalRegionalRecHitsEE");
151  desc.add<std::vector<std::string>>("productLabels", productTags);
152  std::vector<edm::InputTag> recHitLabels;
153  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
154  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
155  recHitLabels.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
156  desc.add<std::vector<edm::InputTag>>("recHitLabels", recHitLabels);
157  std::vector<edm::ParameterSet> l1InputRegions;
158 
159  edm::ParameterSet emIsoPSet;
160  emIsoPSet.addParameter<std::string>("type", "L1EmParticle");
161  emIsoPSet.addParameter<double>("minEt", 5);
162  emIsoPSet.addParameter<double>("maxEt", 999);
163  emIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
164  emIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
165  emIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:NonIsolated"));
166  l1InputRegions.push_back(emIsoPSet);
167  edm::ParameterSet emNonIsoPSet;
168  emNonIsoPSet.addParameter<std::string>("type", "L1EmParticle");
169  emNonIsoPSet.addParameter<double>("minEt", 5);
170  emNonIsoPSet.addParameter<double>("maxEt", 999);
171  emNonIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
172  emNonIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
173  emNonIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:Isolated"));
174  l1InputRegions.push_back(emNonIsoPSet);
175 
176  // Why no Central Jets here? They are present in the python config, e.g. OnLine_HLT_GRun.py
177  // SHarper: because these are the default parameters designed to reproduce the original (no jets) behaviour
178  //
179  edm::ParameterSet egPSet;
180  egPSet.addParameter<std::string>("type", "EGamma");
181  egPSet.addParameter<double>("minEt", 5);
182  egPSet.addParameter<double>("maxEt", 999);
183  egPSet.addParameter<double>("regionEtaMargin", 0.4);
184  egPSet.addParameter<double>("regionPhiMargin", 0.5);
185  egPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
186  l1InputRegions.push_back(egPSet);
187 
189  jetPSet.addParameter<std::string>("type", "EGamma");
190  jetPSet.addParameter<double>("minEt", 200);
191  jetPSet.addParameter<double>("maxEt", 999);
192  jetPSet.addParameter<double>("regionEtaMargin", 0.4);
193  jetPSet.addParameter<double>("regionPhiMargin", 0.5);
194  jetPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
195  l1InputRegions.push_back(jetPSet);
196 
197  edm::ParameterSetDescription l1InputRegionDesc;
198  l1InputRegionDesc.add<std::string>("type");
199  l1InputRegionDesc.add<double>("minEt");
200  l1InputRegionDesc.add<double>("maxEt");
201  l1InputRegionDesc.add<double>("regionEtaMargin");
202  l1InputRegionDesc.add<double>("regionPhiMargin");
203  l1InputRegionDesc.add<edm::InputTag>("inputColl");
204  desc.addVPSet("l1InputRegions", l1InputRegionDesc, l1InputRegions);
205 
207 }
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 210 of file HLTRecHitInAllL1RegionsProducer.cc.

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

210  {
211  // get the collection geometry:
212  auto const& caloGeom = setup.getData(caloGeometryToken_);
213 
214  std::vector<RectangularEtaPhiRegion> regions;
215  std::for_each(l1RegionData_.begin(),
216  l1RegionData_.end(),
217  [&event, &setup, &regions](const std::unique_ptr<L1RegionDataBase>& input) {
218  input->getEtaPhiRegions(event, setup, regions);
219  });
220 
221  for (size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
223  event.getByToken(recHitTokens_[recHitCollNr], recHits);
224 
225  if (!(recHits.isValid())) {
226  edm::LogError("ProductNotFound") << "could not get a handle on the " << typeid(RecHitCollectionType).name()
227  << " named " << recHitLabels_[recHitCollNr].encode() << std::endl;
228  continue;
229  }
230 
231  auto filteredRecHits = std::make_unique<RecHitCollectionType>();
232 
233  if (!recHits->empty()) {
234  const CaloSubdetectorGeometry* subDetGeom = caloGeom.getSubdetectorGeometry(recHits->front().id());
235  if (!regions.empty()) {
236  for (const RecHitType& recHit : *recHits) {
237  auto this_cell = subDetGeom->getGeometry(recHit.id());
238  for (const auto& region : regions) {
239  if (region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
240  filteredRecHits->push_back(recHit);
241  break;
242  }
243  }
244  }
245  } //end check of empty regions
246  } //end check of empty rec-hits
247  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
248  event.put(std::move(filteredRecHits), productLabels_[recHitCollNr]);
249  } //end loop over all rec hit collections
250 }
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 123 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ l1RegionData_

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

Definition at line 116 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ productLabels_

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

Definition at line 119 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ recHitLabels_

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

Definition at line 118 of file HLTRecHitInAllL1RegionsProducer.cc.

◆ recHitTokens_

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

Definition at line 121 of file HLTRecHitInAllL1RegionsProducer.cc.