ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
AFP
AFP_Reconstruction
AFP_SiClusterTools
src
AFPSiClusterBasicNearestNeighbour.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
12
13
14
#include "
AFP_SiClusterTools/AFPSiClusterBasicNearestNeighbour.h
"
15
#include "
AFP_SiClusterTools/AFPSiClusterBasicObj.h
"
16
#include "
xAODForward/AFPClusterAlgID.h
"
17
#include "
xAODForward/AFPSiHit.h
"
18
19
// STL includes
20
#include <list>
21
22
// FrameWork includes
23
#include "GaudiKernel/IToolSvc.h"
24
25
AFPSiClusterBasicNearestNeighbour::AFPSiClusterBasicNearestNeighbour
(
const
std::string &
type
,
26
const
std::string &name,
27
const
IInterface *parent)
28
: base_class(
type
, name, parent) {
29
}
30
31
StatusCode
AFPSiClusterBasicNearestNeighbour::initialize
() {
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
AFPSiClusterBasicNearestNeighbour::finalize
() {
36
return
StatusCode::SUCCESS;
37
}
38
39
StatusCode
AFPSiClusterBasicNearestNeighbour::doClustering
(
const
std::list<const xAOD::AFPSiHit*>& hits, std::list<AFPSiClusterBasicObj>& outputClusters)
const
40
{
41
std::list<const xAOD::AFPSiHit*> hitsAboveThreshold;
42
43
// select only hits above charge threshold
44
for
(
const
xAOD::AFPSiHit
* theHit : hits)
45
if
(theHit->depositedCharge() >
m_chargeThreshold
)
46
hitsAboveThreshold.push_back(theHit);
47
48
while
(!hitsAboveThreshold.empty()) {
49
const
xAOD::AFPSiHit
* theHit = hitsAboveThreshold.front();
50
hitsAboveThreshold.pop_front();
// remove current hit from the list
51
52
const
int
pixelHorizID = theHit->
pixelHorizID
();
53
float
horizID = pixelHorizID;
// value used to make cluster may be not integer
54
float
vertID = theHit->
pixelVertID
();
// value used to make cluster may be not integer
55
float
charge
= theHit->
depositedCharge
();
56
outputClusters.emplace_back(theHit,
xAOD::AFPClusterAlgID::nearestNeighbour
);
57
58
const
std::list<const xAOD::AFPSiHit*>::iterator neighbourEnd = hitsAboveThreshold.end();
59
std::list<const xAOD::AFPSiHit*>::iterator neighbourIter = hitsAboveThreshold.begin();
60
while
(neighbourIter != neighbourEnd) {
61
const
xAOD::AFPSiHit
* neighbour = *neighbourIter;
62
// check if pixels are next to each other
63
if
(abs(neighbour->
pixelHorizID
()-pixelHorizID) == 1) {
64
const
float
neighbourCharge = neighbour->
depositedCharge
();
65
// charge weighted mean position
66
horizID = (horizID*
charge
+ neighbour->
pixelHorizID
()*neighbourCharge)/(
charge
+ neighbourCharge);
67
vertID = (vertID*
charge
+ neighbour->
pixelVertID
()*neighbourCharge)/(
charge
+ neighbourCharge);
68
69
charge
+= neighbourCharge;
70
71
hitsAboveThreshold.erase(neighbourIter);
72
73
// update cluster before finishing the loop
74
AFPSiClusterBasicObj
& theCluster = outputClusters.back();
75
theCluster.
setHorizID
(horizID);
76
theCluster.
setVertID
(vertID);
77
theCluster.
setCharge
(
charge
);
78
theCluster.
hits
().push_back(neighbour);
79
break
;
80
}
81
++neighbourIter;
82
}
83
84
}
85
86
87
return
StatusCode::SUCCESS;
88
}
AFPClusterAlgID.h
Definitions of identification numbers of pixel clustering algorithms.
AFPSiClusterBasicNearestNeighbour.h
Header file for AFPSiClusterBasicNearestNeighbour used for clustering hits.
AFPSiClusterBasicObj.h
Full definition of AFPSiClusterBasicObj.
AFPSiHit.h
charge
double charge(const T &p)
Definition
AtlasPID.h:1003
AFPSiClusterBasicNearestNeighbour::m_chargeThreshold
Gaudi::Property< float > m_chargeThreshold
Definition
AFPSiClusterBasicNearestNeighbour.h:53
AFPSiClusterBasicNearestNeighbour::finalize
virtual StatusCode finalize() override
does nothing
Definition
AFPSiClusterBasicNearestNeighbour.cxx:35
AFPSiClusterBasicNearestNeighbour::doClustering
virtual StatusCode doClustering(const std::list< const xAOD::AFPSiHit * > &hits, std::list< AFPSiClusterBasicObj > &outputClusters) const override
Creates a cluster from the neighbouring pixels, joining only two pixels with charge above m_chargeThr...
Definition
AFPSiClusterBasicNearestNeighbour.cxx:39
AFPSiClusterBasicNearestNeighbour::AFPSiClusterBasicNearestNeighbour
AFPSiClusterBasicNearestNeighbour(const std::string &type, const std::string &name, const IInterface *parent)
Definition
AFPSiClusterBasicNearestNeighbour.cxx:25
AFPSiClusterBasicNearestNeighbour::initialize
virtual StatusCode initialize() override
does nothing
Definition
AFPSiClusterBasicNearestNeighbour.cxx:31
AFPSiClusterBasicObj
Class representing basic silicon pixels cluster, designed to be used for creating the clusters.
Definition
AFPSiClusterBasicObj.h:28
AFPSiClusterBasicObj::setCharge
void setCharge(const double charge)
Definition
AFPSiClusterBasicObj.h:64
AFPSiClusterBasicObj::hits
std::list< const xAOD::AFPSiHit * > & hits()
list of pixels used to form the cluster
Definition
AFPSiClusterBasicObj.h:72
AFPSiClusterBasicObj::setVertID
void setVertID(const float vertID)
Definition
AFPSiClusterBasicObj.h:54
AFPSiClusterBasicObj::setHorizID
void setHorizID(const float horizID)
Definition
AFPSiClusterBasicObj.h:44
xAOD::AFPClusterAlgID::nearestNeighbour
static const int nearestNeighbour
Nearest neighbour algorithm.
Definition
AFPClusterAlgID.h:49
xAOD::AFPSiHit_v2::depositedCharge
float depositedCharge() const
Charge deposited in the pixel.
xAOD::AFPSiHit_v2::pixelHorizID
int pixelHorizID() const
Index of the pixel along X axis in LHC coordinate system.
Definition
AFPSiHit_v2.cxx:37
xAOD::AFPSiHit_v2::pixelVertID
int pixelVertID() const
Index of the pixel along Y axis in LHC coordinate system.
Definition
AFPSiHit_v2.cxx:52
xAOD::AFPSiHit
AFPSiHit_v2 AFPSiHit
Definition
AFPSiHit.h:12
type
Generated on
for ATLAS Offline Software by
1.17.0