CMS 3D CMS Logo

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<>

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Public Member Functions

 PFCandIsolatorFromDeposits (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 build deposits More...
 
 ~PFCandIsolatorFromDeposits () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

std::vector< SingleDepositsources_
 

Detailed Description

Definition at line 27 of file PFCandIsolatorFromDeposit.h.

Member Typedef Documentation

Definition at line 29 of file PFCandIsolatorFromDeposit.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

constructor with config

Definition at line 177 of file PFCandIsolatorFromDeposit.cc.

References edm::ParameterSet::getParameter(), PFCandIsolatorFromDeposits::SingleDeposit::SingleDeposit(), sources_, and HistogramManager_cfi::VPSet().

177  {
178  typedef std::vector<edm::ParameterSet> VPSet;
179  VPSet depPSets = par.getParameter<VPSet>("deposits");
180  for (VPSet::const_iterator it = depPSets.begin(), ed = depPSets.end(); it != ed; ++it) {
181  sources_.push_back(SingleDeposit(*it, consumesCollector()));
182  }
183  if (sources_.empty())
184  throw cms::Exception("Configuration Error") << "Please specify at least one deposit!";
185  produces<CandDoubleMap>();
186 }
T getParameter(std::string const &) const
std::vector< SingleDeposit > sources_
PFCandIsolatorFromDeposits::~PFCandIsolatorFromDeposits ( )
override

destructor

Definition at line 189 of file PFCandIsolatorFromDeposit.cc.

References begin, end, and sources_.

189  {
190  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
191  for (it = begin; it != end; ++it)
192  it->cleanup();
193 }
std::vector< SingleDeposit > sources_
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32

Member Function Documentation

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

build deposits

Definition at line 196 of file PFCandIsolatorFromDeposit.cc.

References begin, edm::View< T >::begin(), edm::ValueMap< T >::begin(), DEFINE_FWK_MODULE, edm::ValueMap< T >::empty(), end, edm::ValueMap< T >::end(), edm::helper::Filler< Map >::fill(), trigObjTnPSource_cfi::filler, edm::helper::Filler< Map >::insert(), PFCandIsolatorFromDeposits::SingleDeposit::map(), eostools::move(), edm::View< T >::refAt(), runTheMatrix::ret, and sources_.

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

196  {
197  std::vector<SingleDeposit>::iterator it, begin = sources_.begin(), end = sources_.end();
198  for (it = begin; it != end; ++it)
199  it->open(event, eventSetup);
200 
201  const IsoDepositMap &map = begin->map();
202 
203  if (map.empty()) { // !!???
204  event.put(std::unique_ptr<CandDoubleMap>(new CandDoubleMap()));
205  return;
206  }
207  std::unique_ptr<CandDoubleMap> ret(new CandDoubleMap());
209 
210  typedef reco::IsoDepositMap::const_iterator iterator_i;
212  iterator_i depI = map.begin();
213  iterator_i depIEnd = map.end();
214  for (; depI != depIEnd; ++depI) {
215  std::vector<double> retV(depI.size(), 0);
217  event.get(depI.id(), candH);
218  const edm::View<reco::Candidate> &candV = *candH;
219 
220  iterator_ii depII = depI.begin();
221  iterator_ii depIIEnd = depI.end();
222  size_t iRet = 0;
223  for (; depII != depIIEnd; ++depII, ++iRet) {
224  double sum = 0;
225  for (it = begin; it != end; ++it)
226  sum += it->compute(candV.refAt(iRet));
227  retV[iRet] = sum;
228  }
229  filler.insert(candH, retV.begin(), retV.end());
230  }
231  filler.fill();
232  event.put(std::move(ret));
233 }
bool empty() const
Definition: ValueMap.h:158
std::vector< SingleDeposit > sources_
const_iterator end() const
Definition: ValueMap.h:230
ret
prodAgent to be discontinued
RefToBase< value_type > refAt(size_type i) const
const_iterator begin() const
#define end
Definition: vmac.h:39
helper::Filler< ValueMap< T > > Filler
Definition: ValueMap.h:168
const_iterator begin() const
Definition: ValueMap.h:229
#define begin
Definition: vmac.h:32
edm::ValueMap< double > CandDoubleMap
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

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