CMS 3D CMS Logo

LCToCPAssociatorEDProducer.cc
Go to the documentation of this file.
1 //
2 // Original Author: Leonardo Cristella
3 // Created: Thu Dec 3 10:52:11 CET 2020
4 //
5 //
6 
7 // system include files
8 #include <memory>
9 #include <string>
10 
11 // user include files
13 
16 
18 
20 
22 
28 
30 
31 //
32 // class decleration
33 //
34 
36 public:
38  ~LCToCPAssociatorEDProducer() override;
39 
40 private:
41  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
42 
46 };
47 
49  produces<ticl::SimToRecoCollection>();
50  produces<ticl::RecoToSimCollection>();
51 
52  CPCollectionToken_ = consumes<CaloParticleCollection>(pset.getParameter<edm::InputTag>("label_cp"));
53  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lc"));
55  consumes<ticl::LayerClusterToCaloParticleAssociator>(pset.getParameter<edm::InputTag>("associator"));
56 }
57 
59 
60 //
61 // member functions
62 //
63 
64 // ------------ method called to produce the data ------------
66  using namespace edm;
67 
69  iEvent.getByToken(associatorToken_, theAssociator);
70 
71  Handle<CaloParticleCollection> CPCollection;
72  iEvent.getByToken(CPCollectionToken_, CPCollection);
73 
75  iEvent.getByToken(LCCollectionToken_, LCCollection);
76 
77  // associate LC and CP
78  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
79  ticl::RecoToSimCollection recSimColl = theAssociator->associateRecoToSim(LCCollection, CPCollection);
80 
81  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
82  ticl::SimToRecoCollection simRecColl = theAssociator->associateSimToReco(LCCollection, CPCollection);
83 
84  auto rts = std::make_unique<ticl::RecoToSimCollection>(recSimColl);
85  auto str = std::make_unique<ticl::SimToRecoCollection>(simRecColl);
86 
87  iEvent.put(std::move(rts));
88  iEvent.put(std::move(str));
89 }
90 
91 // define this as a plug-in
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
#define LogTrace(id)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
ticl::SimToRecoCollection associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a CaloParticle to LayerClusters.
int iEvent
Definition: GenABIO.cc:224
ticl::RecoToSimCollection associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a LayerCluster to CaloParticles.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< ticl::LayerClusterToCaloParticleAssociator > associatorToken_
HLT enums.
LCToCPAssociatorEDProducer(const edm::ParameterSet &)
#define str(s)
def move(src, dest)
Definition: eostools.py:511