|
ATLAS Offline Software
|
Tool for reconstructing AFPTrack parameters from track candidates.
More...
#include <AFPSiDLinRegTool.h>
|
Gaudi::Property< std::string > | m_tracksContainerName {this, "tracksContainerName", "AFPTrackContainer", "Name of the container in which tracks are saved"} |
| Name of the xAOD container to which tracks will be saved; actual saving is done in AFPSIDLocRecoTool. More...
|
|
Gaudi::Property< int > | m_stationID {this, "stationID", 0, "ID number of station for which tracks should be reconstructed"} |
| AFP station ID for which tracks will be reconstructed. More...
|
|
Gaudi::Property< double > | m_allowedDistanceBetweenClustersInTrack {this, "allowedDistanceBetweenClustersInTrack", 0.5, "Maximum allowed distance between clusters to be considered coming from the same proton"} |
| Maximum allowed distance between clusters to be considered coming from the same proton. More...
|
|
Gaudi::Property< std::string > | m_trackSelection {this, "trackSelection", "Medium", "Track selection, allowed values are \"Loose\" (accept all track candidates), \"Medium\" (accept only tracks with clusters in at least #m_minimalNumberOfPlanesInTrack planes), or \"Tight\" (reject all with more than a single cluster per plane and less than #m_minimalNumberOfPlanesInTrack planes)"} |
| Track selection type: More...
|
|
Gaudi::Property< unsigned int > | m_minimalNumberOfPlanesInTrack {this, "minimalNumberOfPlanesInTrack", 2, "Minimal numer of planes required for track candidate"} |
| Minimal numer of planes required for track candidate. More...
|
|
std::function< bool(const std::vector< const xAOD::AFPSiHitsCluster * > &)> | m_selectionFunction |
|
SG::ReadHandleKey< xAOD::AFPSiHitsClusterContainer > | m_hitsClusterContainerKey {this, "AFPSiHitsClusterContainerKey", "AFPSiHitsClusterContainer", "Name of the container with clusters of hits from which tracks are to be reconstructed"} |
| Name of the xAOD container with clusters to be used in track reconstruction. More...
|
|
Tool for reconstructing AFPTrack parameters from track candidates.
Definition at line 40 of file AFPSiDLinRegTool.h.
◆ AFPSiDLinRegTool()
AFPSiDLinRegTool::AFPSiDLinRegTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~AFPSiDLinRegTool()
virtual AFPSiDLinRegTool::~AFPSiDLinRegTool |
( |
| ) |
|
|
inlineoverridevirtual |
◆ areNeighbours()
◆ findClusterAroundElement()
Looks for cluster around init cluster.
- Loops over clusters in the list toJoin
- Checks if those clusters are neighbours of init cluster
- Adds neighbouring cluster to cluster vector and removes them from the list
- Returns
- Vector of clusters - track candiate
Definition at line 93 of file AFPSiDLinRegTool.cxx.
96 std::vector<const xAOD::AFPSiHitsCluster*>
track;
99 std::vector<const xAOD::AFPSiHitsCluster*> newNeighbours;
103 newNeighbours.clear();
104 for (
auto&&
b : toJoin) {
111 newNeighbours.push_back(
b);
117 for (
auto&
t : newNeighbours) {
121 }
while (!newNeighbours.empty());
◆ initialize()
StatusCode AFPSiDLinRegTool::initialize |
( |
| ) |
|
|
overridevirtual |
Read parameters from job options and print tool configuration.
Definition at line 23 of file AFPSiDLinRegTool.cxx.
27 m_selectionFunction = [](
const std::vector<const xAOD::AFPSiHitsCluster*>&) {
return true; };
32 std::vector<int> plane{0, 0, 0, 0};
34 for (
auto&& cluster :
t) {
35 const int p = cluster->pixelLayerID();
39 auto HasAnyClusters = [](
int n) {
return n > 0; };
47 std::vector<int> plane{0, 0, 0, 0};
49 for (
auto&& cluster :
t) {
50 const int p = cluster->pixelLayerID();
54 auto HasMultipleClusters = [](
int n) {
return n > 1; };
56 if (std::any_of(plane.begin(), plane.end(), HasMultipleClusters)) {
return false; }
67 return StatusCode::FAILURE;
72 return StatusCode::SUCCESS;
◆ linearRegression()
std::pair< double, double > AFPSiDLinRegTool::linearRegression |
( |
const std::vector< std::pair< double, double >> & |
YX | ) |
const |
|
private |
Simple linear regression Used to calculate track postions and slopes.
Definition at line 127 of file AFPSiDLinRegTool.cxx.
131 double meanx = 0, meany = 0;
132 for (
const auto& [
y,
x] : YX) {
140 for (
const auto& [
y,
x] : YX) {
141 const double dy =
y - meany;
142 const double dx =
x - meanx;
144 numerator +=
dx *
dy;
149 const double position = meany - slope * meanx;
151 return {position, slope};
◆ outputContainerName()
const std::string& AFPSiDLinRegTool::outputContainerName |
( |
| ) |
const |
|
inlineoverride |
◆ reconstructTracks()
StatusCode AFPSiDLinRegTool::reconstructTracks |
( |
std::unique_ptr< xAOD::AFPTrackContainer > & |
outputContainer, |
|
|
const EventContext & |
ctx |
|
) |
| const |
|
override |
Reconstructs tracks properties from track candidates.
- Loops over all tracks candidates
- Calcutates and sets track properties
Definition at line 155 of file AFPSiDLinRegTool.cxx.
161 return StatusCode::SUCCESS;
165 std::list<const xAOD::AFPSiHitsCluster*> clustersInStation;
167 [
this](
auto cluster) { return cluster->stationID() == m_stationID; });
173 while (!clustersInStation.empty())
176 const auto *
const initialCluster = clustersInStation.front();
177 clustersInStation.pop_front();
184 ATH_MSG_DEBUG(
"track candidate of size " << clusterOfClusters.size() <<
" did not pass selection.");
188 auto *
track = outputContainer->
push_back(std::make_unique<xAOD::AFPTrack>());
194 for (
const auto *
const cluster : clusterOfClusters) {
197 track->addCluster(clusterLink);
200 const int nClusters =
track->clusters().size();
204 track->setNClusters(nClusters);
220 if (nClusters == 1) {
221 x = (*(
track->clusters().at(0)))->xLocal();
222 y = (*(
track->clusters().at(0)))->yLocal();
226 std::vector<std::pair<double, double>> XZ;
227 std::vector<std::pair<double, double>> YZ;
229 for (
int i = 0;
i < nClusters;
i++) {
239 std::tie(
x, xSlope) = linregx;
240 std::tie(
y, ySlope) = linregy;
242 for (
int i = 0;
i < nClusters;
i++) {
245 const double z = cluster->
zLocal();
249 const double dx = cluster->
xLocal() - (
x + xSlope *
z);
250 const double dy = cluster->
yLocal() - (
y + ySlope *
z);
260 track->setXSlope(xSlope);
262 track->setYSlope(ySlope);
263 track->setZLocal(0.);
267 std::vector<int> clustersPlane{0, 0, 0, 0};
268 for (
const auto&
cl :
track->clusters()) {
269 ++clustersPlane[(*cl)->pixelLayerID()];
271 auto HasNoClusters = [](
int n) {
return n == 0; };
272 track->setNHoles(std::count_if(clustersPlane.begin(), clustersPlane.end(), HasNoClusters));
276 <<
", y: " <<
track->yLocal() <<
", sx: " <<
track->xSlope()
277 <<
", sy: " <<
track->ySlope() <<
", chi2: " <<
track->chi2());
278 for (
auto&& cluster :
track->clusters())
280 ATH_MSG_DEBUG(
'\t' << (*cluster)->xLocal() <<
" " << (*cluster)->yLocal() <<
" " << (*cluster)->zLocal());
284 return StatusCode::SUCCESS;
◆ m_allowedDistanceBetweenClustersInTrack
Gaudi::Property<double> AFPSiDLinRegTool::m_allowedDistanceBetweenClustersInTrack {this, "allowedDistanceBetweenClustersInTrack", 0.5, "Maximum allowed distance between clusters to be considered coming from the same proton"} |
|
private |
Maximum allowed distance between clusters to be considered coming from the same proton.
Definition at line 70 of file AFPSiDLinRegTool.h.
◆ m_hitsClusterContainerKey
Name of the xAOD container with clusters to be used in track reconstruction.
Definition at line 85 of file AFPSiDLinRegTool.h.
◆ m_minimalNumberOfPlanesInTrack
Gaudi::Property<unsigned int> AFPSiDLinRegTool::m_minimalNumberOfPlanesInTrack {this, "minimalNumberOfPlanesInTrack", 2, "Minimal numer of planes required for track candidate"} |
|
private |
Minimal numer of planes required for track candidate.
Definition at line 79 of file AFPSiDLinRegTool.h.
◆ m_selectionFunction
◆ m_stationID
Gaudi::Property<int> AFPSiDLinRegTool::m_stationID {this, "stationID", 0, "ID number of station for which tracks should be reconstructed"} |
|
private |
◆ m_tracksContainerName
Gaudi::Property<std::string> AFPSiDLinRegTool::m_tracksContainerName {this, "tracksContainerName", "AFPTrackContainer", "Name of the container in which tracks are saved"} |
|
private |
Name of the xAOD container to which tracks will be saved; actual saving is done in AFPSIDLocRecoTool.
Definition at line 64 of file AFPSiDLinRegTool.h.
◆ m_trackSelection
Gaudi::Property<std::string> AFPSiDLinRegTool::m_trackSelection {this, "trackSelection", "Medium", "Track selection, allowed values are \"Loose\" (accept all track candidates), \"Medium\" (accept only tracks with clusters in at least #m_minimalNumberOfPlanesInTrack planes), or \"Tight\" (reject all with more than a single cluster per plane and less than #m_minimalNumberOfPlanesInTrack planes)"} |
|
private |
The documentation for this class was generated from the following files:
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
std::vector< DMTest::B > xa
double chi2(TH1 *h0, TH1 *h1)
Out copy_if(In first, const In &last, Out res, const Pred &p)
float xLocal() const
Cluster position along X axis in station local coordinate system.
#define CHECK(...)
Evaluate an expression and check for errors.
ElementLink implementation for ROOT usage.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
def init(v_theApp, v_rootStream=None)
void pop_back()
Remove the last element from the collection.
float xLocalErr() const
Uncertainty of cluster position along X axis in station local coordinate system.
Class representing a cluster of AFP pixel hits.
float yLocal() const
Cluster position along Y axis in station local coordinate system.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
float zLocal() const
Cluster position along Z axis in station local coordinate system.
static constexpr int linReg
linear regression algorithm id=1
float yLocalErr() const
Uncertainty of cluster position along Y axis in station local coordinate system.