CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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
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_
def move
Definition: eostools.py:511
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associationMapSCToLCToken_
LCToSimTSAssociatorEDProducer(const edm::ParameterSet &)
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
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_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< CaloParticle > CaloParticleCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, SimClusterCollection, float > > RecoToSimCollectionWithSimClusters
std::vector< Trackster > TracksterCollection
Definition: Trackster.h:203
edm::EDGetTokenT< hgcal::RecoToSimCollectionWithSimClusters > associationMapLCToSCToken_
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
#define str(s)
edm::EDGetTokenT< hgcal::SimToRecoCollection > associationMapCPToLCToken_
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, CaloParticleCollection, float > > RecoToSimCollection
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_