CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType > Class Template Reference

#include <HLTCaloObjInRegionsProducer.h>

Inheritance diagram for HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTCaloObjInRegionsProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTCaloObjInRegionsProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Static Private Member Functions

static std::unique_ptr< CaloObjCollType > makeFilteredColl (const edm::Handle< CaloObjCollType > &inputColl, const edm::ESHandle< CaloGeometry > &caloGeomHandle, const std::vector< EtaPhiRegion > &regions)
 
static bool validIDForGeom (const DetId &id)
 

Private Attributes

std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
 
std::vector< edm::InputTaginputCollTags_
 
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
 
std::vector< std::string > outputProductNames_
 

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

template<typename CaloObjType, typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
class HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >

Definition at line 107 of file HLTCaloObjInRegionsProducer.h.

Constructor & Destructor Documentation

template<typename CaloObjType , typename CaloObjCollType >
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::HLTCaloObjInRegionsProducer ( const edm::ParameterSet ps)

Definition at line 135 of file HLTCaloObjInRegionsProducer.h.

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

136 {
137  const std::vector<edm::ParameterSet> etaPhiRegions = para.getParameter<std::vector<edm::ParameterSet>>("etaPhiRegions");
138  for(auto& pset : etaPhiRegions){
139  const std::string type=pset.getParameter<std::string>("type");
140  etaPhiRegionData_.emplace_back(createEtaPhiRegionData(type,pset,consumesCollector())); //meh I was going to use a factory but it was going to be overly complex for my needs
141  }
142 
143  outputProductNames_=para.getParameter<std::vector<std::string>>("outputProductNames");
144  inputCollTags_=para.getParameter<std::vector<edm::InputTag>>("inputCollTags");
145  if(outputProductNames_.size()!=inputCollTags_.size()){
146  throw cms::Exception("InvalidConfiguration") <<" error outputProductNames and inputCollTags must be the same size, they are "<<outputProductNames_.size()<<" vs "<<inputCollTags_.size();
147  }
148  for (unsigned int collNr=0; collNr<inputCollTags_.size(); collNr++) {
149  inputTokens_.push_back(consumes<CaloObjCollType>(inputCollTags_[collNr]));
150  produces<CaloObjCollType> (outputProductNames_[collNr]);
151  }
152 }
type
Definition: HCALResponse.h:21
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
std::vector< edm::InputTag > inputCollTags_
EtaPhiRegionDataBase * createEtaPhiRegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
std::vector< std::string > outputProductNames_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::~HLTCaloObjInRegionsProducer ( )
inlineoverride

Definition at line 115 of file HLTCaloObjInRegionsProducer.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

115 {}

Member Function Documentation

template<typename CaloObjType , typename CaloObjCollType >
EtaPhiRegionDataBase * HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::createEtaPhiRegionData ( const std::string &  type,
const edm::ParameterSet para,
edm::ConsumesCollector &&  consumesColl 
)
private

Definition at line 282 of file HLTCaloObjInRegionsProducer.h.

References Exception.

Referenced by HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::validIDForGeom().

284 {
285  if(type=="L1EGamma"){
286  return new EtaPhiRegionData<l1t::EGammaBxCollection>(para,consumesColl);
287  }else if(type=="L1Jet"){
288  return new EtaPhiRegionData<l1t::JetBxCollection>(para,consumesColl);
289  }else if(type=="L1Muon"){
290  return new EtaPhiRegionData<l1t::MuonBxCollection>(para,consumesColl);
291  }else if(type=="L1Tau"){
292  return new EtaPhiRegionData<l1t::TauBxCollection>(para,consumesColl);
293  }else if(type=="RecoEcalCandidate"){
294  return new EtaPhiRegionData<reco::RecoEcalCandidateCollection>(para,consumesColl);
295  }else if(type=="RecoChargedCandidate"){
296  return new EtaPhiRegionData<reco::RecoChargedCandidateCollection>(para,consumesColl);
297  }else if(type=="Electron"){
298  return new EtaPhiRegionData<reco::Electron>(para,consumesColl);
299  }else{
300  //this is a major issue and could lead to rather subtle efficiency losses, so if its incorrectly configured, we're aborting the job!
301  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;
302  }
303 
304 }
type
Definition: HCALResponse.h:21
template<typename CaloObjType , typename CaloObjCollType >
void HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 155 of file HLTCaloObjInRegionsProducer.h.

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

