Skip to content
Snippets Groups Projects
Commit 9da22e91 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'DistanceSolution_default_move_inline_to_icc_try_2' into 'master'

Distance  solution, move inline to .icc and use default.

See merge request atlas/athena!39328
parents 274e66a6 e276dc1b
No related branches found
No related tags found
No related merge requests found
...@@ -213,13 +213,13 @@ float SCT_SurfaceChargesGenerator::driftTime(float zhit, const SiDetectorElement ...@@ -213,13 +213,13 @@ float SCT_SurfaceChargesGenerator::driftTime(float zhit, const SiDetectorElement
ATH_MSG_ERROR("driftTime: negative argument X for log(X) " << zhit); ATH_MSG_ERROR("driftTime: negative argument X for log(X) " << zhit);
} }
return -1.0; return -1.0;
} else { } else {
// (m_biasVoltage<m_depletionVoltage) can happen with underdepleted sensors, lose charges in that volume // (m_biasVoltage<m_depletionVoltage) can happen with underdepleted sensors, lose charges in that volume
return -10.0; return -10.0;
} }
} }
float t_drift{log((depletionVoltage + biasVoltage) / denominator)}; float t_drift{std::log((depletionVoltage + biasVoltage) / denominator)};
t_drift *= thickness * thickness / (2.0 * m_siPropertiesTool->getSiProperties(hashId).holeDriftMobility() * depletionVoltage); t_drift *= thickness * thickness / (2.0 * m_siPropertiesTool->getSiProperties(hashId).holeDriftMobility() * depletionVoltage);
return t_drift; return t_drift;
} }
...@@ -236,7 +236,7 @@ float SCT_SurfaceChargesGenerator::diffusionSigma(float zhit, const SiDetectorEl ...@@ -236,7 +236,7 @@ float SCT_SurfaceChargesGenerator::diffusionSigma(float zhit, const SiDetectorEl
const float t{driftTime(zhit, element)}; // in ns const float t{driftTime(zhit, element)}; // in ns
if (t > 0.0) { if (t > 0.0) {
const float sigma{static_cast<float>(sqrt(2. * m_siPropertiesTool->getSiProperties(hashId).holeDiffusionConstant() * t))}; // in mm const float sigma{static_cast<float>(std::sqrt(2. * m_siPropertiesTool->getSiProperties(hashId).holeDiffusionConstant() * t))}; // in mm
return sigma; return sigma;
} else { } else {
return 0.0; return 0.0;
...@@ -351,7 +351,7 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element, ...@@ -351,7 +351,7 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element,
const float cPhi{static_cast<float>(endPos[SiHit::xPhi]) - xPhi}; const float cPhi{static_cast<float>(endPos[SiHit::xPhi]) - xPhi};
const float cDep{static_cast<float>(endPos[SiHit::xDep]) - xDep}; const float cDep{static_cast<float>(endPos[SiHit::xDep]) - xDep};
const float LargeStep{sqrt(cEta*cEta + cPhi*cPhi + cDep*cDep)}; const float LargeStep{std::sqrt(cEta*cEta + cPhi*cPhi + cDep*cDep)};
const int numberOfSteps{static_cast<int>(LargeStep / m_smallStepLength) + 1}; const int numberOfSteps{static_cast<int>(LargeStep / m_smallStepLength) + 1};
const float steps{static_cast<float>(m_numberOfCharges * numberOfSteps)}; const float steps{static_cast<float>(m_numberOfCharges * numberOfSteps)};
const float e1{static_cast<float>(phit.energyLoss() / steps)}; const float e1{static_cast<float>(phit.energyLoss() / steps)};
...@@ -394,7 +394,7 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element, ...@@ -394,7 +394,7 @@ void SCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* element,
const float StepX{cEta / numberOfSteps}; const float StepX{cEta / numberOfSteps};
const float StepY{cPhi / numberOfSteps}; const float StepY{cPhi / numberOfSteps};
const float StepZ{cDep / numberOfSteps}; const float StepZ{cDep / numberOfSteps};
// check the status of truth information for this SiHit // check the status of truth information for this SiHit
// some Truth information is cut for pile up events // some Truth information is cut for pile up events
const EBC_EVCOLL evColl = EBC_MAINEVCOLL; const EBC_EVCOLL evColl = EBC_MAINEVCOLL;
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
#ifndef TRKSURFACES_DISTANCESOLUTION_H #ifndef TRKSURFACES_DISTANCESOLUTION_H
#define TRKSURFACES_DISTANCESOLUTION_H #define TRKSURFACES_DISTANCESOLUTION_H
// STD #include <cmath>
#include <iostream>
#include <math.h>
namespace Trk { namespace Trk {
...@@ -26,14 +24,19 @@ namespace Trk { ...@@ -26,14 +24,19 @@ namespace Trk {
class DistanceSolution class DistanceSolution
{ {
public: public:
/**Default Constructor*/ DistanceSolution() = default;
DistanceSolution(); DistanceSolution(const DistanceSolution&) = default;
DistanceSolution(DistanceSolution&&) = default;
/**Constructor*/ DistanceSolution& operator=(const DistanceSolution&) = default;
DistanceSolution(int num, double current = 0., bool signedDist = false, double first = 0., double second = 0.); DistanceSolution& operator=(DistanceSolution&&) = default;
~DistanceSolution() = default;
/**Destructor*/
virtual ~DistanceSolution() = default; /**Constructor*/
DistanceSolution(int num,
double current = 0.,
bool signedDist = false,
double first = 0.,
double second = 0.);
// methods to access solutions // methods to access solutions
/** Number of intersection solutions*/ /** Number of intersection solutions*/
...@@ -42,7 +45,8 @@ public: ...@@ -42,7 +45,8 @@ public:
/** Distance to first intersection solution along direction*/ /** Distance to first intersection solution along direction*/
double first() const; double first() const;
/** Distance to second intersection solution along direction (for a cylinder surface)*/ /** Distance to second intersection solution along direction (for a cylinder
* surface)*/
double second() const; double second() const;
/** Absolute Distance to closest solution */ /** Absolute Distance to closest solution */
...@@ -51,14 +55,15 @@ public: ...@@ -51,14 +55,15 @@ public:
/** Distance to point of closest approach along direction*/ /** Distance to point of closest approach along direction*/
double toPointOfClosestApproach() const; double toPointOfClosestApproach() const;
/** Current distance to surface (spatial), signed (along/opposite to surface normal) if input argument true (absolute /** Current distance to surface (spatial), signed (along/opposite to surface
* value by default)*/ * normal) if input argument true (absolute value by default)*/
double currentDistance(bool signedDist = false) const; double currentDistance(bool signedDist = false) const;
/** This method indicates availability of signed current distance (false for Perigee and StraighLineSurface) */ /** This method indicates availability of signed current distance (false for
* Perigee and StraighLineSurface) */
bool signedDistance() const; bool signedDistance() const;
protected: private:
int m_num; int m_num;
double m_first; double m_first;
double m_second; double m_second;
...@@ -66,54 +71,7 @@ protected: ...@@ -66,54 +71,7 @@ protected:
bool m_signedDist; bool m_signedDist;
}; };
inline int
DistanceSolution::numberOfSolutions() const
{
return m_num;
}
inline double
DistanceSolution::first() const
{
return m_first;
}
inline double
DistanceSolution::second() const
{
return m_second;
}
inline double
DistanceSolution::absClosest() const
{
if (m_num > 1)
return (m_first * m_first < m_second * m_second) ? fabs(m_first) : fabs(m_second);
else
return fabs(m_first);
}
inline double
DistanceSolution::toPointOfClosestApproach() const
{
return m_first;
}
inline double
DistanceSolution::currentDistance(bool signedDist) const
{
if (signedDist)
return m_current;
else
return fabs(m_current);
}
inline bool
DistanceSolution::signedDistance() const
{
return m_signedDist;
}
} // end of namespace } // end of namespace
#include "TrkSurfaces/DistanceSolution.icc"
#endif // TRKSURFACES_DISTANCESOLUTION_H #endif // TRKSURFACES_DISTANCESOLUTION_H
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
namespace Trk {
inline DistanceSolution::DistanceSolution(int num,
double current,
bool signedDist,
double first,
double second)
: m_num(num)
, m_first(first)
, m_second(second)
, m_current(current)
, m_signedDist(signedDist)
{}
inline int
DistanceSolution::numberOfSolutions() const
{
return m_num;
}
inline double
DistanceSolution::first() const
{
return m_first;
}
inline double
DistanceSolution::second() const
{
return m_second;
}
inline double
DistanceSolution::absClosest() const
{
if (m_num > 1) {
return (m_first * m_first < m_second * m_second) ? std::abs(m_first)
: std::abs(m_second);
} else {
return std::abs(m_first);
}
}
inline double
DistanceSolution::toPointOfClosestApproach() const
{
return m_first;
}
inline double
DistanceSolution::currentDistance(bool signedDist) const
{
if (signedDist) {
return m_current;
} else {
return std::abs(m_current);
}
}
inline bool
DistanceSolution::signedDistance() const
{
return m_signedDist;
}
} // end of namespace
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// DistanceSolution.cxx, (c) ATLAS Detector Software
///////////////////////////////////////////////////////////////////
// Trk
#include "TrkSurfaces/DistanceSolution.h"
// default constructor
Trk::DistanceSolution::DistanceSolution()
: m_num()
, m_first()
, m_second()
, m_current()
, m_signedDist()
{}
// constructor
Trk::DistanceSolution::DistanceSolution(int num, double current, bool signedDist, double first, double second)
: m_num(num)
, m_first(first)
, m_second(second)
, m_current(current)
, m_signedDist(signedDist)
{}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment