Main Page
Namespaces
Classes
Package Documentation
SUSYBSMAnalysis
HSCP
plugins
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
()
override
;
20
21
private
:
22
void
beginJob
()
override
;
23
bool
filter
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
24
void
endJob
()
override
;
25
26
edm::EDGetTokenT<susybsm::HSCParticleCollection>
sourceToken_
;
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
sourceToken_
= consumes<susybsm::HSCParticleCollection>(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.
getByToken
(
sourceToken_
, 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::unique_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->empty());
89
90
iEvent.
put
(
std::move
(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
CandidateSelector
Definition:
CandidateSelector.h:18
MessageLogger.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition:
Event.h:137
susybsm::HSCParticle
Definition:
HSCParticle.h:48
mps_fire.i
i
Definition:
mps_fire.py:329
mps_fire.result
result
Definition:
mps_fire.py:282
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition:
Event.h:579
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:48
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:32
HSCParticle.h
CandidateSelector.h
HSCParticleSelector::beginJob
void beginJob() override
Definition:
HSCParticleSelector.cc:55
edm::EDGetTokenT< susybsm::HSCParticleCollection >
Frameworkfwd.h
edm::LogError
Definition:
MessageLogger.h:174
susybsm::HSCParticleCollection
std::vector< HSCParticle > HSCParticleCollection
Definition:
HSCParticle.h:94
iEvent
int iEvent
Definition:
GenABIO.cc:230
PFJetToCaloProducer_cfi.Source
Source
Definition:
PFJetToCaloProducer_cfi.py:4
EDFilter.h
HSCParticleSelector::HSCParticleSelector
HSCParticleSelector(const edm::ParameterSet &)
Definition:
HSCParticleSelector.cc:34
View.h
edm::EventSetup
Definition:
EventSetup.h:54
HSCParticleSelector::sourceToken_
edm::EDGetTokenT< susybsm::HSCParticleCollection > sourceToken_
Definition:
HSCParticleSelector.cc:26
edm::EDFilter
Definition:
EDFilter.h:38
edm::Handle::product
T const * product() const
Definition:
Handle.h:81
HSCParticleSelector::Selectors
std::vector< CandidateSelector * > Selectors
Definition:
HSCParticleSelector.cc:29
HSCParticleSelector::Filter_
bool Filter_
Definition:
HSCParticleSelector.cc:28
edm::InputTag
Definition:
InputTag.h:15
HSCParticleSelector::endJob
void endJob() override
Definition:
HSCParticleSelector.cc:59
HSCParticleSelector
Definition:
HSCParticleSelector.cc:16
HSCParticleSelector::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition:
HSCParticleSelector.cc:63
HSCParticleProducer_cff.SelectionParameters
SelectionParameters
Definition:
HSCParticleProducer_cff.py:89
edm::ParameterSet
Definition:
ParameterSet.h:36
edm::Event
Definition:
Event.h:70
eostools.move
def move(src, dest)
Definition:
eostools.py:511
HSCParticleSelector::~HSCParticleSelector
~HSCParticleSelector() override
Definition:
HSCParticleSelector.cc:51
Handle.h
Generated for CMSSW Reference Manual by
1.8.11