Project
Loading...
Searching...
No Matches
HitFinder.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#include "MIDBase/HitFinder.h"
18
19#include <cmath>
22
23namespace o2
24{
25namespace mid
26{
27//______________________________________________________________________________
29 : mGeometryTransformer(geoTrans),
30 mTanTheta(std::tan((90. - geoparams::BeamAngle) * std::atan(1) / 45.)),
31 mCosTheta(std::cos(geoparams::BeamAngle * std::atan(1) / 45.))
32{
34}
35
36//______________________________________________________________________________
37math_utils::Point3D<double> HitFinder::getIntersectInDefaultPlane(const Track& track, int chamber) const
38{
39 double defaultZ = geoparams::DefaultChamberZ[chamber];
40 double linePar = ((track.getPositionZ() - defaultZ) * mTanTheta - track.getPositionY()) /
41 (track.getDirectionY() - track.getDirectionZ() * mTanTheta);
42 math_utils::Point3D<double> point;
43 point.SetX(track.getPositionX() + linePar * track.getDirectionX());
44 point.SetY(track.getPositionY() + linePar * track.getDirectionY());
45 point.SetZ(track.getPositionZ() + linePar * track.getDirectionZ());
46 return point;
47}
48
49//______________________________________________________________________________
50Cluster HitFinder::getIntersect(const Track& track, int deId) const
51{
52 math_utils::Point3D<float> localPoint = mGeometryTransformer.globalToLocal(deId, track.getPositionX(), track.getPositionY(), track.getPositionZ());
53
54 math_utils::Vector3D<float> localDirection = mGeometryTransformer.globalToLocal(deId, math_utils::Vector3D<float>(track.getDirectionX(), track.getDirectionY(), track.getDirectionZ()));
55 Track localTrack;
56 localTrack.setPosition(localPoint.x(), localPoint.y(), localPoint.z());
57 localTrack.setDirection(localDirection.x() / localDirection.z(), localDirection.y() / localDirection.z(), 1.);
58
59 localTrack.propagateToZ(0);
60 Cluster cluster;
61 cluster.deId = deId;
62 cluster.xCoor = localTrack.getPositionX();
63 cluster.yCoor = localTrack.getPositionY();
64 return cluster;
65}
66
67//______________________________________________________________________________
68int HitFinder::guessRPC(double yPos, int chamber) const
69{
70 return (int)(yPos / (2. * geoparams::getRPCHalfHeight(chamber)) + 4.5);
71}
72
73//______________________________________________________________________________
74std::vector<int> HitFinder::getFiredDE(const Track& track, int chamber) const
75{
76 std::vector<int> deIdList;
77 math_utils::Point3D<double> defPos = getIntersectInDefaultPlane(track, chamber);
78 double xPos = defPos.x();
79 double xErr = std::sqrt(track.getCovarianceParameter(Track::CovarianceParamIndex::VarX));
80 double yPos = defPos.y() / mCosTheta;
81 double yErr = std::sqrt(track.getCovarianceParameter(Track::CovarianceParamIndex::VarY));
82 double positions[3] = {yPos, yPos - yErr, yPos + yErr};
83 int centerRpc = -1;
84 for (int ipos = 0; ipos < 3; ++ipos) {
85 int rpc = guessRPC(positions[ipos], chamber);
86 if (rpc < 0 || rpc > 8) {
87 continue;
88 }
89 if (ipos == 0) {
90 centerRpc = rpc;
91 } else if (rpc == centerRpc) {
92 continue;
93 }
94 if (xPos > 0) {
95 deIdList.push_back(detparams::getDEId(true, chamber, rpc));
96 if (xPos - xErr < 0) {
97 deIdList.push_back(detparams::getDEId(false, chamber, rpc));
98 }
99 } else {
100 deIdList.push_back(detparams::getDEId(false, chamber, rpc));
101 if (xPos + xErr > 0) {
102 deIdList.push_back(detparams::getDEId(true, chamber, rpc));
103 }
104 }
105 }
106
107 return deIdList;
108}
109
110//______________________________________________________________________________
111std::vector<Cluster> HitFinder::getLocalPositions(const Track& track, int chamber, bool withUncertainties) const
112{
113 std::vector<int> deIdList = getFiredDE(track, chamber);
114
115 std::vector<Cluster> points;
116 for (auto& deId : deIdList) {
117 Cluster cl = getIntersect(track, deId);
118 int rpc = detparams::getRPCLine(deId);
119 double hl = geoparams::getRPCHalfLength(chamber, rpc);
120 double hh = geoparams::getRPCHalfHeight(chamber);
121 if (cl.xCoor < -hl || cl.xCoor > hl) {
122 continue;
123 }
124 if (cl.yCoor < -hh || cl.yCoor > hh) {
125 continue;
126 }
127 if (withUncertainties) {
128 addUncertainty(cl, track);
129 }
130 points.emplace_back(cl);
131 }
132
133 return points;
134}
135
136//______________________________________________________________________________
137void HitFinder::addUncertainty(Cluster& cl, Track track) const
138{
139 auto globalPos = mGeometryTransformer.localToGlobal(cl.deId, cl.xCoor, cl.yCoor);
140 track.propagateToZ(globalPos.z());
141 cl.xErr = std::sqrt(track.getCovarianceParameter(Track::CovarianceParamIndex::VarX));
142 cl.yErr = std::sqrt(track.getCovarianceParameter(Track::CovarianceParamIndex::VarY));
143}
144
145} // namespace mid
146} // namespace o2
Useful detector parameters for MID.
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in tan(phi) dependence of tracklet error due to radial misalignment(centered at 0 angle)") AddOptionRTC(maxChi2Red
Useful geometrical parameters for MID.
Hit finder for MID.
HMPID cluster implementation.
Definition Cluster.h:27
math_utils::Point3D< T > localToGlobal(int deId, const math_utils::Point3D< T > &position) const
math_utils::Point3D< T > globalToLocal(int deId, const math_utils::Point3D< T > &position) const
std::vector< int > getFiredDE(const Track &track, int chamber) const
Definition HitFinder.cxx:74
std::vector< Cluster > getLocalPositions(const Track &track, int chamber, bool withUncertainties=false) const
HitFinder(const GeometryTransformer &geoTrans)
Definition HitFinder.cxx:28
This class defines the MID track.
Definition Track.h:30
@ VarX
Variance on X position.
@ VarY
Variance on Y position.
int getDEId(bool isRight, int chamber, int rpc)
constexpr std::array< const double, 4 > DefaultChamberZ
Array of default z position of the chamber.
double getRPCHalfHeight(int chamber)
double getRPCHalfLength(int chamber, int rpc)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
cluster structure for MID
Definition Cluster.h:30
float yErr
Cluster resolution along y.
Definition Cluster.h:35
float yCoor
y coordinate
Definition Cluster.h:32
float xErr
Cluster resolution along x.
Definition Cluster.h:34
float xCoor
x coordinate
Definition Cluster.h:31
uint8_t deId
Detection element ID.
Definition Cluster.h:36