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

#include <PFCandIsolatorFromDeposit.h>

Inheritance diagram for PFCandIsolatorFromDeposits:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase 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::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 PFCandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 build deposits More...
 
virtual ~PFCandIsolatorFromDeposits ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

std::vector< SingleDepositsources_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Definition at line 23 of file PFCandIsolatorFromDeposit.h.

Member Typedef Documentation

Definition at line 26 of file PFCandIsolatorFromDeposit.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PFCandIsolatorFromDeposits::PFCandIsolatorFromDeposits ( const edm::ParameterSet par)

constructor with config

Definition at line 163 of file PFCandIsolatorFromDeposit.cc.

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

163  {
164  typedef std::vector<edm::ParameterSet> VPSet;
165  VPSet depPSets = par.getParameter<VPSet>("deposits");
166  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
167  sources_.push_back(SingleDeposit(*it, consumesCollector()));
168  }
169  if (sources_.size() == 0) throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
170  produces<CandDoubleMap>();
171 }
T getParameter(std::string const &) const
std::vector< SingleDeposit > sources_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
PFCandIsolatorFromDeposits::~PFCandIsolatorFromDeposits ( )
virtual

destructor

Definition at line 174 of file PFCandIsolatorFromDeposit.cc.

References begin, end, and sources_.

174  {
175  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
176  for (it = begin; it != end; ++it) it->cleanup();
177 }
std::vector< SingleDeposit > sources_
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30

Member Function Documentation

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

build deposits

Implements edm::stream::EDProducerBase.

Definition at line 180 of file PFCandIsolatorFromDeposit.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(), edm::View< T >::refAt(), runTheMatrix::ret, edm::ValueMap< T >::size(), and sources_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

180  {
181 
182  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
183  for (it = begin; it != end; ++it) it->open(event, eventSetup);
184 
185  const IsoDepositMap & map = begin->map();
186 
187  if (map.size()==0) { // !!???
188  event.put(std::auto_ptr<CandDoubleMap>(new CandDoubleMap()));
189  return;
190  }
191  std::auto_ptr<CandDoubleMap> ret(new CandDoubleMap());
192  CandDoubleMap::Filler filler(*ret);
193 
194  typedef reco::IsoDepositMap::const_iterator iterator_i;
195  typedef reco::IsoDepositMap::container::const_iterator iterator_ii;
196  iterator_i depI = map.begin();
197  iterator_i depIEnd = map.end();
198  for (; depI != depIEnd; ++depI){
199  std::vector<double> retV(depI.size(),0);
201  event.get(depI.id(), candH);
202  const edm::View<reco::Candidate>& candV = *candH;
203 
204  iterator_ii depII = depI.begin();
205  iterator_ii depIIEnd = depI.end();
206  size_t iRet = 0;
207  for (; depII != depIIEnd; ++depII,++iRet){
208  double sum=0;
209  for (it = begin; it != end; ++it) sum += it->compute(candV.refAt(iRet));
210  retV[iRet] = sum;
211  }
212  filler.insert(candH, retV.begin(), retV.end());
213  }
214  filler.fill();
215  event.put(ret);
216 }
tuple ret
prodAgent to be discontinued
std::vector< SingleDeposit > sources_
const_iterator end() const
Definition: ValueMap.h:208
RefToBase< value_type > refAt(size_type i) const
const_iterator begin() const
#define end
Definition: vmac.h:37
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
Definition: ValueMap.h:207
#define begin
Definition: vmac.h:30
size_t size() const
Definition: ValueMap.h:157
edm::ValueMap< double > CandDoubleMap

Member Data Documentation

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