ATLAS Offline Software
Loading...
Searching...
No Matches
AFPSiClusterBasicNearestNeighbour Class Reference

#include <AFPSiClusterBasicNearestNeighbour.h>

Inheritance diagram for AFPSiClusterBasicNearestNeighbour:
Collaboration diagram for AFPSiClusterBasicNearestNeighbour:

Public Member Functions

 AFPSiClusterBasicNearestNeighbour (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~AFPSiClusterBasicNearestNeighbour () override
virtual StatusCode initialize () override
 does nothing
virtual StatusCode finalize () override
 does nothing
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_chargeThreshold.
float chargeThreshold () const

Private Attributes

Gaudi::Property< float > m_chargeThreshold {this, "chargeThreshold", 1000., "charge above which hits are used for clustering"}

Detailed Description

Definition at line 30 of file AFPSiClusterBasicNearestNeighbour.h.

Constructor & Destructor Documentation

◆ AFPSiClusterBasicNearestNeighbour()

AFPSiClusterBasicNearestNeighbour::AFPSiClusterBasicNearestNeighbour ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 25 of file AFPSiClusterBasicNearestNeighbour.cxx.

28 : base_class(type, name, parent) {
29}

◆ ~AFPSiClusterBasicNearestNeighbour()

virtual AFPSiClusterBasicNearestNeighbour::~AFPSiClusterBasicNearestNeighbour ( )
inlineoverridevirtual

Definition at line 38 of file AFPSiClusterBasicNearestNeighbour.h.

38{}

Member Function Documentation

◆ chargeThreshold()

float AFPSiClusterBasicNearestNeighbour::chargeThreshold ( ) const
inline

Definition at line 50 of file AFPSiClusterBasicNearestNeighbour.h.

◆ doClustering()

StatusCode AFPSiClusterBasicNearestNeighbour::doClustering ( const std::list< const xAOD::AFPSiHit * > & hits,
std::list< AFPSiClusterBasicObj > & outputClusters ) const
overridevirtual

Creates a cluster from the neighbouring pixels, joining only two pixels with charge above m_chargeThreshold.

Definition at line 39 of file AFPSiClusterBasicNearestNeighbour.cxx.

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}
double charge(const T &p)
Definition AtlasPID.h:997
void setCharge(const double charge)
std::list< const xAOD::AFPSiHit * > & hits()
list of pixels used to form the cluster
void setVertID(const float vertID)
void setHorizID(const float horizID)
static const int nearestNeighbour
Nearest neighbour algorithm.
float depositedCharge() const
Charge deposited in the pixel.
int pixelHorizID() const
Index of the pixel along X axis in LHC coordinate system.
int pixelVertID() const
Index of the pixel along Y axis in LHC coordinate system.
AFPSiHit_v2 AFPSiHit
Definition AFPSiHit.h:12

◆ finalize()

StatusCode AFPSiClusterBasicNearestNeighbour::finalize ( )
overridevirtual

does nothing

Definition at line 35 of file AFPSiClusterBasicNearestNeighbour.cxx.

35 {
36 return StatusCode::SUCCESS;
37}

◆ initialize()

StatusCode AFPSiClusterBasicNearestNeighbour::initialize ( )
overridevirtual

does nothing

Definition at line 31 of file AFPSiClusterBasicNearestNeighbour.cxx.

31 {
32 return StatusCode::SUCCESS;
33}

Member Data Documentation

◆ m_chargeThreshold

Gaudi::Property<float> AFPSiClusterBasicNearestNeighbour::m_chargeThreshold {this, "chargeThreshold", 1000., "charge above which hits are used for clustering"}
private

Definition at line 53 of file AFPSiClusterBasicNearestNeighbour.h.

53{this, "chargeThreshold", 1000., "charge above which hits are used for clustering"};

The documentation for this class was generated from the following files: