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<ticl::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<ticl::RecoToSimCollection>(associatorCP_)),
64  associationMapCPToLCToken_(consumes<ticl::SimToRecoCollection>(associatorCP_)),
65  SCCollectionToken_(consumes<SimClusterCollection>(pset.getParameter<edm::InputTag>("label_scl"))),
66  associatorSC_(pset.getParameter<edm::InputTag>("associator_sc")),
67  associationMapLCToSCToken_(consumes<ticl::RecoToSimCollectionWithSimClusters>(associatorSC_)),
68  associationMapSCToLCToken_(consumes<ticl::SimToRecoCollectionWithSimClusters>(associatorSC_)) {
69  produces<ticl::SimTracksterToRecoCollection>();
70  produces<ticl::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  ticl::RecoToSimTracksterCollection recSimColl = theAssociator->associateRecoToSim(
105  LCCollection, SimTSCollection, CPCollection, LCToCPsColl, SCCollection, LCToSCsColl);
106 
107  LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n";
108  ticl::SimTracksterToRecoCollection simRecColl = theAssociator->associateSimToReco(
109  LCCollection, SimTSCollection, CPCollection, CPToLCsColl, SCCollection, SCToLCsColl);
110 
111  auto rts = std::make_unique<ticl::RecoToSimTracksterCollection>(recSimColl);
112  auto str = std::make_unique<ticl::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::RecoToSimCollection > associationMapLCToCPToken_
edm::EDGetTokenT< ticl::TracksterCollection > SimTSCollectionToken_
ticl::SimTracksterToRecoCollection associateSimToReco(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< ticl::TracksterCollection > &sTCH, const edm::Handle< CaloParticleCollection > &cPCH, const ticl::SimToRecoCollection &cpToLCs, const edm::Handle< SimClusterCollection > &sCCH, const ticl::SimToRecoCollectionWithSimClusters &sCToLCs) const
Associate a SimTrackster to LayerClusters.
edm::EDGetTokenT< ticl::SimToRecoCollectionWithSimClusters > associationMapSCToLCToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< CaloParticleCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollection
edm::EDGetTokenT< ticl::SimToRecoCollection > associationMapCPToLCToken_
edm::EDGetTokenT< ticl::RecoToSimCollectionWithSimClusters > associationMapLCToSCToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< SimClusterCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollectionWithSimClusters
edm::EDGetTokenT< ticl::LayerClusterToSimTracksterAssociator > associatorToken_
#define LogTrace(id)
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, CaloParticleCollection, float > > RecoToSimCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, SimClusterCollection, float > > RecoToSimCollectionWithSimClusters
int iEvent
Definition: GenABIO.cc:224
LCToSimTSAssociatorEDProducer(const edm::ParameterSet &)
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
ticl::RecoToSimTracksterCollection associateRecoToSim(const edm::Handle< reco::CaloClusterCollection > &cCCH, const edm::Handle< ticl::TracksterCollection > &stCH, const edm::Handle< CaloParticleCollection > &cPCH, const ticl::RecoToSimCollection &lCToCPs, const edm::Handle< SimClusterCollection > &sCCH, const ticl::RecoToSimCollectionWithSimClusters &lCToSCs) const
Associate a LayerCluster to SimTracksters.
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
Definition: Common.h:10
std::vector< Trackster > TracksterCollection
Definition: Trackster.h:254
std::vector< SimCluster > SimClusterCollection
#define str(s)
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_