SimTracker
TrackAssociatorProducers
plugins
TrackAssociatorByHitsProducer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: SimTracker/TrackAssociatorProducers
4
// Class: TrackAssociatorByHitsProducer
5
//
13
//
14
// Original Author: Christopher Jones
15
// Created: Mon, 05 Jan 2015 20:38:27 GMT
16
//
17
//
18
19
// system include files
20
#include <memory>
21
22
// user include files
23
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
24
#include "
FWCore/Framework/interface/global/EDProducer.h
"
25
26
#include "
FWCore/Framework/interface/Event.h
"
27
#include "
FWCore/Framework/interface/MakerMacros.h
"
28
#include "
FWCore/Framework/interface/EventSetup.h
"
29
#include "
FWCore/Framework/interface/ESHandle.h
"
30
#include "
FWCore/Utilities/interface/EDGetToken.h
"
31
32
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
33
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
34
35
#include "
DataFormats/TrackerCommon/interface/TrackerTopology.h
"
36
#include "
Geometry/Records/interface/TrackerTopologyRcd.h
"
37
38
#include "
TrackAssociatorByHitsImpl.h
"
39
#include "
SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h
"
40
#include "
SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h
"
41
42
//
43
// class declaration
44
//
45
46
using
SimHitTPAssociationList
=
TrackAssociatorByHitsImpl::SimHitTPAssociationList
;
47
48
class
TrackAssociatorByHitsProducer
:
public
edm::global::EDProducer
<> {
49
public
:
50
explicit
TrackAssociatorByHitsProducer
(
const
edm::ParameterSet
&);
51
~TrackAssociatorByHitsProducer
()
override
;
52
53
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
54
55
private
:
56
void
beginJob
()
override
;
57
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
58
void
endJob
()
override
;
59
60
// ----------member data ---------------------------
61
TrackerHitAssociator::Config
trackerHitAssociatorConfig_
;
62
edm::EDGetTokenT<SimHitTPAssociationList>
simHitTpMapToken_
;
63
TrackAssociatorByHitsImpl::SimToRecoDenomType
SimToRecoDenominator
;
64
const
double
quality_SimToReco
;
65
const
double
purity_SimToReco
;
66
const
double
cut_RecoToSim
;
67
const
bool
UsePixels
;
68
const
bool
UseGrouped
;
69
const
bool
UseSplitting
;
70
const
bool
ThreeHitTracksAreSpecial
;
71
const
bool
AbsoluteNumberOfHits
;
72
};
73
74
//
75
// constants, enums and typedefs
76
//
77
78
//
79
// static data member definitions
80
//
81
82
//
83
// constructors and destructor
84
//
85
TrackAssociatorByHitsProducer::TrackAssociatorByHitsProducer
(
const
edm::ParameterSet
& iConfig)
86
: trackerHitAssociatorConfig_(iConfig, consumesCollector()),
87
simHitTpMapToken_(consumes<
SimHitTPAssociationList
>(iConfig.getParameter<
edm
::
InputTag
>(
"simHitTpMapTag"
))),
88
SimToRecoDenominator
(
TrackAssociatorByHitsImpl
::denomnone),
89
quality_SimToReco(iConfig.getParameter<double>(
"Quality_SimToReco"
)),
90
purity_SimToReco(iConfig.getParameter<double>(
"Purity_SimToReco"
)),
91
cut_RecoToSim(iConfig.getParameter<double>(
"Cut_RecoToSim"
)),
92
UsePixels
(iConfig.getParameter<
bool
>(
"UsePixels"
)),
93
UseGrouped
(iConfig.getParameter<
bool
>(
"UseGrouped"
)),
94
UseSplitting
(iConfig.getParameter<
bool
>(
"UseSplitting"
)),
95
ThreeHitTracksAreSpecial
(iConfig.getParameter<
bool
>(
"ThreeHitTracksAreSpecial"
)),
96
AbsoluteNumberOfHits
(iConfig.getParameter<
bool
>(
"AbsoluteNumberOfHits"
)) {
97
std::string
tmp
= iConfig.
getParameter
<
std::string
>(
"SimToRecoDenominator"
);
98
if
(
tmp
==
"sim"
) {
99
SimToRecoDenominator
=
TrackAssociatorByHitsImpl::denomsim
;
100
}
else
if
(
tmp
==
"reco"
) {
101
SimToRecoDenominator
=
TrackAssociatorByHitsImpl::denomreco
;
102
}
103
104
if
(
SimToRecoDenominator
==
TrackAssociatorByHitsImpl::denomnone
) {
105
throw
cms::Exception
(
"TrackAssociatorByHitsImpl"
) <<
"SimToRecoDenominator not specified as sim or reco"
;
106
}
107
108
//register your products
109
produces<reco::TrackToTrackingParticleAssociator>();
110
}
111
112
TrackAssociatorByHitsProducer::~TrackAssociatorByHitsProducer
() {
113
// do anything here that needs to be done at desctruction time
114
// (e.g. close files, deallocate resources etc.)
115
}
116
117
//
118
// member functions
119
//
120
121
// ------------ method called to produce the data ------------
122
void
TrackAssociatorByHitsProducer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
123
using namespace
edm
;
124
125
std::unique_ptr<TrackerHitAssociator> thAssoc(
new
TrackerHitAssociator
(
iEvent
,
trackerHitAssociatorConfig_
));
126
127
edm::ESHandle<TrackerTopology>
tTopoHand;
128
iSetup.
get
<
TrackerTopologyRcd
>().
get
(tTopoHand);
129
130
edm::Handle<SimHitTPAssociationList>
simHitsTPAssoc;
131
//warning: make sure the TP collection used in the map is the same used in the associator!
132
iEvent
.getByToken(
simHitTpMapToken_
, simHitsTPAssoc);
133
134
std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl>
impl
(
135
new
TrackAssociatorByHitsImpl
(
iEvent
.productGetter(),
136
std::move
(thAssoc),
137
&(*tTopoHand),
138
&(*simHitsTPAssoc),
139
SimToRecoDenominator
,
140
quality_SimToReco
,
141
purity_SimToReco
,
142
cut_RecoToSim
,
143
UsePixels
,
144
UseGrouped
,
145
UseSplitting
,
146
ThreeHitTracksAreSpecial
,
147
AbsoluteNumberOfHits
));
148
std::unique_ptr<reco::TrackToTrackingParticleAssociator>
toPut
(
149
new
reco::TrackToTrackingParticleAssociator
(
std::move
(
impl
)));
150
iEvent
.put(
std::move
(
toPut
));
151
}
152
153
// ------------ method called once each job just before starting event loop ------------
154
void
TrackAssociatorByHitsProducer::beginJob
() {}
155
156
// ------------ method called once each job just after ending the event loop ------------
157
void
TrackAssociatorByHitsProducer::endJob
() {}
158
159
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
160
void
TrackAssociatorByHitsProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
161
//The following says we do not know what parameters are allowed so do no validation
162
// Please change this to state exactly what you do use, even if it is no parameters
163
edm::ParameterSetDescription
desc
;
164
desc
.setUnknown();
165
descriptions.
addDefault
(
desc
);
166
}
167
168
//define this as a plug-in
169
DEFINE_FWK_MODULE
(
TrackAssociatorByHitsProducer
);
edm::StreamID
Definition:
StreamID.h:30
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
TrackAssociatorByHitsProducer::trackerHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Definition:
TrackAssociatorByHitsProducer.cc:61
TrackAssociatorByHitsProducer::purity_SimToReco
const double purity_SimToReco
Definition:
TrackAssociatorByHitsProducer.cc:65
MessageLogger.h
TrackAssociatorByHitsImpl::SimHitTPAssociationList
std::vector< SimHitTPPair > SimHitTPAssociationList
Definition:
TrackAssociatorByHitsImpl.h:28
ESHandle.h
TrackAssociatorByHitsProducer::endJob
void endJob() override
Definition:
TrackAssociatorByHitsProducer.cc:157
edm::EDGetTokenT< SimHitTPAssociationList >
edm
HLT enums.
Definition:
AlignableModifier.h:19
MuonAssociatorByHits_cfi.UsePixels
UsePixels
Definition:
MuonAssociatorByHits_cfi.py:32
TrackAssociatorByHitsProducer::simHitTpMapToken_
edm::EDGetTokenT< SimHitTPAssociationList > simHitTpMapToken_
Definition:
TrackAssociatorByHitsProducer.cc:62
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89285
reco::TrackToTrackingParticleAssociator
Definition:
TrackToTrackingParticleAssociator.h:51
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
TrackAssociatorByHitsProducer::SimToRecoDenominator
TrackAssociatorByHitsImpl::SimToRecoDenomType SimToRecoDenominator
Definition:
TrackAssociatorByHitsProducer.cc:63
TrackAssociatorByHitsProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
TrackAssociatorByHitsProducer.cc:122
TrackerHitAssociator.h
TrackerHitAssociator::Config
Definition:
TrackerHitAssociator.h:57
createJobs.tmp
tmp
align.sh
Definition:
createJobs.py:716
TrackAssociatorByHitsProducer::UseSplitting
const bool UseSplitting
Definition:
TrackAssociatorByHitsProducer.cc:69
edm::Handle
Definition:
AssociativeIterator.h:50
TrackAssociatorByHitsImpl::denomnone
Definition:
TrackAssociatorByHitsImpl.h:25
TrackAssociatorByHitsProducer::AbsoluteNumberOfHits
const bool AbsoluteNumberOfHits
Definition:
TrackAssociatorByHitsProducer.cc:71
MakerMacros.h
TrackerTopology.h
TrackerTopologyRcd.h
TrackAssociatorByHitsProducer::beginJob
void beginJob() override
Definition:
TrackAssociatorByHitsProducer.cc:154
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ESHandle< TrackerTopology >
TrackAssociatorByHitsImpl::denomsim
Definition:
TrackAssociatorByHitsImpl.h:25
MuonAssociatorByHits_cfi.UseSplitting
UseSplitting
Definition:
MuonAssociatorByHits_cfi.py:34
TrackAssociatorByHitsImpl::denomreco
Definition:
TrackAssociatorByHitsImpl.h:25
EDGetToken.h
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
TrackToTrackingParticleAssociator.h
edm::ParameterSet
Definition:
ParameterSet.h:47
TrackAssociatorByHitsProducer::UsePixels
const bool UsePixels
Definition:
TrackAssociatorByHitsProducer.cc:67
TrackAssociatorByHitsProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TrackAssociatorByHitsProducer.cc:160
Event.h
TrackAssociatorByHitsProducer
Definition:
TrackAssociatorByHitsProducer.cc:48
MuonAssociatorByHits_cfi.UseGrouped
UseGrouped
Definition:
MuonAssociatorByHits_cfi.py:33
iEvent
int iEvent
Definition:
GenABIO.cc:224
TrackAssociatorByHitsProducer::ThreeHitTracksAreSpecial
const bool ThreeHitTracksAreSpecial
Definition:
TrackAssociatorByHitsProducer.cc:70
edm::EventSetup
Definition:
EventSetup.h:58
DBConfiguration_cff.toPut
toPut
Definition:
DBConfiguration_cff.py:25
TrackAssociatorByHitsImpl
Definition:
TrackAssociatorByHitsImpl.h:23
get
#define get
TrackAssociatorByHitsProducer::TrackAssociatorByHitsProducer
TrackAssociatorByHitsProducer(const edm::ParameterSet &)
Definition:
TrackAssociatorByHitsProducer.cc:85
TrackerHitAssociator
Definition:
TrackerHitAssociator.h:55
TrackAssociatorByHitsProducer::cut_RecoToSim
const double cut_RecoToSim
Definition:
TrackAssociatorByHitsProducer.cc:66
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
impl
Definition:
trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
quickTrackAssociatorByHits_cfi.AbsoluteNumberOfHits
AbsoluteNumberOfHits
Definition:
quickTrackAssociatorByHits_cfi.py:4
Exception
Definition:
hltDiff.cc:245
TrackAssociatorByHitsProducer::UseGrouped
const bool UseGrouped
Definition:
TrackAssociatorByHitsProducer.cc:68
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
TrackAssociatorByHitsProducer::~TrackAssociatorByHitsProducer
~TrackAssociatorByHitsProducer() override
Definition:
TrackAssociatorByHitsProducer.cc:112
TrackAssociatorByHitsImpl.h
TrackAssociatorByHitsProducer::quality_SimToReco
const double quality_SimToReco
Definition:
TrackAssociatorByHitsProducer.cc:64
TrackerTopologyRcd
Definition:
TrackerTopologyRcd.h:10
SimHitTPAssociationList
TrackAssociatorByHitsImpl::SimHitTPAssociationList SimHitTPAssociationList
Definition:
TrackAssociatorByHitsProducer.cc:46
ParameterSet.h
TrackAssociatorByHitsImpl::SimToRecoDenomType
SimToRecoDenomType
Definition:
TrackAssociatorByHitsImpl.h:25
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
quickTrackAssociatorByHits_cfi.SimToRecoDenominator
SimToRecoDenominator
Definition:
quickTrackAssociatorByHits_cfi.py:6
MuonAssociatorByHits_cfi.ThreeHitTracksAreSpecial
ThreeHitTracksAreSpecial
Definition:
MuonAssociatorByHits_cfi.py:35
Generated for CMSSW Reference Manual by
1.8.16