CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes
edm::helper::Filler< Map > Class Template Reference

#include <ValueMap.h>

Public Member Functions

void add (const Map &map)
 
void fill ()
 
 Filler (Map &map)
 
template<typename H , typename I >
void insert (const H &h, I begin, I end)
 

Protected Attributes

Map & map_
 

Private Types

typedef Map::id_offset_vector id_offset_vector
 
typedef std::vector< size_t > index_vector
 
typedef Map::offset offset
 
typedef std::map< ProductID, value_vectorvalue_map
 
typedef std::vector< typename Map::value_type > value_vector
 

Private Member Functions

void throwAdd () const
 
void throwFillID (ProductID id) const
 
void throwFillSize () const
 

Private Attributes

size_t totSize_
 
value_map values_
 

Detailed Description

template<typename Map>
class edm::helper::Filler< Map >

Definition at line 22 of file ValueMap.h.

Member Typedef Documentation

◆ id_offset_vector

template<typename Map>
typedef Map::id_offset_vector edm::helper::Filler< Map >::id_offset_vector
private

Definition at line 28 of file ValueMap.h.

◆ index_vector

template<typename Map>
typedef std::vector<size_t> edm::helper::Filler< Map >::index_vector
private

Definition at line 24 of file ValueMap.h.

◆ offset

template<typename Map>
typedef Map::offset edm::helper::Filler< Map >::offset
private

Definition at line 27 of file ValueMap.h.

◆ value_map

template<typename Map>
typedef std::map<ProductID, value_vector> edm::helper::Filler< Map >::value_map
private

Definition at line 26 of file ValueMap.h.

◆ value_vector

template<typename Map>
typedef std::vector<typename Map::value_type> edm::helper::Filler< Map >::value_vector
private

Definition at line 25 of file ValueMap.h.

Constructor & Destructor Documentation

◆ Filler()

template<typename Map>
edm::helper::Filler< Map >::Filler ( Map &  map)
inlineexplicit

Definition at line 31 of file ValueMap.h.

31 : map_(map), totSize_(0) { add(map); }

Member Function Documentation

◆ add()

template<typename Map>
void edm::helper::Filler< Map >::add ( const Map &  map)
inline

Definition at line 32 of file ValueMap.h.

32  {
33  if (map.empty())
34  return;
35  typename id_offset_vector::const_iterator j = map.ids_.begin();
36  const typename id_offset_vector::const_iterator end = map.ids_.end();
37  size_t i = 0;
38  const size_t size = map.values_.size();
39  // std::pair<ProductID, offset> id = *j;
40  do {
41  ProductID id = j->first;
42  ++j;
43  size_t max = (j == end ? size : j->second);
44  typename value_map::iterator f = values_.find(id);
45  if (f != values_.end())
46  throwAdd();
47  value_vector& values = values_.insert(std::make_pair(id, value_vector())).first->second;
48  while (i != max)
49  values.push_back(map.values_[i++]);
50  } while (j != end);
51  }

Referenced by edm::helper::Filler< Association< C > >::Filler(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

◆ fill()

template<typename Map>
void edm::helper::Filler< Map >::fill ( void  )
inline

Definition at line 65 of file ValueMap.h.

65  {
66  map_.clear();
67  offset off = 0;
68  map_.ids_.reserve(values_.size());
69  map_.values_.reserve(totSize_);
70  for (typename value_map::const_iterator i = values_.begin(); i != values_.end(); ++i) {
71  ProductID id = i->first;
72  map_.ids_.push_back(std::make_pair(id, off));
73  const value_vector& values = i->second;
74  for (typename value_vector::const_iterator j = values.begin(); j != values.end(); ++j) {
75  map_.values_.push_back(*j);
76  ++off;
77  }
78  }
79  map_.shrink_to_fit();
80  }

Referenced by IsoValueMapProducer< T >::doMiniIso(), IsoValueMapProducer< T >::doPFIsoEle(), IsoValueMapProducer< T >::doPFIsoPho(), BetaStarVarProducer< T >::fillValueMaps(), PhotonIsoProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), GEDGsfElectronValueMapProducer::produce(), pat::PATVertexSlimmer::produce(), RegressionEnergyPatElectronProducer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), MuonReducedTrackExtraProducer::produce(), PATPuppiJetSpecificProducer::produce(), AlignmentPrescaler::produce(), L3MuonIsolationProducer::produce(), TkAlCaOverlapTagger::produce(), citk::PFIsolationSumProducerForPUPPI::produce(), L2MuonIsolationProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), pat::L1MuonMatcher::produce(), pat::HLTL1MuonMatcher::produce(), PileupJetIDVarProducer::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), PuppiProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), citk::PFIsolationSumProducer::produce(), pat::PATPackedCandidateProducer::produce(), LeptonInJetProducer< T >::produce(), MuonTimingProducer::produce(), EGMSeedGainProducer< T >::produce(), cms::MuonTCMETValueMapProducer::produce(), PFECALSuperClusterProducer::produce(), PFClusterMatchedToPhotonsSelector::produce(), MuonFSRAssociator::produce(), GenJetTauTaggerProducer::produce(), SoftKillerProducer::produce(), pat::MatcherByPulls< T >::produce(), ConversionTrackCandidateProducer::produce(), pat::PATTriggerEventProducer::produce(), EGMEnergyVarProducer< T >::produce(), ProtonProducer::produce(), LeptonJetVarProducer< T >::produce(), MuonMCClassifier::produce(), MuonSimClassifier::produce(), BJetEnergyRegressionVarProducer< T >::produce(), and JetCleanerForType1METT< T, Textractor >::produce().

