RecoParticleFlow
PFClusterProducer
interface
PFPSRecHitCreator.h
Go to the documentation of this file.
1
#ifndef RecoParticleFlow_PFClusterProducer_PFPSRecHitCreator_h
2
#define RecoParticleFlow_PFClusterProducer_PFPSRecHitCreator_h
3
4
#include "
RecoParticleFlow/PFClusterProducer/interface/PFRecHitCreatorBase.h
"
5
#include "
DataFormats/EcalRecHit/interface/EcalRecHit.h
"
6
#include "
DataFormats/EcalRecHit/interface/EcalRecHitCollections.h
"
7
#include "
DataFormats/EcalDetId/interface/EcalSubdetector.h
"
8
9
#include "
DataFormats/EcalDetId/interface/EEDetId.h
"
10
#include "
DataFormats/EcalDetId/interface/EBDetId.h
"
11
#include "
DataFormats/EcalDetId/interface/ESDetId.h
"
12
13
#include "
Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h
"
14
#include "
Geometry/CaloGeometry/interface/CaloGeometry.h
"
15
#include "
Geometry/CaloGeometry/interface/CaloCellGeometry.h
"
16
#include "
Geometry/CaloGeometry/interface/TruncatedPyramid.h
"
17
#include "
Geometry/Records/interface/CaloGeometryRecord.h
"
18
19
#include "
Geometry/EcalAlgo/interface/EcalEndcapGeometry.h
"
20
#include "
Geometry/EcalAlgo/interface/EcalBarrelGeometry.h
"
21
#include "
Geometry/CaloTopology/interface/EcalEndcapTopology.h
"
22
#include "
Geometry/CaloTopology/interface/EcalBarrelTopology.h
"
23
#include "
Geometry/CaloTopology/interface/EcalPreshowerTopology.h
"
24
#include "
RecoCaloTools/Navigation/interface/CaloNavigator.h
"
25
26
class
PFPSRecHitCreator
final :
public
PFRecHitCreatorBase
{
27
public
:
28
PFPSRecHitCreator
(
const
edm::ParameterSet
& iConfig,
edm::ConsumesCollector
& iC) :
PFRecHitCreatorBase
(iConfig, iC) {
29
recHitToken_
= iC.
consumes
<
EcalRecHitCollection
>(iConfig.
getParameter
<
edm::InputTag
>(
"src"
));
30
}
31
32
void
importRecHits
(std::unique_ptr<reco::PFRecHitCollection>&
out
,
33
std::unique_ptr<reco::PFRecHitCollection>& cleaned,
34
const
edm::Event
&
iEvent
,
35
const
edm::EventSetup
& iSetup)
override
{
36
beginEvent
(
iEvent
, iSetup);
37
38
edm::Handle<EcalRecHitCollection>
recHitHandle;
39
edm::ESHandle<CaloGeometry>
geoHandle;
40
iSetup.
get
<
CaloGeometryRecord
>().
get
(geoHandle);
41
42
// get the ecal geometry
43
const
CaloSubdetectorGeometry
* psGeometry = geoHandle->
getSubdetectorGeometry
(
DetId::Ecal
,
EcalPreshower
);
44
45
iEvent
.getByToken(
recHitToken_
, recHitHandle);
46
for
(
const
auto
& erh : *recHitHandle) {
47
ESDetId
detid(erh.detid());
48
auto
energy
= erh.energy();
49
50
PFLayer::Layer
layer =
PFLayer::NONE
;
51
52
switch
(detid.plane()) {
53
case
1:
54
layer =
PFLayer::PS1
;
55
break
;
56
case
2:
57
layer =
PFLayer::PS2
;
58
break
;
59
default
:
60
throw
cms::Exception
(
"PFRecHitBadInput"
)
61
<<
"incorrect preshower plane !! plane number "
<< detid.plane() << std::endl;
62
}
63
64
auto
thisCell = psGeometry->
getGeometry
(detid);
65
66
// find rechit geometry
67
if
(!thisCell) {
68
edm::LogError
(
"PFPSRecHitCreator"
)
69
<<
"warning detid "
<< detid.rawId() <<
" not found in geometry"
<< std::endl;
70
continue
;
71
}
72
73
out
->emplace_back(thisCell, detid.rawId(), layer,
energy
);
74
auto
& rh =
out
->back();
75
rh.setDepth(detid.plane());
76
rh.setTime(erh.time());
77
78
bool
rcleaned =
false
;
79
bool
keep
=
true
;
80
bool
hi
=
true
;
// all ES rhs are produced, independently on the ECAL SRP decision
81
82
//Apply Q tests
83
for
(
const
auto
& qtest :
qualityTests_
) {
84
if
(!qtest->test(rh, erh, rcleaned,
hi
)) {
85
keep
=
false
;
86
}
87
}
88
89
if
(rcleaned)
90
cleaned->push_back(
std::move
(
out
->back()));
91
if
(!
keep
)
92
out
->pop_back();
93
}
94
}
95
96
protected
:
97
edm::EDGetTokenT<EcalRecHitCollection>
recHitToken_
;
98
};
99
100
#endif
EcalPreshowerTopology.h
PFRecHitCreatorBase.h
EcalBarrelGeometry.h
CaloNavigator.h
PFRecHitCreatorBase::beginEvent
void beginEvent(const edm::Event &event, const edm::EventSetup &setup)
Definition:
PFRecHitCreatorBase.h:43
PFPSRecHitCreator
Definition:
PFPSRecHitCreator.h:26
edm::EDGetTokenT
Definition:
EDGetToken.h:33
CaloGeometryRecord
Definition:
CaloGeometryRecord.h:30
EBDetId.h
EEDetId.h
EcalBarrelTopology.h
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition:
CaloGeometry.cc:34
edm::SortedCollection< EcalRecHit >
PFRecHitCreatorBase
Definition:
PFRecHitCreatorBase.h:23
ESDetId
Definition:
ESDetId.h:15
ESDetId.h
edm::Handle
Definition:
AssociativeIterator.h:50
EcalRecHitCollections.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
PFLayer::PS1
Definition:
PFLayer.h:31
TruncatedPyramid.h
PFRecHitCreatorBase::qualityTests_
std::vector< std::unique_ptr< PFRecHitQTestBase > > qualityTests_
Definition:
PFRecHitCreatorBase.h:48
edm::ESHandle< CaloGeometry >
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition:
ConsumesCollector.h:55
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition:
HCALHighEnergyHPDFilter_cfi.py:5
PFLayer::NONE
Definition:
PFLayer.h:34
CaloGeometryRecord.h
PFLayer::Layer
Layer
layer definition
Definition:
PFLayer.h:29
EcalSubdetector.h
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition:
ParameterSet.h:47
EcalEndcapGeometry.h
EcalEndcapTopology.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
PFPSRecHitCreator::recHitToken_
edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
Definition:
PFPSRecHitCreator.h:97
CaloSubdetectorGeometry::getGeometry
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
Definition:
CaloSubdetectorGeometry.cc:36
edm::EventSetup
Definition:
EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
DetId::Ecal
Definition:
DetId.h:27
get
#define get
EcalRecHit.h
EcalPreshower
Definition:
EcalSubdetector.h:10
hi
Definition:
EPCuts.h:4
CaloCellGeometry.h
eostools.move
def move(src, dest)
Definition:
eostools.py:511
Exception
Definition:
hltDiff.cc:246
CaloGeometry.h
CaloSubdetectorGeometry
Definition:
CaloSubdetectorGeometry.h:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition:
MillePedeFileConverter_cfg.py:31
PFPSRecHitCreator::PFPSRecHitCreator
PFPSRecHitCreator(const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
Definition:
PFPSRecHitCreator.h:28
edm::Event
Definition:
Event.h:73
PFLayer::PS2
Definition:
PFLayer.h:30
keep
const int keep
Definition:
GenParticlePruner.cc:48
edm::InputTag
Definition:
InputTag.h:15
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
PFPSRecHitCreator::importRecHits
void importRecHits(std::unique_ptr< reco::PFRecHitCollection > &out, std::unique_ptr< reco::PFRecHitCollection > &cleaned, const edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition:
PFPSRecHitCreator.h:32
Generated for CMSSW Reference Manual by
1.8.16