CMS 3D CMS Logo

MCToCPAssociatorEDProducer.cc
Go to the documentation of this file.
1 //
2 // Original Author: Leonardo Cristella
3 // Created: Tue Feb 2 10:52:11 CET 2021
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  ~MCToCPAssociatorEDProducer() override;
37 
38 private:
39  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
40 
44 };
45 
47  produces<hgcal::SimToRecoCollectionWithMultiClusters>();
48  produces<hgcal::RecoToSimCollectionWithMultiClusters>();
49 
50  CPCollectionToken_ = consumes<CaloParticleCollection>(pset.getParameter<edm::InputTag>("label_cp"));
51  MCCollectionToken_ = consumes<reco::HGCalMultiClusterCollection>(pset.getParameter<edm::InputTag>("label_mcl"));
53  consumes<hgcal::MultiClusterToCaloParticleAssociator>(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(MCCollectionToken_, MCCollection);
74 
75  // associate MutiCluster and CP
76  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method"
77  << "\n";
79  theAssociator->associateRecoToSim(MCCollection, CPCollection);
80 
81  LogTrace("AssociatorValidator") << "Calling associateSimToReco method"
82  << "\n";
84  theAssociator->associateSimToReco(MCCollection, CPCollection);
85 
86  auto rts = std::make_unique<hgcal::RecoToSimCollectionWithMultiClusters>(recSimColl);
87  auto str = std::make_unique<hgcal::SimToRecoCollectionWithMultiClusters>(simRecColl);
88 
89  iEvent.put(std::move(rts));
90  iEvent.put(std::move(str));
91 }
92 
93 // define this as a plug-in
edm::StreamID
Definition: StreamID.h:30
MCToCPAssociatorEDProducer::MCToCPAssociatorEDProducer
MCToCPAssociatorEDProducer(const edm::ParameterSet &)
Definition: MCToCPAssociatorEDProducer.cc:46
MultiClusterToCaloParticleAssociator.h
MessageLogger.h
ESHandle.h
edm::EDGetTokenT< CaloParticleCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
CaloParticleFwd.h
HGCalMultiCluster.h
edm::Handle
Definition: AssociativeIterator.h:50
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MCToCPAssociatorEDProducer
Definition: MCToCPAssociatorEDProducer.cc:33
str
#define str(s)
Definition: TestProcessor.cc:53
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
MCToCPAssociatorEDProducer::CPCollectionToken_
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_
Definition: MCToCPAssociatorEDProducer.cc:41
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
MCToCPAssociatorEDProducer::~MCToCPAssociatorEDProducer
~MCToCPAssociatorEDProducer() override
Definition: MCToCPAssociatorEDProducer.cc:56
edm::AssociationMap
Definition: AssociationMap.h:48
iEvent
int iEvent
Definition: GenABIO.cc:224
MCToCPAssociatorEDProducer::associatorToken_
edm::EDGetTokenT< hgcal::MultiClusterToCaloParticleAssociator > associatorToken_
Definition: MCToCPAssociatorEDProducer.cc:43
edm::EventSetup
Definition: EventSetup.h:58
eostools.move
def move(src, dest)
Definition: eostools.py:511
hgcal::MultiClusterToCaloParticleAssociator::associateSimToReco
hgcal::SimToRecoCollectionWithMultiClusters associateSimToReco(const edm::Handle< reco::HGCalMultiClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a CaloParticle to MultiClusters.
Definition: MultiClusterToCaloParticleAssociator.h:33
hgcal::MultiClusterToCaloParticleAssociator::associateRecoToSim
hgcal::RecoToSimCollectionWithMultiClusters associateRecoToSim(const edm::Handle< reco::HGCalMultiClusterCollection > &cCCH, const edm::Handle< CaloParticleCollection > &cPCH) const
Associate a MultiCluster to CaloParticles.
Definition: MultiClusterToCaloParticleAssociator.h:26
MCToCPAssociatorEDProducer::MCCollectionToken_
edm::EDGetTokenT< reco::HGCalMultiClusterCollection > MCCollectionToken_
Definition: MCToCPAssociatorEDProducer.cc:42
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
EDProducer.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
MCToCPAssociatorEDProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: MCToCPAssociatorEDProducer.cc:63
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27