ATLAS Offline Software
StrawT0Container.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 // $Id: StrawT0Container.h,v 1.7 2007-06-13 11:10:44 hansenph Exp $
13 
14 #ifndef TRT_CONDITIONSDATA_STRAWT0CONTAINER_H
15 #define TRT_CONDITIONSDATA_STRAWT0CONTAINER_H
16 
17 #include <string>
18 #include "AthenaKernel/CLASS_DEF.h"
22 
23 namespace TRTCond
24 {
25 
29  {
30  public:
31  static void erase( StrawT0& x) { x = StrawT0() ; }
32  static void copy( StrawT0& out, const StrawT0& in) { out = in ; }
33  static bool isvalid( const StrawT0& x ) { return x.isvalid() ; }
34  static void initialize( StrawT0& x) { x = StrawT0() ; }
35  static size_t footprint( const StrawT0& x) { return sizeof(x) ; }
36  static void print(const StrawT0& x) { x.print() ; }
37  static StrawT0 initialvalue() { return StrawT0() ; }
38  static bool isequal(const StrawT0& x, const StrawT0& y) { return x==y ; }
39  } ;
40 
41 
43  template <int LEVEL>
44  class StrawT0ContainerTemplate : public NestedContainer<LEVEL, StrawT0,StrawT0Trait>
45  {
46  private:
50  public:
53 
56 
58  float getT0(const ExpandedIdentifier& id) const {
60  return StrawT0Trait::isvalid(sd) ? m_t0packer.unpack(sd.packedt0()) : 0 ;
61  }
62 
64  float getT0Err(const ExpandedIdentifier& id) const {
66  return StrawT0Trait::isvalid(sd) ? m_t0errpacker.unpack(sd.packedt0err()) : 0 ;
67  }
68 
70  void setT0(const ExpandedIdentifier& id, float t0, float t0err) {
72  }
73 
75  void setT0(float t0, float t0err) {
77  }
78 
80  void unpack(const StrawT0& sd, float& t0 , float& t0err) const {
81  t0 = m_t0packer.unpack(sd.packedt0()) ;
82  t0err = m_t0errpacker.unpack(sd.packedt0err()) ;
83  }
84 
86  float unpackT0( const StrawT0& sd ) const { return m_t0packer.unpack(sd.packedt0()); }
87  float unpackT0Err( const StrawT0& sd ) const { return m_t0errpacker.unpack(sd.packedt0err()); }
88 
90  void setPackingLimits( float t0min, float t0max, float t0errmin, float t0errmax) ;
91 
93  static const char* classname() { return "TRTCond::StrawT0Container" ; }
94  } ;
95 
96  template <int LEVEL>
97  void StrawT0ContainerTemplate<LEVEL>::setPackingLimits( float t0min, float t0max, float t0errmin, float t0errmax)
98  {
100  LinearPacker<float,unsigned char> newt0packer(t0min,t0max) ;
101  LinearPacker<float,unsigned char> newt0errpacker(t0errmin,t0errmax) ;
102  LinearPacker<float,unsigned char> oldt0packer = m_t0packer ;
103  LinearPacker<float,unsigned char> oldt0errpacker = m_t0errpacker ;
104 
107  this->getall( entries ) ;
109  it = entries.begin() ; it != entries.end(); ++it) {
110  StrawT0& sd = const_cast<StrawT0&>(*(it->second)) ;
111  float t0 = oldt0packer.unpack(sd.packedt0());
112  float t0err = oldt0errpacker. unpack(sd.packedt0err());
113  unsigned char newpackedt0 = newt0packer.pack(t0) ;
114  unsigned char newpackedt0err = newt0errpacker.pack(t0err) ;
115  sd = StrawT0( newpackedt0, newpackedt0err ) ;
116  }
117  m_t0packer = newt0packer ;
118  m_t0errpacker = newt0errpacker ;
119  }
120 
121  // The typedef gives problems when generating the reflex dictionary
122  //typedef StrawT0ContainerTemplate<ExpandedIdentifier::DETECTOR> StrawT0Container ;
126  class StrawT0Container : public StrawT0ContainerTemplate<ExpandedIdentifier::DETECTOR>
127  {
128  } ;
129 }
130 
132 
133 #endif
TRTCond::StrawT0Trait::erase
static void erase(StrawT0 &x)
Definition: StrawT0Container.h:31
checkHVCorrections.unpack
unpack
Definition: checkHVCorrections.py:98
TRTCond::StrawT0ContainerTemplate::m_t0errpacker
LinearPacker< float, unsigned char > m_t0errpacker
Definition: StrawT0Container.h:49
TRTCond::StrawT0ContainerTemplate::unpackT0
float unpackT0(const StrawT0 &sd) const
more public methods
Definition: StrawT0Container.h:86
TRTCond::StrawT0ContainerTemplate
class for storing/accessing trt t0 data
Definition: StrawT0Container.h:45
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TRTCond::StrawT0Trait
Definition: StrawT0Container.h:29
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TRTCond::NestedContainerBase< NestingLevel, NestedContainer< NestingLevel+1, T, Trait >, T, Trait >::set
void set(const ExpandedIdentifier &id, const T &t)
set a value.
Definition: NestedContainer.h:191
TRTCond::StrawT0
Definition: StrawT0.h:23
TRTCond::StrawT0ContainerTemplate::setPackingLimits
void setPackingLimits(float t0min, float t0max, float t0errmin, float t0errmax)
change the packing limits
Definition: StrawT0Container.h:97
x
#define x
TRTCond::StrawT0Trait::print
static void print(const StrawT0 &x)
Definition: StrawT0Container.h:36
TRTCond::StrawT0ContainerTemplate::m_t0packer
LinearPacker< float, unsigned char > m_t0packer
packing borders
Definition: StrawT0Container.h:48
TRTCond::StrawT0Trait::initialize
static void initialize(StrawT0 &x)
Definition: StrawT0Container.h:34
python.selector.AtlRunQuerySelectorLhcOlc.sd
sd
Definition: AtlRunQuerySelectorLhcOlc.py:612
TRTCond::StrawT0ContainerTemplate::getT0
float getT0(const ExpandedIdentifier &id) const
access to unpacked t0
Definition: StrawT0Container.h:58
TRTCond::StrawT0Trait::isvalid
static bool isvalid(const StrawT0 &x)
Definition: StrawT0Container.h:33
TRTCond::StrawT0ContainerTemplate::classname
static const char * classname()
classname used to talk to iovservice
Definition: StrawT0Container.h:93
TRTCond::NestedContainer
Definition: NestedContainer.h:373
TRTCond::StrawT0ContainerTemplate::getT0Err
float getT0Err(const ExpandedIdentifier &id) const
access to unpacked t0 error
Definition: StrawT0Container.h:64
TRTCond::StrawT0Container
Definition: StrawT0Container.h:127
TRTCond::LinearPacker< float, unsigned char >
TRTCond::LinearPacker::unpack
UnpackedType unpack(PackedType val) const
Unpack method.
Definition: LinearPacker.h:27
TRTCond::StrawT0Trait::isequal
static bool isequal(const StrawT0 &x, const StrawT0 &y)
Definition: StrawT0Container.h:38
TRTCond::StrawT0ContainerTemplate::unpack
void unpack(const StrawT0 &sd, float &t0, float &t0err) const
public method to unpack a StrawT0 object
Definition: StrawT0Container.h:80
TRTCond::StrawT0ContainerTemplate::unpackT0Err
float unpackT0Err(const StrawT0 &sd) const
Definition: StrawT0Container.h:87
TRTCond::StrawT0Trait::footprint
static size_t footprint(const StrawT0 &x)
Definition: StrawT0Container.h:35
TRTCond
Definition: BasicRtRelation.cxx:8
NestedContainer.h
'Nested' template container for storing TRT conditions data.
TRTCond::StrawT0ContainerTemplate::setT0
void setT0(float t0, float t0err)
set the top-level t0
Definition: StrawT0Container.h:75
y
#define y
TRTCond::NestedContainerBase< NestingLevel, NestedContainer< NestingLevel+1, T, Trait >, T, Trait >::get
const T & get() const
get the default value
Definition: NestedContainer.h:232
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
TRTCond::StrawT0Trait::copy
static void copy(StrawT0 &out, const StrawT0 &in)
Definition: StrawT0Container.h:32
TRTCond::StrawT0ContainerTemplate::~StrawT0ContainerTemplate
virtual ~StrawT0ContainerTemplate()
destructor
Definition: StrawT0Container.h:55
TRTCond::StrawT0ContainerTemplate::setT0
void setT0(const ExpandedIdentifier &id, float t0, float t0err)
set t0
Definition: StrawT0Container.h:70
entries
double entries
Definition: listroot.cxx:49
TRTCond::StrawT0Trait::initialvalue
static StrawT0 initialvalue()
Definition: StrawT0Container.h:37
StrawT0.h
TRT straw t0 object.
TRTCond::LinearPacker::pack
PackedType pack(UnpackedType x) const
Pack method.
Definition: LinearPacker.h:30
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
CLASS_DEF.h
macros to associate a CLID to a type
LinearPacker.h
TRTCond::StrawT0ContainerTemplate::StrawT0ContainerTemplate
StrawT0ContainerTemplate()
constructor
Definition: StrawT0Container.h:52