JetMETCorrections
JetVertexAssociation
src
JetVertexAssociation.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: JetVertexAssociation
4
// Class: JetVertexAssociation
5
//
13
//
14
// Original Author: Natalia Ilina
15
// Modified by Eduardo Luiggi
16
//
17
// Created: Tue Oct 31 10:52:41 CET 2006
18
//
19
//
20
32
#include <memory>
33
#include <iostream>
34
#include <iomanip>
35
#include <cmath>
36
37
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
38
#include "
FWCore/Framework/interface/EDProducer.h
"
39
#include "
FWCore/Framework/interface/Event.h
"
40
41
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
42
#include "
FWCore/Framework/interface/MakerMacros.h
"
43
44
#include "
DataFormats/Common/interface/Handle.h
"
45
#include "
FWCore/Framework/interface/EventSetup.h
"
46
#include "
DataFormats/JetReco/interface/CaloJet.h
"
47
#include "
DataFormats/VertexReco/interface/Vertex.h
"
48
49
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
50
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexAssociation.h
"
51
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexMain.h
"
52
53
using namespace
std
;
54
using namespace
reco
;
55
namespace
cms
{
56
57
JetVertexAssociation::JetVertexAssociation(
const
edm::ParameterSet
& iConfig)
58
: m_algo(iConfig),
59
jet_token(consumes<
CaloJetCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"JET_ALGO"
)))),
60
track_token(consumes<
TrackCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"TRACK_ALGO"
)))),
61
vertex_token(consumes<
VertexCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"VERTEX_ALGO"
)))) {
62
produces<ResultCollection1>(
"Var"
);
63
produces<ResultCollection2>(
"JetType"
);
64
}
65
66
void
JetVertexAssociation::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
67
edm::Handle<CaloJetCollection>
jets
;
68
iEvent
.getByToken(
jet_token
,
jets
);
69
70
edm::Handle<TrackCollection>
tracks
;
71
iEvent
.getByToken(
track_token
,
tracks
);
72
73
edm::Handle<VertexCollection>
vertexes
;
74
iEvent
.getByToken(
vertex_token
,
vertexes
);
75
76
double
SIGNAL_V_Z = 0.;
77
double
SIGNAL_V_Z_ERROR = 0.;
78
double
ptmax
= -100.;
79
80
VertexCollection::const_iterator vert =
vertexes
->begin();
81
if
(!
vertexes
->empty()) {
82
for
(; vert !=
vertexes
->end(); vert++) {
83
SIGNAL_V_Z = vert->z();
84
double
pt
= 0.;
85
reco::Vertex::trackRef_iterator
tr = vert->tracks_begin();
86
for
(; tr != vert->tracks_end(); tr++)
87
pt
+= (*tr)->pt();
88
if
(
pt
>=
ptmax
) {
89
ptmax
=
pt
;
90
SIGNAL_V_Z = vert->z();
91
SIGNAL_V_Z_ERROR = vert->zError();
92
}
93
}
94
}
95
96
pair<double, bool>
result
;
97
std::unique_ptr<ResultCollection1> result1(
new
ResultCollection1
);
98
std::unique_ptr<ResultCollection2> result2(
new
ResultCollection2
);
99
100
CaloJetCollection::const_iterator
jet
=
jets
->begin();
101
102
if
(!
jets
->empty()) {
103
for
(;
jet
!=
jets
->end();
jet
++) {
104
result
=
m_algo
.
Main
(*
jet
,
tracks
, SIGNAL_V_Z, SIGNAL_V_Z_ERROR);
105
result1->push_back(
result
.first);
106
result2->push_back(
result
.second);
107
}
108
}
109
110
iEvent
.put(
std::move
(result1),
"Var"
);
111
iEvent
.put(
std::move
(result2),
"JetType"
);
112
}
113
}
// namespace cms
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition:
Vertex.h:38
Handle.h
CaloJet.h
EDProducer.h
cms::JetVertexAssociation::vertex_token
edm::EDGetTokenT< reco::VertexCollection > vertex_token
Definition:
JetVertexAssociation.h:41
DiDispStaMuonMonitor_cfi.pt
pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
JetVertexMain::Main
std::pair< double, bool > Main(const reco::CaloJet &jet, edm::Handle< reco::TrackCollection > tracks, double SIGNAL_V_Z, double SIGNAL_V_Z_Error)
Definition:
JetVertexMain.cc:21
edm
HLT enums.
Definition:
AlignableModifier.h:19
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
cms::JetVertexAssociation::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition:
JetVertexAssociation.cc:66
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89281
jets_cff.vertexes
vertexes
Definition:
jets_cff.py:706
singleTopDQM_cfi.jets
jets
Definition:
singleTopDQM_cfi.py:42
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:45
edm::Handle
Definition:
AssociativeIterator.h:50
MakerMacros.h
cms::JetVertexAssociation::track_token
edm::EDGetTokenT< reco::TrackCollection > track_token
Definition:
JetVertexAssociation.h:40
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
Vertex.h
cms::JetVertexAssociation::ResultCollection1
std::vector< double > ResultCollection1
Definition:
JetVertexAssociation.h:35
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition:
CAHitNtupletGeneratorKernelsImpl.h:159
ModuleDef.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition:
CaloJetCollection.h:15
edm::EventSetup
Definition:
EventSetup.h:58
JetVertexAssociation.h
cms::JetVertexAssociation::jet_token
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
Definition:
JetVertexAssociation.h:39
cms::JetVertexAssociation::ResultCollection2
std::vector< bool > ResultCollection2
Definition:
JetVertexAssociation.h:36
muonTiming_cfi.ptmax
ptmax
Definition:
muonTiming_cfi.py:22
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
Frameworkfwd.h
metsig::jet
Definition:
SignAlgoResolutions.h:47
EventSetup.h
mps_fire.result
result
Definition:
mps_fire.py:311
cms::JetVertexAssociation::m_algo
JetVertexMain m_algo
Definition:
JetVertexAssociation.h:38
JetVertexMain.h
ParameterSet.h
edm::Event
Definition:
Event.h:73
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:21
Generated for CMSSW Reference Manual by
1.8.16