Commit c17ab6af authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'fix_getLocalPosition' into 'master'

Fix function Detector::getLocalPosition (follow-up on MR !116)

Closes #74

See merge request !168
parents a384643b 4233e0ba
Pipeline #1126470 passed with stages
in 23 minutes and 57 seconds
......@@ -291,9 +291,10 @@ bool Detector::hasIntercept(const Track* track, double pixelTolerance) const {
double column = this->getColumn(localIntercept);
// Check if the row and column are outside of the chip
// Chip reaches from -0.5 to nPixels-0.5
bool intercept = true;
if(row < pixelTolerance || row > (this->m_nPixels.Y() - pixelTolerance) || column < pixelTolerance ||
column > (this->m_nPixels.X() - pixelTolerance))
if(row < pixelTolerance - 0.5 || row > (this->m_nPixels.Y() - pixelTolerance - 0.5) || column < pixelTolerance - 0.5 ||
column > (this->m_nPixels.X() - pixelTolerance - 0.5))
intercept = false;
return intercept;
......@@ -326,10 +327,12 @@ bool Detector::hitMasked(Track* track, int tolerance) const {
// Functions to get row and column from local position
double Detector::getRow(const PositionVector3D<Cartesian3D<double>> localPosition) const {
// (1-m_nPixelsX%2)/2. --> add 1/2 pixel pitch if even number of rows
double row = localPosition.Y() / m_pitch.Y() + static_cast<double>(m_nPixels.Y()) / 2. + (1 - m_nPixels.Y() % 2) / 2.;
return row;
}
double Detector::getColumn(const PositionVector3D<Cartesian3D<double>> localPosition) const {
// (1-m_nPixelsX%2)/2. --> add 1/2 pixel pitch if even number of columns
double column = localPosition.X() / m_pitch.X() + static_cast<double>(m_nPixels.X()) / 2. + (1 - m_nPixels.X() % 2) / 2.;
return column;
}
......@@ -338,7 +341,7 @@ double Detector::getColumn(const PositionVector3D<Cartesian3D<double>> localPosi
PositionVector3D<Cartesian3D<double>> Detector::getLocalPosition(double column, double row) const {
return PositionVector3D<Cartesian3D<double>>(
m_pitch.X() * (column - (m_nPixels.X()) / 2.), m_pitch.Y() * (row - (m_nPixels.Y()) / 2.), 0.);
m_pitch.X() * (column - m_nPixels.X() / 2), m_pitch.Y() * (row - m_nPixels.Y() / 2), 0.);
}
// Function to get in-pixel position
......
......@@ -309,14 +309,17 @@ StatusCode AnalysisCLICpix::run(std::shared_ptr<Clipboard> clipboard) {
// Cut on the track intercept - this makes sure that it actually went
// through the chip
if(chipInterceptCol < 0.5 || chipInterceptRow < 0.5 || chipInterceptCol > (m_detector->nPixels().X() - 0.5) ||
chipInterceptRow > (m_detector->nPixels().Y() - 0.5))
if(!m_detector->hasIntercept(track, 0.5)) {
LOG(DEBUG) << " - track outside DUT area";
continue;
}
// Check if the hit is near a masked pixel
bool hitMasked = checkMasked(chipInterceptRow, chipInterceptCol);
if(hitMasked)
if(hitMasked) {
LOG(DEBUG) << " - hit is masked";
continue;
}
// Check there are no other tracks nearby
bool proximityCut = checkProximity(track, tracks);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment