Main Page
Namespaces
Classes
Package Documentation
CVS Directory
WorkBook
Offline Guide
Release schedule
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
// $Id: JetVertexAssociation.cc,v 1.6 2007/08/23 17:15:26 ratnik Exp $
19
//
20
//
21
33
#include <memory>
34
#include <iostream>
35
#include <iomanip>
36
#include <cmath>
37
38
39
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
40
#include "
FWCore/Framework/interface/EDProducer.h
"
41
#include "
DataFormats/Common/interface/EDProduct.h
"
42
#include "
FWCore/Framework/interface/Event.h
"
43
44
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
45
#include "
FWCore/Framework/interface/MakerMacros.h
"
46
47
#include "
DataFormats/Common/interface/Handle.h
"
48
#include "
FWCore/Framework/interface/EventSetup.h
"
49
#include "
DataFormats/JetReco/interface/CaloJetCollection.h
"
50
#include "
DataFormats/JetReco/interface/CaloJet.h
"
51
#include "
DataFormats/TrackReco/interface/Track.h
"
52
#include "
DataFormats/VertexReco/interface/Vertex.h
"
53
#include "
DataFormats/VertexReco/interface/VertexFwd.h
"
54
55
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
56
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexAssociation.h
"
57
#include "
JetMETCorrections/JetVertexAssociation/interface/JetVertexMain.h
"
58
59
using namespace
std;
60
using namespace
reco
;
61
namespace
cms{
62
63
JetVertexAssociation::JetVertexAssociation(
const
edm::ParameterSet
& iConfig): m_algo(iConfig),
64
jet_algo(iConfig.getParameter<std::string>(
"JET_ALGO"
)),
65
track_algo(iConfig.getParameter<std::string>(
"TRACK_ALGO"
)),
66
vertex_algo(iConfig.getParameter<std::string>(
"VERTEX_ALGO"
)) {
67
68
69
70
produces<ResultCollection1>(
"Var"
);
71
produces<ResultCollection2>(
"JetType"
);
72
73
74
}
75
76
void
JetVertexAssociation::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup){
77
78
edm::Handle<CaloJetCollection>
jets
;
79
iEvent.
getByLabel
(
jet_algo
, jets);
80
81
edm::Handle<TrackCollection>
tracks
;
82
iEvent.
getByLabel
(
track_algo
, tracks);
83
84
edm::Handle<VertexCollection>
vertexes;
85
iEvent.
getByLabel
(
vertex_algo
, vertexes);
86
87
double
SIGNAL_V_Z = 0.;
88
double
SIGNAL_V_Z_ERROR = 0.;
89
double
ptmax = -100.;
90
91
VertexCollection::const_iterator vert = vertexes->begin ();
92
if
(vertexes->size() > 0 ) {
93
for
(; vert != vertexes->end (); vert++) {
94
95
SIGNAL_V_Z = vert->z();
96
double
pt = 0.;
97
reco::Vertex::trackRef_iterator
tr = vert->tracks_begin();
98
for
(; tr != vert->tracks_end(); tr++) pt += (*tr)->pt();
99
if
( pt >= ptmax ){
100
101
ptmax = pt;
102
SIGNAL_V_Z = vert->z();
103
SIGNAL_V_Z_ERROR = vert->zError();
104
105
}
106
107
}
108
}
109
110
pair<double, bool>
result
;
111
std::auto_ptr<ResultCollection1> result1 (
new
ResultCollection1
) ;
112
std::auto_ptr<ResultCollection2> result2 (
new
ResultCollection2
) ;
113
114
CaloJetCollection::const_iterator
jet
= jets->begin ();
115
116
if
(jets->size() > 0 ) {
117
for
(; jet != jets->end (); jet++) {
118
result =
m_algo
.
Main
(*jet, tracks, SIGNAL_V_Z, SIGNAL_V_Z_ERROR);
119
result1->push_back(result.first);
120
result2->push_back(result.second);
121
122
}
123
}
124
125
iEvent.
put
(result1,
"Var"
);
126
iEvent.
put
(result2,
"JetType"
);
127
128
}
129
}
metsig::jet
Definition:
SignAlgoResolutions.h: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)
Definition:
JetVertexMain.cc:24
cms::JetVertexAssociation::produce
void produce(edm::Event &e, const edm::EventSetup &c)
Definition:
JetVertexAssociation.cc:76
cms::JetVertexAssociation::ResultCollection1
std::vector< double > ResultCollection1
Definition:
JetVertexAssociation.h:36
Event.h
CaloJetCollection.h
MakerMacros.h
EventSetup.h
cms::JetVertexAssociation::jet_algo
std::string jet_algo
Definition:
JetVertexAssociation.h:40
VertexFwd.h
Handle.h
edm::Handle
Definition:
AssociativeIterator.h:48
dt_dqm_sourceclient_common_cff.reco
tuple reco
Definition:
dt_dqm_sourceclient_common_cff.py:101
EDProduct.h
Frameworkfwd.h
ParameterSet.h
analyzePatCleaning_cfg.jets
tuple jets
Definition:
analyzePatCleaning_cfg.py:8
iEvent
int iEvent
Definition:
GenABIO.cc:243
edm::Event::put
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition:
Event.h:84
query.result
tuple result
Definition:
query.py:137
cms::JetVertexAssociation::ResultCollection2
std::vector< bool > ResultCollection2
Definition:
JetVertexAssociation.h:37
edm::EventSetup
Definition:
EventSetup.h:44
cms::JetVertexAssociation::track_algo
std::string track_algo
Definition:
JetVertexAssociation.h:41
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:355
Vertex.h
JetVertexAssociation.h
EDProducer.h
testEve_cfg.tracks
tuple tracks
Definition:
testEve_cfg.py:39
reco::Vertex::trackRef_iterator
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition:
Vertex.h:38
edm::ParameterSet
Definition:
ParameterSet.h:32
CaloJet.h
edm::Event
Definition:
Event.h:49
Track.h
ModuleDef.h
cms::JetVertexAssociation::vertex_algo
std::string vertex_algo
Definition:
JetVertexAssociation.h:42
JetVertexMain.h
cms::JetVertexAssociation::m_algo
JetVertexMain m_algo
Definition:
JetVertexAssociation.h:39
Generated for CMSSW Reference Manual by
1.8.5