Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
SUSYBSMAnalysis
HSCP
src
HSCParticleSelector.cc
Go to the documentation of this file.
1
#include <memory>
2
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
3
#include "
FWCore/Framework/interface/MakerMacros.h
"
4
#include "
FWCore/Framework/interface/EDFilter.h
"
5
6
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
7
#include "
DataFormats/Common/interface/Handle.h
"
8
#include "
DataFormats/Common/interface/View.h
"
9
10
#include "
AnalysisDataFormats/SUSYBSMObjects/interface/HSCParticle.h
"
11
#include "
SUSYBSMAnalysis/HSCP/interface/CandidateSelector.h
"
12
13
//
14
// class declaration
15
//
16
class
HSCParticleSelector
:
public
edm::EDFilter
{
17
public
:
18
explicit
HSCParticleSelector
(
const
edm::ParameterSet
&);
19
~HSCParticleSelector
();
20
21
private
:
22
virtual
void
beginJob
() ;
23
virtual
bool
filter
(
edm::Event
&,
const
edm::EventSetup
&);
24
virtual
void
endJob
() ;
25
26
edm::InputTag
sourceTag_
;
27
28
bool
Filter_
;
29
std::vector<CandidateSelector*>
Selectors
;
30
};
31
32
34
HSCParticleSelector::HSCParticleSelector
(
const
edm::ParameterSet
& iConfig)
35
{
36
// What is being produced
37
produces<susybsm::HSCParticleCollection >();
38
39
// Input products
40
sourceTag_
= iConfig.
getParameter
<
edm::InputTag
> (
"source"
);
41
Filter_
= iConfig.
getParameter
<
bool
> (
"filter"
);
42
43
// Load all the selections
44
std::vector<edm::ParameterSet> SelectionParameters = iConfig.
getParameter
<std::vector<edm::ParameterSet> >(
"SelectionParameters"
);
45
for
(
unsigned
int
i
=0;
i
<SelectionParameters.size();
i
++){
46
Selectors
.push_back(
new
CandidateSelector
(SelectionParameters[
i
]) );
47
}
48
}
49
51
HSCParticleSelector::~HSCParticleSelector
(){
52
}
53
55
void
HSCParticleSelector::beginJob
() {
56
}
57
59
void
HSCParticleSelector::endJob
(){
60
}
61
63
bool
HSCParticleSelector::filter
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
64
{
65
// Source Collection
66
edm::Handle<susybsm::HSCParticleCollection >
SourceHandle;
67
if
(!iEvent.
getByLabel
(
sourceTag_
, SourceHandle)) {
68
edm::LogError
(
""
) <<
">>> HSCParticleCollection does not exist !!!"
;
69
return
false
;
70
}
71
susybsm::HSCParticleCollection
Source
= *SourceHandle.
product
();
72
73
74
// Output Collection
75
susybsm::HSCParticleCollection
*
output
=
new
susybsm::HSCParticleCollection
;
76
std::auto_ptr<susybsm::HSCParticleCollection>
result
(output);
77
78
// cleanup the collection based on the input selection
79
for
(susybsm::HSCParticleCollection::iterator hscpcandidate = Source.begin(); hscpcandidate < Source.end(); ++hscpcandidate){
80
bool
decision =
false
;
81
for
(
unsigned
int
i
=0;
i
<
Selectors
.size();
i
++){decision |=
Selectors
[
i
]->isSelected(*hscpcandidate);}
82
if
(decision){
83
susybsm::HSCParticle
* newhscp =
new
susybsm::HSCParticle
(*hscpcandidate);
84
output->push_back(*newhscp);
85
}
86
}
87
88
bool
filterResult = !
Filter_
|| (
Filter_
&& output->size()>=1);
89
90
iEvent.
put
(result);
91
92
return
filterResult;
93
}
94
95
DEFINE_FWK_MODULE
(
HSCParticleSelector
);
96
97
98
99
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
i
int i
Definition:
DBlmapReader.cc:9
CandidateSelector
Definition:
CandidateSelector.h:18
MessageLogger.h
susybsm::HSCParticle
Definition:
HSCParticle.h:48
HSCParticleSelector::~HSCParticleSelector
~HSCParticleSelector()
Definition:
HSCParticleSelector.cc:51
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
MakerMacros.h
HSCParticle.h
CandidateSelector.h
Handle.h
edm::Handle
Definition:
AssociativeIterator.h:48
Frameworkfwd.h
HSCParticleSelector::beginJob
virtual void beginJob()
Definition:
HSCParticleSelector.cc:55
HSCParticleSelector::sourceTag_
edm::InputTag sourceTag_
Definition:
HSCParticleSelector.cc:26
edm::LogError
Definition:
MessageLogger.h:164
susybsm::HSCParticleCollection
std::vector< HSCParticle > HSCParticleCollection
Definition:
HSCParticle.h:94
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:94
EDFilter.h
HSCParticleSelector::HSCParticleSelector
HSCParticleSelector(const edm::ParameterSet &)
Definition:
HSCParticleSelector.cc:34
popcon_last_value_cfg.Source
tuple Source
Definition:
popcon_last_value_cfg.py:163
query.result
tuple result
Definition:
query.py:137
HSCParticleSelector::endJob
virtual void endJob()
Definition:
HSCParticleSelector.cc:59
View.h
edm::EventSetup
Definition:
EventSetup.h:44
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:361
edm::EDFilter
Definition:
EDFilter.h:25
convertSQLitetoXML_cfg.output
tuple output
Definition:
convertSQLitetoXML_cfg.py:32
edm::Handle::product
T const * product() const
Definition:
Handle.h:74
HSCParticleSelector::Selectors
std::vector< CandidateSelector * > Selectors
Definition:
HSCParticleSelector.cc:29
HSCParticleSelector::Filter_
bool Filter_
Definition:
HSCParticleSelector.cc:28
edm::InputTag
Definition:
InputTag.h:17
HSCParticleSelector
Definition:
HSCParticleSelector.cc:16
edm::ParameterSet
Definition:
ParameterSet.h:35
edm::Event
Definition:
Event.h:56
HSCParticleSelector::filter
virtual bool filter(edm::Event &, const edm::EventSetup &)
Definition:
HSCParticleSelector.cc:63
Generated for CMSSW Reference Manual by
1.8.5