Skip to content

Commit 2d178de

Browse files
committed
Add runtime files
1 parent 0ba337b commit 2d178de

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Original author: Leonardo Cristella
2+
3+
// user include files
4+
#include "FWCore/Framework/interface/Frameworkfwd.h"
5+
#include "FWCore/Framework/interface/global/EDProducer.h"
6+
7+
#include "FWCore/Framework/interface/Event.h"
8+
#include "FWCore/Framework/interface/MakerMacros.h"
9+
10+
#include "FWCore/ParameterSet/interface/ParameterSet.h"
11+
#include "FWCore/Utilities/interface/EDGetToken.h"
12+
#include "FWCore/Utilities/interface/ESGetToken.h"
13+
14+
#include "SimDataFormats/Associations/interface/TracksterToSimTracksterAssociator.h"
15+
#include "TSToSimTSAssociatorByEnergyScoreImpl.h"
16+
17+
class TSToSimTSAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> {
18+
public:
19+
explicit TSToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &);
20+
~TSToSimTSAssociatorByEnergyScoreProducer() override;
21+
22+
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
23+
24+
private:
25+
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override;
26+
edm::EDGetTokenT<std::unordered_map<DetId, const HGCRecHit *>> hitMap_;
27+
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
28+
const bool hardScatterOnly_;
29+
std::shared_ptr<hgcal::RecHitTools> rhtools_;
30+
};
31+
32+
TSToSimTSAssociatorByEnergyScoreProducer::TSToSimTSAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps)
33+
: hitMap_(consumes<std::unordered_map<DetId, const HGCRecHit *>>(ps.getParameter<edm::InputTag>("hitMapTag"))),
34+
caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()),
35+
hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")) {
36+
rhtools_.reset(new hgcal::RecHitTools());
37+
38+
// Register the product
39+
produces<hgcal::TracksterToSimTracksterAssociator>();
40+
}
41+
42+
TSToSimTSAssociatorByEnergyScoreProducer::~TSToSimTSAssociatorByEnergyScoreProducer() {}
43+
44+
void TSToSimTSAssociatorByEnergyScoreProducer::produce(edm::StreamID,
45+
edm::Event &iEvent,
46+
const edm::EventSetup &es) const {
47+
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_);
48+
rhtools_->setGeometry(*geom);
49+
50+
const auto hitMap = &iEvent.get(hitMap_);
51+
52+
auto impl = std::make_unique<TSToSimTSAssociatorByEnergyScoreImpl>(
53+
iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap);
54+
auto toPut = std::make_unique<hgcal::TracksterToSimTracksterAssociator>(std::move(impl));
55+
iEvent.put(std::move(toPut));
56+
}
57+
58+
void TSToSimTSAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) {
59+
edm::ParameterSetDescription desc;
60+
desc.add<edm::InputTag>("hitMapTag", edm::InputTag("hgcalRecHitMapProducer"));
61+
desc.add<bool>("hardScatterOnly", true);
62+
63+
cfg.add("simTracksterAssociatorByEnergyScore", desc);
64+
}
65+
66+
//define this as a plug-in
67+
DEFINE_FWK_MODULE(TSToSimTSAssociatorByEnergyScoreProducer);

SimDataFormats/Associations/src/classes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "SimDataFormats/Associations/interface/TrackAssociation.h"
1212
#include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h"
1313
#include "SimDataFormats/Associations/interface/MultiClusterToCaloParticleAssociator.h"
14+
#include "SimDataFormats/Associations/interface/TracksterToSimTracksterAssociator.h"
1415
#include "SimDataFormats/Associations/interface/TTTrackTruthPair.h"
1516

