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::StreamID
Definition: StreamID.h:30
LCToSimTSAssociatorEDProducer::LCCollectionToken_
edm::EDGetTokenT< reco::CaloClusterCollection > LCCollectionToken_
Definition: LCToSimTSAssociatorEDProducer.cc:41
SimClusterCollection
std::vector< SimCluster > SimClusterCollection
Definition: SimClusterFwd.h:8
LCToSimTSAssociatorEDProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: LCToSimTSAssociatorEDProducer.cc:80
LayerClusterToSimTracksterAssociator.h
MessageLogger.h
ESHandle.h
hgcal::RecoToSimCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, CaloParticleCollection, float > > RecoToSimCollection
Definition: LayerClusterToCaloParticleAssociatorBaseImpl.h:26
edm::EDGetTokenT< reco::CaloClusterCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
CaloParticleFwd.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
LCToSimTSAssociatorEDProducer::associationMapCPToLCToken_
edm::EDGetTokenT< hgcal::SimToRecoCollection > associationMapCPToLCToken_
Definition: LCToSimTSAssociatorEDProducer.cc:48
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:46
LCToSimTSAssociatorEDProducer::associationMapSCToLCToken_
edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associationMapSCToLCToken_
Definition: LCToSimTSAssociatorEDProducer.cc:53
LCToSimTSAssociatorEDProducer
Definition: LCToSimTSAssociatorEDProducer.cc:33
ticl
Definition: Common.h:8
edm::Handle
Definition: AssociativeIterator.h:50
LCToSimTSAssociatorEDProducer::associationMapLCToCPToken_
edm::EDGetTokenT< hgcal::RecoToSimCollection > associationMapLCToCPToken_
Definition: LCToSimTSAssociatorEDProducer.cc:47
hgcal
Definition: EgammaPCAHelper.h:31
MakerMacros.h
LCToSimTSAssociatorEDProducer::LCToSimTSAssociatorEDProducer
LCToSimTSAssociatorEDProducer(const edm::ParameterSet &)
Definition: LCToSimTSAssociatorEDProducer.cc:56
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
hgcal::LayerClusterToSimTracksterAssociator::associateRecoToSim
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.
Definition: LayerClusterToSimTracksterAssociator.h:26
hgcal::LayerClusterToSimTracksterAssociator::associateSimToReco
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.
Definition: LayerClusterToSimTracksterAssociator.h:37
reco::CaloClusterCollection
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
Definition: CaloClusterFwd.h:19
str
#define str(s)
Definition: TestProcessor.cc:53
CaloClusterFwd.h
EDGetToken.h
CaloParticleCollection
std::vector< CaloParticle > CaloParticleCollection
Definition: CaloParticleFwd.h:8
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::AssociationMap
Definition: AssociationMap.h:48
hgcal::SimToRecoCollectionWithSimClusters
edm::AssociationMap< edm::OneToManyWithQualityGeneric< SimClusterCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollectionWithSimClusters
Definition: LayerClusterToSimClusterAssociatorBaseImpl.h:23
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
LCToSimTSAssociatorEDProducer::associationMapLCToSCToken_
edm::EDGetTokenT< hgcal::RecoToSimCollectionWithSimClusters > associationMapLCToSCToken_
Definition: LCToSimTSAssociatorEDProducer.cc:52
LCToSimTSAssociatorEDProducer::associatorSC_
edm::InputTag associatorSC_
Definition: LCToSimTSAssociatorEDProducer.cc:51
LCToSimTSAssociatorEDProducer::associatorCP_
edm::InputTag associatorCP_
Definition: LCToSimTSAssociatorEDProducer.cc:46
LCToSimTSAssociatorEDProducer::~LCToSimTSAssociatorEDProducer
~LCToSimTSAssociatorEDProducer() override
Definition: LCToSimTSAssociatorEDProducer.cc:73
eostools.move
def move(src, dest)
Definition: eostools.py:511
ticl::TracksterCollection
std::vector< Trackster > TracksterCollection
Definition: Trackster.h:203
hgcal::RecoToSimCollectionWithSimClusters
edm::AssociationMap< edm::OneToManyWithQualityGeneric< reco::CaloClusterCollection, SimClusterCollection, float > > RecoToSimCollectionWithSimClusters
Definition: LayerClusterToSimClusterAssociatorBaseImpl.h:25
hgcal::SimToRecoCollection
edm::AssociationMap< edm::OneToManyWithQualityGeneric< CaloParticleCollection, reco::CaloClusterCollection, std::pair< float, float > > > SimToRecoCollection
Definition: LayerClusterToCaloParticleAssociatorBaseImpl.h:23
LCToSimTSAssociatorEDProducer::CPCollectionToken_
edm::EDGetTokenT< CaloParticleCollection > CPCollectionToken_
Definition: LCToSimTSAssociatorEDProducer.cc:45
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
LCToSimTSAssociatorEDProducer::SimTSCollectionToken_
edm::EDGetTokenT< ticl::TracksterCollection > SimTSCollectionToken_
Definition: LCToSimTSAssociatorEDProducer.cc:42
EDProducer.h
edm::Event
Definition: Event.h:73
LCToSimTSAssociatorEDProducer::associatorToken_
edm::EDGetTokenT< hgcal::LayerClusterToSimTracksterAssociator > associatorToken_
Definition: LCToSimTSAssociatorEDProducer.cc:43
edm::InputTag
Definition: InputTag.h:15
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
LCToSimTSAssociatorEDProducer::SCCollectionToken_
edm::EDGetTokenT< SimClusterCollection > SCCollectionToken_
Definition: LCToSimTSAssociatorEDProducer.cc:50