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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

template<typename RecHitType>
class HLTRecHitInAllL1RegionsProducer< RecHitType >

Definition at line 94 of file HLTRecHitInAllL1RegionsProducer.cc.

Member Typedef Documentation

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

Definition at line 95 of file HLTRecHitInAllL1RegionsProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 118 of file HLTRecHitInAllL1RegionsProducer.cc.

References edm::ParameterSet::getParameter(), HLT_2018_cff::l1InputRegions, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

118  {
119  const std::vector<edm::ParameterSet> l1InputRegions =
120  para.getParameter<std::vector<edm::ParameterSet>>("l1InputRegions");
121  for (auto& pset : l1InputRegions) {
122  const std::string type = pset.getParameter<std::string>("type");
123  l1RegionData_.emplace_back(createL1RegionData(
124  type,
125  pset,
126  consumesCollector())); //meh I was going to use a factory but it was going to be overly complex for my needs
127  }
128  recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>("recHitLabels");
129  productLabels_ = para.getParameter<std::vector<std::string>>("productLabels");
130 
131  for (unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
132  recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
133  produces<RecHitCollectionType>(productLabels_[collNr]);
134  }
135 }
type
Definition: HCALResponse.h:21
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
L1RegionDataBase * createL1RegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
template<typename RecHitType >
HLTRecHitInAllL1RegionsProducer< RecHitType >::~HLTRecHitInAllL1RegionsProducer ( )
inlineoverride

Member Function Documentation

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

Definition at line 249 of file HLTRecHitInAllL1RegionsProducer.cc.

References Exception.

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

Definition at line 137 of file HLTRecHitInAllL1RegionsProducer.cc.

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

137  {
139  std::vector<std::string> productTags;
140  productTags.push_back("EcalRegionalRecHitsEB");
141  productTags.push_back("EcalRegionalRecHitsEE");
142  desc.add<std::vector<std::string>>("productLabels", productTags);
143  std::vector<edm::InputTag> recHitLabels;
144  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
145  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
146  recHitLabels.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
147  desc.add<std::vector<edm::InputTag>>("recHitLabels", recHitLabels);
148  std::vector<edm::ParameterSet> l1InputRegions;
149 
150  edm::ParameterSet emIsoPSet;
151  emIsoPSet.addParameter<std::string>("type", "L1EmParticle");
152  emIsoPSet.addParameter<double>("minEt", 5);
153  emIsoPSet.addParameter<double>("maxEt", 999);
154  emIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
155  emIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
156  emIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:NonIsolated"));
157  l1InputRegions.push_back(emIsoPSet);
158  edm::ParameterSet emNonIsoPSet;
159  emNonIsoPSet.addParameter<std::string>("type", "L1EmParticle");
160  emNonIsoPSet.addParameter<double>("minEt", 5);
161  emNonIsoPSet.addParameter<double>("maxEt", 999);
162  emNonIsoPSet.addParameter<double>("regionEtaMargin", 0.14);
163  emNonIsoPSet.addParameter<double>("regionPhiMargin", 0.4);
164  emNonIsoPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltL1extraParticles:Isolated"));
165  l1InputRegions.push_back(emNonIsoPSet);
166 
167  // Why no Central Jets here? They are present in the python config, e.g. OnLine_HLT_GRun.py
168  // SHarper: because these are the default parameters designed to reproduce the original (no jets) behaviour
169  //
170  edm::ParameterSet egPSet;
171  egPSet.addParameter<std::string>("type", "EGamma");
172  egPSet.addParameter<double>("minEt", 5);
173  egPSet.addParameter<double>("maxEt", 999);
174  egPSet.addParameter<double>("regionEtaMargin", 0.4);
175  egPSet.addParameter<double>("regionPhiMargin", 0.5);
176  egPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
177  l1InputRegions.push_back(egPSet);
178 
180  jetPSet.addParameter<std::string>("type", "EGamma");
181  jetPSet.addParameter<double>("minEt", 200);
182  jetPSet.addParameter<double>("maxEt", 999);
183  jetPSet.addParameter<double>("regionEtaMargin", 0.4);
184  jetPSet.addParameter<double>("regionPhiMargin", 0.5);
185  jetPSet.addParameter<edm::InputTag>("inputColl", edm::InputTag("hltCaloStage2Digis"));
186  l1InputRegions.push_back(jetPSet);
187 
188  edm::ParameterSetDescription l1InputRegionDesc;
189  l1InputRegionDesc.add<std::string>("type");
190  l1InputRegionDesc.add<double>("minEt");
191  l1InputRegionDesc.add<double>("maxEt");
192  l1InputRegionDesc.add<double>("regionEtaMargin");
193  l1InputRegionDesc.add<double>("regionPhiMargin");
194  l1InputRegionDesc.add<edm::InputTag>("inputColl");
195  desc.addVPSet("l1InputRegions", l1InputRegionDesc, l1InputRegions);
196 
198 }
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
std::string defaultModuleLabel()
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:124
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 201 of file HLTRecHitInAllL1RegionsProducer.cc.

