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
EgammaHLTCombinedIsolationProducer Class Reference

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

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

Public Member Functions

 EgammaHLTCombinedIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTCombinedIsolationProducer ()
 
- 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

edm::ParameterSet conf_
 
std::vector< edm::InputTagIsolTag_
 
std::vector< double > IsolWeight_
 
edm::InputTag recoEcalCandidateProducer_
 

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

$Id:

Definition at line 29 of file EgammaHLTCombinedIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file EgammaHLTCombinedIsolationProducer.cc.

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

25  : conf_(config)
26 {
27  // use configuration file to setup input/output collection names
28  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");
29 
30  IsolTag_ = conf_.getParameter< std::vector<edm::InputTag> > ("IsolationMapTags");
31  IsolWeight_ = conf_.getParameter< std::vector<double> > ("IsolationWeight");
32 
33  //register your products
34  produces < reco::RecoEcalCandidateIsolationMap >();
35 
36  if ( IsolTag_.size() != IsolWeight_.size()){
37  throw cms::Exception("BadConfig") << "vectors IsolationMapTags and IsolationWeight need to have the same size";
38  }
39 
40 }
T getParameter(std::string const &) const
EgammaHLTCombinedIsolationProducer::~EgammaHLTCombinedIsolationProducer ( )

Definition at line 43 of file EgammaHLTCombinedIsolationProducer.cc.

43 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 52 of file EgammaHLTCombinedIsolationProducer.cc.

References spr::find(), edm::Event::getByLabel(), edm::AssociationMap< Tag >::insert(), IsolTag_, IsolWeight_, edm::Event::put(), recoEcalCandidateProducer_, and edm::helpers::KeyVal< K, V >::val.

53 {
54 
56  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);
57 
59  double TotalIso=0;
60 
61  std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > IsoMap;
62  for( unsigned int u=0; u < IsolWeight_.size(); u++){
64  if(IsolWeight_[u] != 0){ iEvent.getByLabel (IsolTag_[u],depMapTemp);}
65  IsoMap.push_back(depMapTemp);
66  }
67 
68  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
69  reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
70  TotalIso = 0;
71  for( unsigned int u=0; u < IsolWeight_.size(); u++){
72  if(IsolWeight_[u]==0){continue;}
73  reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*IsoMap[u]).find( recoecalcandref );
74  TotalIso += mapi->val * IsolWeight_[u];
75  }
76  TotalIsolMap.insert(recoecalcandref, TotalIso);
77 
78  }
79 
80  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> Map(new reco::RecoEcalCandidateIsolationMap(TotalIsolMap));
81  iEvent.put(Map);
82 
83 }
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
void insert(const key_type &k, const data_type &v)
insert an association

Member Data Documentation

edm::ParameterSet EgammaHLTCombinedIsolationProducer::conf_
private
std::vector<edm::InputTag> EgammaHLTCombinedIsolationProducer::IsolTag_
private
std::vector<double> EgammaHLTCombinedIsolationProducer::IsolWeight_
private
edm::InputTag EgammaHLTCombinedIsolationProducer::recoEcalCandidateProducer_
private