|
ATLAS Offline Software
|
Go to the documentation of this file.
60 #ifndef TRTConditionsData_NestedContainer_h
61 #define TRTConditionsData_NestedContainer_h
69 #include "GaudiKernel/MsgStream.h"
78 template <
class Daughter,
class T,
class Trait>
84 static const T&
get(
const Daughter&
d,
const ExpandedIdentifier&
id ,
size_t& resolvelevel) {
return d.get(
id,resolvelevel) ; }
86 static const T&
get(
const Daughter&
d) {
return d.get() ; }
90 static bool empty(Daughter&
d) {
return d.daughters().empty() ; }
94 static void clear(Daughter&
d) {
d.clear() ; } ;
96 static void print(
const Daughter&
d) {
d.print() ; }
98 static void getall(
const Daughter&
d, std::vector< std::pair<ExpandedIdentifier, const T*> >&
entries) {
103 static void copy(Daughter&
out,
const Daughter& in) {
out = in ; }
105 static size_t footprint(
const Daughter&
d) {
return d.footprint() ; }
107 static void crunch(Daughter&
d) {
return d.crunch() ; }
109 static bool isequal(
const Daughter& lhs,
const Daughter& rhs) {
return lhs==rhs ; }
111 static size_t numObjects(
const Daughter&
d) {
return d.numObjects() ; }
118 template <
class T,
class Trait>
123 static const T&
get(
const T&
d) {
return d ; }
125 static bool empty(T&) {
return true ; }
129 static void getall(
const T&
d, std::vector< std::pair<ExpandedIdentifier, const T*> >&
entries) {
130 if(Trait::isvalid(
d) ) {
132 entries.push_back(std::pair<ExpandedIdentifier, const T*>(
id,&
d)) ;
137 static size_t footprint(
const T&
d) {
return Trait::footprint(
d) ; }
139 static bool isequal(
const T& lhs,
const T& rhs) {
return Trait::isequal(lhs,rhs) ; }
140 static size_t numObjects(
const T&
d) {
return Trait::isvalid(
d) ? 1 : 0 ; }
149 template <
int NestingLevel,
class Daughter,
class T,
class Trait>
192 if( NestingLevel ==
id.
level() ) {
196 unsigned int thisindex =
id.index(NestingLevel+1) ;
206 if( NestingLevel <
id.
level() ) {
207 unsigned int thisindex =
id.index(NestingLevel+1) ;
211 if( Trait::isvalid(rc) )
return rc ;
219 if( NestingLevel <
id.
level() ) {
220 unsigned int thisindex =
id.index(NestingLevel+1) ;
223 if( Trait::isvalid(rc) )
return rc ;
226 resolvelevel = NestingLevel ;
249 unsigned int thisindex =
id.index(NestingLevel+1) ;
299 size_t firstvaliddaughter(0);
300 bool allequal(
true) ;
301 for(
size_t idau=0; idau<
m_daughters.size() && allequal; ++idau) {
306 if( firstvaliddaughter==0 ) firstvaliddaughter = idau ;
331 for(
int i=0;
i<NestingLevel; ++
i)
337 std::cout <<
"level = " <<
id.name(NestingLevel) <<
" (" << NestingLevel <<
")" << std::endl ;
340 std::cout <<
"daughter " <<
i << std::endl ;
346 typedef std::vector< std::pair<ExpandedIdentifier, const T*> >
FlatContainer ;
349 for(
unsigned int idau = 0; idau<
m_daughters.size(); ++idau) {
354 for(
unsigned int j=0; j< dauentries.size(); ++j )
355 dauentries[j].
first.index(NestingLevel+1) = idau ;
357 entries.insert(
entries.end(),dauentries.begin(),dauentries.end()) ;
362 entries.push_back( std::pair<ExpandedIdentifier, const T*>(
id,&
m_default)) ;
370 template <
int NestingLevel,
class T,
class Trait>
372 :
public NestedContainerBase<NestingLevel, NestedContainer<NestingLevel+1,T,Trait>, T, Trait>
378 template <
class T,
class Trait>
JetConstituentVector::iterator iterator
static size_t footprint(const_pointer x)
static void clear(Daughter &d, const ExpandedIdentifier &id)
clear container for given id
std::remove_pointer_t< pointer > base_type
T value_type
Type of atomic element.
static void crunch(Daughter &d)
compress daugther size
singleton-like access to IMessageSvc via open function and helper
size_t numObjects() const
return the total number of valid calibration objects
static const T & get(const T &d, const ExpandedIdentifier &, size_t &)
static bool empty(Daughter &d)
empty daughter container
static bool isequal(const_pointer lhs, const_pointer rhs)
static bool isequal(const T &lhs, const T &rhs)
static void copy(T &out, const T &in)
void set(const ExpandedIdentifier &id, const T &t)
set a value.
static const T & get(const Daughter &d, const ExpandedIdentifier &id)
get value for given id
static void set(Daughter &d, const ExpandedIdentifier &id, const T &t)
set value for given id
DaughterContainer m_daughters
Container of Daughters.
const base_type * const_pointer
std::vector< std::pair< ExpandedIdentifier, const T * > > FlatContainer
fill vector with all entries in the container. needed to dump to Peter's flat file format
static void print(const Daughter &d)
print daugther info
static const T & get(const Daughter &d)
get default for daughter container
void set(const T &t)
set the default value
static void clear(Daughter &d)
clear container
static void getall(const T &d, std::vector< std::pair< ExpandedIdentifier, const T * > > &entries)
const T & get(const ExpandedIdentifier &id) const
get a value.
bool operator==(const T &rhs) const
another equality operator, used for compressing
static void copy(pointer &out, const_pointer in)
static bool isvalid(const_pointer x)
static void print(const T &d)
void printindent() const
some IO for debugging
static const T & get(const T &d, const ExpandedIdentifier &)
static size_t numObjects(const T &d)
const DaughterContainer & daughters() const
return the vector of daughters
static pointer initialvalue()
static void set(T &d, const ExpandedIdentifier &, const T &t)
static const T & get(const T &d)
static void getall(const Daughter &d, std::vector< std::pair< ExpandedIdentifier, const T * > > &entries)
copy all object pointers into a vector of (id,pointer) pairs
T m_default
Type of atomic element.
static bool isequal(const Daughter &lhs, const Daughter &rhs)
equality operator
const T & get(const ExpandedIdentifier &id, size_t &resolvelevel) const
static const T & get(const Daughter &d, const ExpandedIdentifier &id, size_t &resolvelevel)
resolve the nesting level for a given id
Trait trait_type
Type of trait.
const T & get() const
get the default value
static void print(const_pointer x)
NestedContainerBase()
constructor
void clear(const ExpandedIdentifier &id)
clear only entries specified
static void clear(T &d, const ExpandedIdentifier &)
static size_t footprint(const Daughter &d)
return allocated memory
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
static size_t numObjects(const Daughter &d)
total number of atomic objects in daugther
void clear()
clear entire container
void getall(FlatContainer &entries) const
std::vector< Daughter > DaughterContainer
typedef of container
static void erase(pointer &x)
Identifier for TRT detector elements in the conditions code.
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
static Daughter initialvalue()
make a default daugther
static void copy(Daughter &out, const Daughter &in)
copy daugthers
const T const_value_type
const Type of atomic element.
size_t footprint() const
return the memory allocated by the container and its daughters
~NestedContainerBase()=default
destructor
static void initialize(pointer &x)
static size_t footprint(const T &d)
bool operator==(const NestedContainerBase &rhs) const
equality operator, used for compressing
void crunch()
reduce the footprint as much as possible by removing the extra space allocated by the vectors