CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
def move
Definition: eostools.py:511
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
LCToSCAssociatorEDProducer(const edm::ParameterSet &)
#define str(s)
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
edm::EDGetTokenT< hgcal::LayerClusterToSimClusterAssociator > associatorToken_