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

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

Definition at line 28 of file ValueMap.h.

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

Definition at line 24 of file ValueMap.h.

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

Definition at line 27 of file ValueMap.h.

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

Definition at line 26 of file ValueMap.h.

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

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

Definition at line 30 of file ValueMap.h.

30  :
31  map_(map), totSize_(0) {
32  add(map);
33  }
void add(const Map &map)
Definition: ValueMap.h:34

Member Function Documentation

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

Definition at line 34 of file ValueMap.h.

Referenced by edm::Association< reco::FFTJPTJetCollection >::add(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::add(), edm::helper::Filler< Association< C > >::Filler(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::operator+=(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

34  {
35  if (map.empty()) return;
36  typename id_offset_vector::const_iterator j = map.ids_.begin();
37  const typename id_offset_vector::const_iterator end = map.ids_.end();
38  size_t i = 0;
39  const size_t size = map.values_.size();
40  // std::pair<ProductID, offset> id = *j;
41  do {
42  ProductID id = j->first;
43  ++j;
44  size_t max = (j == end ? size : j->second);
45  typename value_map::iterator f = values_.find(id);
46  if(f!=values_.end()) 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  }
size
Write out results.
double f[11][100]
#define end
Definition: vmac.h:39
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:25
value_map values_
Definition: ValueMap.h:84
void throwAdd() const
Definition: ValueMap.h:97
EventID const & max(EventID const &lh, EventID const &rh)
Definition: EventID.h:142
template<typename Map>
void edm::helper::Filler< Map >::fill ( void  )
inline

Definition at line 63 of file ValueMap.h.

Referenced by edm::Association< reco::FFTJPTJetCollection >::add(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::add(), TrackingParticleNumberOfLayers::calculate(), IsoValueMapProducer< T >::doMiniIso(), IsoValueMapProducer< T >::doPFIsoEle(), IsoValueMapProducer< T >::doPFIsoPho(), ElectronIsolatorFromEffectiveArea::filter(), PhotonIsoProducer::filter(), ElectronIdMVAProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), TrackMergeremb< T1 >::merg_and_put(), pat::PATVertexSlimmer::produce(), AssociationMapOneToOne2Association< CKey, CVal >::produce(), AssociationVector2ValueMap< KeyRefProd, CVal >::produce(), MuIsoDepositProducer::produce(), RegressionEnergyPatElectronProducer::produce(), TrackProducerWithSCAssociation::produce(), MCTrackMatcher::produce(), ElectronSeedTrackRefFix::produce(), pat::PackedPFCandidateRefMixer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), reco::modulesNew::MCTruthCompositeMatcher::produce(), PFCandidateMuonUntagger::produce(), ElectronPATIdMVAProducer::produce(), PATPuppiJetSpecificProducer::produce(), GenTrackMatcher::produce(), L3MuonIsolationProducer::produce(), PuppiPhoton::produce(), reco::modulesNew::Matcher< C1, C2, S, D >::produce(), ChargedHadronPFTrackIsolationProducer::produce(), PFCandIsolatorFromDeposits::produce(), edm::FilterValueMapWrapper< T, C >::produce(), citk::PFIsolationSumProducerForPUPPI::produce(), L2MuonIsolationProducer::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), PuppiProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), pat::L1MuonMatcher::produce(), pat::HLTL1MuonMatcher::produce(), HSCPDeDxInfoProducer::produce(), RecoTauJetRegionProducer::produce(), pat::PATPackedCandidateProducer::produce(), citk::PFIsolationSumProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), ConversionTrackCandidateProducer::produce(), PFECALSuperClusterProducer::produce(), cms::MuonTCMETValueMapProducer::produce(), PFClusterMatchedToPhotonsSelector::produce(), ValueMapTraslator::produce(), pat::MatcherByPulls< T >::produce(), SoftKillerProducer::produce(), EGMEnergyVarProducer< T >::produce(), VIDNestedWPBitmapProducer< T >::produce(), LeptonJetVarProducer< T >::produce(), MuonSimClassifier::produce(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::produce(), JetDeltaRValueMapProducer< T, C >::produce(), ProduceIsolationMap::produce(), MuonMCClassifier::produce(), BaseMVAValueMapProducer< T >::produce(), pat::L1MuonMatcher::storeExtraInfo(), pat::HLTL1MuonMatcher::storeExtraInfo(), pat::MatcherUsingTracks::storeValueMap(), TriggerMatcherToHLTDebug::storeValueMap(), ElectronHEEPIDValueMapProducer::writeValueMap(), MuonSimClassifier::writeValueMap(), and MuonMCClassifier::writeValueMap().

63  {
64  map_.clear();
65  offset off = 0;
66  map_.ids_.reserve(values_.size());
67  map_.values_.reserve(totSize_);
68  for(typename value_map::const_iterator i = values_.begin(); i != values_.end(); ++i) {
69  ProductID id = i->first;
70  map_.ids_.push_back(std::make_pair(id, off));
71  const value_vector & values = i->second;
72  for(typename value_vector::const_iterator j = values.begin(); j != values.end(); ++j) {
73  map_.values_.push_back( *j );
74  ++off;
75  }
76  }
77  map_.shrink_to_fit();
78  }
Map::offset offset
Definition: ValueMap.h:27
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:25
value_map values_
Definition: ValueMap.h:84
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.

Referenced by BeautifulSoup.PageElement::append(), EcalHaloAlgo::Calculate(), TrackingParticleNumberOfLayers::calculate(), IsoValueMapProducer< T >::doMiniIso(), IsoValueMapProducer< T >::doPFIsoEle(), IsoValueMapProducer< T >::doPFIsoPho(), GEDGsfElectronProducer::fillGsfElectronValueMap(), PFElectronTranslator::fillMVAValueMap(), GoodSeedProducer::fillPreIdRefValueMap(), PFElectronTranslator::fillSCRefValueMap(), ElectronIsolatorFromEffectiveArea::filter(), PhotonIsoProducer::filter(), ElectronIdMVAProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), TrackMergeremb< T1 >::merg_and_put(), pat::PATVertexSlimmer::produce(), AssociationMapOneToOne2Association< CKey, CVal >::produce(), AssociationVector2ValueMap< KeyRefProd, CVal >::produce(), MuIsoDepositProducer::produce(), RegressionEnergyPatElectronProducer::produce(), TrackProducerWithSCAssociation::produce(), MCTrackMatcher::produce(), ElectronSeedTrackRefFix::produce(), pat::PackedPFCandidateRefMixer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), reco::modulesNew::MCTruthCompositeMatcher::produce(), PFCandidateMuonUntagger::produce(), ElectronPATIdMVAProducer::produce(), PATPuppiJetSpecificProducer::produce(), GenTrackMatcher::produce(), L3MuonIsolationProducer::produce(), PuppiPhoton::produce(), reco::modulesNew::Matcher< C1, C2, S, D >::produce(), ChargedHadronPFTrackIsolationProducer::produce(), PFCandIsolatorFromDeposits::produce(), edm::FilterValueMapWrapper< T, C >::produce(), L2MuonIsolationProducer::produce(), citk::PFIsolationSumProducerForPUPPI::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), PuppiProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), pat::L1MuonMatcher::produce(), pat::HLTL1MuonMatcher::produce(), HSCPDeDxInfoProducer::produce(), RecoTauJetRegionProducer::produce(), pat::PATPackedCandidateProducer::produce(), citk::PFIsolationSumProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), ConversionTrackCandidateProducer::produce(), PFECALSuperClusterProducer::produce(), cms::MuonTCMETValueMapProducer::produce(), PFClusterMatchedToPhotonsSelector::produce(), ValueMapTraslator::produce(), pat::MatcherByPulls< T >::produce(), SoftKillerProducer::produce(), EGMEnergyVarProducer< T >::produce(), VIDNestedWPBitmapProducer< T >::produce(), LeptonJetVarProducer< T >::produce(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::produce(), MuonSimClassifier::produce(), JetDeltaRValueMapProducer< T, C >::produce(), ProduceIsolationMap::produce(), MuonMCClassifier::produce(), BaseMVAValueMapProducer< T >::produce(), pat::L1MuonMatcher::storeExtraInfo(), pat::HLTL1MuonMatcher::storeExtraInfo(), pat::MatcherUsingTracks::storeValueMap(), TriggerMatcherToHLTDebug::storeValueMap(), ElectronHEEPIDValueMapProducer::writeValueMap(), MuonSimClassifier::writeValueMap(), and MuonMCClassifier::writeValueMap().

53  {
54  ProductID id = h.id();
55  size_t size = h->size(), sizeIt = end - begin;
56  if(sizeIt!=size) throwFillSize();
57  typename value_map::const_iterator f = values_.find(id);
58  if(f != values_.end()) throwFillID(id);
59  value_vector & values = values_.insert(make_pair(id, value_vector(size))).first->second;
60  std::copy(begin, end, values.begin());
61  totSize_+=size;
62  }
size
Write out results.
def copy(args, dbName)
void throwFillSize() const
Definition: ValueMap.h:87
double f[11][100]
#define end
Definition: vmac.h:39
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:25
value_map values_
Definition: ValueMap.h:84
#define begin
Definition: vmac.h:32
void throwFillID(ProductID id) const
Definition: ValueMap.h:92
template<typename Map>
void edm::helper::Filler< Map >::throwAdd ( ) const
inlineprivate

Definition at line 97 of file ValueMap.h.

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

97  {
99  "ValueMap: trying to add entries for an already existing product\n");
100  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")
template<typename Map>
void edm::helper::Filler< Map >::throwFillID ( ProductID  id) const
inlineprivate

Definition at line 92 of file ValueMap.h.

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

92  {
94  e << "index map has already been filled for id: " << id << "\n";
95  e.raise();
96  }
template<typename Map>
void edm::helper::Filler< Map >::throwFillSize ( ) const
inlineprivate

Definition at line 87 of file ValueMap.h.

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

87  {
89  "ValueMap::Filler: handle and reference "
90  "collections should the same size\n");
91  }
static void throwThis(Code category, char const *message0="", char const *message1="", char const *message2="", char const *message3="", char const *message4="")

Member Data Documentation

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

Definition at line 81 of file ValueMap.h.

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

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

Definition at line 84 of file ValueMap.h.

Referenced by edm::helper::Filler< Association< C > >::add(), edm::ValueMap< T >::const_iterator::begin(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::begin(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::clear(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::empty(), edm::ValueMap< T >::const_iterator::end(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::end(), edm::helper::Filler< Association< C > >::fill(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::get(), edm::helper::Filler< Association< C > >::insert(), edm::ValueMap< T >::const_iterator::operator+(), edm::ValueMap< T >::const_iterator::operator-(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::rawIndexOf(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::shrink_to_fit(), edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::size(), and edm::ValueMap< edm::Ref< std::vector< reco::PFCandidate >, reco::PFCandidate, edm::refhelper::FindUsingAdvance< std::vector< reco::PFCandidate >, reco::PFCandidate > > >::swap().