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\n";
76  hgcal::RecoToSimCollectionWithSimClusters recSimColl = theAssociator->associateRecoToSim(LCCollection, SCCollection);
77 
78  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
79  hgcal::SimToRecoCollectionWithSimClusters simRecColl = theAssociator->associateSimToReco(LCCollection, SCCollection);
80 
81  auto rts = std::make_unique<hgcal::RecoToSimCollectionWithSimClusters>(recSimColl);
82  auto str = std::make_unique<hgcal::SimToRecoCollectionWithSimClusters>(simRecColl);
83 
84  iEvent.put(std::move(rts));
85  iEvent.put(std::move(str));
86 }
87 
88 // define this as a plug-in
hgcal::SimToRecoCollectionWithSimClusters associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a SimCluster to LayerClusters.
hgcal::RecoToSimCollectionWithSimClusters associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< SimClusterCollection > &sCCH) const
Associate a LayerCluster to SimClusters.
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
HLT enums.
LCToSCAssociatorEDProducer(const edm::ParameterSet &)
#define str(s)
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< hgcal::LayerClusterToSimClusterAssociator > associatorToken_