Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
RecoHI
HiCentralityAlgos
plugins
CentralityFilter.cc
Go to the documentation of this file.
1
//
2
// Original Author: Yetkin Yilmaz,32 4-A08,+41227673039,
3
// Created: Tue Jun 29 12:19:49 CEST 2010
4
//
5
//
6
7
8
// system include files
9
#include <memory>
10
#include <vector>
11
#include <string>
12
13
// user include files
14
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
15
#include "
FWCore/Framework/interface/EDFilter.h
"
16
#include "
FWCore/Framework/interface/Event.h
"
17
#include "
FWCore/Framework/interface/MakerMacros.h
"
18
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
19
#include "
FWCore/Utilities/interface/Exception.h
"
20
#include "
RecoHI/HiCentralityAlgos/interface/CentralityProvider.h
"
21
22
//
23
// class declaration
24
//
25
26
class
CentralityFilter
:
public
edm::EDFilter
{
27
public
:
28
explicit
CentralityFilter
(
const
edm::ParameterSet
&);
29
~CentralityFilter
();
30
31
private
:
32
virtual
void
beginJob
() ;
33
virtual
bool
filter
(
edm::Event
&,
const
edm::EventSetup
&);
34
virtual
void
endJob
() ;
35
36
// ----------member data ---------------------------
37
CentralityProvider
*
centrality_
;
38
std::vector<int>
selectedBins_
;
39
};
40
41
//
42
// constants, enums and typedefs
43
//
44
45
//
46
// static data member definitions
47
//
48
49
//
50
// constructors and destructor
51
//
52
CentralityFilter::CentralityFilter
(
const
edm::ParameterSet
& iConfig) :
53
centrality_(0),
54
selectedBins_(iConfig.getParameter<std::vector<int> >(
"selectedBins"
))
55
{
56
//now do what ever initialization is needed
57
58
}
59
60
61
CentralityFilter::~CentralityFilter
()
62
{
63
64
// do anything here that needs to be done at desctruction time
65
// (e.g. close files, deallocate resources etc.)
66
67
}
68
69
70
//
71
// member functions
72
//
73
74
// ------------ method called on each new Event ------------
75
bool
76
CentralityFilter::filter
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
77
{
78
bool
result
=
false
;
79
80
using namespace
edm;
81
if
(!
centrality_
)
centrality_
=
new
CentralityProvider
(iSetup);
82
centrality_
->
newEvent
(iEvent,iSetup);
83
int
bin
=
centrality_
->
getBin
();
84
85
for
(
unsigned
int
i
= 0;
i
<
selectedBins_
.size(); ++
i
){
86
if
(
bin
==
selectedBins_
[
i
]) result =
true
;
87
}
88
89
return
result
;
90
}
91
92
// ------------ method called once each job just before starting event loop ------------
93
void
94
CentralityFilter::beginJob
()
95
{
96
}
97
98
// ------------ method called once each job just after ending the event loop ------------
99
void
100
CentralityFilter::endJob
() {
101
}
102
103
//define this as a plug-in
104
DEFINE_FWK_MODULE
(
CentralityFilter
);
i
int i
Definition:
DBlmapReader.cc:9
CentralityFilter
Definition:
CentralityFilter.cc:26
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
MakerMacros.h
Frameworkfwd.h
CentralityProvider.h
ParameterSet.h
iEvent
int iEvent
Definition:
GenABIO.cc:243
newFWLiteAna.bin
string bin
Definition:
newFWLiteAna.py:161
CentralityProvider::newEvent
void newEvent(const edm::Event &ev, const edm::EventSetup &iSetup)
Definition:
CentralityProvider.cc:40
EDFilter.h
query.result
tuple result
Definition:
query.py:137
CentralityFilter::CentralityFilter
CentralityFilter(const edm::ParameterSet &)
Definition:
CentralityFilter.cc:52
edm::EventSetup
Definition:
EventSetup.h:44
CentralityFilter::filter
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition:
CentralityFilter.cc:76
edm::EDFilter
Definition:
EDFilter.h:24
CentralityProvider::getBin
int getBin() const
Definition:
CentralityProvider.h:22
Exception.h
CentralityFilter::selectedBins_
std::vector< int > selectedBins_
Definition:
CentralityFilter.cc:38
CentralityFilter::beginJob
virtual void beginJob()
Definition:
CentralityFilter.cc:94
CentralityProvider
Definition:
CentralityProvider.h:12
CentralityFilter::centrality_
CentralityProvider * centrality_
Definition:
CentralityFilter.cc:37
edm::ParameterSet
Definition:
ParameterSet.h:35
CentralityFilter::~CentralityFilter
~CentralityFilter()
Definition:
CentralityFilter.cc:61
edm::Event
Definition:
Event.h:50
CentralityFilter::endJob
virtual void endJob()
Definition:
CentralityFilter.cc:100
Generated for CMSSW Reference Manual by
1.8.5