CMS 3D CMS Logo

CandIsolatorFromDeposits Class Reference

#include <PhysicsTools/IsolationAlgos/plugins/CandIsolatorFromDeposits.h>

Inheritance diagram for CandIsolatorFromDeposits:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Types

typedef edm::ValueMap< double > CandDoubleMap
enum  Mode {
  Sum, SumRelative, Sum2, Sum2Relative,
  Max, MaxRelative, Count
}

Public Member Functions

 CandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config
virtual void produce (edm::Event &, const edm::EventSetup &)
 build deposits
virtual ~CandIsolatorFromDeposits ()
 destructor

Private Attributes

std::vector< SingleDepositsources_

Classes

class  SingleDeposit


Detailed Description

Definition at line 22 of file CandIsolatorFromDeposits.h.


Member Typedef Documentation

typedef edm::ValueMap<double> CandIsolatorFromDeposits::CandDoubleMap

Definition at line 25 of file CandIsolatorFromDeposits.h.


Member Enumeration Documentation

enum CandIsolatorFromDeposits::Mode

Enumerator:
Sum 
SumRelative 
Sum2 
Sum2Relative 
Max 
MaxRelative 
Count 

Definition at line 27 of file CandIsolatorFromDeposits.h.


Constructor & Destructor Documentation

CandIsolatorFromDeposits::CandIsolatorFromDeposits ( const edm::ParameterSet par  ) 

constructor with config

Definition at line 113 of file CandIsolatorFromDeposits.cc.

References edm::ParameterSet::getParameter(), it, and sources_.

00113                                                                           {
00114   typedef std::vector<edm::ParameterSet> VPSet;
00115   VPSet depPSets = par.getParameter<VPSet>("deposits");
00116   for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
00117     sources_.push_back(SingleDeposit(*it));
00118   }
00119   if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
00120   produces<CandDoubleMap>();
00121 }

CandIsolatorFromDeposits::~CandIsolatorFromDeposits (  )  [virtual]

destructor

Definition at line 124 of file CandIsolatorFromDeposits.cc.

References begin, end, it, and sources_.

00124                                                     {
00125   vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
00126   for (it = begin; it != end; ++it) it->cleanup();
00127 }


Member Function Documentation

void CandIsolatorFromDeposits::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

build deposits

Implements edm::EDProducer.

Definition at line 130 of file CandIsolatorFromDeposits.cc.

References edm::ValueMap< T >::begin(), begin, end, edm::ValueMap< T >::end(), edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), it, edm::View< T >::refAt(), edm::ValueMap< T >::size(), sources_, and sum().

00130                                                                                 {
00131 
00132   vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
00133   for (it = begin; it != end; ++it) it->open(event, eventSetup);
00134 
00135   const IsoDepositMap & map = begin->map();
00136 
00137   if (map.size()==0) { // !!???
00138         event.put(auto_ptr<CandDoubleMap>(new CandDoubleMap()));
00139         return;
00140   }
00141   auto_ptr<CandDoubleMap> ret(new CandDoubleMap());
00142   CandDoubleMap::Filler filler(*ret);
00143 
00144   typedef reco::IsoDepositMap::const_iterator iterator_i; 
00145   typedef reco::IsoDepositMap::container::const_iterator iterator_ii; 
00146   iterator_i depI = map.begin(); 
00147   iterator_i depIEnd = map.end(); 
00148   for (; depI != depIEnd; ++depI){ 
00149     std::vector<double> retV(depI.size(),0);
00150     edm::Handle<edm::View<reco::Candidate> > candH;
00151     event.get(depI.id(), candH);
00152     const edm::View<reco::Candidate>& candV = *candH;
00153 
00154     iterator_ii depII = depI.begin(); 
00155     iterator_ii depIIEnd = depI.end(); 
00156     size_t iRet = 0;
00157     for (; depII != depIIEnd; ++depII,++iRet){ 
00158       double sum=0;
00159       for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet)); 
00160       retV[iRet] = sum;
00161     }
00162     filler.insert(candH, retV.begin(), retV.end());
00163   }
00164   filler.fill();
00165   event.put(ret);
00166 }


Member Data Documentation

std::vector<SingleDeposit> CandIsolatorFromDeposits::sources_ [private]

Definition at line 55 of file CandIsolatorFromDeposits.h.

Referenced by CandIsolatorFromDeposits(), produce(), and ~CandIsolatorFromDeposits().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:04 2009 for CMSSW by  doxygen 1.5.4