RecoParticleFlow
PFClusterProducer
interface
PFRecHitCaloNavigatorWithTime.h
Go to the documentation of this file.
1
2
#ifndef RecoParticleFlow_PFClusterProducer_PFRecHitCaloNavigatorWithTime_h
3
#define RecoParticleFlow_PFClusterProducer_PFRecHitCaloNavigatorWithTime_h
4
5
#include <memory>
6
7
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
8
#include "
Geometry/CaloGeometry/interface/CaloGeometry.h
"
9
#include "
Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h
"
10
#include "
RecoParticleFlow/PFClusterProducer/interface/PFRecHitNavigatorBase.h
"
11
12
#include "
RecoCaloTools/Navigation/interface/CaloNavigator.h
"
13
#include "
DataFormats/EcalDetId/interface/EBDetId.h
"
14
#include "
DataFormats/EcalDetId/interface/EEDetId.h
"
15
#include "
DataFormats/EcalDetId/interface/ESDetId.h
"
16
#include "
DataFormats/HcalDetId/interface/HcalDetId.h
"
17
18
#include "
Geometry/CaloTopology/interface/EcalEndcapTopology.h
"
19
#include "
Geometry/CaloTopology/interface/EcalBarrelTopology.h
"
20
#include "
Geometry/CaloTopology/interface/EcalPreshowerTopology.h
"
21
#include "
Geometry/CaloTopology/interface/HcalTopology.h
"
22
23
#include "
Geometry/CaloTopology/interface/CaloTowerTopology.h
"
24
#include "
DataFormats/CaloTowers/interface/CaloTowerDetId.h
"
25
26
#include "
RecoParticleFlow/PFClusterProducer/interface/CaloRecHitResolutionProvider.h
"
27
28
template
<
typename
D,
typename
T,
bool
ownsTopo = true>
29
class
PFRecHitCaloNavigatorWithTime
:
public
PFRecHitNavigatorBase
{
30
public
:
31
PFRecHitCaloNavigatorWithTime
(
const
edm::ParameterSet
& iConfig,
edm::ConsumesCollector
&
cc
) {
32
sigmaCut2_
=
pow
(iConfig.
getParameter
<
double
>(
"sigmaCut"
), 2);
33
const
edm::ParameterSet
& timeResConf = iConfig.
getParameterSet
(
"timeResolutionCalc"
);
34
_timeResolutionCalc
= std::make_unique<CaloRecHitResolutionProvider>(timeResConf);
35
}
36
37
~PFRecHitCaloNavigatorWithTime
()
override
{
38
if
(!ownsTopo) {
39
topology_
.release();
40
}
41
}
42
43
void
associateNeighbours
(
reco::PFRecHit
&
hit
,
44
std::unique_ptr<reco::PFRecHitCollection>&
hits
,
45
edm::RefProd<reco::PFRecHitCollection>
& refProd)
override
{
46
DetId
detid(
hit
.detId());
47
48
CaloNavigator<D>
navigator
(detid,
topology_
.get());
49
50
DetId
N
(0);
51
DetId
E(0);
52
DetId
S
(0);
53
DetId
W(0);
54
DetId
NW(0);
55
DetId
NE(0);
56
DetId
SW(0);
57
DetId
SE(0);
58
59
N
=
navigator
.north();
60
associateNeighbour
(
N
,
hit
,
hits
, refProd, 0, 1);
61
62
if
(
N
!=
DetId
(0)) {
63
NE =
navigator
.east();
64
}
else
{
65
navigator
.home();
66
E =
navigator
.east();
67
NE =
navigator
.north();
68
}
69
associateNeighbour
(NE,
hit
,
hits
, refProd, 1, 1);
70
navigator
.home();
71
72
S
=
navigator
.south();
73
associateNeighbour
(
S
,
hit
,
hits
, refProd, 0, -1);
74
75
if
(
S
!=
DetId
(0)) {
76
SW =
navigator
.west();
77
}
else
{
78
navigator
.home();
79
W =
navigator
.west();
80
SW =
navigator
.south();
81
}
82
associateNeighbour
(SW,
hit
,
hits
, refProd, -1, -1);
83
navigator
.home();
84
85
E =
navigator
.east();
86
associateNeighbour
(E,
hit
,
hits
, refProd, 1, 0);
87
88
if
(E !=
DetId
(0)) {
89
SE =
navigator
.south();
90
}
else
{
91
navigator
.home();
92
S
=
navigator
.south();
93
SE =
navigator
.east();
94
}
95
associateNeighbour
(SE,
hit
,
hits
, refProd, 1, -1);
96
navigator
.home();
97
98
W =
navigator
.west();
99
associateNeighbour
(W,
hit
,
hits
, refProd, -1, 0);
100
101
if
(W !=
DetId
(0)) {
102
NW =
navigator
.north();
103
}
else
{
104
navigator
.home();
105
N
=
navigator
.north();
106
NW =
navigator
.west();
107
}
108
associateNeighbour
(NW,
hit
,
hits
, refProd, -1, 1);
109
}
110
111
protected
:
112
double
sigmaCut2_
;
113
std::unique_ptr<const T>
topology_
;
114
std::unique_ptr<CaloRecHitResolutionProvider>
_timeResolutionCalc
;
115
116
void
associateNeighbour
(
const
DetId
&
id
,
117
reco::PFRecHit
&
hit
,
118
std::unique_ptr<reco::PFRecHitCollection>&
hits
,
119
edm::RefProd<reco::PFRecHitCollection>
& refProd,
120
short
eta
,
121
short
phi
) {
122
double
sigma2 = 10000.0;
123
124
auto
found_hit =
std::lower_bound
(
hits
->begin(),
hits
->end(),
id
, [](
const
reco::PFRecHit
&
a
,
DetId
b
) {
125
if
(
DetId
(
a
.detId()).det() ==
DetId::Hcal
||
b
.det() ==
DetId::Hcal
)
126
return
(
HcalDetId
)(
a
.detId()) < (
HcalDetId
)(
b
);
127
128
else
129
return
a
.detId() <
b
.rawId();
130
});
131
132
if
(found_hit !=
hits
->end() &&
133
((found_hit->detId() ==
id
.rawId()) ||
134
((
id
.det() ==
DetId::Hcal
) && ((
HcalDetId
)(found_hit->detId()) == (
HcalDetId
)(
id
))))) {
135
sigma2 =
_timeResolutionCalc
->timeResolution2(
hit
.energy()) +
136
_timeResolutionCalc
->timeResolution2(found_hit->energy());
137
const
double
deltaTime =
hit
.time() - found_hit->time();
138
if
(deltaTime * deltaTime <
sigmaCut2_
* sigma2) {
139
hit
.addNeighbour(
eta
,
phi
, 0, found_hit -
hits
->begin());
140
}
141
}
142
}
143
};
144
145
#endif
edm::RefProd
Definition:
EDProductfwd.h:25
EcalPreshowerTopology.h
PFRecHitCaloNavigatorWithTime::PFRecHitCaloNavigatorWithTime
PFRecHitCaloNavigatorWithTime(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
Definition:
PFRecHitCaloNavigatorWithTime.h:31
CaloNavigator.h
hfClusterShapes_cfi.hits
hits
Definition:
hfClusterShapes_cfi.py:5
HLT_FULL_cff.navigator
navigator
Definition:
HLT_FULL_cff.py:13108
EBDetId.h
EEDetId.h
DetId::Hcal
Definition:
DetId.h:28
EcalBarrelTopology.h
PFRecHitCaloNavigatorWithTime::~PFRecHitCaloNavigatorWithTime
~PFRecHitCaloNavigatorWithTime() override
Definition:
PFRecHitCaloNavigatorWithTime.h:37
ESDetId.h
PFRecHitNavigatorBase.h
PFRecHitCaloNavigatorWithTime::associateNeighbour
void associateNeighbour(const DetId &id, reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd, short eta, short phi)
Definition:
PFRecHitCaloNavigatorWithTime.h:116
DetId
Definition:
DetId.h:17
PFRecHitCaloNavigatorWithTime::_timeResolutionCalc
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
Definition:
PFRecHitCaloNavigatorWithTime.h:114
PVValHelper::eta
Definition:
PVValidationHelpers.h:70
PFRecHitCaloNavigatorWithTime::sigmaCut2_
double sigmaCut2_
Definition:
PFRecHitCaloNavigatorWithTime.h:112
N
#define N
Definition:
blowfish.cc:9
CaloTowerTopology.h
b
double b
Definition:
hdecay.h:118
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:97
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition:
pfDeepBoostedJetPreprocessParams_cfi.py:15
CaloSubdetectorGeometry.h
edm::ParameterSet
Definition:
ParameterSet.h:47
a
double a
Definition:
hdecay.h:119
EcalEndcapTopology.h
HcalDetId.h
PFRecHitNavigatorBase
Definition:
PFRecHitNavigatorBase.h:25
HcalDetId
Definition:
HcalDetId.h:12
CaloTowerDetId.h
cc
DDAxes::phi
HcalTopology.h
CaloNavigator
Definition:
CaloNavigator.h:7
triggerObjects_cff.id
id
Definition:
triggerObjects_cff.py:29
CaloRecHitResolutionProvider.h
CaloGeometry.h
PFRecHitCaloNavigatorWithTime::topology_
std::unique_ptr< const T > topology_
Definition:
PFRecHitCaloNavigatorWithTime.h:113
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
S
Definition:
CSCDBL1TPParametersExtended.h:16
reco::PFRecHit
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition:
PFRecHit.h:31
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition:
Power.h:29
ConsumesCollector.h
PFRecHitCaloNavigatorWithTime
Definition:
PFRecHitCaloNavigatorWithTime.h:29
PFRecHitCaloNavigatorWithTime::associateNeighbours
void associateNeighbours(reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd) override
Definition:
PFRecHitCaloNavigatorWithTime.h:43
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
edm::ParameterSet::getParameterSet
ParameterSet const & getParameterSet(std::string const &) const
Definition:
ParameterSet.cc:2128
hit
Definition:
SiStripHitEffFromCalibTree.cc:88
Generated for CMSSW Reference Manual by
1.8.16