SimTracker
TrackAssociatorProducers
plugins
TrackAssociatorByChi2Producer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: SimTracker/TrackAssociatorProducers
4
// Class: TrackAssociatorByChi2Producer
5
//
13
//
14
// Original Author: Christopher Jones
15
// Created: Tue, 06 Jan 2015 16:13:00 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/ESHandle.h
"
29
30
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
31
32
#include "
SimDataFormats/Associations/interface/TrackToTrackingParticleAssociator.h
"
33
#include "
SimDataFormats/Associations/interface/TrackToGenParticleAssociator.h
"
34
#include "
SimDataFormats/Associations/interface/TrackToTrackingParticleAssociatorBaseImpl.h
"
35
36
#include "
MagneticField/Records/interface/IdealMagneticFieldRecord.h
"
37
38
#include "
TrackAssociatorByChi2Impl.h
"
39
#include "
TrackGenAssociatorByChi2Impl.h
"
40
41
//
42
// class declaration
43
//
44
45
class
TrackAssociatorByChi2Producer
:
public
edm::global::EDProducer
<> {
46
public
:
47
explicit
TrackAssociatorByChi2Producer
(
const
edm::ParameterSet
&);
48
~TrackAssociatorByChi2Producer
()
override
;
49
50
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
51
52
private
:
53
void
produce
(
edm::StreamID
,
edm::Event
&,
const
edm::EventSetup
&)
const override
;
54
55
// ----------member data ---------------------------
56
edm::EDGetTokenT<reco::BeamSpot>
bsToken_
;
57
const
double
chi2cut_
;
58
const
bool
onlyDiagonal_
;
59
};
60
61
//
62
// constants, enums and typedefs
63
//
64
65
//
66
// static data member definitions
67
//
68
69
//
70
// constructors and destructor
71
//
72
TrackAssociatorByChi2Producer::TrackAssociatorByChi2Producer
(
const
edm::ParameterSet
& iConfig)
73
: bsToken_(consumes<
reco
::
BeamSpot
>(iConfig.getParameter<
edm
::
InputTag
>(
"beamSpot"
))),
74
chi2cut_(iConfig.getParameter<double>(
"chi2cut"
)),
75
onlyDiagonal_(iConfig.getParameter<
bool
>(
"onlyDiagonal"
)) {
76
//register your products
77
produces<reco::TrackToTrackingParticleAssociator>();
78
produces<reco::TrackToGenParticleAssociator>();
79
}
80
81
TrackAssociatorByChi2Producer::~TrackAssociatorByChi2Producer
() {
82
// do anything here that needs to be done at desctruction time
83
// (e.g. close files, deallocate resources etc.)
84
}
85
86
//
87
// member functions
88
//
89
90
// ------------ method called to produce the data ------------
91
void
TrackAssociatorByChi2Producer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
92
using namespace
edm
;
93
94
edm::ESHandle<MagneticField>
magField;
95
iSetup.
get
<
IdealMagneticFieldRecord
>().
get
(magField);
96
97
edm::Handle<reco::BeamSpot>
beamSpot
;
98
iEvent
.getByToken(
bsToken_
,
beamSpot
);
99
100
{
101
std::unique_ptr<reco::TrackToTrackingParticleAssociatorBaseImpl>
impl
(
102
new
TrackAssociatorByChi2Impl
(*magField, *
beamSpot
,
chi2cut_
,
onlyDiagonal_
));
103
104
std::unique_ptr<reco::TrackToTrackingParticleAssociator>
assoc
(
105
new
reco::TrackToTrackingParticleAssociator
(
std::move
(
impl
)));
106
107
iEvent
.put(
std::move
(
assoc
));
108
}
109
110
{
111
std::unique_ptr<reco::TrackToGenParticleAssociatorBaseImpl>
impl
(
112
new
TrackGenAssociatorByChi2Impl
(*magField, *
beamSpot
,
chi2cut_
,
onlyDiagonal_
));
113
114
std::unique_ptr<reco::TrackToGenParticleAssociator>
assoc
(
new
reco::TrackToGenParticleAssociator
(
std::move
(
impl
)));
115
116
iEvent
.put(
std::move
(
assoc
));
117
}
118
}
119
120
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
121
void
TrackAssociatorByChi2Producer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
122
//The following says we do not know what parameters are allowed so do no validation
123
// Please change this to state exactly what you do use, even if it is no parameters
124
edm::ParameterSetDescription
desc;
125
desc.
setUnknown
();
126
descriptions.
addDefault
(desc);
127
}
128
129
//define this as a plug-in
130
DEFINE_FWK_MODULE
(
TrackAssociatorByChi2Producer
);
edm::StreamID
Definition:
StreamID.h:30
TrackAssociatorByChi2Producer::~TrackAssociatorByChi2Producer
~TrackAssociatorByChi2Producer() override
Definition:
TrackAssociatorByChi2Producer.cc:81
TrackToTrackingParticleAssociatorBaseImpl.h
electrons_cff.bool
bool
Definition:
electrons_cff.py:372
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition:
pwdgSkimBPark_cfi.py:5
ESHandle.h
align::BeamSpot
Definition:
StructureType.h:89
TrackGenAssociatorByChi2Impl.h
edm::EDGetTokenT< reco::BeamSpot >
TrackAssociatorByChi2Impl.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco::TrackToTrackingParticleAssociator
Definition:
TrackToTrackingParticleAssociator.h:51
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
TrackAssociatorByChi2Producer
Definition:
TrackAssociatorByChi2Producer.cc:45
reco::TrackToGenParticleAssociator
Definition:
TrackToGenParticleAssociator.h:34
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
TrackAssociatorByChi2Producer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
TrackAssociatorByChi2Producer.cc:121
edm::Handle< reco::BeamSpot >
trackingPlots.assoc
assoc
Definition:
trackingPlots.py:183
IdealMagneticFieldRecord
Definition:
IdealMagneticFieldRecord.h:11
MakerMacros.h
TrackAssociatorByChi2Producer::TrackAssociatorByChi2Producer
TrackAssociatorByChi2Producer(const edm::ParameterSet &)
Definition:
TrackAssociatorByChi2Producer.cc:72
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
TrackAssociatorByChi2Impl
Definition:
TrackAssociatorByChi2Impl.h:34
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
TrackAssociatorByChi2Producer::chi2cut_
const double chi2cut_
Definition:
TrackAssociatorByChi2Producer.cc:57
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
TrackToTrackingParticleAssociator.h
HLT_2018_cff.InputTag
InputTag
Definition:
HLT_2018_cff.py:79016
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition:
ParameterSetDescription.cc:39
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
impl
Definition:
trackAlgoPriorityOrder.h:18
eostools.move
def move(src, dest)
Definition:
eostools.py:511
TrackAssociatorByChi2Producer::bsToken_
edm::EDGetTokenT< reco::BeamSpot > bsToken_
Definition:
TrackAssociatorByChi2Producer.cc:56
Frameworkfwd.h
TrackAssociatorByChi2Producer::onlyDiagonal_
const bool onlyDiagonal_
Definition:
TrackAssociatorByChi2Producer.cc:58
TrackToGenParticleAssociator.h
TrackGenAssociatorByChi2Impl
Definition:
TrackGenAssociatorByChi2Impl.h:35
TrackAssociatorByChi2Producer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition:
TrackAssociatorByChi2Producer.cc:91
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:99
Generated for CMSSW Reference Manual by
1.8.16