L1Trigger
Phase2L1ParticleFlow
plugins
PFTrackProducerFromL1Tracks.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
2
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/Framework/interface/MakerMacros.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
7
#include "
FWCore/Framework/interface/ESHandle.h
"
8
#include "
MagneticField/Engine/interface/MagneticField.h
"
9
#include "
MagneticField/Records/interface/IdealMagneticFieldRecord.h
"
10
#include "
FWCore/Framework/interface/ESWatcher.h
"
11
12
#include "
DataFormats/L1TParticleFlow/interface/PFTrack.h
"
13
#include "
L1Trigger/Phase2L1ParticleFlow/interface/L1TPFUtils.h
"
14
#include "
L1Trigger/Phase2L1ParticleFlow/interface/ParametricResolution.h
"
15
16
namespace
l1tpf
{
17
class
PFTrackProducerFromL1Tracks
:
public
edm::stream::EDProducer
<> {
18
public
:
19
explicit
PFTrackProducerFromL1Tracks
(
const
edm::ParameterSet
&);
20
~PFTrackProducerFromL1Tracks
()
override
{}
21
22
private
:
23
edm::EDGetTokenT<std::vector<l1t::PFTrack::L1TTTrackType>
>
TrackTag_
;
24
edm::ESWatcher<IdealMagneticFieldRecord>
BFieldWatcher_
;
25
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord>
BFieldTag_
;
26
int
nParam_
;
27
float
fBz_
;
28
l1tpf::ParametricResolution
resolCalo_
,
resolTrk_
;
29
30
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
31
32
};
// class
33
}
// namespace l1tpf
34
35
l1tpf::PFTrackProducerFromL1Tracks::PFTrackProducerFromL1Tracks
(
const
edm::ParameterSet
&iConfig)
36
: TrackTag_(consumes<
std
::
vector
<
l1t
::PFTrack::
L1TTTrackType
>>(iConfig.getParameter<
edm
::
InputTag
>(
"L1TrackTag"
))),
37
BFieldTag_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
38
nParam_(iConfig.getParameter<
unsigned
int
>(
"nParam"
)),
39
resolCalo_(iConfig.getParameter<
edm::ParameterSet
>(
"resolCalo"
)),
40
resolTrk_(iConfig.getParameter<
edm::ParameterSet
>(
"resolTrack"
)) {
41
produces<l1t::PFTrackCollection>();
42
}
43
44
void
l1tpf::PFTrackProducerFromL1Tracks::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
&iSetup) {
45
if
(BFieldWatcher_.check(iSetup)) {
46
fBz_ = iSetup.
getData
(BFieldTag_).inTesla(
GlobalPoint
(0, 0, 0)).z();
47
}
48
49
std::unique_ptr<l1t::PFTrackCollection>
out
(
new
l1t::PFTrackCollection
());
50
51
// https://github.com/skinnari/cmssw/blob/80c19f1b721325c3a02ee0482f72fb974a4c3bf7/L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker.cc
52
edm::Handle<std::vector<l1t::PFTrack::L1TTTrackType>
> htracks;
53
iEvent
.getByToken(TrackTag_, htracks);
54
const
auto
&
tracks
= *htracks;
55
56
for
(
unsigned
int
i
= 0,
n
=
tracks
.size();
i
<
n
; ++
i
) {
57
const
auto
&tk =
tracks
[
i
];
58
59
float
pt
= tk.momentum().perp();
60
float
eta
= tk.momentum().eta();
61
float
phi = tk.momentum().phi();
62
float
z0
= tk.POCA().z();
//cm
63
int
charge
= tk.rInv() > 0 ? +1 : -1;
64
65
reco::Candidate::PolarLorentzVector
p4p(
pt
,
eta
, phi, 0.137);
// pion mass
66
reco::Particle::LorentzVector
p4
(p4p.X(), p4p.Y(), p4p.Z(), p4p.E());
67
reco::Particle::Point
vtx
(0., 0.,
z0
);
68
69
auto
caloetaphi =
l1tpf::propagateToCalo
(
p4
,
math::XYZTLorentzVector
(0., 0.,
z0
, 0.),
charge
, fBz_);
70
71
float
trkErr = resolTrk_(
pt
,
std::abs
(
eta
));
72
float
caloErr = resolCalo_(
pt
,
std::abs
(
eta
));
73
int
quality
= 1;
74
out
->emplace_back(
charge
,
75
p4
,
76
vtx
,
77
l1t::PFTrack::TrackRef
(htracks,
i
),
78
nParam_,
79
caloetaphi.first,
80
caloetaphi.second,
81
trkErr,
82
caloErr,
83
quality
);
84
}
85
iEvent
.put(
std::move
(
out
));
86
}
87
using
l1tpf::PFTrackProducerFromL1Tracks
;
88
DEFINE_FWK_MODULE
(
PFTrackProducerFromL1Tracks
);
l1tpf::PFTrackProducerFromL1Tracks::TrackTag_
edm::EDGetTokenT< std::vector< l1t::PFTrack::L1TTTrackType > > TrackTag_
Definition:
PFTrackProducerFromL1Tracks.cc:23
l1tpf::PFTrackProducerFromL1Tracks::fBz_
float fBz_
Definition:
PFTrackProducerFromL1Tracks.cc:27
ParametricResolution.h
PDWG_EXOHSCP_cff.tracks
tracks
Definition:
PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition:
mps_fire.py:428
dqmiodumpmetadata.n
n
Definition:
dqmiodumpmetadata.py:28
edm::ESWatcher< IdealMagneticFieldRecord >
l1tpf::PFTrackProducerFromL1Tracks
Definition:
PFTrackProducerFromL1Tracks.cc:17
ESHandle.h
DiDispStaMuonMonitor_cfi.pt
pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
edm::EDGetTokenT
Definition:
EDGetToken.h:33
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco::Candidate::PolarLorentzVector
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition:
Candidate.h:38
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89287
EDProducer.h
l1t::L1TTTrackType
TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType
Definition:
L1CaloTkTau.h:31
edm::Handle
Definition:
AssociativeIterator.h:50
reco::Particle::LorentzVector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition:
Particle.h:21
edm::Ref< std::vector< L1TTTrackType > >
l1tpf::PFTrackProducerFromL1Tracks::PFTrackProducerFromL1Tracks
PFTrackProducerFromL1Tracks(const edm::ParameterSet &)
Definition:
PFTrackProducerFromL1Tracks.cc:35
MakerMacros.h
l1tpf::ParametricResolution
Definition:
ParametricResolution.h:10
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
PVValHelper::eta
Definition:
PVValidationHelpers.h:69
L1TPFUtils.h
IdealMagneticFieldRecord.h
l1tpf::PFTrackProducerFromL1Tracks::BFieldWatcher_
edm::ESWatcher< IdealMagneticFieldRecord > BFieldWatcher_
Definition:
PFTrackProducerFromL1Tracks.cc:24
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition:
HLTMuonOfflineAnalyzer_cfi.py:98
GlobalPoint
Global3DPoint GlobalPoint
Definition:
GlobalPoint.h:10
l1t::PFTrackCollection
std::vector< l1t::PFTrack > PFTrackCollection
Definition:
PFTrack.h:84
l1tpf::PFTrackProducerFromL1Tracks::BFieldTag_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > BFieldTag_
Definition:
PFTrackProducerFromL1Tracks.cc:25
l1tpf::PFTrackProducerFromL1Tracks::resolTrk_
l1tpf::ParametricResolution resolTrk_
Definition:
PFTrackProducerFromL1Tracks.cc:28
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition:
ALCARECOTkAlJpsiMuMu_cff.py:47
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
l1t
delete x;
Definition:
CaloConfig.h:22
iEvent
int iEvent
Definition:
GenABIO.cc:224
PFTrack.h
p4
double p4[4]
Definition:
TauolaWrapper.h:92
trackerHitRTTI::vector
Definition:
trackerHitRTTI.h:21
edm::stream::EDProducer
Definition:
EDProducer.h:38
MagneticField.h
edm::EventSetup
Definition:
EventSetup.h:57
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord >
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition:
EventSetup.h:120
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
l1tpf::PFTrackProducerFromL1Tracks::resolCalo_
l1tpf::ParametricResolution resolCalo_
Definition:
PFTrackProducerFromL1Tracks.cc:28
qcdUeDQM_cfi.quality
quality
Definition:
qcdUeDQM_cfi.py:31
extraflags_cff.vtx
vtx
Definition:
extraflags_cff.py:18
Frameworkfwd.h
ESWatcher.h
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition:
LorentzVector.h:29
l1tpf::propagateToCalo
std::pair< float, float > propagateToCalo(const math::XYZTLorentzVector &iMom, const math::XYZTLorentzVector &iVtx, double iCharge, double iBField)
Definition:
L1TPFUtils.cc:7
l1tpf
Definition:
HGC3DClusterEgID.h:20
l1tpf::PFTrackProducerFromL1Tracks::nParam_
int nParam_
Definition:
PFTrackProducerFromL1Tracks.cc:26
l1tpf::PFTrackProducerFromL1Tracks::~PFTrackProducerFromL1Tracks
~PFTrackProducerFromL1Tracks() override
Definition:
PFTrackProducerFromL1Tracks.cc:20
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition:
Particle.h:25
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
ParameterSet.h
edm::Event
Definition:
Event.h:73
l1tpf::PFTrackProducerFromL1Tracks::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
PFTrackProducerFromL1Tracks.cc:44
Generated for CMSSW Reference Manual by
1.8.16