CMS 3D CMS Logo

LCToSCAssociatorEDProducer.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 
25 
27 
28 //
29 // class decleration
30 //
31 
33 public:
35  ~LCToSCAssociatorEDProducer() override;
36 
37 private:
38  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
39 
43 };
44 
46  produces<hgcal::SimToRecoCollectionWithSimClusters>();
47  produces<hgcal::RecoToSimCollectionWithSimClusters>();
48 
49  SCCollectionToken_ = consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"));
50  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lcl"));
52  consumes<hgcal::LayerClusterToSimClusterAssociator>(pset.getParameter<edm::InputTag>("associator"));
53 }
54 
56 
57 //
58 // member functions
59 //
60 
61 // ------------ method called to produce the data ------------
63  using namespace edm;
64 
66  iEvent.getByToken(associatorToken_, theAssociator);
67 
68  Handle<SimClusterCollection> SCCollection;
69  iEvent.getByToken(SCCollectionToken_, SCCollection);
70 
72  iEvent.getByToken(LCCollectionToken_, LCCollection);
73 
74  // associate LC and SC
75  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method"
76  << "\n";
77  hgcal::RecoToSimCollectionWithSimClusters recSimColl = theAssociator->associateRecoToSim(LCCollection, SCCollection);
78 
79  LogTrace("AssociatorValidator") << "Calling associateSimToReco method"
80  << "\n";
81  hgcal::SimToRecoCollectionWithSimClusters simRecColl = theAssociator->associateSimToReco(LCCollection, SCCollection);
82 
83  auto rts = std::make_unique<hgcal::RecoToSimCollectionWithSimClusters>(recSimColl);
84  auto str = std::make_unique<hgcal::SimToRecoCollectionWithSimClusters>(simRecColl);
85 
86  iEvent.put(std::move(rts));
87  iEvent.put(std::move(str));
88 }
89 
90 // define this as a plug-in
edm::StreamID
Definition: StreamID.h:30
MessageLogger.h
ESHandle.h
edm::EDGetTokenT< SimClusterCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
LCToSCAssociatorEDProducer::SCCollectionToken_
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
Definition: LCToSCAssociatorEDProducer.cc:40
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:52
CaloClusterFwd.h
EDGetToken.h
edm::global::EDProducer
Definition: EDProducer.h:32
LCToSCAssociatorEDProducer::LCToSCAssociatorEDProducer
LCToSCAssociatorEDProducer(const edm::ParameterSet &)
Definition: LCToSCAssociatorEDProducer.cc:45
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
hgcal::LayerClusterToSimClusterAssociator::associateSimToReco
hgcal::SimToRecoCollectionWithSimClusters associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a SimCluster to LayerClusters.
Definition: LayerClusterToSimClusterAssociator.h:35
hgcal::LayerClusterToSimClusterAssociator::associateRecoToSim
hgcal::RecoToSimCollectionWithSimClusters associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a LayerCluster to SimClusters.
Definition: LayerClusterToSimClusterAssociator.h:29
LCToSCAssociatorEDProducer
Definition: LCToSCAssociatorEDProducer.cc:32
LayerClusterToSimClusterAssociator.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
LCToSCAssociatorEDProducer::LCCollectionToken_
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
Definition: LCToSCAssociatorEDProducer.cc:41
LCToSCAssociatorEDProducer::associatorToken_
edm::EDGetTokenT< hgcal::LayerClusterToSimClusterAssociator > associatorToken_
Definition: LCToSCAssociatorEDProducer.cc:42
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
EDProducer.h
LCToSCAssociatorEDProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: LCToSCAssociatorEDProducer.cc:62
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
LCToSCAssociatorEDProducer::~LCToSCAssociatorEDProducer
~LCToSCAssociatorEDProducer() override
Definition: LCToSCAssociatorEDProducer.cc:55