CMS 3D CMS Logo

AssociationMapOneToOne2Association.h
Go to the documentation of this file.
1 #ifndef CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
2 #define CommonTools_UtilAlgos_AssociationMapOneToOne2Association_h
3 /* \class AssociationMapOneToOne2Association
4  *
5  * \author Luca Lista, INFN
6  *
7  * \version $Id: AssociationMapOneToOne2Association.h,v 1.2 2010/02/20 20:55:14 wmtan Exp $
8  */
9 
15 
16 template <typename CKey, typename CVal>
18 public:
20 
21 private:
24  void produce(edm::Event&, const edm::EventSetup&) override;
26 };
27 
33 
34 template <typename CKey, typename CVal>
36  : am_(consumes<am_t>(cfg.template getParameter<edm::InputTag>("src"))) {
37  produces<as_t>();
38 }
39 
40 template <typename CKey, typename CVal>
42  using namespace edm;
43  using namespace std;
44  Handle<am_t> am;
45  evt.getByToken(am_, am);
46 
47  unique_ptr<as_t> as(new as_t);
48  typename as_t::Filler filler(*as);
49  filler.fill();
50  size_t size = am->size();
51  vector<int> indices;
52  indices.reserve(size);
53  for (typename am_t::const_iterator i = am->begin(); i != am->end(); ++i) {
54  indices.push_back(i->val.key());
55  }
56  filler.insert(am->refProd().key, indices.begin(), indices.end());
57  evt.put(std::move(as));
58 }
59 
60 #endif
bTagCombinedSVVariables_cff.indices
indices
Definition: bTagCombinedSVVariables_cff.py:67
AssociationMapOneToOne2Association::am_t
edm::AssociationMap< edm::OneToOne< CKey, CVal > > am_t
Definition: AssociationMapOneToOne2Association.h:22
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
edm::Association::Filler
Definition: Association.h:78
EDProducer.h
AssociationMapOneToOne2Association::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: AssociationMapOneToOne2Association.h:41
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
AssociationMap.h
AssociationMapOneToOne2Association::as_t
edm::Association< CVal > as_t
Definition: AssociationMapOneToOne2Association.h:23
AssociationMapOneToOne2Association::AssociationMapOneToOne2Association
AssociationMapOneToOne2Association(const edm::ParameterSet &)
Definition: AssociationMapOneToOne2Association.h:35
OneToOne.h
Association.h
edm::Handle
Definition: AssociativeIterator.h:50
CloneTrait.h
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
edm::AssociationMap
Definition: AssociationMap.h:48
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:132
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:57
svgfig.template
def template(fileName, svg, replaceme="REPLACEME")
Definition: svgfig.py:521
AssociationMapOneToOne2Association
Definition: AssociationMapOneToOne2Association.h:17
InputTag.h
looper.cfg
cfg
Definition: looper.py:297
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
AssociationMapOneToOne2Association::am_
edm::EDGetTokenT< am_t > am_
Definition: AssociationMapOneToOne2Association.h:25
edm::EDProducer
Definition: EDProducer.h:36
ParameterAdapter.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443