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 (const std::string &iProcessName, std::vector< const char * > &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 74 of file HLTRecHitInAllL1RegionsProducer.h.

Member Typedef Documentation

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

Definition at line 76 of file HLTRecHitInAllL1RegionsProducer.h.

Constructor & Destructor Documentation

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

Definition at line 101 of file HLTRecHitInAllL1RegionsProducer.h.

References edm::ParameterSet::getParameter(), HLT_25ns14e33_v3_cff::l1InputRegions, and AlCaHLTBitMon_QueryRunRegistry::string.

102 {
103  const std::vector<edm::ParameterSet> l1InputRegions = para.getParameter<std::vector<edm::ParameterSet>>("l1InputRegions");
104  for(auto& pset : l1InputRegions){
105  const std::string type=pset.getParameter<std::string>("type");
106  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
107  }
108  recHitLabels_ =para.getParameter<std::vector<edm::InputTag>>("recHitLabels");
109  productLabels_=para.getParameter<std::vector<std::string>>("productLabels");
110 
111  for (unsigned int collNr=0; collNr<recHitLabels_.size(); collNr++) {
112  recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
113  produces<RecHitCollectionType> (productLabels_[collNr]);
114  }
115 }
type
Definition: HCALResponse.h:21
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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 81 of file HLTRecHitInAllL1RegionsProducer.h.

81 {}

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 215 of file HLTRecHitInAllL1RegionsProducer.h.

References edm::hlt::Exception.

216 {
217  if(type=="L1EmParticle"){
218  return new L1RegionData<l1extra::L1EmParticleCollection>(para,consumesColl);
219  }else if(type=="L1JetParticle"){
220  return new L1RegionData<l1extra::L1JetParticleCollection>(para,consumesColl);
221  }else if(type=="L1MuonParticle"){
222  return new L1RegionData<l1extra::L1MuonParticleCollection>(para,consumesColl);
223  }else{
224  //this is a major issue and could lead to rather subtle efficiency losses, so if its incorrectly configured, we're aborting the job!
225  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;
226  }
227 
228 }
type
Definition: HCALResponse.h:21
template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 117 of file HLTRecHitInAllL1RegionsProducer.h.

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

118 {
120  std::vector<std::string> productTags;
121  productTags.push_back("EcalRegionalRecHitsEB");
122  productTags.push_back("EcalRegionalRecHitsEE");
123  desc.add<std::vector<std::string>>("productLabels", productTags);
124  std::vector<edm::InputTag> recHitLabels;
125  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
126  recHitLabels.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
127  recHitLabels.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
128  desc.add<std::vector<edm::InputTag>>("recHitLabels", recHitLabels);
129  std::vector<edm::ParameterSet> l1InputRegions;
130  edm::ParameterSet emIsoPSet;
131  emIsoPSet.addParameter<std::string>("type","L1EmParticle");
132  emIsoPSet.addParameter<double>("minEt",5);
133  emIsoPSet.addParameter<double>("maxEt",999);
134  emIsoPSet.addParameter<double>("regionEtaMargin",0.14);
135  emIsoPSet.addParameter<double>("regionPhiMargin",0.4);
136  emIsoPSet.addParameter<edm::InputTag>("inputColl",edm::InputTag("hltL1extraParticles:NonIsolated"));
137  l1InputRegions.push_back(emIsoPSet);
138  edm::ParameterSet emNonIsoPSet;
139  emNonIsoPSet.addParameter<std::string>("type","L1EmParticle");
140  emNonIsoPSet.addParameter<double>("minEt",5);
141  emNonIsoPSet.addParameter<double>("maxEt",999);
142  emNonIsoPSet.addParameter<double>("regionEtaMargin",0.14);
143  emNonIsoPSet.addParameter<double>("regionPhiMargin",0.4);
144  emNonIsoPSet.addParameter<edm::InputTag>("inputColl",edm::InputTag("hltL1extraParticles:Isolated"));
145  l1InputRegions.push_back(emNonIsoPSet);
146 
147  edm::ParameterSetDescription l1InputRegionDesc;
148  l1InputRegionDesc.add<std::string>("type");
149  l1InputRegionDesc.add<double>("minEt");
150  l1InputRegionDesc.add<double>("maxEt");
151  l1InputRegionDesc.add<double>("regionEtaMargin");
152  l1InputRegionDesc.add<double>("regionPhiMargin");
153  l1InputRegionDesc.add<edm::InputTag>("inputColl");
154  desc.addVPSet("l1InputRegions",l1InputRegionDesc,l1InputRegions);
155 
157 }
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)
template<typename RecHitType >
void HLTRecHitInAllL1RegionsProducer< RecHitType >::produce ( edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 161 of file HLTRecHitInAllL1RegionsProducer.h.

References event(), edm::EventSetup::get(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), edm::HandleBase::id(), input, edm::HandleBase::isValid(), mergeVDriftHistosByStation::name, position, HLT_50ns_5e33_v3_cff::recHits, HLT_50ns_5e33_v3_cff::region, and GeomDetEnumerators::subDetGeom.

161  {
162 
163  // get the collection geometry:
164  edm::ESHandle<CaloGeometry> caloGeomHandle;
165  setup.get<CaloGeometryRecord>().get(caloGeomHandle);
166 
167  // Get the CaloGeometry
168  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
169  setup.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
170 
171  std::vector<EcalEtaPhiRegion> regions;
172  std::for_each(l1RegionData_.begin(),l1RegionData_.end(),
173  [&event,&regions,l1CaloGeom](const std::unique_ptr<L1RegionDataBase>& input)
174  {input->getEtaPhiRegions(event,regions,*l1CaloGeom);}
175  );
176 
177  for(size_t recHitCollNr=0;recHitCollNr<recHitTokens_.size();recHitCollNr++){
179  event.getByToken(recHitTokens_[recHitCollNr],recHits);
180 
181  if (!(recHits.isValid())) {
182  edm::LogError("ProductNotFound")<< "could not get a handle on the "<<typeid(RecHitCollectionType).name() <<" named "<< recHitLabels_[recHitCollNr].encode() << std::endl;
183  continue;
184  }
185 
186  std::auto_ptr<RecHitCollectionType> filteredRecHits(new RecHitCollectionType);
187 
188  if(!recHits->empty()){
189  const CaloSubdetectorGeometry* subDetGeom=caloGeomHandle->getSubdetectorGeometry(recHits->front().id());
190  if(!regions.empty()){
191 
192  for(const RecHitType& recHit : *recHits){
193  const CaloCellGeometry* recHitGeom = subDetGeom->getGeometry(recHit.id());
194  GlobalPoint position = recHitGeom->getPosition();
195  for(const auto& region : regions){
196  if(region.inRegion(position)) {
197  filteredRecHits->push_back(recHit);
198  break;
199  }
200  }
201  }
202  }//end check of empty regions
203  }//end check of empty rec-hits
204  // std::cout <<"putting fileter coll in "<<filteredRecHits->size()<<std::endl;
205  event.put(filteredRecHits,productLabels_[recHitCollNr]);
206  }//end loop over all rec hit collections
207 
208 }
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:43
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:55
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 89 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 92 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 91 of file HLTRecHitInAllL1RegionsProducer.h.

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

Definition at line 94 of file HLTRecHitInAllL1RegionsProducer.h.