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

#include <HLTRecHitInAllL1RegionsProducer.h>

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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 85 of file HLTRecHitInAllL1RegionsProducer.h.

Member Typedef Documentation

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

Definition at line 87 of file HLTRecHitInAllL1RegionsProducer.h.

Constructor & Destructor Documentation

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

Definition at line 112 of file HLTRecHitInAllL1RegionsProducer.h.

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

113 {
114  const std::vector<edm::ParameterSet> l1InputRegions = para.getParameter<std::vector<edm::ParameterSet>>("l1InputRegions");
115  for(auto& pset : l1InputRegions){
116  const std::string type=pset.getParameter<std::string>("type");
117  l1RegionData_.emplace_back(createL1RegionData(type,pset,consumesCollector())); //meh I was going to use a factory but it was going to be overly complex for my needs
118  }
119  recHitLabels_ =para.getParameter<std::vector<edm::InputTag>>("recHitLabels");
120  productLabels_=para.getParameter<std::vector<std::string>>("productLabels");
121 
122  for (unsigned int collNr=0; collNr<recHitLabels_.size(); collNr++) {
123  recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
124  produces<RecHitCollectionType> (productLabels_[collNr]);
125  }
126 }
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 248 of file HLTRecHitInAllL1RegionsProducer.h.

References Exception.

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

Definition at line 128 of file HLTRecHitInAllL1RegionsProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSet::addParameter(), edm::ParameterSetDescription::addVPSet(), defaultModuleLabel(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

195  {
196 
197  // get the collection geometry:
198  edm::ESHandle<CaloGeometry> caloGeomHandle;
199  setup.get<CaloGeometryRecord>().get(caloGeomHandle);
200 
201  // Get the CaloGeometry
202  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
203  setup.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
204 
205  std::vector<RectangularEtaPhiRegion> regions;
206  std::for_each(l1RegionData_.begin(),l1RegionData_.end(),
207  [&event,&regions,l1CaloGeom](const std::unique_ptr<L1RegionDataBase>& input)
208  {input->getEtaPhiRegions(event,regions,*l1CaloGeom);}
209  );
210 
211  for(size_t recHitCollNr=0;recHitCollNr<recHitTokens_.size();recHitCollNr++){
213  event.getByToken(recHitTokens_[recHitCollNr],recHits);
214 
215  if (!(recHits.isValid())) {
216  edm::LogError("ProductNotFound")<< "could not get a handle on the "<<typeid(RecHitCollectionType).name() <<" named "<< recHitLabels_[recHitCollNr].encode() << std::endl;
217  continue;
218  }
219 
220  auto filteredRecHits = std::make_unique<RecHitCollectionType>();
221 
222  if(!recHits->empty()){
223  const CaloSubdetectorGeometry* subDetGeom=caloGeomHandle->getSubdetectorGeometry(recHits->front().id());
224  if(!regions.empty()){
225 
226  for(const RecHitType& recHit : *recHits){
227  auto this_cell = subDetGeom->getGeometry(recHit.id());
228  for(const auto& region : regions){
229  if (region.inRegion(this_cell->etaPos(),this_cell->phiPos())) {
230  filteredRecHits->push_back(recHit);
231  break;
232  }
233  }
234  }
235  }//end check of empty regions
236  }//end check of empty rec-hits
237  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
238  event.put(std::move(filteredRecHits),productLabels_[recHitCollNr]);
239  }//end loop over all rec hit collections
240 
241 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
edm::SortedCollection< RecHitType > RecHitCollectionType
static std::string const input
Definition: EdmProvDump.cc:44
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:74
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.
const T & get() const
Definition: EventSetup.h:59
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 100 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 103 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 102 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 105 of file HLTRecHitInAllL1RegionsProducer.h.