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
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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTCombinedIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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 (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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_, edm::hlt::Exception, edm::ParameterSet::getParameter(), 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
int i
Definition: DBlmapReader.cc:9
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 
)
virtual

Implements edm::EDProducer.

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  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> Map(new reco::RecoEcalCandidateIsolationMap(TotalIsolMap));
82  iEvent.put(Map);
83 
84 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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:7
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
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