CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EgammaHLTCombinedIsolationProducer Class Reference

#include <RecoEgamma/EgammaHLTProducers/interface/EgammaHLTCombinedIsolationProducer.h>

Inheritance diagram for EgammaHLTCombinedIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTCombinedIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaHLTCombinedIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > 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
 
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::ParameterSet conf_
 
std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > IsolTag_
 
std::vector< double > IsolWeight_
 
edm::EDGetTokenT< reco::RecoEcalCandidateCollectionrecoEcalCandidateProducer_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer 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

Author
Alessio Ghezzi

$Id:

Definition at line 30 of file EgammaHLTCombinedIsolationProducer.h.

Constructor & Destructor Documentation

EgammaHLTCombinedIsolationProducer::EgammaHLTCombinedIsolationProducer ( const edm::ParameterSet config)
explicit

Definition at line 18 of file EgammaHLTCombinedIsolationProducer.cc.

References conf_, Exception, edm::ParameterSet::getParameter(), mps_fire::i, IsolTag_, IsolWeight_, and recoEcalCandidateProducer_.

18  : conf_(config)
19 {
20  // use configuration file to setup input/output collection names
21  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
22 
23  std::vector<edm::InputTag> tempIsolTag = conf_.getParameter< std::vector<edm::InputTag> > ("IsolationMapTags");
24  for (unsigned int i=0; i<tempIsolTag.size(); i++)
25  IsolTag_.push_back(consumes<reco::RecoEcalCandidateIsolationMap>(tempIsolTag[i]));
26 
27  IsolWeight_ = conf_.getParameter< std::vector<double> > ("IsolationWeight");
28 
29  //register your products
30  produces < reco::RecoEcalCandidateIsolationMap >();
31 
32  if (IsolTag_.size() != IsolWeight_.size()){
33  throw cms::Exception("BadConfig") << "vectors IsolationMapTags and IsolationWeight need to have the same size";
34  }
35 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > IsolTag_
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
EgammaHLTCombinedIsolationProducer::~EgammaHLTCombinedIsolationProducer ( )

Definition at line 37 of file EgammaHLTCombinedIsolationProducer.cc.

38 {}

Member Function Documentation

void EgammaHLTCombinedIsolationProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 40 of file EgammaHLTCombinedIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

40  {
41 
43  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidate"));
44  desc.add<std::vector<edm::InputTag>>("IsolationMapTags", std::vector<edm::InputTag>());
45  desc.add<std::vector<double>>("IsolationWeight", std::vector<double>());
46  descriptions.add("hltEgammaHLTCombinedIsolationProducer", desc);
47 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTCombinedIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 52 of file EgammaHLTCombinedIsolationProducer.cc.

References edm::AssociationMap< edm::OneToValue< std::vector< reco::RecoEcalCandidate >, float > >::const_iterator, spr::find(), edm::Event::getByToken(), edm::AssociationMap< Tag >::insert(), IsolTag_, IsolWeight_, edm::Event::put(), and recoEcalCandidateProducer_.

52  {
53 
55  iEvent.getByToken(recoEcalCandidateProducer_, recoecalcandHandle);
56 
58  double TotalIso=0;
59 
60  std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > IsoMap;
61  for( unsigned int u=0; u < IsolWeight_.size(); u++){
63  if(IsolWeight_[u] != 0)
64  iEvent.getByToken(IsolTag_[u], depMapTemp);
65 
66  IsoMap.push_back(depMapTemp);
67  }
68 
69  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
70  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
71  TotalIso = 0;
72  for( unsigned int u=0; u < IsolWeight_.size(); u++){
73  if(IsolWeight_[u]==0){continue;}
74  reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*IsoMap[u]).find( recoecalcandref );
75  TotalIso += mapi->val * IsolWeight_[u];
76  }
77  TotalIsolMap.insert(recoecalcandref, TotalIso);
78 
79  }
80 
81  iEvent.put(std::make_unique<reco::RecoEcalCandidateIsolationMap>(TotalIsolMap));
82 
83 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > IsolTag_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
void insert(const key_type &k, const data_type &v)
insert an association

Member Data Documentation

edm::ParameterSet EgammaHLTCombinedIsolationProducer::conf_
private
std::vector<edm::EDGetTokenT<reco::RecoEcalCandidateIsolationMap> > EgammaHLTCombinedIsolationProducer::IsolTag_
private
std::vector<double> EgammaHLTCombinedIsolationProducer::IsolWeight_
private
edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTCombinedIsolationProducer::recoEcalCandidateProducer_
private