CMS 3D CMS Logo

Public Member Functions | Private Attributes

EgammaHLTCombinedIsolationProducer Class Reference

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

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

List of all members.

Public Member Functions

 EgammaHLTCombinedIsolationProducer (const edm::ParameterSet &)
virtual void produce (edm::Event &, const edm::EventSetup &)
 ~EgammaHLTCombinedIsolationProducer ()

Private Attributes

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

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_, Exception, edm::ParameterSet::getParameter(), IsolTag_, IsolWeight_, and recoEcalCandidateProducer_.

                                                                                                    : conf_(config)
{
 // use configuration file to setup input/output collection names
  recoEcalCandidateProducer_ = conf_.getParameter<edm::InputTag>("recoEcalCandidateProducer");

  IsolTag_ = conf_.getParameter< std::vector<edm::InputTag> > ("IsolationMapTags");
  IsolWeight_ = conf_.getParameter< std::vector<double> > ("IsolationWeight");

  //register your products
  produces < reco::RecoEcalCandidateIsolationMap >();

  if ( IsolTag_.size() != IsolWeight_.size()){ 
    throw cms::Exception("BadConfig") << "vectors IsolationMapTags and IsolationWeight need to have the same size";
  }

}
EgammaHLTCombinedIsolationProducer::~EgammaHLTCombinedIsolationProducer ( )

Definition at line 43 of file EgammaHLTCombinedIsolationProducer.cc.

{}

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(), and recoEcalCandidateProducer_.

{
  
  edm::Handle<reco::RecoEcalCandidateCollection> recoecalcandHandle;
  iEvent.getByLabel(recoEcalCandidateProducer_,recoecalcandHandle);

  reco::RecoEcalCandidateIsolationMap TotalIsolMap;
  double TotalIso=0;

  std::vector< edm::Handle<reco::RecoEcalCandidateIsolationMap> > IsoMap;
  for( unsigned int u=0; u < IsolWeight_.size(); u++){
    edm::Handle<reco::RecoEcalCandidateIsolationMap> depMapTemp;
    if(IsolWeight_[u] != 0){ iEvent.getByLabel (IsolTag_[u],depMapTemp);}
    IsoMap.push_back(depMapTemp);
  }
  
  for(reco::RecoEcalCandidateCollection::const_iterator iRecoEcalCand = recoecalcandHandle->begin(); iRecoEcalCand != recoecalcandHandle->end(); iRecoEcalCand++){
    reco::RecoEcalCandidateRef recoecalcandref(recoecalcandHandle,iRecoEcalCand-recoecalcandHandle->begin());
    TotalIso = 0;  
    for( unsigned int u=0; u < IsolWeight_.size(); u++){
      if(IsolWeight_[u]==0){continue;}
      reco::RecoEcalCandidateIsolationMap::const_iterator mapi = (*IsoMap[u]).find( recoecalcandref );    
      TotalIso += mapi->val * IsolWeight_[u];
    }
    TotalIsolMap.insert(recoecalcandref, TotalIso);
    
  }

  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> Map(new reco::RecoEcalCandidateIsolationMap(TotalIsolMap));
  iEvent.put(Map);

}

Member Data Documentation

std::vector<double> EgammaHLTCombinedIsolationProducer::IsolWeight_ [private]