1617
namespace SimDataFormats_Associations {
@@ -30,6 +31,8 @@ namespace SimDataFormats_Associations {
3031

3132
edm::Wrapper<hgcal::MultiClusterToCaloParticleAssociator> dummy8;
3233

34+
edm::Wrapper<hgcal::TracksterToSimTracksterAssociator> dummy9;
35+
3336
reco::VertexSimToRecoCollection vstrc;
3437
reco::VertexSimToRecoCollection::const_iterator vstrci;
3538
edm::Wrapper<reco::VertexSimToRecoCollection> wvstrc;

SimDataFormats/Associations/src/classes_def.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
<class name="hgcal::MultiClusterToCaloParticleAssociator" persistent="false"/>
2222
<class name="edm::Wrapper<hgcal::MultiClusterToCaloParticleAssociator>" persistent="false"/>
2323

24+
<class name="hgcal::TracksterToSimTracksterAssociator" persistent="false"/>
25+
<class name="edm::Wrapper<hgcal::TracksterToSimTracksterAssociator>" persistent="false"/>
26+
27+
2428
<class name="reco::VertexSimToRecoCollection" >
2529
<field name="transientMap_" transient="true"/>
2630
</class>
@@ -59,6 +63,7 @@
5963
<class name="edm::helpers::KeyVal<edm::RefProd<vector<SimCluster> >, edm::RefProd<vector<ticl::Trackster> > >" />
6064
<class name="edm::helpers::KeyVal<edm::RefProd<vector<ticl::Trackster> >, edm::RefProd<vector<SimCluster> > >" />
6165

66+
6267
<class name="hgcal::SimToRecoCollectionTracksters" >
6368
<field name="transientMap_" transient="true"/>
6469
</class>
@@ -80,10 +85,13 @@
8085
<class name="reco::RecoToSimCollection" >
8186
<field name="transientMap_" transient="true"/>
8287
</class>
88+
89+
8390
<class name="edm::Wrapper<edm::AssociationMap<edm::OneToManyWithQualityGeneric<edm::View<reco::Track>,vector<TrackingParticle>,double,unsigned int,edm::RefToBaseProd<reco::Track>,edm::RefProd<vector<TrackingParticle> >,edm::RefToBase<reco::Track>,edm::Ref<vector<TrackingParticle>,TrackingParticle,edm::refhelper::FindUsingAdvance<vector<TrackingParticle>,TrackingParticle> > > > >" />
8491
<class name="edm::Wrapper<edm::AssociationMap<edm::OneToManyWithQualityGeneric<vector<TrackingParticle>,edm::View<reco::Track>,double,unsigned int,edm::RefProd<vector<TrackingParticle> >,edm::RefToBaseProd<reco::Track>,edm::Ref<vector<TrackingParticle>,TrackingParticle,edm::refhelper::FindUsingAdvance<vector<TrackingParticle>,TrackingParticle> >,edm::RefToBase<reco::Track> > > >" />
8592

86-
<class name="hgcal::SimToRecoCollectionWithMultiClusters" >
93+
94+
<class name="hgcal::SimToRecoCollectionWithMultiClusters" >
8795
<field name="transientMap_" transient="true"/>
8896
</class>
8997
<class name="edm::Wrapper<hgcal::SimToRecoCollectionWithMultiClusters>" />
@@ -96,6 +104,19 @@
96104
<class name="edm::helpers::KeyVal<edm::RefProd<vector<CaloParticle> >,edm::RefProd<vector<reco::HGCalMultiCluster> > >" />
97105
<class name="edm::helpers::KeyVal<edm::RefProd<vector<reco::HGCalMultiCluster> >,edm::RefProd<vector<CaloParticle> > >" />
98106

107+
108+
<class name="hgcal::SimToRecoCollectionSimTracksters" >
109+
<field name="transientMap_" transient="true"/>
110+
</class>
111+
<class name="edm::Wrapper<hgcal::SimToRecoCollectionSimTracksters>" />
112+
<class name="hgcal::RecoToSimCollectionSimTracksters" >
113+
<field name="transientMap_" transient="true"/>
114+
</class>
115+
<class name="edm::Wrapper<hgcal::RecoToSimCollectionSimTracksters>" />
116+
117+
<class name="edm::helpers::KeyVal<edm::RefProd<vector<ticl::Trackster> >,edm::RefProd<vector<ticl::Trackster> > >" />
118+
119+
99120
<class name="TTTrackTruthPair<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>,Phase2TrackerDigi,edm::refhelper::FindForDetSetVector<Phase2TrackerDigi> > >" />
100121
<class name="std::vector<TTTrackTruthPair<edm::Ref<edm::DetSetVector<Phase2TrackerDigi>,Phase2TrackerDigi,edm::refhelper::FindForDetSetVector<Phase2TrackerDigi> > > >" />
101122

0 commit comments

Comments
 (0)