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 
26 
28 
29 //
30 // class decleration
31 //
32 
34 public:
36  ~LCToCPAssociatorEDProducer() override;
37 
38 private:
39  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
40 
44 };
45 
47  produces<hgcal::SimToRecoCollection>();
48  produces<hgcal::RecoToSimCollection>();
49 
50  CPCollectionToken_ = consumes<CaloParticleCollection>(pset.getParameter<edm::InputTag>("label_cp"));
51  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lc"));
53  consumes<hgcal::LayerClusterToCaloParticleAssociator>(pset.getParameter<edm::InputTag>("associator"));
54 }
55 
57 
58 //
59 // member functions
60 //
61 
62 // ------------ method called to produce the data ------------
64  using namespace edm;
65 
67  iEvent.getByToken(associatorToken_, theAssociator);
68 
69  Handle<CaloParticleCollection> CPCollection;
70  iEvent.getByToken(CPCollectionToken_, CPCollection);
71 
73  iEvent.getByToken(LCCollectionToken_, LCCollection);
74 
75  // associate LC and CP
76  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
77  hgcal::RecoToSimCollection recSimColl = theAssociator->associateRecoToSim(LCCollection, CPCollection);
78 
79  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
80  hgcal::SimToRecoCollection simRecColl = theAssociator->associateSimToReco(LCCollection, CPCollection);
81 
82  auto rts = std::make_unique<hgcal::RecoToSimCollection>(recSimColl);
83  auto str = std::make_unique<hgcal::SimToRecoCollection>(simRecColl);
84 
85  iEvent.put(std::move(rts));
86  iEvent.put(std::move(str));
87 }
88 
89 // define this as a plug-in
LCToCPAssociatorEDProducer::~LCToCPAssociatorEDProducer
~LCToCPAssociatorEDProducer() override
Definition: LCToCPAssociatorEDProducer.cc:56
edm::StreamID
Definition: StreamID.h:30
hgcal::LayerClusterToCaloParticleAssociator::associateSimToReco
hgcal::SimToRecoCollection associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a CaloParticle to LayerClusters.
Definition: LayerClusterToCaloParticleAssociator.h:32
LCToCPAssociatorEDProducer::LCToCPAssociatorEDProducer
LCToCPAssociatorEDProducer(const edm::ParameterSet &)
Definition: LCToCPAssociatorEDProducer.cc:46
MessageLogger.h
ESHandle.h
edm::EDGetTokenT< CaloParticleCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
CaloParticleFwd.h
hgcal::LayerClusterToCaloParticleAssociator::associateRecoToSim
hgcal::RecoToSimCollection associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a LayerCluster to CaloParticles.
Definition: LayerClusterToCaloParticleAssociator.h:26
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
str
#define str(s)
Definition: TestProcessor.cc:53
CaloClusterFwd.h
LCToCPAssociatorEDProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: LCToCPAssociatorEDProducer.cc:63
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::AssociationMap
Definition: AssociationMap.h:48
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
LCToCPAssociatorEDProducer::CPCollectionToken_
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_
Definition: LCToCPAssociatorEDProducer.cc:41
eostools.move
def move(src, dest)
Definition: eostools.py:511
LCToCPAssociatorEDProducer::associatorToken_
edm::EDGetTokenT< hgcal::LayerClusterToCaloParticleAssociator > associatorToken_
Definition: LCToCPAssociatorEDProducer.cc:43
LCToCPAssociatorEDProducer::LCCollectionToken_
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
Definition: LCToCPAssociatorEDProducer.cc:42
LCToCPAssociatorEDProducer
Definition: LCToCPAssociatorEDProducer.cc:33
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
LayerClusterToCaloParticleAssociator.h
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27