ATLAS Offline Software
StrawDxMultChanContainer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
12 // $Id: StrawDxMultChanContainer.h,v 1.2 2007-06-13 11:10:43 hansenph Exp $
13 
14 #ifndef TRTCONDITIONSDATA_STRAWDXMULTCHANCONTAINER_H
15 #define TRTCONDITIONSDATA_STRAWDXMULTCHANCONTAINER_H
16 
20 #include "GaudiKernel/MsgStream.h"
21 
22 namespace TRTCond
23 {
25 
28  class StrawDxMultChanContainer : public MultChanContainer<StrawDxContainerTemplate<ExpandedIdentifier::LAYERWHEEL> >
29  {
30  public:
33 
36 
39 
41  float getDx1(const ExpandedIdentifier& id) const {
42  ContainerWithValue valwithcontainer = getWithContainer( id ) ;
43  return StrawDxTrait::isvalid(*valwithcontainer.second) ? valwithcontainer.first->unpackDx1( *valwithcontainer.second ) : 0 ;
44  }
46  float getDx2(const ExpandedIdentifier& id) const {
47  ContainerWithValue valwithcontainer = getWithContainer( id ) ;
48  return StrawDxTrait::isvalid(*valwithcontainer.second) ? valwithcontainer.first->unpackDx2( *valwithcontainer.second ) : 0 ;
49  }
50 
52  float getDxErr(const ExpandedIdentifier& id) const {
53  ContainerWithValue valwithcontainer = getWithContainer( id ) ;
54  return StrawDxTrait::isvalid(*valwithcontainer.second) ? valwithcontainer.first->unpackDxErr( *valwithcontainer.second ) : 0 ;
55  }
56 
58  void setDx(const ExpandedIdentifier& id, float dx1, float dx2, float dxerr) {
60  findContainer(id)->setDx(dx1,dx2,dxerr) ;
61  } else if( id.level()==ExpandedIdentifier::BARRELEC ) {
62  MsgStream log(Athena::getMessageSvc(),"StrawDxMultChanContainer");
63  log << MSG::WARNING << "Sorry: cannot store containers at BARREL_EC granularity" << endmsg ;
64  } else {
65  findContainer(id)->setDx( id, dx1, dx2, dxerr) ;
66  }
67  }
68 
70  void unpack(const ExpandedIdentifier& id, float& dx1 , float& dx2, float& dxerr) const {
71  const StrawDxLayerContainer* container = getContainer(channelId(id)) ;
72  if(container==nullptr) {
73  MsgStream log(Athena::getMessageSvc(),"StrawDxMultChanContainer");
74  log << MSG::ERROR << "cannot find container channel " << channelId(id) << endmsg;
75  } else{
76  dx1 = container->getDx1(id);
77  dx2 = container->getDx2(id);
78  dxerr = container->getDxErr(id);
79  }
80  }
81 
83  static const char* classname() { return "TRTCond::StrawDxMultChanContainer" ; }
84  } ;
85 
86 }
87 
89 
90 #endif
TRTCond::StrawDxTrait::isvalid
static bool isvalid(const StrawDx &x)
Definition: StrawDxContainer.h:35
TRTCond::StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL >
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
TRTCond::StrawDxMultChanContainer::classname
static const char * classname()
classname used to talk to iovservice
Definition: StrawDxMultChanContainer.h:83
TRTCond::MultChanContainer< StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::ContainerWithValue
std::pair< const StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > *, const typename DaughterContainer::value_type * > ContainerWithValue
get a value with the corresponding container.
Definition: MultChanContainer.h:82
TRTCond::StrawDxMultChanContainer::StrawDxMultChanContainer
StrawDxMultChanContainer()
constructor
Definition: StrawDxMultChanContainer.h:35
TRTCond::ExpandedIdentifier::BARRELEC
@ BARRELEC
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::StrawDxMultChanContainer::getDx2
float getDx2(const ExpandedIdentifier &id) const
access to unpacked dx far from electronics
Definition: StrawDxMultChanContainer.h:46
TRTCond::StrawDxMultChanContainer
Definition: StrawDxMultChanContainer.h:29
TRTCond::StrawDxMultChanContainer::setDx
void setDx(const ExpandedIdentifier &id, float dx1, float dx2, float dxerr)
set dx
Definition: StrawDxMultChanContainer.h:58
TRTCond::MultChanContainer< StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::getContainer
const StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > * getContainer(size_t chanid) const
get a layercontainer from a channel id.
Definition: MultChanContainer.h:211
TRTCond::MultChanContainer< StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::getWithContainer
ContainerWithValue getWithContainer(const ExpandedIdentifier &id) const
for retrieving t0 values, we need also the container to 'unpack' the t0
Definition: MultChanContainer.h:281
TRTCond::StrawDxLayerContainer
StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > StrawDxLayerContainer
Definition: StrawDxMultChanContainer.h:24
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
TRTCond::StrawDxMultChanContainer::~StrawDxMultChanContainer
virtual ~StrawDxMultChanContainer()
destructor
Definition: StrawDxMultChanContainer.h:38
TRTCond::MultChanContainer< StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::findContainer
StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > * findContainer(const ExpandedIdentifier &id)
find a layercontainer from an identifier.
Definition: MultChanContainer.h:176
TRTCond::StrawDxMultChanContainer::getDx1
float getDx1(const ExpandedIdentifier &id) const
access to unpacked dx near electronics
Definition: StrawDxMultChanContainer.h:41
TRTCond::MultChanContainer
Definition: MultChanContainer.h:44
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TRTCond::MultChanContainer< StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::channelId
size_t channelId(const ExpandedIdentifier &x) const
calculate the channel for a given TRT identifier
Definition: MultChanContainer.h:151
TRTCond::ExpandedIdentifier::DETECTOR
@ DETECTOR
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
MultChanContainer.h
CondMultChanCollection for storing TRT conditions data. CondMultChanCollections store objects identif...
TRTCond::StrawDxMultChanContainer::getDxErr
float getDxErr(const ExpandedIdentifier &id) const
access to unpacked dx error
Definition: StrawDxMultChanContainer.h:52
TRTCond::StrawDxMultChanContainer::unpack
void unpack(const ExpandedIdentifier &id, float &dx1, float &dx2, float &dxerr) const
method to unpack a StrawDx object
Definition: StrawDxMultChanContainer.h:70
TRTCond::StrawDxContainerTemplate::getDx1
float getDx1(const ExpandedIdentifier &id) const
access to unpacked dx
Definition: StrawDxContainer.h:61
TRTCond
Definition: BasicRtRelation.cxx:8
TRTCond::StrawDxContainerTemplate::getDxErr
float getDxErr(const ExpandedIdentifier &id) const
access to unpacked dx error
Definition: StrawDxContainer.h:70
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
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
TRTCond::StrawDxContainerTemplate::setDx
void setDx(const ExpandedIdentifier &id, float dx1, float dx2, float dxerr)
set dx
Definition: StrawDxContainer.h:76
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
StrawDxContainer.h
Class for storing/accessing trt endpoint corrections data.
TRTCond::StrawDxContainerTemplate::getDx2
float getDx2(const ExpandedIdentifier &id) const
Definition: StrawDxContainer.h:65
TRTCond::StrawDxMultChanContainer::FlatContainer
StrawDxContainerTemplate< ExpandedIdentifier::LAYERWHEEL >::FlatContainer FlatContainer
typedefs
Definition: StrawDxMultChanContainer.h:32