Skip to content
Snippets Groups Projects
Commit 69248ad3 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'cache.TrkExUtils-20190205' into 'master'

TrkExUtils: Allow associating intersector-specific data with TrackSurfaceIntersection.

See merge request atlas/athena!20896
parents 3c9d9ccb bcd6870e
9 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!20896TrkExUtils: Allow associating intersector-specific data with TrackSurfaceIntersection.
......@@ -11,6 +11,7 @@
//Trk
#include "GeoPrimitives/GeoPrimitives.h"
#include <memory>
class MsgStream;
......@@ -22,19 +23,34 @@ namespace Trk {
- a global position
- a momentum direction (unit vector)
- the pathlength to go there from the starting point
We can optionally attach an additional block of data (`cache')
for the private use of a particular intersection tool.
@author Andreas.Salzburger@cern.ch
*/
class TrackSurfaceIntersection {
public:
/**Constructor*/
/**Base class for cache block.*/
class IIntersectionCache
{
public:
virtual ~IIntersectionCache() = default;
virtual std::unique_ptr<IIntersectionCache> clone() const = 0;
};
/**Constructor*/
TrackSurfaceIntersection(const Amg::Vector3D& pos, const Amg::Vector3D& dir, double path);
/**Destructor*/
virtual ~TrackSurfaceIntersection() = default;
TrackSurfaceIntersection (const TrackSurfaceIntersection& other);
TrackSurfaceIntersection& operator= (const TrackSurfaceIntersection& other) = default;
TrackSurfaceIntersection (const TrackSurfaceIntersection& other,
std::unique_ptr<IIntersectionCache> cache);
TrackSurfaceIntersection& operator= (const TrackSurfaceIntersection& other);
TrackSurfaceIntersection (TrackSurfaceIntersection&& other) = default;
TrackSurfaceIntersection& operator= (TrackSurfaceIntersection&& other) = default;
/** Method to retrieve the position of the Intersection */
const Amg::Vector3D& position() const;
......@@ -51,13 +67,16 @@ namespace Trk {
/** Method to retrieve the object serial number (needed for speed optimization) */
unsigned long long serialNumber() const;
/** Retrieve the associated cache block, if it exists. */
const IIntersectionCache* cache() const;
private:
static unsigned long long s_serialNumber;
unsigned long long m_serialNumber;
Amg::Vector3D m_position;
Amg::Vector3D m_direction;
double m_pathlength;
std::shared_ptr<IIntersectionCache> m_cache;
};
inline const Amg::Vector3D& TrackSurfaceIntersection::position() const
......@@ -81,6 +100,9 @@ namespace Trk {
inline unsigned long long TrackSurfaceIntersection::serialNumber() const
{ return m_serialNumber; }
inline const TrackSurfaceIntersection::IIntersectionCache* TrackSurfaceIntersection::cache() const
{ return m_cache.get(); }
/**Overload of << operator for both, MsgStream and std::ostream for debug output*/
MsgStream& operator << ( MsgStream& sl, const TrackSurfaceIntersection& tsfi);
std::ostream& operator << ( std::ostream& sl, const TrackSurfaceIntersection& tsfi);
......
......@@ -37,6 +37,29 @@ Trk::TrackSurfaceIntersection::TrackSurfaceIntersection(const TrackSurfaceInters
m_serialNumber = ++s_serialNumber;
}
Trk::TrackSurfaceIntersection::TrackSurfaceIntersection(const TrackSurfaceIntersection& other,
std::unique_ptr<IIntersectionCache> cache)
: m_position (other.m_position),
m_direction (other.m_direction),
m_pathlength (other.m_pathlength),
m_cache (std::move (cache))
{
m_serialNumber = ++s_serialNumber;
}
Trk::TrackSurfaceIntersection&
Trk::TrackSurfaceIntersection::operator=(const TrackSurfaceIntersection& other)
{
if (this != &other) {
m_position = other.m_position;
m_direction = other.m_direction;
m_pathlength = other.m_pathlength;
m_cache = other.m_cache->clone();
m_serialNumber = other.m_serialNumber;
}
return *this;
}
//Overload of << operator for both, MsgStream and std::ostream for debug output
MsgStream& Trk::operator << ( MsgStream& sl, const Trk::TrackSurfaceIntersection& tsfi)
{
......
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