CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
EgammaHLTElectronCombinedIsolationProducer Class Reference

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

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

Public Member Functions

 EgammaHLTElectronCombinedIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTElectronCombinedIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

std::vector< edm::InputTagCaloIsolTag_
 
std::vector< double > CaloIsolWeight_
 
edm::ParameterSet conf_
 
edm::InputTag electronProducer_
 
edm::InputTag recoEcalCandidateProducer_
 
edm::InputTag TrackIsolTag_
 
double TrackIsolWeight_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Author
Alessio Ghezzi

Definition at line 29 of file EgammaHLTElectronCombinedIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file EgammaHLTElectronCombinedIsolationProducer.cc.

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

32  : conf_(config)
33 {
34 
35  electronProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
36  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
37 
38  CaloIsolTag_ = conf_.getParameter< std::vector<edm::InputTag> > ("CaloIsolationMapTags");
39  //need to be in the order EcalIso, HcalIso, EleTrackIso
40  CaloIsolWeight_ = conf_.getParameter< std::vector<double> > ("CaloIsolationWeight");
41 
42  TrackIsolTag_ = conf_.getParameter<edm::InputTag>("TrackIsolationMapTag");
43  TrackIsolWeight_ = conf_.getParameter<double>("TrackIsolationWeight");
44 
45  if ( CaloIsolTag_.size() != CaloIsolWeight_.size()){
46  throw cms::Exception("BadConfig") << "vectors CaloIsolationMapTags and CaloIsolationWeight need to have size 3";
47  }
48 
49 
50  // SCProducer_ = conf_.getParameter<edm::InputTag>("electronProducer");
51 
52  //register your products
53  produces < reco::ElectronIsolationMap >();
54 
55 }
T getParameter(std::string const &) const
EgammaHLTElectronCombinedIsolationProducer::~EgammaHLTElectronCombinedIsolationProducer ( )

Definition at line 56 of file EgammaHLTElectronCombinedIsolationProducer.cc.

56 {}

Member Function Documentation

void EgammaHLTElectronCombinedIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 59 of file EgammaHLTElectronCombinedIsolationProducer.cc.

References CaloIsolTag_, CaloIsolWeight_, electronProducer_, spr::find(), edm::Event::getByLabel(), edm::Event::put(), recoEcalCandidateProducer_, TrackIsolTag_, TrackIsolWeight_, and edm::helpers::KeyVal< K, V >::val.

60 {
61 
62  using namespace std;
63 
65  iEvent.getByLabel(electronProducer_,electronHandle);
66 
68  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
69 
70  std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > CaloIsoMap;
71  for( unsigned int u=0; u < CaloIsolTag_.size(); u++){
73  if(CaloIsolWeight_[u] != 0){ iEvent.getByLabel (CaloIsolTag_[u],depMapTemp);}
74  CaloIsoMap.push_back(depMapTemp);
75  }
76 
78  if(TrackIsolWeight_ != 0){ iEvent.getByLabel (TrackIsolTag_,TrackIsoMap);}
79 
80  reco::ElectronIsolationMap TotalIsolMap;
81  double TotalIso=0;
82  for(reco::ElectronCollection::const_iterator iElectron = electronHandle->begin(); iElectron != electronHandle->end(); iElectron++){
83  TotalIso=0;
84  reco::ElectronRef electronref(reco::ElectronRef(electronHandle,iElectron - electronHandle->begin()));
85  const reco::SuperClusterRef theEleClus = electronref->superCluster();
86 
87  //look for corresponding recoecal candidates to search for in the ecal and Hcal iso map
88  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
89  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
90  const reco::SuperClusterRef cluster = recoecalcandref->superCluster();
91  if(&(*cluster) == &(*theEleClus)) {//recoecalcand and electron have the same SC
92  for(unsigned int u=0; u < CaloIsolTag_.size() ;u++){
93  if(CaloIsolWeight_[u]==0){continue;}
94  reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*CaloIsoMap[u]).find( recoecalcandref );
95  TotalIso += mapi->val * CaloIsolWeight_[u];
96  }
97  break;
98  }
99  }
100 
101  //add the track isolation
102  if(TrackIsolWeight_ != 0){
103  reco::ElectronIsolationMap::const_iterator mapi = (*TrackIsoMap).find( electronref );
104  TotalIso += mapi->val * TrackIsolWeight_;
105  }
106  TotalIsolMap.insert(electronref, TotalIso);
107 
108  }
109 
110  std::auto_ptr<reco::ElectronIsolationMap> isolMap(new reco::ElectronIsolationMap(TotalIsolMap));
111  iEvent.put(isolMap);
112 
113 }
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:85
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356

Member Data Documentation

std::vector<edm::InputTag> EgammaHLTElectronCombinedIsolationProducer::CaloIsolTag_
private
std::vector<double> EgammaHLTElectronCombinedIsolationProducer::CaloIsolWeight_
private
edm::ParameterSet EgammaHLTElectronCombinedIsolationProducer::conf_
private
edm::InputTag EgammaHLTElectronCombinedIsolationProducer::electronProducer_
private
edm::InputTag EgammaHLTElectronCombinedIsolationProducer::recoEcalCandidateProducer_
private
edm::InputTag EgammaHLTElectronCombinedIsolationProducer::TrackIsolTag_
private
double EgammaHLTElectronCombinedIsolationProducer::TrackIsolWeight_
private