CMS 3D CMS Logo

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

#include <CandIsolatorFromDeposits.h>

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

Classes

class  SingleDeposit
 

Public Types

typedef edm::ValueMap< double > CandDoubleMap
 
enum  Mode {
  Sum, SumRelative, Sum2, Sum2Relative,
  Max, MaxRelative, Count, NearestDR
}
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Public Member Functions

 CandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 build deposits More...
 
virtual ~CandIsolatorFromDeposits ()
 destructor More...
 
- 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< SingleDepositsources_
 

Additional Inherited Members

- 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

Definition at line 22 of file CandIsolatorFromDeposits.h.

Member Typedef Documentation

Definition at line 25 of file CandIsolatorFromDeposits.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 114 of file CandIsolatorFromDeposits.cc.

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

114  {
115  typedef std::vector<edm::ParameterSet> VPSet;
116  VPSet depPSets = par.getParameter<VPSet>("deposits");
117  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
118  sources_.push_back(SingleDeposit(*it));
119  }
120  if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
121  produces<CandDoubleMap>();
122 }
T getParameter(std::string const &) const
std::vector< SingleDeposit > sources_
CandIsolatorFromDeposits::~CandIsolatorFromDeposits ( )
virtual

destructor

Definition at line 125 of file CandIsolatorFromDeposits.cc.

References begin, end, and sources_.

125  {
126  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
127  for (it = begin; it != end; ++it) it->cleanup();
128 }
std::vector< SingleDeposit > sources_
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31

Member Function Documentation

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

build deposits

Implements edm::EDProducer.

Definition at line 131 of file CandIsolatorFromDeposits.cc.

References begin, edm::View< T >::begin(), edm::ValueMap< T >::begin(), end, edm::ValueMap< T >::end(), edm::helper::Filler< Map >::fill(), edm::helper::Filler< Map >::insert(), python.multivaluedict::map(), edm::View< T >::refAt(), run_regression::ret, edm::ValueMap< T >::size(), and sources_.

131  {
132 
133  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
134  for (it = begin; it != end; ++it) it->open(event, eventSetup);
135 
136  const IsoDepositMap & map = begin->map();
137 
138  if (map.size()==0) { // !!???
139  event.put(std::auto_ptr<CandDoubleMap>(new CandDoubleMap()));
140  return;
141  }
142  std::auto_ptr<CandDoubleMap> ret(new CandDoubleMap());
143  CandDoubleMap::Filler filler(*ret);
144 
145  typedef reco::IsoDepositMap::const_iterator iterator_i;
147  iterator_i depI = map.begin();
148  iterator_i depIEnd = map.end();
149  for (; depI != depIEnd; ++depI){
150  std::vector<double> retV(depI.size(),0);
152  event.get(depI.id(), candH);
153  const edm::View<reco::Candidate>& candV = *candH;
154 
155  iterator_ii depII = depI.begin();
156  iterator_ii depIIEnd = depI.end();
157  size_t iRet = 0;
158  for (; depII != depIIEnd; ++depII,++iRet){
159  double sum=0;
160  for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet));
161  retV[iRet] = sum;
162  }
163  filler.insert(candH, retV.begin(), retV.end());
164  }
165  filler.fill();
166  event.put(ret);
167 }
const_iterator end() const
Definition: ValueMap.h:197
std::vector< SingleDeposit > sources_
RefToBase< value_type > refAt(size_type i) const
edm::ValueMap< double > CandDoubleMap
#define end
Definition: vmac.h:38
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:157
const_iterator begin() const
Definition: ValueMap.h:196
#define begin
Definition: vmac.h:31
size_t size() const
Definition: ValueMap.h:152
const_iterator begin() const

Member Data Documentation

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