◆ insert()

template<typename Map>
template<typename H , typename I >
void edm::helper::Filler< Map >::insert ( const H &  h,
begin,
end 
)
inline

Definition at line 53 of file ValueMap.h.

53  {
54  ProductID id = h.id();
55  size_t size = h->size(), sizeIt = end - begin;
56  if (sizeIt != size)
57  throwFillSize();
58  typename value_map::const_iterator f = values_.find(id);
59  if (f != values_.end())
60  throwFillID(id);
61  value_vector& values = values_.insert(make_pair(id, value_vector(size))).first->second;
62  std::copy(begin, end, values.begin());
63  totSize_ += size;
64  }

Referenced by BeautifulSoup.PageElement::append(), EcalHaloAlgo::Calculate(), IsoValueMapProducer< T >::doMiniIso(), IsoValueMapProducer< T >::doPFIsoEle(), IsoValueMapProducer< T >::doPFIsoPho(), BetaStarVarProducer< T >::fillValueMaps(), PhotonIsoProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), GEDGsfElectronValueMapProducer::produce(), pat::PATVertexSlimmer::produce(), RegressionEnergyPatElectronProducer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), MuonReducedTrackExtraProducer::produce(), PATPuppiJetSpecificProducer::produce(), AlignmentPrescaler::produce(), L3MuonIsolationProducer::produce(), TkAlCaOverlapTagger::produce(), citk::PFIsolationSumProducerForPUPPI::produce(), L2MuonIsolationProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), pat::L1MuonMatcher::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), pat::HLTL1MuonMatcher::produce(), PileupJetIDVarProducer::produce(), PuppiProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), citk::PFIsolationSumProducer::produce(), pat::PATPackedCandidateProducer::produce(), LeptonInJetProducer< T >::produce(), MuonTimingProducer::produce(), EGMSeedGainProducer< T >::produce(), PFClusterMatchedToPhotonsSelector::produce(), cms::MuonTCMETValueMapProducer::produce(), PFECALSuperClusterProducer::produce(), MuonFSRAssociator::produce(), GenJetTauTaggerProducer::produce(), SoftKillerProducer::produce(), pat::MatcherByPulls< T >::produce(), ConversionTrackCandidateProducer::produce(), pat::PATTriggerEventProducer::produce(), EGMEnergyVarProducer< T >::produce(), ProtonProducer::produce(), LeptonJetVarProducer< T >::produce(), MuonMCClassifier::produce(), MuonSimClassifier::produce(), BJetEnergyRegressionVarProducer< T >::produce(), and JetCleanerForType1METT< T, Textractor >::produce().

◆ throwAdd()

template<typename Map>
void edm::helper::Filler< Map >::throwAdd ( ) const
inlineprivate

Definition at line 99 of file ValueMap.h.

99  {
101  "ValueMap: trying to add entries for an already existing product\n");
102  }

Referenced by edm::helper::Filler< Association< C > >::add().

◆ throwFillID()

template<typename Map>
void edm::helper::Filler< Map >::throwFillID ( ProductID  id) const
inlineprivate

Definition at line 94 of file ValueMap.h.

94  {
96  e << "index map has already been filled for id: " << id << "\n";
97  e.raise();
98  }

Referenced by edm::helper::Filler< Association< C > >::insert().

◆ throwFillSize()

template<typename Map>
void edm::helper::Filler< Map >::throwFillSize ( ) const
inlineprivate

Definition at line 89 of file ValueMap.h.

89  {
91  "ValueMap::Filler: handle and reference "
92  "collections should the same size\n");
93  }

Referenced by edm::helper::Filler< Association< C > >::insert().

Member Data Documentation

◆ map_

template<typename Map>
Map& edm::helper::Filler< Map >::map_
protected

Definition at line 83 of file ValueMap.h.

Referenced by edm::helper::Filler< Association< C > >::fill().

◆ totSize_

template<typename Map>
size_t edm::helper::Filler< Map >::totSize_
private

◆ values_

template<typename Map>
value_map edm::helper::Filler< Map >::values_
private
mps_fire.i
i
Definition: mps_fire.py:428
edm::errors::InvalidReference
Definition: EDMException.h:39
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
edm::max
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:118
edm::helper::Filler::throwFillID
void throwFillID(ProductID id) const
Definition: ValueMap.h:94
edm::helper::Filler::offset
Map::offset offset
Definition: ValueMap.h:27
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
mps_fire.end
end
Definition: mps_fire.py:242
edm::helper::Filler::totSize_
size_t totSize_
Definition: ValueMap.h:87
h
edm::helper::Filler::throwAdd
void throwAdd() const
Definition: ValueMap.h:99
Exception
edm::helper::Filler::throwFillSize
void throwFillSize() const
Definition: ValueMap.h:89
edm::helper::Filler::values_
value_map values_
Definition: ValueMap.h:86
edm::Exception::throwThis
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
Definition: EDMException.cc:83
edm::helper::Filler::add
void add(const Map &map)
Definition: ValueMap.h:32
edm::helper::Filler::value_vector
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:25
genParticles_cff.map
map
Definition: genParticles_cff.py:11
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::helper::Filler::map_
Map & map_
Definition: ValueMap.h:83
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37