156 {
158  std::vector<std::string> outputProductNames;
159  outputProductNames.push_back("EcalRegionalRecHitsEB");
160  desc.add<std::vector<std::string>>("outputProductNames", outputProductNames);
161  std::vector<edm::InputTag> inputColls;
162  inputColls.push_back(edm::InputTag("hltHcalDigis"));
163  desc.add<std::vector<edm::InputTag>>("inputCollTags", inputColls);
164  std::vector<edm::ParameterSet> etaPhiRegions;
165 
166  edm::ParameterSet ecalCandPSet;
167  ecalCandPSet.addParameter<std::string>("type","RecoEcalCandidate");
168  ecalCandPSet.addParameter<double>("minEt",-1);
169  ecalCandPSet.addParameter<double>("maxEt",-1);
170  ecalCandPSet.addParameter<double>("maxDeltaR",0.5);
171  ecalCandPSet.addParameter<double>("maxDEta",0.);
172  ecalCandPSet.addParameter<double>("maxDPhi",0.);
173  ecalCandPSet.addParameter<edm::InputTag>("inputColl",edm::InputTag("hltEgammaCandidates"));
174  etaPhiRegions.push_back(ecalCandPSet);
175 
176 
177  edm::ParameterSetDescription etaPhiRegionDesc;
178  etaPhiRegionDesc.add<std::string>("type");
179  etaPhiRegionDesc.add<double>("minEt");
180  etaPhiRegionDesc.add<double>("maxEt");
181  etaPhiRegionDesc.add<double>("maxDeltaR");
182  etaPhiRegionDesc.add<double>("maxDEta");
183  etaPhiRegionDesc.add<double>("maxDPhi");
184  etaPhiRegionDesc.add<edm::InputTag>("inputColl");
185  desc.addVPSet("etaPhiRegions",etaPhiRegionDesc,etaPhiRegions);
186 
188 }
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 CaloObjType , typename CaloObjCollType >
std::unique_ptr< CaloObjCollType > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl ( const edm::Handle< CaloObjCollType > &  inputColl,
const edm::ESHandle< CaloGeometry > &  caloGeomHandle,
const std::vector< EtaPhiRegion > &  regions 
)
staticprivate

Definition at line 220 of file HLTCaloObjInRegionsProducer.h.

References PVValHelper::eta, CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), edm::HandleBase::id(), dataset::name, GetRecoTauVFromDQM_MC_cff::obj, hiSpikeCleaner_cfi::outputColl, phi, GeomDetEnumerators::subDetGeom, and HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::validIDForGeom().

Referenced by HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::produce().

