RecoPixelVertexing
PixelLowPtUtilities
plugins
SiPixelClusterShapeCacheProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/global/EDProducer.h
"
2
#include "
FWCore/Framework/interface/MakerMacros.h
"
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/Framework/interface/EventSetup.h
"
5
#include "
FWCore/Utilities/interface/EDGetToken.h
"
6
7
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
8
#include "
FWCore/Utilities/interface/InputTag.h
"
9
10
#include "
FWCore/Framework/interface/ESHandle.h
"
11
#include "
DataFormats/Common/interface/Handle.h
"
12
#include "
DataFormats/SiPixelCluster/interface/SiPixelClusterShapeCache.h
"
13
14
#include "
Geometry/Records/interface/TrackerDigiGeometryRecord.h
"
15
#include "
Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h
"
16
#include "
Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h
"
17
18
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
19
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
20
21
#include "
RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShape.h
"
22
#include "
RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterData.h
"
23
24
#include <cassert>
25
26
class
SiPixelClusterShapeCacheProducer
:
public
edm::global::EDProducer
<> {
27
public
:
28
explicit
SiPixelClusterShapeCacheProducer
(
const
edm::ParameterSet
& iConfig);
29
~SiPixelClusterShapeCacheProducer
()
override
;
30
31
static
void
fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions);
32
33
void
produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const override
;
34
35
private
:
36
using
InputCollection
=
edmNew::DetSetVector<SiPixelCluster>
;
37
38
const
edm::EDGetTokenT<InputCollection>
token_
;
39
};
40
41
SiPixelClusterShapeCacheProducer::SiPixelClusterShapeCacheProducer
(
const
edm::ParameterSet
& iConfig)
42
: token_(consumes<
InputCollection
>(iConfig.getParameter<
edm
::
InputTag
>(
"src"
))) {
43
if
(iConfig.
getParameter
<
bool
>(
"onDemand"
)) {
44
throw
cms::Exception
(
"OnDemandNotAllowed"
)
45
<<
"Use of the `onDemand` feature of SiPixelClusterShapeCacheProducer is no longer supported"
;
46
}
47
produces<SiPixelClusterShapeCache>();
48
}
49
50
SiPixelClusterShapeCacheProducer::~SiPixelClusterShapeCacheProducer
() {}
51
52
void
SiPixelClusterShapeCacheProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& descriptions) {
53
edm::ParameterSetDescription
desc
;
54
desc
.add<
edm::InputTag
>(
"src"
,
edm::InputTag
(
"siPixelClusters"
));
55
desc
.add<
bool
>(
"onDemand"
,
false
)->setComment(
"The on demand feature is no longer supported"
);
56
descriptions.
add
(
"siPixelClusterShapeCache"
,
desc
);
57
}
58
59
void
SiPixelClusterShapeCacheProducer::produce
(
edm::StreamID
,
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
const
{
60
edm::Handle<InputCollection>
input
;
61
iEvent
.getByToken(
token_
,
input
);
62
63
edm::ESHandle<TrackerGeometry>
geom
;
64
iSetup.
get
<
TrackerDigiGeometryRecord
>().
get
(
geom
);
65
66
auto
output
= std::make_unique<SiPixelClusterShapeCache>(
input
);
67
output
->resize(
input
->data().size());
68
69
ClusterData
data
;
// reused
70
ClusterShape
clusterShape;
71
72
for
(
const
auto
& detSet : *
input
) {
73
const
GeomDetUnit
* genericDet =
geom
->idToDetUnit(detSet.detId());
74
const
PixelGeomDetUnit
* pixDet = dynamic_cast<const PixelGeomDetUnit*>(genericDet);
75
assert
(pixDet);
76
77
edmNew::DetSet<SiPixelCluster>::const_iterator
iCluster = detSet.begin(), endCluster = detSet.end();
78
for
(; iCluster != endCluster; ++iCluster) {
79
SiPixelClusterShapeCache::ClusterRef
clusterRef =
edmNew::makeRefTo
(
input
, iCluster);
80
if
(not
output
->isFilled(clusterRef)) {
81
data
.size.clear();
82
clusterShape.
determineShape
(*pixDet, *iCluster,
data
);
83
output
->insert(clusterRef,
data
);
84
}
85
}
86
}
87
output
->shrink_to_fit();
88
89
iEvent
.put(
std::move
(
output
));
90
}
91
92
DEFINE_FWK_MODULE
(
SiPixelClusterShapeCacheProducer
);
ConfigurationDescriptions.h
edm::StreamID
Definition:
StreamID.h:30
Handle.h
input
static const std::string input
Definition:
EdmProvDump.cc:48
TrackerGeometry.h
GeomDet
Definition:
GeomDet.h:27
ESHandle.h
convertSQLitetoXML_cfg.output
output
Definition:
convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT< InputCollection >
ClusterShape
Definition:
ClusterShape.h:14
edm
HLT enums.
Definition:
AlignableModifier.h:19
SiPixelClusterShapeCacheProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition:
SiPixelClusterShapeCacheProducer.cc:52
HLT_FULL_cff.InputTag
InputTag
Definition:
HLT_FULL_cff.py:89287
edmNew::makeRefTo
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
Definition:
DetSetVectorNew.h:689
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
SiPixelClusterShapeCacheProducer::token_
const edm::EDGetTokenT< InputCollection > token_
Definition:
SiPixelClusterShapeCacheProducer.cc:38
cms::cuda::assert
assert(be >=bs)
SiPixelClusterShapeCacheProducer::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition:
SiPixelClusterShapeCacheProducer.cc:59
edm::Handle
Definition:
AssociativeIterator.h:50
SiPixelClusterShapeCacheProducer
Definition:
SiPixelClusterShapeCacheProducer.cc:26
edm::Ref
Definition:
AssociativeIterator.h:58
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
PixelGeomDetUnit
Definition:
PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition:
TrackerDigiGeometryRecord.h:15
edm::ESHandle< TrackerGeometry >
relativeConstraints.geom
geom
Definition:
relativeConstraints.py:72
ParameterSetDescription.h
EDGetToken.h
edm::global::EDProducer
Definition:
EDProducer.h:32
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
ClusterShape.h
TrackerDigiGeometryRecord.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
ClusterShape::determineShape
void determineShape(const PixelGeomDetUnit &pixelDet, const SiPixelRecHit &recHit, ClusterData &data)
Definition:
ClusterShape.cc:75
iEvent
int iEvent
Definition:
GenABIO.cc:224
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
InputTag.h
edmNew::DetSetVector
Definition:
DetSetNew.h:13
submitPVResolutionJobs.desc
string desc
Definition:
submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition:
eostools.py:511
ClusterData.h
SiPixelClusterShapeCacheProducer::~SiPixelClusterShapeCacheProducer
~SiPixelClusterShapeCacheProducer() override
Definition:
SiPixelClusterShapeCacheProducer.cc:50
Exception
Definition:
hltDiff.cc:246
PixelGeomDetUnit.h
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
data
char data[epos_bytes_allocation]
Definition:
EPOS_Wrapper.h:79
ParameterSet.h
EDProducer.h
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
SiPixelClusterShapeCacheProducer::SiPixelClusterShapeCacheProducer
SiPixelClusterShapeCacheProducer(const edm::ParameterSet &iConfig)
Definition:
SiPixelClusterShapeCacheProducer.cc:41
SiPixelClusterShapeCache.h
ClusterData
Definition:
ClusterData.h:7
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition:
DetSetNew.h:31
Generated for CMSSW Reference Manual by
1.8.16