CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTRecHitInAllL1RegionsProducer (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTRecHitInAllL1RegionsProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 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(), HLT_FULL_cff::l1InputRegions, TrackValidation_cff::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_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
tuple l1InputRegions
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
L1RegionDataBase * createL1RegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
template<typename RecHitType >
HLTRecHitInAllL1RegionsProducer< RecHitType >::~HLTRecHitInAllL1RegionsProducer ( )
inline

Definition at line 92 of file HLTRecHitInAllL1RegionsProducer.h.

92 {}

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.h.

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") << " 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;
268  }
269 
270 }
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(), HLT_FULL_cff::InputTag, HLT_FULL_cff::l1InputRegions, HLT_FULL_cff::recHitLabels, 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 }
std::string defaultModuleLabel()
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
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)
tuple l1InputRegions
template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 195 of file HLTRecHitInAllL1RegionsProducer.h.

References event(), edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), edm::HandleBase::id(), input, edm::HandleBase::isValid(), mergeVDriftHistosByStation::name, position, HLT_FULL_cff::recHits, HLT_FULL_cff::region, 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<EcalEtaPhiRegion> 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  std::auto_ptr<RecHitCollectionType> filteredRecHits(new 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  const CaloCellGeometry* recHitGeom = subDetGeom->getGeometry(recHit.id());
228  GlobalPoint position = recHitGeom->getPosition();
229  for(const auto& region : regions){
230  if(region.inRegion(position)) {
231  filteredRecHits->push_back(recHit);
232  break;
233  }
234  }
235  }
236  }//end check of empty regions
237  }//end check of empty rec-hits
238  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
239  event.put(filteredRecHits,productLabels_[recHitCollNr]);
240  }//end loop over all rec hit collections
241 
242 }
ProductID id() const
Definition: HandleBase.cc:15
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
edm::SortedCollection< RecHitType > RecHitCollectionType
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
static std::string const input
Definition: EdmProvDump.cc:44
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:75
SubDetector subDetGeom[18]
const T & get() const
Definition: EventSetup.h:56
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.

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.