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

#include <AFPSiClusterAllNeighbours.h>

Inheritance diagram for AFPSiClusterAllNeighbours:
Collaboration diagram for AFPSiClusterAllNeighbours:

Public Member Functions

 AFPSiClusterAllNeighbours (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~AFPSiClusterAllNeighbours () 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"}
Gaudi::Property< std::string > m_neighbourhoodType {this, "neighbourhoodType", "X", "type of hit neighbourhood in cluster, either X (only long-edge) or XY (both long- and short-edge)"}
bool m_doOnlyHorz = false

Detailed Description

Definition at line 31 of file AFPSiClusterAllNeighbours.h.

Constructor & Destructor Documentation

◆ AFPSiClusterAllNeighbours()

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

Definition at line 25 of file AFPSiClusterAllNeighbours.cxx.

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

◆ ~AFPSiClusterAllNeighbours()

virtual AFPSiClusterAllNeighbours::~AFPSiClusterAllNeighbours ( )
inlineoverridevirtual

Definition at line 39 of file AFPSiClusterAllNeighbours.h.

39{}

Member Function Documentation

◆ chargeThreshold()

float AFPSiClusterAllNeighbours::chargeThreshold ( ) const
inline

Definition at line 51 of file AFPSiClusterAllNeighbours.h.

51{return m_chargeThreshold;}
Gaudi::Property< float > m_chargeThreshold

◆ doClustering()

StatusCode AFPSiClusterAllNeighbours::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 48 of file AFPSiClusterAllNeighbours.cxx.

49{
50 std::list<const xAOD::AFPSiHit*> hitsAboveThreshold;
51
52 // select only hits above charge threshold
53 for (const xAOD::AFPSiHit* theHit : hits)
54 if (theHit->depositedCharge() > m_chargeThreshold)
55 hitsAboveThreshold.push_back(theHit);
56
57 while (!hitsAboveThreshold.empty())
58 {
59 // add the first hit to a new proto-cluster
60 std::list<const xAOD::AFPSiHit*> currentProtoCluster{hitsAboveThreshold.front()};
61 // and remove the hit from the list
62 hitsAboveThreshold.pop_front();
63
64 // for each hit in the growing list of hits in the current proto-cluster
65 for(const xAOD::AFPSiHit* currHit : currentProtoCluster)
66 {
67 // loop over remaining hits
68 for(std::list<const xAOD::AFPSiHit*>::iterator remHit=hitsAboveThreshold.begin();remHit!=hitsAboveThreshold.end();)
69 {
70 if(abs(currHit->pixelVertID()-(*remHit)->pixelVertID())<=1 && abs(currHit->pixelHorizID()-(*remHit)->pixelHorizID())<=1)
71 {
72 if(m_doOnlyHorz && currHit->pixelVertID()!=(*remHit)->pixelVertID())
73 {
74 ++remHit;
75 }
76 else
77 {
78 // these hits are neighbours
79 currentProtoCluster.push_back(*remHit);
80 hitsAboveThreshold.erase(remHit++); // move iterator first, then erase the element
81 }
82 }
83 else
84 {
85 ++remHit;
86 }
87 }
88 // end loop over remaining hits, all neighbours of the current hit are added to currentProtoCluster
89 // let's continue with the next hit in currentProtoCluster, possible the one that has been just added
90 }
91 // reach end of currentProtoCluster, no more hits to be added
92
93 // calculate positions on plane and save the cluster
94 outputClusters.emplace_back(0,0,0,xAOD::AFPClusterAlgID::allNeighbours);
95 AFPSiClusterBasicObj& newCluster = outputClusters.back();
96 double horizID = 0.;
97 double vertID = 0.;
98 double charge = 0.;
99 for (const xAOD::AFPSiHit* currHit : currentProtoCluster)
100 {
101 charge += currHit->depositedCharge();
102 horizID += currHit->pixelHorizID() * currHit->depositedCharge();
103 vertID += currHit->pixelVertID() * currHit->depositedCharge();
104
105 newCluster.hits().push_back(currHit);
106 }
107
108 newCluster.setHorizID(horizID/charge);
109 newCluster.setVertID(vertID/charge);
110 newCluster.setCharge(charge);
111 }
112
113
114 return StatusCode::SUCCESS;
115}
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 allNeighbours
All neighbours algorithm.
AFPSiHit_v2 AFPSiHit
Definition AFPSiHit.h:12

◆ finalize()

StatusCode AFPSiClusterAllNeighbours::finalize ( )
overridevirtual

does nothing

Definition at line 44 of file AFPSiClusterAllNeighbours.cxx.

44 {
45 return StatusCode::SUCCESS;
46}

◆ initialize()

StatusCode AFPSiClusterAllNeighbours::initialize ( )
overridevirtual

does nothing

Definition at line 31 of file AFPSiClusterAllNeighbours.cxx.

32{
34 else if(m_neighbourhoodType=="xy" || m_neighbourhoodType=="XY") m_doOnlyHorz=false;
35 else
36 {
37 ATH_MSG_ERROR("neighbourhoodType is "<<m_neighbourhoodType<<" but allowed values are only \"X\" (only long-edge) or \"XY\" (both long- and short-edge); will abort");
38 return StatusCode::FAILURE;
39 }
40
41 return StatusCode::SUCCESS;
42}
#define ATH_MSG_ERROR(x)
Gaudi::Property< std::string > m_neighbourhoodType

Member Data Documentation

◆ m_chargeThreshold

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

Definition at line 54 of file AFPSiClusterAllNeighbours.h.

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

◆ m_doOnlyHorz

bool AFPSiClusterAllNeighbours::m_doOnlyHorz = false
private

Definition at line 58 of file AFPSiClusterAllNeighbours.h.

◆ m_neighbourhoodType

Gaudi::Property<std::string> AFPSiClusterAllNeighbours::m_neighbourhoodType {this, "neighbourhoodType", "X", "type of hit neighbourhood in cluster, either X (only long-edge) or XY (both long- and short-edge)"}
private

Definition at line 56 of file AFPSiClusterAllNeighbours.h.

56{this, "neighbourhoodType", "X", "type of hit neighbourhood in cluster, either X (only long-edge) or XY (both long- and short-edge)"};

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