CMS 3D CMS Logo

MtdSimLayerClusterToTPAssociatorEDProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <string>
4 
5 // user include files
7 
11 
13 
17 
19 
21 
22 //
23 // class decleration
24 //
25 
27 public:
30 
31  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
32 
33 private:
34  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
35 
39 };
40 
42  produces<reco::SimToTPCollectionMtd>();
43  produces<reco::TPToSimCollectionMtd>();
44 
45  simClustersToken_ = consumes<MtdSimLayerClusterCollection>(pset.getParameter<edm::InputTag>("mtdSimClustersTag"));
46  tpToken_ = consumes<TrackingParticleCollection>(pset.getParameter<edm::InputTag>("trackingParticlesTag"));
47  associatorToken_ = consumes<reco::MtdSimLayerClusterToTPAssociator>(pset.getParameter<edm::InputTag>("associator"));
48 }
49 
51 
52 //
53 // member functions
54 //
55 
56 // ------------ method called to produce the data ------------
59  const edm::EventSetup &iSetup) const {
60  using namespace edm;
61 
63  iEvent.getByToken(associatorToken_, theAssociator);
64 
66  iEvent.getByToken(simClustersToken_, simClusters);
67 
69  iEvent.getByToken(tpToken_, trackingParticles);
70 
71  reco::SimToTPCollectionMtd simToTPColl = theAssociator->associateSimToTP(simClusters, trackingParticles);
72  reco::TPToSimCollectionMtd tpToSimColl = theAssociator->associateTPToSim(simClusters, trackingParticles);
73 
74  auto s2tp = std::make_unique<reco::SimToTPCollectionMtd>(simToTPColl);
75  auto tp2s = std::make_unique<reco::TPToSimCollectionMtd>(tpToSimColl);
76 
77  iEvent.put(std::move(s2tp));
78  iEvent.put(std::move(tp2s));
79 }
80 
83  desc.add<edm::InputTag>("associator", edm::InputTag("mtdSimLayerClusterToTPAssociatorByTrackId"));
84  desc.add<edm::InputTag>("mtdSimClustersTag", edm::InputTag("mix", "MergedMtdTruthLC"));
85  desc.add<edm::InputTag>("trackingParticlesTag", edm::InputTag("mix", "MergedTrackTruth"));
86 
87  cfg.add("mtdSimLayerClusterToTPAssociationDefault", desc);
88 }
89 
90 // define this as a plug-in
edm::EDGetTokenT< MtdSimLayerClusterCollection > simClustersToken_
edm::EDGetTokenT< reco::MtdSimLayerClusterToTPAssociator > associatorToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
reco::SimToTPCollectionMtd associateSimToTP(const edm::Handle< MtdSimLayerClusterCollection > &simClusH, const edm::Handle< TrackingParticleCollection > &trackingParticleH) const
Associate MtdSimLayerCluster to TrackingParticle.
reco::TPToSimCollectionMtd associateTPToSim(const edm::Handle< MtdSimLayerClusterCollection > &simClusH, const edm::Handle< TrackingParticleCollection > &trackingParticleH) const
Associate TrackingParticle to MtdSimLayerCluster.
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
HLT enums.
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:511