Validation
Tools
examples
printJetInfo.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
// CMS includes
4
#include "
FWCore/Utilities/interface/InputTag.h
"
5
#include "
DataFormats/Common/interface/Handle.h
"
6
#include "
DataFormats/JetReco/interface/CaloJet.h
"
7
8
#include "
PhysicsTools/FWLite/interface/EventContainer.h
"
9
#include "
PhysicsTools/FWLite/interface/CommandLineParser.h
"
10
11
// Root includes
12
#include "TString.h"
13
#include "TROOT.h"
14
15
using namespace
std
;
16
18
// ///////////////////// //
19
// // Main Subroutine // //
20
// ///////////////////// //
22
23
int
main
(
int
argc
,
char
*
argv
[])
24
{
26
// ////////////////////////// //
27
// // Command Line Options // //
28
// ////////////////////////// //
30
31
32
// Tell people what this analysis code does and setup default options.
33
optutl::CommandLineParser
parser
(
""
);
34
36
// Change any defaults or add any new command //
37
// line options you would like here. //
39
40
// Parse the command line arguments
41
parser
.parseArguments (
argc
,
argv
);
42
44
// //////////////////////////// //
45
// // Create Event Container // //
46
// //////////////////////////// //
48
49
// This object 'event' is used both to get all information from the
50
// event as well as to store histograms, etc.
51
fwlite::EventContainer
eventCont (
parser
);
52
54
// ////////////////////////////////// //
55
// // Begin Run // //
56
// // (e.g., book histograms, etc) // //
57
// ////////////////////////////////// //
59
60
// Setup a style
61
gROOT->SetStyle (
"Plain"
);
62
63
// Book those histograms!
64
66
// //////////////// //
67
// // Event Loop // //
68
// //////////////// //
70
71
edm::Handle< std::vector< reco::CaloJet>
> jetHandle;
72
edm::InputTag
jetLabel
(
"sisCone5CaloJets"
);
73
74
for
(eventCont.
toBegin
(); ! eventCont.
atEnd
(); ++eventCont)
75
{
76
77
cout
<<
"run "
<< eventCont.
eventAuxiliary
().
run
() <<
" event "
78
<< eventCont.
eventAuxiliary
().
event
() << endl;
79
cout
<<
" index Et eta phi"
<< endl;
80
81
83
// Take What We Need From Event //
85
eventCont.
getByLabel
(
jetLabel
, jetHandle);
86
assert
(jetHandle.
isValid
());
87
const
std::vector< reco::CaloJet > &jetVec( *jetHandle.
product
() );
88
int
index
= 0;
89
for
(std::vector< reco::CaloJet >::const_iterator iter = jetVec.begin();
90
jetVec.end() != iter;
91
++iter, ++
index
)
92
{
93
cout
<<
" "
<< setw(2) <<
index
<<
") "
;
94
cout
<< setw(8) << Form (
"%8.4f"
, iter->et() ) <<
" "
95
<< setw(8) << Form (
"%8.4f"
, iter->eta()) <<
" "
96
<< setw(8) << Form (
"%8.4f"
, iter->phi()) <<
" "
<< endl;
97
}
98
99
}
// for eventCont
100
101
103
// ////////////////// //
104
// // Clean Up Job // //
105
// ////////////////// //
107
108
// Histograms will be automatically written to the root file
109
// specificed by command line options.
110
111
// All done! Bye bye.
112
return
0;
113
}
edm::EventAuxiliary::event
EventNumber_t event() const
Definition:
EventAuxiliary.h:72
Handle.h
CaloJet.h
cmsBatch.argv
argv
Definition:
cmsBatch.py:279
CommandLineParser.h
edm::Handle::product
T const * product() const
Definition:
Handle.h:70
dir2webdir.argc
argc
Definition:
dir2webdir.py:39
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
writedatasetfile.parser
parser
Definition:
writedatasetfile.py:7
fwlite::EventContainer::toBegin
const EventContainer & toBegin() override
Definition:
EventContainer.cc:113
edm::Handle
Definition:
AssociativeIterator.h:50
main
int main(int argc, char *argv[])
Definition:
printJetInfo.cc:23
edm::EventAuxiliary::run
RunNumber_t run() const
Definition:
EventAuxiliary.h:73
commonCuts_cff.jetLabel
jetLabel
Definition:
commonCuts_cff.py:15
fwlite::EventContainer::eventAuxiliary
edm::EventAuxiliary const & eventAuxiliary() const override
Definition:
EventContainer.h:103
EventContainer.h
fwlite::EventContainer
Definition:
EventContainer.h:21
fwlite::EventContainer::getByLabel
bool getByLabel(const std::type_info &iInfo, const char *iModuleLabel, const char *iProductInstanceLabel, const char *iProcessLabel, void *oData) const override
Definition:
EventContainer.cc:85
InputTag.h
std
Definition:
JetResolutionObject.h:76
fwlite::EventContainer::atEnd
bool atEnd() const override
Definition:
EventContainer.cc:124
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
edm::HandleBase::isValid
bool isValid() const
Definition:
HandleBase.h:70
edm::InputTag
Definition:
InputTag.h:15
optutl::CommandLineParser
Definition:
CommandLineParser.h:10
Generated for CMSSW Reference Manual by
1.8.16