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
SimGeneral
MixingModule
plugins
InputAnalyzer.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: InputAnalyzer
4
// Class: InputAnalyzer
5
//
13
//
14
// Original Author: Emilia Lubenova Becheva
15
// Created: Mon Apr 20 13:43:06 CEST 2009
16
// $Id: InputAnalyzer.cc,v 1.3 2011/11/15 21:57:47 gowdy Exp $
17
//
18
//
19
20
21
// system include files
22
#include <memory>
23
24
// user include files
25
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
26
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
27
28
#include "
FWCore/Framework/interface/Event.h
"
29
#include "
FWCore/Framework/interface/MakerMacros.h
"
30
31
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
32
33
34
#include "
DataFormats/Provenance/interface/ProductID.h
"
35
#include "
DataFormats/Common/interface/Handle.h
"
36
37
#include "
FWCore/Utilities/interface/InputTag.h
"
38
39
#include "
InputAnalyzer.h
"
40
41
#include "
SimDataFormats/Track/interface/SimTrackContainer.h
"
42
#include "
SimDataFormats/CrossingFrame/interface/PCrossingFrame.h
"
43
44
//
45
// constructors and destructor
46
//
47
namespace
edm
48
{
49
50
InputAnalyzer::InputAnalyzer
(
const
edm::ParameterSet
& iConfig)
51
{
52
53
dataStep2_
= iConfig.
getParameter
<
bool
>(
"dataStep2"
);
54
55
if
(
dataStep2_
)
56
// The data file contain the PCrossingFrame<SimTrack>
57
label_
= iConfig.
getParameter
<
edm::InputTag
>(
"collPCF"
);
58
else
59
// The data file contain the SimTrack
60
label_
= iConfig.
getParameter
<
edm::InputTag
>(
"collSimTrack"
);
61
}
62
63
64
InputAnalyzer::~InputAnalyzer
()
65
{
66
}
67
68
69
//
70
// member functions
71
//
72
73
// ------------ method called to for each event ------------
74
void
75
InputAnalyzer::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
76
{
77
std::cout
<<
" dataStep2_ = "
<<
dataStep2_
<< std::endl;
78
79
if
(!
dataStep2_
){
80
// Get the SimTrack collection
81
82
//double simPt=0;
83
int
i
=0;
84
85
// Get the SimTrack collection from the event
86
edm::Handle<SimTrackContainer>
simTracks;
87
bool
gotTracks = iEvent.
getByLabel
(
label_
,simTracks);
88
89
if
(!gotTracks)
90
{
91
std::cout
<<
"-> Could not read SimTracks !!!!"
<<std::endl;
92
}
93
else
{
94
std::cout
<<
"-> Could read SimTracks !!!!"
<<std::endl;
95
96
}
97
98
99
// Loop over the tracks
100
SimTrackContainer::const_iterator simTrack;
101
for
(simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
102
i++;
103
104
//simPt=(*simTrack).momentum().Pt();
105
//std::cout << " # i = " << i << " simPt = " << simPt << std::endl;
106
107
}
108
109
110
}
111
else
{
112
// Get the PCrossingFrame collection given as signal
113
114
edm::Handle<PCrossingFrame<SimTrack>
> cf_simtrack;
115
bool
gotTracks = iEvent.
getByLabel
(
"CFWriter"
,
"g4SimHits"
,cf_simtrack);
116
117
if
(!gotTracks)
118
{
119
std::cout
<<
"-> Could not read PCrossingFrame<SimTracks> !!!!"
<<std::endl;
120
}
121
else
122
std::cout
<<
"-> Could read PCrossingFrame<SimTracks> !!!!"
<<std::endl;
123
124
}
125
}
126
127
128
// ------------ method called once each job just before starting event loop ------------
129
void
InputAnalyzer::beginJob
()
130
{
131
}
132
133
// ------------ method called once each job just after ending the event loop ------------
134
void
135
InputAnalyzer::endJob
() {
136
}
137
138
}
//edm
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
i
int i
Definition:
DBlmapReader.cc:9
Event.h
MakerMacros.h
edm::InputAnalyzer::analyze
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition:
InputAnalyzer.cc:75
Handle.h
edm::InputAnalyzer::label_
edm::InputTag label_
Definition:
InputAnalyzer.h:47
edm::Handle
Definition:
AssociativeIterator.h:48
ProductID.h
Frameworkfwd.h
InputAnalyzer.h
ParameterSet.h
edm::InputAnalyzer::dataStep2_
bool dataStep2_
Definition:
InputAnalyzer.h:46
iEvent
int iEvent
Definition:
GenABIO.cc:243
edm::InputAnalyzer::~InputAnalyzer
~InputAnalyzer()
Definition:
InputAnalyzer.cc:64
edm::EventSetup
Definition:
EventSetup.h:44
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:356
EDAnalyzer.h
edm::InputAnalyzer::InputAnalyzer
InputAnalyzer(const edm::ParameterSet &)
Definition:
InputAnalyzer.cc:50
PCrossingFrame.h
edm::InputAnalyzer::beginJob
virtual void beginJob()
Definition:
InputAnalyzer.cc:129
edm::InputAnalyzer::endJob
virtual void endJob()
Definition:
InputAnalyzer.cc:135
SimTrackContainer.h
edm::InputTag
Definition:
InputTag.h:12
InputTag.h
edm::ParameterSet
Definition:
ParameterSet.h:35
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:121
edm::Event
Definition:
Event.h:50
Generated for CMSSW Reference Manual by
1.8.5