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 Attributes
EgammaHLTElectronCombinedIsolationProducer Class Reference

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

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

Public Member Functions

 EgammaHLTElectronCombinedIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~EgammaHLTElectronCombinedIsolationProducer ()
 
- 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)
 
 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::EDProducer
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::ElectronCollection
electronProducer_
 
edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
recoEcalCandidateProducer_
 
edm::EDGetTokenT
< reco::ElectronIsolationMap
TrackIsolTag_
 
double TrackIsolWeight_
 

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

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 ( )

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(), edm::ParameterSetDescription::add(), and HLT_25ns10e33_v2_cff::InputTag.

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::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

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  std::auto_ptr<reco::ElectronIsolationMap> isolMap(new reco::ElectronIsolationMap(TotalIsolMap));
101  iEvent.put(isolMap);
102 
103 }
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
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