CMS 3D CMS Logo

TSToSimTSHitLCAssociatorEDProducer.cc
Go to the documentation of this file.
1 //
2 // Original Author: Leonardo Cristella
3 // Created: Wed Mar 30 10:52:11 CET 2022
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 
30 public:
33 
34 private:
35  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
36 
46 };
47 
49  produces<hgcal::SimToRecoCollectionSimTracksters>("simToReco");
50  produces<hgcal::RecoToSimCollectionSimTracksters>("recoToSim");
51 
52  TSCollectionToken_ = consumes<ticl::TracksterCollection>(pset.getParameter<edm::InputTag>("label_tst"));
53  SimTSCollectionToken_ = consumes<ticl::TracksterCollection>(pset.getParameter<edm::InputTag>("label_simTst"));
54  LCCollectionToken_ = consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lcl"));
55  SCCollectionToken_ = consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"));
56  CPCollectionToken_ = consumes<CaloParticleCollection>(pset.getParameter<edm::InputTag>("label_cp"));
58  consumes<hgcal::TracksterToSimTracksterHitLCAssociator>(pset.getParameter<edm::InputTag>("associator"));
59 }
60 
62 
65  const edm::EventSetup &iSetup) const {
66  using namespace edm;
67 
69  iEvent.getByToken(associatorToken_, theAssociator);
70 
72  iEvent.getByToken(TSCollectionToken_, TSCollection);
73 
74  Handle<ticl::TracksterCollection> SimTSCollection;
75  iEvent.getByToken(SimTSCollectionToken_, SimTSCollection);
76 
78  iEvent.getByToken(LCCollectionToken_, LCCollection);
79 
80  Handle<SimClusterCollection> SCCollection;
81  iEvent.getByToken(SCCollectionToken_, SCCollection);
82 
83  Handle<CaloParticleCollection> CPCollection;
84  iEvent.getByToken(CPCollectionToken_, CPCollection);
85 
86  // associate TS and SimTS
87  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
88 
90  theAssociator->associateRecoToSim(TSCollection, LCCollection, SCCollection, CPCollection, SimTSCollection);
91 
92  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
94  theAssociator->associateSimToReco(TSCollection, LCCollection, SCCollection, CPCollection, SimTSCollection);
95 
96  auto rts = std::make_unique<hgcal::RecoToSimCollectionSimTracksters>(recSimColl);
97  auto str = std::make_unique<hgcal::SimToRecoCollectionSimTracksters>(simRecColl);
98 
99  iEvent.put(std::move(rts), "recoToSim");
100  iEvent.put(std::move(str), "simToReco");
101 }
102 
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_
hgcal::SimToRecoCollectionSimTracksters associateSimToReco(const edm::Handle< ticl::TracksterCollection > &tCH, const edm::Handle< reco::CaloClusterCollection > &lCCH, const edm::Handle< SimClusterCollection > &sCCH, const edm::Handle< CaloParticleCollection > &cPCH, const edm::Handle< ticl::TracksterCollection > &sTCH) const
Associate a SimCluster to Tracksters.
edm::EDGetTokenT< std::map< uint, std::vector< uint > > > simTrackstersMap_
edm::EDGetTokenT< ticl::TracksterCollection > TSCollectionToken_
edm::EDGetTokenT< hgcal::TracksterToSimTracksterHitLCAssociator > associatorToken_
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
hgcal::RecoToSimCollectionSimTracksters associateRecoToSim(const edm::Handle< ticl::TracksterCollection > &tCH, const edm::Handle< reco::CaloClusterCollection > &lCCH, const edm::Handle< SimClusterCollection > &sCCH, const edm::Handle< CaloParticleCollection > &cPCH, const edm::Handle< ticl::TracksterCollection > &sTCH) const
Associate a Trackster to SimClusters.
edm::EDGetTokenT< ticl::TracksterCollection > SimTSFromCPCollectionToken_
HLT enums.
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define str(s)
edm::EDGetTokenT< ticl::TracksterCollection > SimTSCollectionToken_
def move(src, dest)
Definition: eostools.py:511