CMS 3D CMS Logo

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

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

Inheritance diagram for EgammaHLTElectronCombinedIsolationProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTElectronCombinedIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
 
 ~EgammaHLTElectronCombinedIsolationProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::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)
 
 ~ProducerBase () noexcept(false) override
 
- 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > CaloIsolTag_
 
std::vector< double > CaloIsolWeight_
 
edm::ParameterSet conf_
 
edm::EDGetTokenT< reco::ElectronCollectionelectronProducer_
 
edm::EDGetTokenT< reco::RecoEcalCandidateCollectionrecoEcalCandidateProducer_
 
edm::EDGetTokenT< reco::ElectronIsolationMapTrackIsolTag_
 
double TrackIsolWeight_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ESProduct , Transition Tr = Transition::Event>
auto esConsumes (eventsetup::EventSetupRecordKey const &, ESInputTag const &tag)
 
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

Definition at line 33 of file EgammaHLTElectronCombinedIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 13 of file EgammaHLTElectronCombinedIsolationProducer.cc.

References CaloIsolTag_, CaloIsolWeight_, conf_, electronProducer_, Exception, edm::ParameterSet::getParameter(), recoEcalCandidateProducer_, GlobalPosition_Frontier_DevDB_cff::tag, TrackIsolTag_, and TrackIsolWeight_.

13  : conf_(config) {
14 
15  electronProducer_ = consumes<reco::ElectronCollection>(conf_.getParameter<edm::InputTag>("electronProducer"));
16  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
17 
18  for (edm::InputTag const & tag : conf_.getParameter< std::vector<edm::InputTag> > ("CaloIsolationMapTags"))
19  CaloIsolTag_.push_back(consumes<reco::RecoEcalCandidateIsolationMap>(tag));
20 
21  TrackIsolTag_ = consumes<reco::ElectronIsolationMap>(conf_.getParameter<edm::InputTag>("TrackIsolationMapTag"));
22 
23  CaloIsolWeight_ = conf_.getParameter< std::vector<double> > ("CaloIsolationWeight");
24  TrackIsolWeight_ = conf_.getParameter<double>("TrackIsolationWeight");
25 
26  if (CaloIsolTag_.size() != CaloIsolWeight_.size()){
27  throw cms::Exception("BadConfig") << "vectors CaloIsolationMapTags and CaloIsolationWeight need to have size 3";
28  }
29 
30  //register your products
31  produces < reco::ElectronIsolationMap >();
32 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > CaloIsolTag_
edm::EDGetTokenT< reco::ElectronIsolationMap > TrackIsolTag_
EgammaHLTElectronCombinedIsolationProducer::~EgammaHLTElectronCombinedIsolationProducer ( )
override

Definition at line 34 of file EgammaHLTElectronCombinedIsolationProducer.cc.

35 {}

Member Function Documentation

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

Definition at line 37 of file EgammaHLTElectronCombinedIsolationProducer.cc.

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

37  {
38 
40  desc.add<edm::InputTag>("electronProducer", edm::InputTag(""));
41  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag(""));
42  desc.add<std::vector<edm::InputTag> >("CaloIsolationMapTags", std::vector<edm::InputTag>());
43  desc.add<edm::InputTag>("TrackIsolationMapTag", edm::InputTag(""));
44 desc.add<std::vector<double> >("CaloIsolationWeight", std::vector<double>());
45  desc.add<double>("TrackIsolationWeight", 0);
46  descriptions.add("hltEgammaHLTElectronCombinedIsolationProducer", desc);
47 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTElectronCombinedIsolationProducer::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
override

Definition at line 49 of file EgammaHLTElectronCombinedIsolationProducer.cc.

References CaloIsolTag_, CaloIsolWeight_, edm::AssociationMap< edm::OneToValue< std::vector< reco::RecoEcalCandidate >, float > >::const_iterator, edm::AssociationMap< edm::OneToValue< std::vector< reco::Electron >, float > >::const_iterator, electronProducer_, spr::find(), edm::Event::getByToken(), edm::AssociationMap< Tag >::insert(), edm::Event::put(), recoEcalCandidateProducer_, TrackIsolTag_, and TrackIsolWeight_.

49  {
50 
52  iEvent.getByToken(electronProducer_,electronHandle);
53 
55  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
56 
57  std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > CaloIsoMap;
58  for( unsigned int u=0; u < CaloIsolTag_.size(); u++){
60  if(CaloIsolWeight_[u] != 0)
61  iEvent.getByToken(CaloIsolTag_[u],depMapTemp);
62 
63  CaloIsoMap.push_back(depMapTemp);
64  }
65 
67  if(TrackIsolWeight_ != 0)
68  iEvent.getByToken(TrackIsolTag_,TrackIsoMap);
69 
70  reco::ElectronIsolationMap TotalIsolMap(electronHandle);
71  double TotalIso=0;
72  for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
73  TotalIso=0;
74  reco::ElectronRef electronref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin()));
75  const reco::SuperClusterRef theEleClus = electronref->superCluster();
76 
77  //look for corresponding recoecal candidates to search for in the ecal and Hcal iso map
78  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
79  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
80  const reco::SuperClusterRef cluster = recoecalcandref->superCluster();
81  if(&(*cluster) == &(*theEleClus)) {//recoecalcand and electron have the same SC
82  for(unsigned int u=0; u < CaloIsolTag_.size() ;u++){
83  if(CaloIsolWeight_[u]==0){continue;}
84  reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*CaloIsoMap[u]).find( recoecalcandref );
85  TotalIso += mapi->val * CaloIsolWeight_[u];
86  }
87  break;
88  }
89  }
90 
91  //add the track isolation
92  if(TrackIsolWeight_ != 0){
93  reco::ElectronIsolationMap::const_iterator mapi = (*TrackIsoMap).find( electronref );
94  TotalIso += mapi->val * TrackIsolWeight_;
95  }
96  TotalIsolMap.insert(electronref, TotalIso);
97 
98  }
99 
100  iEvent.put(std::make_unique<reco::ElectronIsolationMap>(TotalIsolMap));
101 
102 }
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< edm::EDGetTokenT< reco::RecoEcalCandidateIsolationMap > > CaloIsolTag_
edm::EDGetTokenT< reco::ElectronIsolationMap > TrackIsolTag_

Member Data Documentation

std::vector<edm::EDGetTokenT<reco::RecoEcalCandidateIsolationMap> > EgammaHLTElectronCombinedIsolationProducer::CaloIsolTag_
private
std::vector<double> EgammaHLTElectronCombinedIsolationProducer::CaloIsolWeight_
private
edm::ParameterSet EgammaHLTElectronCombinedIsolationProducer::conf_
private
edm::EDGetTokenT<reco::ElectronCollection> EgammaHLTElectronCombinedIsolationProducer::electronProducer_
private
edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTElectronCombinedIsolationProducer::recoEcalCandidateProducer_
private
edm::EDGetTokenT<reco::ElectronIsolationMap> EgammaHLTElectronCombinedIsolationProducer::TrackIsolTag_
private
double EgammaHLTElectronCombinedIsolationProducer::TrackIsolWeight_
private