References event(), edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), edm::HandleBase::id(), input, edm::HandleBase::isValid(), eostools::move(), Skims_PA_cff::name, rpcPointValidation_cfi::recHit, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2018_cff::region, and GeomDetEnumerators::subDetGeom.

201  {
202  // get the collection geometry:
203  edm::ESHandle<CaloGeometry> caloGeomHandle;
204  setup.get<CaloGeometryRecord>().get(caloGeomHandle);
205 
206  // Get the CaloGeometry
208  setup.get<L1CaloGeometryRecord>().get(l1CaloGeom);
209 
210  std::vector<RectangularEtaPhiRegion> regions;
211  std::for_each(l1RegionData_.begin(),
212  l1RegionData_.end(),
213  [&event, &regions, l1CaloGeom](const std::unique_ptr<L1RegionDataBase>& input) {
214  input->getEtaPhiRegions(event, regions, *l1CaloGeom);
215  });
216 
217  for (size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
219  event.getByToken(recHitTokens_[recHitCollNr], recHits);
220 
221  if (!(recHits.isValid())) {
222  edm::LogError("ProductNotFound") << "could not get a handle on the " << typeid(RecHitCollectionType).name()
223  << " named " << recHitLabels_[recHitCollNr].encode() << std::endl;
224  continue;
225  }
226 
227  auto filteredRecHits = std::make_unique<RecHitCollectionType>();
228 
229  if (!recHits->empty()) {
230  const CaloSubdetectorGeometry* subDetGeom = caloGeomHandle->getSubdetectorGeometry(recHits->front().id());
231  if (!regions.empty()) {
232  for (const RecHitType& recHit : *recHits) {
233  auto this_cell = subDetGeom->getGeometry(recHit.id());
234  for (const auto& region : regions) {
235  if (region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
236  filteredRecHits->push_back(recHit);
237  break;
238  }
239  }
240  }
241  } //end check of empty regions
242  } //end check of empty rec-hits
243  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
244  event.put(std::move(filteredRecHits), productLabels_[recHitCollNr]);
245  } //end loop over all rec hit collections
246 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
edm::SortedCollection< RecHitType > RecHitCollectionType
static std::string const input
Definition: EdmProvDump.cc:48
const_reference front() const
SubDetector subDetGeom[21]
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool isValid() const
Definition: HandleBase.h:70
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
T get() const
Definition: EventSetup.h:73
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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

Definition at line 109 of file HLTRecHitInAllL1RegionsProducer.cc.

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

Definition at line 112 of file HLTRecHitInAllL1RegionsProducer.cc.

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

Definition at line 111 of file HLTRecHitInAllL1RegionsProducer.cc.

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

Definition at line 114 of file HLTRecHitInAllL1RegionsProducer.cc.