CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TSToSCAssociatorEDProducer.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  ~TSToSCAssociatorEDProducer() override;
36 
37 private:
38  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
39 
44 };
45 
47  produces<hgcal::SimToRecoCollectionTracksters>();
48  produces<hgcal::RecoToSimCollectionTracksters>();
49 
50  SCCollectionToken_ = consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"));
51  TSCollectionToken_ = consumes<ticl::TracksterCollection>(pset.getParameter<edm::InputTag>("label_tst"));
52  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lcl"));
53  associatorToken_ = consumes<hgcal::TracksterToSimClusterAssociator>(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<SimClusterCollection> SCCollection;
70  iEvent.getByToken(SCCollectionToken_, SCCollection);
71 
73  iEvent.getByToken(TSCollectionToken_, TSCollection);
74 
76  iEvent.getByToken(LCCollectionToken_, LCCollection);
77 
78  // associate TS and SC
79  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
81  theAssociator->associateRecoToSim(TSCollection, LCCollection, SCCollection);
82 
83  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
85  theAssociator->associateSimToReco(TSCollection, LCCollection, SCCollection);
86 
87  auto rts = std::make_unique<hgcal::RecoToSimCollectionTracksters>(recSimColl);
88  auto str = std::make_unique<hgcal::SimToRecoCollectionTracksters>(simRecColl);
89 
90  iEvent.put(std::move(rts));
91  iEvent.put(std::move(str));
92 }
93 
94 // 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
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< ticl::TracksterCollection > TSCollectionToken_
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< hgcal::TracksterToSimClusterAssociator > associatorToken_
def move
Definition: eostools.py:511
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TSToSCAssociatorEDProducer(const edm::ParameterSet &)
#define str(s)