2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 #include "CxxUtils/CachedUniquePtr.h"
7 class GeoStraightAccSection::Clockwork {
11 Clockwork():r1(NULL){};
16 void buildSmallCache();
23 double xcent[1024][14];
24 double ycent[1024][14];
25 double cosu[1024][14];
26 double sinu[1024][14];
27 double halfLength[1024][14];
35 std::unique_ptr<GeoXF::Function> transfunction[14];
36 double halfLength[14];
39 CxxUtils::CachedUniquePtrT<Rep1> r1;
40 std::unique_ptr<Rep2> r2;
42 const Rep1& getFastCache() const;
43 Rep1& getWritableFastCache();
44 Rep2& getWritableSmallCache();
47 void fillFastCache (Rep1& rep1) const;
49 Clockwork( const Clockwork &);
51 Clockwork & operator = ( const Clockwork &);
56 const GeoStraightAccSection::Clockwork::Rep1&
57 GeoStraightAccSection::Clockwork::getFastCache() const
60 auto rep = std::make_unique<Rep1>();
62 r1.set (std::move (rep));
69 GeoStraightAccSection::Clockwork::Rep1&
70 GeoStraightAccSection::Clockwork::getWritableFastCache()
72 if (r2) throw std::runtime_error("Error in GeoStraightAccSection: Illegal Modification Sequence");
74 r1.store (std::make_unique<Rep1>());
81 GeoStraightAccSection::Clockwork::Rep2&
82 GeoStraightAccSection::Clockwork::getWritableSmallCache()
84 if (r1) throw std::runtime_error("Error in GeoStraightAccSection: Illegal Modification Sequence");
85 if (!r2) buildSmallCache();
90 inline const double & GeoStraightAccSection::XCent(int stackid, int cellid) const
92 return m_c->getFastCache().xcent[stackid][cellid];
94 inline const double & GeoStraightAccSection::YCent(int stackid, int cellid) const
96 return m_c->getFastCache().ycent[stackid][cellid];
98 inline const double & GeoStraightAccSection::Sinu(int stackid, int cellid) const
100 return m_c->getFastCache().sinu[stackid][cellid];
102 inline const double & GeoStraightAccSection::Cosu(int stackid, int cellid) const
104 return m_c->getFastCache().cosu[stackid][cellid];
106 inline const double & GeoStraightAccSection::HalfLength(int stackid, int cellid) const
108 return m_c->getFastCache().halfLength[stackid][cellid];