RecoLocalCalo
HGCalRecProducers
plugins
HEBRecHitFromSoA.cc
Go to the documentation of this file.
1
#include <memory>
2
3
#include "
FWCore/Framework/interface/stream/EDProducer.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
DataFormats/HGCRecHit/interface/HGCRecHit.h
"
6
#include "
DataFormats/HGCRecHit/interface/HGCRecHitCollections.h
"
7
#include "
DataFormats/ForwardDetId/interface/HGCSiliconDetId.h
"
8
#include "
FWCore/Utilities/interface/EDGetToken.h
"
9
#include "
FWCore/Utilities/interface/EDPutToken.h
"
10
11
#include "
CUDADataFormats/HGCal/interface/HGCRecHitCPUProduct.h
"
12
#include "
CUDADataFormats/HGCal/interface/ConstHGCRecHitSoA.h
"
13
14
class
HEBRecHitFromSoA
:
public
edm::stream::EDProducer
<> {
15
public
:
16
explicit
HEBRecHitFromSoA
(
const
edm::ParameterSet
& ps);
17
~HEBRecHitFromSoA
()
override
;
18
19
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
20
void
convert_soa_data_to_collection_
(uint32_t,
HGCRecHitCollection
&,
ConstHGCRecHitSoA
*);
21
22
private
:
23
std::unique_ptr<HGChefRecHitCollection>
rechits_
;
24
edm::EDGetTokenT<HGCRecHitCPUProduct>
recHitSoAToken_
;
25
edm::EDPutTokenT<HGChefRecHitCollection>
recHitCollectionToken_
;
26
};
27
28
HEBRecHitFromSoA::HEBRecHitFromSoA
(
const
edm::ParameterSet
& ps) {
29
recHitSoAToken_
= consumes<HGCRecHitCPUProduct>(ps.
getParameter
<
edm::InputTag
>(
"HEBRecHitSoATok"
));
30
recHitCollectionToken_
= produces<HGChebRecHitCollection>();
31
}
32
33
HEBRecHitFromSoA::~HEBRecHitFromSoA
() {}
34
35
void
HEBRecHitFromSoA::produce
(
edm::Event
&
event
,
const
edm::EventSetup
&
setup
) {
36
const
HGCRecHitCPUProduct
&
recHits
=
event
.get(
recHitSoAToken_
);
37
ConstHGCRecHitSoA
recHitsSoA =
recHits
.get();
38
rechits_
= std::make_unique<HGCRecHitCollection>();
39
convert_soa_data_to_collection_
(
recHits
.nHits(), *
rechits_
, &recHitsSoA);
40
event
.put(
std::move
(
rechits_
));
41
}
42
43
void
HEBRecHitFromSoA::convert_soa_data_to_collection_
(uint32_t
nhits
,
44
HGCRecHitCollection
&
rechits
,
45
ConstHGCRecHitSoA
* h_calibSoA) {
46
rechits
.reserve(
nhits
);
47
for
(
uint
i
= 0;
i
<
nhits
; ++
i
) {
48
DetId
id_converted(h_calibSoA->
id_
[
i
]);
49
rechits
.emplace_back(id_converted,
50
h_calibSoA->
energy_
[
i
],
51
h_calibSoA->
time_
[
i
],
52
0,
53
h_calibSoA->
flagBits_
[
i
],
54
h_calibSoA->
son_
[
i
],
55
h_calibSoA->
timeError_
[
i
]);
56
}
57
}
58
59
#include "
FWCore/Framework/interface/MakerMacros.h
"
60
DEFINE_FWK_MODULE
(
HEBRecHitFromSoA
);
HEBRecHitFromSoA::convert_soa_data_to_collection_
void convert_soa_data_to_collection_(uint32_t, HGCRecHitCollection &, ConstHGCRecHitSoA *)
Definition:
HEBRecHitFromSoA.cc:43
mps_fire.i
i
Definition:
mps_fire.py:428
HEBRecHitFromSoA::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
HEBRecHitFromSoA.cc:35
ConstHGCRecHitSoA.h
HEBRecHitFromSoA::HEBRecHitFromSoA
HEBRecHitFromSoA(const edm::ParameterSet &ps)
Definition:
HEBRecHitFromSoA.cc:28
HGCRecHitCPUProduct
Definition:
HGCRecHitCPUProduct.h:12
edm::EDGetTokenT< HGCRecHitCPUProduct >
edm::EDPutTokenT
Definition:
EDPutToken.h:33
HEBRecHitFromSoA::recHitCollectionToken_
edm::EDPutTokenT< HGChefRecHitCollection > recHitCollectionToken_
Definition:
HEBRecHitFromSoA.cc:25
HGCSiliconDetId.h
EDProducer.h
edm::SortedCollection
Definition:
SortedCollection.h:49
HEBRecHitFromSoA
Definition:
HEBRecHitFromSoA.cc:14
ConstHGCRecHitSoA::energy_
const float * energy_
Definition:
ConstHGCRecHitSoA.h:8
HGCRecHitCPUProduct.h
parallelization.uint
uint
Definition:
parallelization.py:124
singleTopDQM_cfi.setup
setup
Definition:
singleTopDQM_cfi.py:37
ConstHGCRecHitSoA::son_
const uint8_t * son_
Definition:
ConstHGCRecHitSoA.h:13
DetId
Definition:
DetId.h:17
MakerMacros.h
ConstHGCRecHitSoA::time_
const float * time_
Definition:
ConstHGCRecHitSoA.h:9
HGCRecHit.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
HI_PhotonSkim_cff.rechits
rechits
Definition:
HI_PhotonSkim_cff.py:76
nhits
Definition:
HIMultiTrackSelector.h:42
EDGetToken.h
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition:
FastTrackerRecHitMaskProducer_cfi.py:8
HGCRecHitCollections.h
edm::ParameterSet
Definition:
ParameterSet.h:47
EDPutToken.h
ConstHGCRecHitSoA::flagBits_
const uint32_t * flagBits_
Definition:
ConstHGCRecHitSoA.h:12
edm::stream::EDProducer
Definition:
EDProducer.h:38
edm::EventSetup
Definition:
EventSetup.h:58
ConstHGCRecHitSoA::timeError_
const float * timeError_
Definition:
ConstHGCRecHitSoA.h:10
HEBRecHitFromSoA::~HEBRecHitFromSoA
~HEBRecHitFromSoA() override
Definition:
HEBRecHitFromSoA.cc:33
eostools.move
def move(src, dest)
Definition:
eostools.py:511
ConstHGCRecHitSoA
Definition:
ConstHGCRecHitSoA.h:6
HEBRecHitFromSoA::recHitSoAToken_
edm::EDGetTokenT< HGCRecHitCPUProduct > recHitSoAToken_
Definition:
HEBRecHitFromSoA.cc:24
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
ParameterSet.h
event
Definition:
event.py:1
edm::Event
Definition:
Event.h:73
edm::InputTag
Definition:
InputTag.h:15
ConstHGCRecHitSoA::id_
const uint32_t * id_
Definition:
ConstHGCRecHitSoA.h:11
HEBRecHitFromSoA::rechits_
std::unique_ptr< HGChefRecHitCollection > rechits_
Definition:
HEBRecHitFromSoA.cc:23
Generated for CMSSW Reference Manual by
1.8.16