223 {
224 
225  auto outputColl = std::make_unique<CaloObjCollType>();
226  if(!inputColl->empty()){
227  const CaloSubdetectorGeometry* subDetGeom=caloGeomHandle->getSubdetectorGeometry(inputColl->begin()->id());
228  if(!regions.empty()){
229  for(const CaloObjType& obj : *inputColl){
230  auto objGeom = subDetGeom->getGeometry(obj.id());
231  if(objGeom==nullptr){
232  //wondering what to do here
233  //something is very very wrong
234  //given HLT should never crash or throw, decided to log an error
235  //update: so turns out HCAL can pass through calibration channels in QIE11 so for that module, its an expected behaviour
236  //so we check if the ID is valid
237  if(validIDForGeom(obj.id())) {
238  edm::LogError("HLTCaloObjInRegionsProducer") << "for an object of type "<<typeid(CaloObjType).name()<<" the geometry returned null for id "<<DetId(obj.id()).rawId()<<" with initial ID "<<DetId(inputColl->begin()->id()).rawId()<<" in HLTCaloObjsInRegion, this shouldnt be possible and something has gone wrong, auto accepting hit";
239  }
240  outputColl->push_back(obj);
241  continue;
242  }
243  float eta = objGeom->getPosition().eta();
244  float phi = objGeom->getPosition().phi();
245 
246  for(const auto& region : regions){
247  if(region(eta,phi)) {
248  outputColl->push_back(obj);
249  break;
250  }
251  }
252  }
253  }//end check of empty regions
254  }//end check of empty rec-hits
255  return outputColl;
256 
257 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:44
ProductID id() const
Definition: HandleBase.cc:15
static bool validIDForGeom(const DetId &id)
SubDetector subDetGeom[21]
Definition: DetId.h:18
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.
template<typename CaloObjType , typename CaloObjCollType >
void HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 192 of file HLTCaloObjInRegionsProducer.h.

References event(), edm::EventSetup::get(), input, edm::HandleBase::isValid(), HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl(), eostools::move(), dataset::name, and hiSpikeCleaner_cfi::outputColl.

192  {
193 
194  // get the collection geometry:
195  edm::ESHandle<CaloGeometry> caloGeomHandle;
196  setup.get<CaloGeometryRecord>().get(caloGeomHandle);
197 
198  std::vector<EtaPhiRegion> regions;
199  std::for_each(etaPhiRegionData_.begin(),etaPhiRegionData_.end(),
200  [&event,&regions](const std::unique_ptr<EtaPhiRegionDataBase>& input)
201  {input->getEtaPhiRegions(event,regions);}
202  );
203 
204  for(size_t inputCollNr=0;inputCollNr<inputTokens_.size();inputCollNr++){
206  event.getByToken(inputTokens_[inputCollNr],inputColl);
207 
208  if (!(inputColl.isValid())) {
209  edm::LogError("ProductNotFound")<< "could not get a handle on the "<<typeid(CaloObjCollType).name() <<" named "<< inputCollTags_[inputCollNr].encode() << std::endl;
210  continue;
211  }
212  auto outputColl = makeFilteredColl(inputColl,caloGeomHandle,regions);
213  event.put(std::move(outputColl),outputProductNames_[inputCollNr]);
214  }
215 }
std::vector< edm::EDGetTokenT< CaloObjCollType > > inputTokens_
std::vector< edm::InputTag > inputCollTags_
static std::string const input
Definition: EdmProvDump.cc:44
std::vector< std::string > outputProductNames_
static std::unique_ptr< CaloObjCollType > makeFilteredColl(const edm::Handle< CaloObjCollType > &inputColl, const edm::ESHandle< CaloGeometry > &caloGeomHandle, const std::vector< EtaPhiRegion > &regions)
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
const T & get() const
Definition: EventSetup.h:58
std::vector< std::unique_ptr< EtaPhiRegionDataBase > > etaPhiRegionData_
def move(src, dest)
Definition: eostools.py:510
template<typename CaloObjType , typename CaloObjCollType >
bool HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::validIDForGeom ( const DetId id)
staticprivate

Definition at line 265 of file HLTCaloObjInRegionsProducer.h.

References HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::createEtaPhiRegionData(), DetId::Hcal, HcalEmpty, and HcalOther.

Referenced by HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::makeFilteredColl().

266 {
267  if(id.det()==DetId::Hcal){
268  if(id.subdetId() == HcalSubdetector::HcalEmpty ||
269  id.subdetId() == HcalSubdetector::HcalOther){
270  return false;
271  }
272  }
273  return true;
274 }

Member Data Documentation

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<std::unique_ptr<EtaPhiRegionDataBase> > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::etaPhiRegionData_
private

Definition at line 130 of file HLTCaloObjInRegionsProducer.h.

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<edm::InputTag> HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::inputCollTags_
private

Definition at line 128 of file HLTCaloObjInRegionsProducer.h.

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<edm::EDGetTokenT<CaloObjCollType> > HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::inputTokens_
private

Definition at line 129 of file HLTCaloObjInRegionsProducer.h.

template<typename CaloObjType , typename CaloObjCollType = edm::SortedCollection<CaloObjType>>
std::vector<std::string> HLTCaloObjInRegionsProducer< CaloObjType, CaloObjCollType >::outputProductNames_
private

Definition at line 127 of file HLTCaloObjInRegionsProducer.h.