Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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
metsig::jet
Definition:
SignAlgoResolutions.h:47
Vertex.h
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::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:133
DiDispStaMuonMonitor_cfi.pt
tuple pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
cms::JetVertexAssociation::vertex_token
edm::EDGetTokenT< reco::VertexCollection > vertex_token
Definition:
JetVertexAssociation.h:41
cms::JetVertexAssociation::track_token
edm::EDGetTokenT< reco::TrackCollection > track_token
Definition:
JetVertexAssociation.h:40
cms::JetVertexAssociation::ResultCollection1
std::vector< double > ResultCollection1
Definition:
JetVertexAssociation.h:35
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:539
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:50
EventSetup.h
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition:
TrackFwd.h:14
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition:
VertexFwd.h:9
tracks
auto const & tracks
cannot be loose
Definition:
CAHitNtupletGeneratorKernelsImpl.h:146
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:111
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
mps_fire.result
tuple result
Definition:
mps_fire.py:311
ParameterSet.h
cms::JetVertexAssociation::jet_token
edm::EDGetTokenT< reco::CaloJetCollection > jet_token
Definition:
JetVertexAssociation.h:39
iEvent
int iEvent
Definition:
GenABIO.cc:224
fwrapper::jets
vector< PseudoJet > jets
Definition:
fastjetfortran_madfks.cc:44
eostools.move
def move
Definition:
eostools.py:511
cms::JetVertexAssociation::ResultCollection2
std::vector< bool > ResultCollection2
Definition:
JetVertexAssociation.h:36
edm::EventSetup
Definition:
EventSetup.h:59
CaloJet.h
JetVertexAssociation.h
EDProducer.h
HLT_FULL_cff.InputTag
tuple InputTag
Definition:
HLT_FULL_cff.py:86956
cms::JetVertexAssociation::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Definition:
JetVertexAssociation.cc:66
edm::ParameterSet
Definition:
ParameterSet.h:47
edm::Event
Definition:
Event.h:73
iConfig
iConfig
Definition:
TSGFromPropagation.cc:56
ModuleDef.h
JetVertexMain.h
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:38
Handle.h
Generated for CMSSW Reference Manual by
1.8.5