RecoLocalMuon
GEMSegment
plugins
GEMSegmentProducer.cc
Go to the documentation of this file.
1
7
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
8
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
9
#include "
FWCore/Framework/interface/Event.h
"
10
#include "
FWCore/Framework/interface/ESHandle.h
"
11
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
12
#include "
FWCore/Utilities/interface/InputTag.h
"
13
#include "
FWCore/Utilities/interface/ESGetToken.h
"
14
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
15
16
#include "
DataFormats/Common/interface/Handle.h
"
17
#include "
DataFormats/GEMRecHit/interface/GEMRecHitCollection.h
"
18
#include "
DataFormats/GEMRecHit/interface/GEMSegmentCollection.h
"
19
#include "
DataFormats/GEMRecHit/interface/GEMSegment.h
"
20
21
#include "
RecoLocalMuon/GEMSegment/plugins/GEMSegmentBuilder.h
"
22
#include "
Geometry/Records/interface/MuonGeometryRecord.h
"
23
24
class
GEMSegmentProducer
:
public
edm::stream::EDProducer
<> {
25
public
:
27
explicit
GEMSegmentProducer
(
const
edm::ParameterSet
&);
29
~GEMSegmentProducer
()
override
{}
31
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
32
33
private
:
34
int
iev
;
// events through
35
edm::EDGetTokenT<GEMRecHitCollection>
theGEMRecHitToken
;
36
std::unique_ptr<GEMSegmentBuilder>
segmentBuilder_
;
37
edm::ESGetToken<GEMGeometry, MuonGeometryRecord>
gemGeomToken_
;
38
};
39
40
GEMSegmentProducer::GEMSegmentProducer
(
const
edm::ParameterSet
& ps) : iev(0) {
41
theGEMRecHitToken
= consumes<GEMRecHitCollection>(ps.
getParameter
<
edm::InputTag
>(
"gemRecHitLabel"
));
42
segmentBuilder_
= std::make_unique<GEMSegmentBuilder>(ps);
// pass on the Parameter Set
43
gemGeomToken_
= esConsumes<GEMGeometry, MuonGeometryRecord>();
44
// register what this produces
45
produces<GEMSegmentCollection>();
46
}
47
48
void
GEMSegmentProducer::produce
(
edm::Event
&
ev
,
const
edm::EventSetup
&
setup
) {
49
LogDebug
(
"GEMSegmentProducer"
) <<
"start producing segments for "
<< ++
iev
<<
"th event with GEM data"
;
50
51
// find the geometry (& conditions?) for this event & cache it in the builder
52
edm::ESHandle<GEMGeometry>
gemg =
setup
.getHandle(
gemGeomToken_
);
53
const
GEMGeometry
* mgeom = &*gemg;
54
segmentBuilder_
->setGeometry(mgeom);
55
56
// get the collection of GEMRecHit
57
edm::Handle<GEMRecHitCollection>
gemRecHits
;
58
ev
.getByToken(
theGEMRecHitToken
,
gemRecHits
);
59
60
// create empty collection of Segments
61
auto
oc = std::make_unique<GEMSegmentCollection>();
62
63
// fill the collection
64
segmentBuilder_
->build(
gemRecHits
.product(), *oc);
//@@ FILL oc
65
66
// put collection in event
67
ev
.put(
std::move
(oc));
68
}
69
70
#include "
FWCore/Framework/interface/MakerMacros.h
"
71
DEFINE_FWK_MODULE
(
GEMSegmentProducer
);
GEMSegmentProducer
Definition:
GEMSegmentProducer.cc:24
Handle.h
MessageLogger.h
ESHandle.h
edm::EDGetTokenT< GEMRecHitCollection >
EDProducer.h
GEMSegmentProducer::~GEMSegmentProducer
~GEMSegmentProducer() override
Destructor.
Definition:
GEMSegmentProducer.cc:29
edm::Handle< GEMRecHitCollection >
ESGetToken.h
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
GEMSegmentProducer::gemGeomToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > gemGeomToken_
Definition:
GEMSegmentProducer.cc:37
MakerMacros.h
GEMSegmentProducer::iev
int iev
Definition:
GEMSegmentProducer.cc:34
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ESHandle< GEMGeometry >
GEMSegmentProducer::segmentBuilder_
std::unique_ptr< GEMSegmentBuilder > segmentBuilder_
Definition:
GEMSegmentProducer.cc:36
LogDebug
#define LogDebug(id)
Definition:
MessageLogger.h:223
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
edm::stream::EDProducer
Definition:
EDProducer.h:38
GEMSegmentProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Produce the GEMSegment collection.
Definition:
GEMSegmentProducer.cc:48
GEMRecHitCollection.h
edm::EventSetup
Definition:
EventSetup.h:57
edm::ESGetToken< GEMGeometry, MuonGeometryRecord >
InputTag.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Frameworkfwd.h
GEMSegmentCollection.h
ev
bool ev
Definition:
Hydjet2Hadronizer.cc:95
GEMSegmentProducer::GEMSegmentProducer
GEMSegmentProducer(const edm::ParameterSet &)
Constructor.
Definition:
GEMSegmentProducer.cc:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
GEMGeometry
Definition:
GEMGeometry.h:24
GEMSegmentBuilder.h
gemRecHits_cfi.gemRecHits
gemRecHits
Definition:
gemRecHits_cfi.py:7
ParameterSet.h
MuonGeometryRecord.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
GEMSegmentProducer::theGEMRecHitToken
edm::EDGetTokenT< GEMRecHitCollection > theGEMRecHitToken
Definition:
GEMSegmentProducer.cc:35
GEMSegment.h
Generated for CMSSW Reference Manual by
1.8.16