RecoLocalMuon
DTRecHit
plugins
DTRecHitProducer.cc
Go to the documentation of this file.
1
6
#include "
DTRecHitProducer.h
"
7
8
#include "
FWCore/Framework/interface/Event.h
"
9
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
10
#include "
FWCore/Framework/interface/ESHandle.h
"
11
12
#include "
DataFormats/DTDigi/interface/DTDigiCollection.h
"
13
14
#include "
Geometry/DTGeometry/interface/DTLayer.h
"
15
#include "
Geometry/DTGeometry/interface/DTGeometry.h
"
16
#include "
Geometry/Records/interface/MuonGeometryRecord.h
"
17
#include "
DataFormats/MuonDetId/interface/DTLayerId.h
"
18
#include "
DataFormats/DTRecHit/interface/DTRecHit1DPair.h
"
19
20
#include "
RecoLocalMuon/DTRecHit/interface/DTRecHitBaseAlgo.h
"
21
#include "
RecoLocalMuon/DTRecHit/interface/DTRecHitAlgoFactory.h
"
22
#include "
DataFormats/DTRecHit/interface/DTRecHitCollection.h
"
23
#include <string>
24
25
using namespace
edm
;
26
using namespace
std
;
27
28
DTRecHitProducer::DTRecHitProducer
(
const
ParameterSet
&
config
)
29
:
// Set verbose output
30
debug
(
config
.getUntrackedParameter<
bool
>(
"debug"
,
false
)),
31
// Get the concrete reconstruction algo from the factory
32
theAlgo{
DTRecHitAlgoFactory::get
()->create(
config
.getParameter<
string
>(
"recAlgo"
),
33
config
.getParameter<
ParameterSet
>(
"recAlgoConfig"
))} {
34
if
(
debug
)
35
cout
<<
"[DTRecHitProducer] Constructor called"
<< endl;
36
37
produces<DTRecHitCollection>();
38
39
DTDigiToken_ = consumes<DTDigiCollection>(
config
.getParameter<
InputTag
>(
"dtDigiLabel"
));
40
}
41
42
DTRecHitProducer::~DTRecHitProducer
() {
43
if
(
debug
)
44
cout
<<
"[DTRecHitProducer] Destructor called"
<< endl;
45
}
46
47
void
DTRecHitProducer::produce
(
Event
&
event
,
const
EventSetup
&
setup
) {
48
// Get the DT Geometry
49
ESHandle<DTGeometry>
dtGeom;
50
setup
.get<
MuonGeometryRecord
>().
get
(dtGeom);
51
52
// Get the digis from the event
53
Handle<DTDigiCollection>
digis;
54
event
.getByToken(
DTDigiToken_
, digis);
55
56
// Pass the EventSetup to the algo
57
theAlgo
->setES(
setup
);
58
59
// Create the pointer to the collection which will store the rechits
60
auto
recHitCollection = std::make_unique<DTRecHitCollection>();
61
62
// Iterate through all digi collections ordered by LayerId
63
DTDigiCollection::DigiRangeIterator
dtLayerIt;
64
for
(dtLayerIt = digis->begin(); dtLayerIt != digis->end(); ++dtLayerIt) {
65
// The layerId
66
const
DTLayerId
& layerId = (*dtLayerIt).first;
67
// Get the GeomDet from the setup
68
const
DTLayer
*
layer
= dtGeom->
layer
(layerId);
69
70
// Get the iterators over the digis associated with this LayerId
71
const
DTDigiCollection::Range
&
range
= (*dtLayerIt).second;
72
73
OwnVector<DTRecHit1DPair>
recHits
=
theAlgo
->reconstruct(
layer
, layerId,
range
);
74
75
if
(
debug
)
76
cout
<<
"Number of hits in this layer: "
<<
recHits
.size() << endl;
77
if
(!
recHits
.empty())
//FIXME: is it really needed?
78
recHitCollection->put(layerId,
recHits
.begin(),
recHits
.end());
79
}
80
81
event
.put(
std::move
(recHitCollection));
82
}
FastTimerService_cff.range
range
Definition:
FastTimerService_cff.py:34
electrons_cff.bool
bool
Definition:
electrons_cff.py:366
funct::false
false
Definition:
Factorize.h:29
DTRecHitProducer::produce
void produce(edm::Event &event, const edm::EventSetup &setup) override
The method which produces the rechits.
Definition:
DTRecHitProducer.cc:47
ESHandle.h
DTRecHitCollection.h
DTLayerId.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
DTRecHitBaseAlgo.h
edm::Handle< DTDigiCollection >
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
config
Definition:
config.py:1
debug
#define debug
Definition:
HDRShower.cc:19
DTRecHitProducer.h
edm::ESHandle< DTGeometry >
DTLayerId
Definition:
DTLayerId.h:12
DTLayer.h
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition:
phase1PixelTopology.h:99
DTGeometry.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition:
FastTrackerRecHitMaskProducer_cfi.py:8
DTRecHitProducer::debug
const bool debug
Definition:
DTRecHitProducer.h:37
DTRecHitProducer::theAlgo
std::unique_ptr< DTRecHitBaseAlgo > theAlgo
Definition:
DTRecHitProducer.h:41
edm::ParameterSet
Definition:
ParameterSet.h:47
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition:
DTGeometry.cc:96
Event.h
DTRecHitAlgoFactory.h
DTRecHit1DPair.h
edm::EventSetup
Definition:
EventSetup.h:58
get
#define get
DTLayer
Definition:
DTLayer.h:25
eostools.move
def move(src, dest)
Definition:
eostools.py:511
std
Definition:
JetResolutionObject.h:76
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition:
MuonDigiCollection.h:95
DTRecHitProducer::DTRecHitProducer
DTRecHitProducer(const edm::ParameterSet &)
Constructor.
Definition:
DTRecHitProducer.cc:28
DTRecHitProducer::~DTRecHitProducer
~DTRecHitProducer() override
Destructor.
Definition:
DTRecHitProducer.cc:42
DTDigiCollection.h
ParameterSet.h
MuonGeometryRecord.h
event
Definition:
event.py:1
DigiContainerIterator
Definition:
MuonDigiCollection.h:30
edm::Event
Definition:
Event.h:73
MuonGeometryRecord
Definition:
MuonGeometryRecord.h:34
edm::InputTag
Definition:
InputTag.h:15
DTRecHitProducer::DTDigiToken_
edm::EDGetTokenT< DTDigiCollection > DTDigiToken_
Definition:
DTRecHitProducer.h:39
edm::OwnVector
Definition:
OwnVector.h:24
Generated for CMSSW Reference Manual by
1.8.16