CMS 3D CMS Logo

LCToSimTSAssociatorEDProducer.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 
26 
28 
29 //
30 // class decleration
31 //
32 
34 public:
37 
38 private:
39  void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
40 
44 
49 
54 };
55 
57  : LCCollectionToken_(consumes<reco::CaloClusterCollection>(pset.getParameter<edm::InputTag>("label_lc"))),
58  SimTSCollectionToken_(consumes<ticl::TracksterCollection>(pset.getParameter<edm::InputTag>("label_simTst"))),
59  associatorToken_(
60  consumes<hgcal::LayerClusterToSimTracksterAssociator>(pset.getParameter<edm::InputTag>("associator"))),
61  CPCollectionToken_(consumes<CaloParticleCollection>(pset.getParameter<edm::InputTag>("label_cp"))),
62  associatorCP_(pset.getParameter<edm::InputTag>("associator_cp")),
63  associationMapLCToCPToken_(consumes<hgcal::RecoToSimCollection>(associatorCP_)),
64  associationMapCPToLCToken_(consumes<hgcal::SimToRecoCollection>(associatorCP_)),
65  SCCollectionToken_(consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"))),
66  associatorSC_(pset.getParameter<edm::InputTag>("associator_sc")),
67  associationMapLCToSCToken_(consumes<hgcal::RecoToSimCollectionWithSimClusters>(associatorSC_)),
68  associationMapSCToLCToken_(consumes<hgcal::SimToRecoCollectionWithSimClusters>(associatorSC_)) {
69  produces<hgcal::SimTracksterToRecoCollection>();
70  produces<hgcal::RecoToSimTracksterCollection>();
71 }
72 
74 
75 //
76 // member functions
77 //
78 
79 // ------------ method called to produce the data ------------
81  using namespace edm;
82 
84  iEvent.getByToken(associatorToken_, theAssociator);
85 
87  iEvent.getByToken(LCCollectionToken_, LCCollection);
88 
89  Handle<ticl::TracksterCollection> SimTSCollection;
90  iEvent.getByToken(SimTSCollectionToken_, SimTSCollection);
91 
92  Handle<CaloParticleCollection> CPCollection;
93  iEvent.getByToken(CPCollectionToken_, CPCollection);
94  const auto &LCToCPsColl = iEvent.get(associationMapLCToCPToken_);
95  const auto &CPToLCsColl = iEvent.get(associationMapCPToLCToken_);
96 
97  Handle<SimClusterCollection> SCCollection;
98  iEvent.getByToken(SCCollectionToken_, SCCollection);
99  const auto &LCToSCsColl = iEvent.get(associationMapLCToSCToken_);
100  const auto &SCToLCsColl = iEvent.get(associationMapSCToLCToken_);
101 
102  // associate LC and SimTS
103  LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n";
104  hgcal::RecoToSimTracksterCollection recSimColl = theAssociator->associateRecoToSim(
105  LCCollection, SimTSCollection, CPCollection, LCToCPsColl, SCCollection, LCToSCsColl);
106 
107  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
108  hgcal::SimTracksterToRecoCollection simRecColl = theAssociator->associateSimToReco(
109  LCCollection, SimTSCollection, CPCollection, CPToLCsColl, SCCollection, SCToLCsColl);
110 
111  auto rts = std::make_unique<hgcal::RecoToSimTracksterCollection>(recSimColl);
112  auto str = std::make_unique<hgcal::SimTracksterToRecoCollection>(simRecColl);
113 
114  iEvent.put(std::move(rts));
115  iEvent.put(std::move(str));
116 }
117 
118 // define this as a plug-in
edm::EDGetTokenT< ticl::TracksterCollection > SimTSCollectionToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::AssociationMap< edm::OneToManyWithQualityGeneric< CaloParticleCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollection
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< hgcal::RecoToSimCollection > associationMapLCToCPToken_
hgcal::RecoToSimTracksterCollection associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< ticl::TracksterCollection > &stCH, const edm::Handle< CaloParticleCollection > &cPCH, const hgcal::RecoToSimCollection &lCToCPs, const edm::Handle< SimClusterCollection > &sCCH, const hgcal::RecoToSimCollectionWithSimClusters &lCToSCs) const
Associate a LayerCluster to SimTracksters.
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associationMapSCToLCToken_
LCToSimTSAssociatorEDProducer(const edm::ParameterSet &)
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
hgcal::SimTracksterToRecoCollection associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< ticl::TracksterCollection > &sTCH, const edm::Handle< CaloParticleCollection > &cPCH, const hgcal::SimToRecoCollection &cpToLCs, const edm::Handle< SimClusterCollection > &sCCH, const hgcal::SimToRecoCollectionWithSimClusters &sCToLCs) const
Associate a SimTrackster to LayerClusters.
edm::EDGetTokenT< hgcal::LayerClusterToSimTracksterAssociator > associatorToken_
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< SimClusterCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollectionWithSimClusters
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
fixed size matrix
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
HLT enums.
std::vector< CaloParticle > CaloParticleCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, SimClusterCollection, float > > RecoToSimCollectionWithSimClusters
Definition: Common.h:8
std::vector< Trackster > TracksterCollection
Definition: Trackster.h:203
edm::EDGetTokenT< hgcal::RecoToSimCollectionWithSimClusters > associationMapLCToSCToken_
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
#define str(s)
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< hgcal::SimToRecoCollection > associationMapCPToLCToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, CaloParticleCollection, float > > RecoToSimCollection
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_