src
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/Event.h
"
39
40
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
41
#include "
FWCore/Framework/interface/MakerMacros.h
"
42
43
#include "
DataFormats/Common/interface/Handle.h
"
44
#include "
FWCore/Framework/interface/EventSetup.h
"
45
#include "
DataFormats/JetReco/interface/CaloJet.h
"
46
#include "
DataFormats/VertexReco/interface/Vertex.h
"
47
48
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
49
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexAssociation.h
"
50
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexMain.h
"
51
52
using namespace
std
;
53
using namespace
reco
;
54
namespace
cms
{
55
56
JetVertexAssociation::JetVertexAssociation(
const
edm::ParameterSet
& iConfig)
57
: m_algo(iConfig),
58
jet_token(consumes<
CaloJetCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"JET_ALGO"
)))),
59
track_token(consumes<
TrackCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"TRACK_ALGO"
)))),
60
vertex_token(consumes<
VertexCollection
>(
edm
::
InputTag
(iConfig.getParameter<
std
::
string
>(
"VERTEX_ALGO"
)))) {
61
produces<ResultCollection1>(
"Var"
);
62
produces<ResultCollection2>(
"JetType"
);
63
}
64
65
void
JetVertexAssociation::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
66
edm::Handle<CaloJetCollection>
jets
;
67
iEvent
.getByToken(
jet_token
,
jets
);
68
69
edm::Handle<TrackCollection>
tracks
;
70
iEvent
.getByToken(
track_token
,
tracks
);
71
72
edm::Handle<VertexCollection>
vertexes
;
73
iEvent
.getByToken(
vertex_token
,
vertexes
);
74
75
double
SIGNAL_V_Z = 0.;
76
double
SIGNAL_V_Z_ERROR = 0.;
77
double
ptmax
= -100.;
78
79
VertexCollection::const_iterator vert =
vertexes
->begin();
80
if
(!
vertexes
->empty()) {
81
for
(; vert !=
vertexes
->end(); vert++) {
82
SIGNAL_V_Z = vert->z();
83
double
pt
= 0.;
84
reco::Vertex::trackRef_iterator
tr = vert->tracks_begin();
85
for
(; tr != vert->tracks_end(); tr++)
86
pt
+= (*tr)->pt();
87
if
(
pt
>=
ptmax
) {
88
ptmax
=
pt
;
89
SIGNAL_V_Z = vert->z();
90
SIGNAL_V_Z_ERROR = vert->zError();
91
}
92
}
93
}
94
95
pair<double, bool>
result
;
96
std::unique_ptr<ResultCollection1> result1(
new
ResultCollection1
);
97
std::unique_ptr<ResultCollection2> result2(
new
ResultCollection2
);
98
99
CaloJetCollection::const_iterator
jet
=
jets
->begin();
100
101
if
(!
jets
->empty()) {
102
for
(;
jet
!=
jets
->end();
jet
++) {
103
result
=
m_algo
.
Main
(*
jet
,
tracks
, SIGNAL_V_Z, SIGNAL_V_Z_ERROR);
104
result1->push_back(
result
.first);
105
result2->push_back(
result
.second);
106
}
107
}
108
109
iEvent
.put(
std::move
(result1),
"Var"
);
110
iEvent
.put(
std::move
(result2),
"JetType"
);
111
}
112
}
// namespace cms
metsig::jet
Definition:
SignAlgoResolutions.h:47
Vertex.h
ProducerED_cfi.InputTag
InputTag
Definition:
ProducerED_cfi.py:5
cms::JetVertexAssociation::vertex_token
edm::EDGetTokenT< reco::VertexCollection > vertex_token
Definition:
JetVertexAssociation.h:39
cms::JetVertexAssociation::track_token
edm::EDGetTokenT< reco::TrackCollection > track_token
Definition:
JetVertexAssociation.h:38
cms::JetVertexAssociation::ResultCollection1
std::vector< double > ResultCollection1
Definition:
JetVertexAssociation.h:33
mps_fire.result
result
Definition:
mps_fire.py:311
edm::StreamID
Definition:
StreamID.h:30
Event.h
edm::Handle
Definition:
AssociativeIterator.h:50
EventSetup.h
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
PDWG_EXODelayedJetMET_cff.jets
jets
Definition:
PDWG_EXODelayedJetMET_cff.py:14
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
std
Definition:
JetResolutionObject.h:76
muonTiming_cfi.ptmax
ptmax
Definition:
muonTiming_cfi.py:22
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
DiDispStaMuonMonitor_cfi.pt
pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
ParameterSet.h
cms::JetVertexAssociation::jet_token
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
Definition:
JetVertexAssociation.h:37
iEvent
int iEvent
Definition:
GenABIO.cc:224
cms::JetVertexAssociation::ResultCollection2
std::vector< bool > ResultCollection2
Definition:
JetVertexAssociation.h:34
edm::EventSetup
Definition:
EventSetup.h:56
CaloJet.h
JetVertexAssociation.h
cms::JetVertexAssociation::produce
void produce(edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
Definition:
JetVertexAssociation.cc:65
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:41
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) const
Definition:
JetVertexMain.cc:21
reco
fixed size matrix
Definition:
AlignmentAlgorithmBase.h:46
jetsAK4_CHS_cff.vertexes
vertexes
Definition:
jetsAK4_CHS_cff.py:358
edm
HLT enums.
Definition:
AlignableModifier.h:19
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::Event
Definition:
Event.h:73
ModuleDef.h
MakerMacros.h
pwdgSkimBPark_cfi.tracks
tracks
Definition:
pwdgSkimBPark_cfi.py:29
JetVertexMain.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition:
Vertex.h:38
reco::CaloJetCollection
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Definition:
CaloJetCollection.h:15
cms::JetVertexAssociation::m_algo
JetVertexMain m_algo
Definition:
JetVertexAssociation.h:36
Handle.h
Generated for CMSSW Reference Manual by
1.8.14