CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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_vector
value_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 21 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 27 of file ValueMap.h.

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

Definition at line 23 of file ValueMap.h.

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

Definition at line 26 of file ValueMap.h.

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

Definition at line 25 of file ValueMap.h.

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

Definition at line 24 of file ValueMap.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file ValueMap.h.

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

Member Function Documentation

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

Definition at line 33 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(), and counter.Counter::register().

33  {
34  if (map.empty()) 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()) throwAdd();
46  value_vector & values = values_.insert(std::make_pair(id, value_vector())).first->second;
47  while(i!=max)
48  values.push_back( map.values_[i++] );
49  } while(j != end);
50  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
double f[11][100]
#define end
Definition: vmac.h:37
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:24
value_map values_
Definition: ValueMap.h:83
tuple size
Write out results.
void throwAdd() const
Definition: ValueMap.h:96
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 62 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(), PFLinker::fillValueMap(), ElectronIsolatorFromEffectiveArea::filter(), ElectronIdMVAProducer::filter(), PhotonIsoProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), PFCandidateMixer::mix(), IsolationProducerForTracks::produce(), GEDGsfElectronProducer::produce(), ECFAdder::produce(), pat::PATVertexSlimmer::produce(), PhotonIDProducer::produce(), AssociationMapOneToOne2Association< CKey, CVal >::produce(), AssociationVector2ValueMap< KeyRefProd, CVal >::produce(), MuIsoDepositProducer::produce(), RegressionEnergyPatElectronProducer::produce(), EgammaElectronTkIsolationProducer::produce(), EgammaPhotonTkIsolationProducer::produce(), EgammaPhotonTkNumIsolationProducer::produce(), TrackProducerWithSCAssociation::produce(), GenParticlePruner::produce(), ElectronSeedTrackRefFix::produce(), MCTrackMatcher::produce(), CandIsoDepositProducer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::produce(), ElectronIDExternalProducer< algo >::produce(), reco::modulesNew::MCTruthCompositeMatcher::produce(), PFElectronTranslator::produce(), EgammaElectronTkNumIsolationProducer::produce(), AlignmentPrescaler::produce(), EgammaEcalPFClusterIsolationProducer< T1 >::produce(), EgammaHcalPFClusterIsolationProducer< T1 >::produce(), GenTrackMatcher::produce(), L3MuonIsolationProducer::produce(), MuonSelectionTypeValueMapProducer::produce(), ElectronPATIdMVAProducer::produce(), reco::modulesNew::Matcher< C1, C2, S, D >::produce(), CalibratedElectronProducer::produce(), PFCandIsolatorFromDeposits::produce(), photonIsolationHIProducer::produce(), CandIsolatorFromDeposits::produce(), TkAlCaOverlapTagger::produce(), QjetsAdder::produce(), JVFJetIdProducer::produce(), pat::PATLostTracks::produce(), GlobalTrackQualityProducer::produce(), PuppiProducer::produce(), L2MuonIsolationProducer::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), MuonShowerInformationProducer::produce(), pat::L1MuonMatcher::produce(), pat::PATVertexAssociationProducer::produce(), pat::HLTL1MuonMatcher::produce(), RecoTauJetRegionProducer::produce(), DeDxHitInfoProducer::produce(), HSCPDeDxInfoProducer::produce(), EgammaEcalRecHitIsolationProducer::produce(), EgammaTowerIsolationProducer::produce(), pat::PATPackedCandidateProducer::produce(), CosmicsMuonIdProducer::produce(), citk::PFIsolationSumProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), VoronoiBackgroundProducer::produce(), ConversionTrackCandidateProducer::produce(), cms::MuonMETValueMapProducer::produce(), CastorJetIDProducer::produce(), PFECALSuperClusterProducer::produce(), MuonTimingProducer::produce(), NjettinessAdder::produce(), GEDPhotonProducer::produce(), TevMuonProducer::produce(), cms::MuonTCMETValueMapProducer::produce(), pat::TauJetCorrFactorsProducer::produce(), JetIDProducer::produce(), ReducedEGProducer::produce(), pat::MatcherByPulls< T >::produce(), ValueMapTraslator::produce(), SoftKillerProducer::produce(), DeDxEstimatorProducer::produce(), pat::PATTriggerEventProducer::produce(), pat::JetCorrFactorsProducer::produce(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::produce(), pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::produce(), JetDeltaRValueMapProducer< T >::produce(), ProduceIsolationMap::produce(), MuonIdProducer::produce(), MuonMCClassifier::produce(), GoodSeedProducer::produce(), QGTagger::putInEvent(), pat::L1MuonMatcher::storeExtraInfo(), pat::HLTL1MuonMatcher::storeExtraInfo(), pat::MatcherUsingTracks::storeValueMap(), TriggerMatcherToHLTDebug::storeValueMap(), MuIsolatorResultProducer< BT >::writeOutImpl(), ElectronIDValueMapProducer::writeValueMap(), MVAValueMapProducer< ParticleType >::writeValueMap(), PhotonIDValueMapProducer::writeValueMap(), and MuonMCClassifier::writeValueMap().

62  {
63  map_.clear();
64  offset off = 0;
65  map_.ids_.reserve(values_.size());
66  map_.values_.reserve(totSize_);
67  for(typename value_map::const_iterator i = values_.begin(); i != values_.end(); ++i) {
68  ProductID id = i->first;
69  map_.ids_.push_back(std::make_pair(id, off));
70  const value_vector & values = i->second;
71  for(typename value_vector::const_iterator j = values.begin(); j != values.end(); ++j) {
72  map_.values_.push_back( *j );
73  ++off;
74  }
75  }
76  map_.shrink_to_fit();
77  }
int i
Definition: DBlmapReader.cc:9
Map::offset offset
Definition: ValueMap.h:26
int j
Definition: DBlmapReader.cc:9
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:24
value_map values_
Definition: ValueMap.h:83
template<typename Map>
template<typename H , typename I >
void edm::helper::Filler< Map >::insert ( const H &  h,
begin,
end 
)
inline

Definition at line 52 of file ValueMap.h.

Referenced by BeautifulSoup.PageElement::_invert(), EcalHaloAlgo::Calculate(), TrackingParticleNumberOfLayers::calculate(), GEDGsfElectronProducer::fillGsfElectronValueMap(), PFElectronTranslator::fillMVAValueMap(), GoodSeedProducer::fillPreIdRefValueMap(), PFElectronTranslator::fillSCRefValueMap(), PFLinker::fillValueMap(), ElectronIsolatorFromEffectiveArea::filter(), PhotonIsoProducer::filter(), ElectronIdMVAProducer::filter(), ElectronRegressionEnergyProducer::filter(), HLTMuonPFIsoFilter::hltFilter(), HLTMuonIsoFilter::hltFilter(), PFCandidateMixer::mix(), IsolationProducerForTracks::produce(), ECFAdder::produce(), pat::PATVertexSlimmer::produce(), PhotonIDProducer::produce(), AssociationMapOneToOne2Association< CKey, CVal >::produce(), AssociationVector2ValueMap< KeyRefProd, CVal >::produce(), MuIsoDepositProducer::produce(), RegressionEnergyPatElectronProducer::produce(), EgammaElectronTkIsolationProducer::produce(), EgammaPhotonTkIsolationProducer::produce(), EgammaPhotonTkNumIsolationProducer::produce(), TrackProducerWithSCAssociation::produce(), GenParticlePruner::produce(), ElectronSeedTrackRefFix::produce(), MCTrackMatcher::produce(), CandIsoDepositProducer::produce(), L3MuonSumCaloPFIsolationProducer::produce(), pat::helper::AnythingToValueMap< Adaptor, Collection, value_type >::produce(), ElectronIDExternalProducer< algo >::produce(), reco::modulesNew::MCTruthCompositeMatcher::produce(), EgammaElectronTkNumIsolationProducer::produce(), AlignmentPrescaler::produce(), EgammaEcalPFClusterIsolationProducer< T1 >::produce(), EgammaHcalPFClusterIsolationProducer< T1 >::produce(), L3MuonIsolationProducer::produce(), MuonSelectionTypeValueMapProducer::produce(), GenTrackMatcher::produce(), ElectronPATIdMVAProducer::produce(), reco::modulesNew::Matcher< C1, C2, S, D >::produce(), CalibratedElectronProducer::produce(), PFCandIsolatorFromDeposits::produce(), photonIsolationHIProducer::produce(), CandIsolatorFromDeposits::produce(), TkAlCaOverlapTagger::produce(), QjetsAdder::produce(), JVFJetIdProducer::produce(), pat::PATLostTracks::produce(), GlobalTrackQualityProducer::produce(), L2MuonIsolationProducer::produce(), L3MuonCombinedRelativeIsolationProducer::produce(), PuppiProducer::produce(), VersionedIdProducer< PhysicsObjectPtr, SelectorType >::produce(), MuonShowerInformationProducer::produce(), pat::PATVertexAssociationProducer::produce(), pat::L1MuonMatcher::produce(), pat::HLTL1MuonMatcher::produce(), RecoTauJetRegionProducer::produce(), DeDxHitInfoProducer::produce(), HSCPDeDxInfoProducer::produce(), EgammaEcalRecHitIsolationProducer::produce(), EgammaTowerIsolationProducer::produce(), pat::PATPackedCandidateProducer::produce(), citk::PFIsolationSumProducer::produce(), CosmicsMuonIdProducer::produce(), PrimaryVertexSorter< ParticlesCollection >::produce(), VoronoiBackgroundProducer::produce(), ConversionTrackCandidateProducer::produce(), cms::MuonMETValueMapProducer::produce(), CastorJetIDProducer::produce(), PFECALSuperClusterProducer::produce(), MuonTimingProducer::produce(), cms::MuonTCMETValueMapProducer::produce(), NjettinessAdder::produce(), TevMuonProducer::produce(), GEDPhotonProducer::produce(), pat::TauJetCorrFactorsProducer::produce(), JetIDProducer::produce(), ReducedEGProducer::produce(), ValueMapTraslator::produce(), pat::MatcherByPulls< T >::produce(), SoftKillerProducer::produce(), DeDxEstimatorProducer::produce(), pat::PATTriggerEventProducer::produce(), pat::JetCorrFactorsProducer::produce(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::produce(), JetDeltaRValueMapProducer< T >::produce(), pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::produce(), MuonIdProducer::produce(), MuonMCClassifier::produce(), ProduceIsolationMap::produce(), QGTagger::putInEvent(), pat::L1MuonMatcher::storeExtraInfo(), pat::HLTL1MuonMatcher::storeExtraInfo(), pat::MatcherUsingTracks::storeValueMap(), TriggerMatcherToHLTDebug::storeValueMap(), MuIsolatorResultProducer< BT >::writeOutImpl(), ElectronIDValueMapProducer::writeValueMap(), MVAValueMapProducer< ParticleType >::writeValueMap(), PhotonIDValueMapProducer::writeValueMap(), and MuonMCClassifier::writeValueMap().

52  {
53  ProductID id = h.id();
54  size_t size = h->size(), sizeIt = end - begin;
55  if(sizeIt!=size) throwFillSize();
56  typename value_map::const_iterator f = values_.find(id);
57  if(f != values_.end()) throwFillID(id);
58  value_vector & values = values_.insert(make_pair(id, value_vector(size))).first->second;
59  std::copy(begin, end, values.begin());
60  totSize_+=size;
61  }
void throwFillSize() const
Definition: ValueMap.h:86
double f[11][100]
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
#define end
Definition: vmac.h:37
std::vector< typename Map::value_type > value_vector
Definition: ValueMap.h:24
value_map values_
Definition: ValueMap.h:83
#define begin
Definition: vmac.h:30
void throwFillID(ProductID id) const
Definition: ValueMap.h:91
tuple size
Write out results.
template<typename Map>
void edm::helper::Filler< Map >::throwAdd ( ) const
inlineprivate

Definition at line 96 of file ValueMap.h.

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

96  {
98  "ValueMap: trying to add entries for an already existing product\n");
99  }
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 91 of file ValueMap.h.

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

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

Definition at line 86 of file ValueMap.h.

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

86  {
88  "ValueMap::Filler: handle and reference "
89  "collections should the same size\n");
90  }
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 80 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