ATLAS Offline Software
StrawT0MultChanContainer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // @file StrawT0MultChanContainer.h
6 //
7 // @brief
8 // Class for storing/accessing trt t0 data with channels
9 //
10 // @author Wouter Hulsbergen <wouter.hulsbergen@cern.ch>
11 //
12 // $Id: StrawT0MultChanContainer.h,v 1.5 2007-06-13 11:10:44 hansenph Exp $
13 
14 #ifndef TRTCONDITIONSDATA_STRAWT0MULTCHANCONTAINER_H
15 #define TRTCONDITIONSDATA_STRAWT0MULTCHANCONTAINER_H
16 
19 #include "AthenaKernel/CondCont.h"
21 #include "GaudiKernel/MsgStream.h"
22 
23 namespace TRTCond
24 {
26 
30  class StrawT0MultChanContainer : public MultChanContainer<StrawT0ContainerTemplate<ExpandedIdentifier::LAYERWHEEL> >
31  {
32  public:
35 
38 
41 
43  float getT0(const ExpandedIdentifier& id) const {
44  ContainerWithValue valwithcontainer = getWithContainer( id ) ;
45  return StrawT0Trait::isvalid(*valwithcontainer.second) ? valwithcontainer.first->unpackT0( *valwithcontainer.second ) : 0 ;
46  }
47 
49  float getT0Err(const ExpandedIdentifier& id) const {
50  ContainerWithValue valwithcontainer = getWithContainer( id ) ;
51  return StrawT0Trait::isvalid(*valwithcontainer.second) ? valwithcontainer.first->unpackT0Err( *valwithcontainer.second ) : 0 ;
52  }
53 
55  void setT0(const ExpandedIdentifier& id, float t0, float t0err) {
56  if( id.level()==ExpandedIdentifier::DETECTOR ) {
57  findContainer(id)->setT0(t0,t0err) ;
58  } else if( id.level()==ExpandedIdentifier::BARRELEC ) {
59  MsgStream log(Athena::getMessageSvc(),"StrawT0MultChanContainer");
60  log << MSG::WARNING << "Sorry: cannot store containers at BARREL_EC granularity" << endmsg;
61  } else {
62  findContainer(id)->setT0( id, t0,t0err) ;
63  }
64  }
66  void unpack(const ExpandedIdentifier& id, const StrawT0& sd, float& t0 , float& t0err) const {
67  const StrawT0LayerContainer* container = getContainer(channelId(id)) ;
68  if(not container){
69  MsgStream log(Athena::getMessageSvc(),"StrawT0MultChanContainer");
70  log << MSG::ERROR << "cannot find container channel" << channelId(id) << endmsg ;
71  } else {
72  container->unpack( sd,t0,t0err ) ;
73  }
74  }
75 
77  void setPackingLimits( float t0min, float t0max, float t0errmin, float t0errmax) ;
78 
80  static const char* classname() { return "TRTCond::StrawT0MultChanContainer" ; }
81  } ;
82 
83  inline void StrawT0MultChanContainer::setPackingLimits( float t0min, float t0max, float t0errmin, float t0errmax)
84  {
86  for(dauit = this->begin() ; dauit != this->end(); ++dauit)
87  (*dauit)->setPackingLimits( t0min,t0max,t0errmin,t0errmax ) ;
88  }
89 }
90 
91 
93 CONDCONT_DEF(TRTCond::StrawT0MultChanContainer,182150756);
94 
95 
96 #endif
TRTCond::StrawT0LayerContainer
StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > StrawT0LayerContainer
Definition: StrawT0MultChanContainer.h:25
CondCont.h
Hold mappings of ranges to condition objects.
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
TRTCond::MultChanContainer< StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::ContainerWithValue
std::pair< const StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > *, const typename DaughterContainer::value_type * > ContainerWithValue
get a value with the corresponding container.
Definition: MultChanContainer.h:82
TRTCond::StrawT0MultChanContainer::setT0
void setT0(const ExpandedIdentifier &id, float t0, float t0err)
set t0
Definition: StrawT0MultChanContainer.h:55
TRTCond::ExpandedIdentifier::BARRELEC
@ BARRELEC
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:37
TRTCond::StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL >
CondMultChanCollection
A CondMultChanCollection is a template class which can hold a collection of T* objects which are inte...
Definition: CondMultChanCollection.h:52
CONDCONT_DEF
CONDCONT_DEF(TRTCond::StrawT0MultChanContainer, 182150756)
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
TRTCond::StrawT0MultChanContainer::~StrawT0MultChanContainer
virtual ~StrawT0MultChanContainer()
destructor
Definition: StrawT0MultChanContainer.h:40
TRTCond::StrawT0
Definition: StrawT0.h:23
TRTCond::MultChanContainer< StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::getContainer
const StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > * getContainer(size_t chanid) const
get a layercontainer from a channel id.
Definition: MultChanContainer.h:211
TRTCond::MultChanContainer< StrawT0ContainerTemplate< 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::StrawT0MultChanContainer::getT0
float getT0(const ExpandedIdentifier &id) const
access to unpacked t0
Definition: StrawT0MultChanContainer.h:43
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
python.selector.AtlRunQuerySelectorLhcOlc.sd
sd
Definition: AtlRunQuerySelectorLhcOlc.py:612
TRTCond::MultChanContainer< StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::findContainer
StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > * findContainer(const ExpandedIdentifier &id)
find a layercontainer from an identifier.
Definition: MultChanContainer.h:176
TRTCond::StrawT0Trait::isvalid
static bool isvalid(const StrawT0 &x)
Definition: StrawT0Container.h:33
StrawT0Container.h
Class for storing/accessing trt t0 data.
TRTCond::MultChanContainer
Definition: MultChanContainer.h:44
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
TRTCond::StrawT0MultChanContainer::setPackingLimits
void setPackingLimits(float t0min, float t0max, float t0errmin, float t0errmax)
change the packing limits. NOTE: this only works for channels that already exist!
Definition: StrawT0MultChanContainer.h:83
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TRTCond::MultChanContainer< StrawT0ContainerTemplate< 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
TRTCond::StrawT0MultChanContainer::unpack
void unpack(const ExpandedIdentifier &id, const StrawT0 &sd, float &t0, float &t0err) const
public method to unpack a StrawT0 object
Definition: StrawT0MultChanContainer.h:66
MultChanContainer.h
CondMultChanCollection for storing TRT conditions data. CondMultChanCollections store objects identif...
TRTCond::StrawT0MultChanContainer::StrawT0MultChanContainer
StrawT0MultChanContainer()
constructor
Definition: StrawT0MultChanContainer.h:37
TRTCond::StrawT0MultChanContainer::classname
static const char * classname()
classname used to talk to iovservice
Definition: StrawT0MultChanContainer.h:80
DataVector< StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
TRTCond
Definition: BasicRtRelation.cxx:8
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::StrawT0ContainerTemplate::setT0
void setT0(const ExpandedIdentifier &id, float t0, float t0err)
set t0
Definition: StrawT0Container.h:70
TRTCond::StrawT0MultChanContainer::getT0Err
float getT0Err(const ExpandedIdentifier &id) const
access to unpacked t0 error
Definition: StrawT0MultChanContainer.h:49
TRTCond::ExpandedIdentifier
Identifier for TRT detector elements in the conditions code.
Definition: InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/ExpandedIdentifier.h:30
TRTCond::StrawT0MultChanContainer
Definition: StrawT0MultChanContainer.h:31
TRTCond::StrawT0MultChanContainer::FlatContainer
StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL >::FlatContainer FlatContainer
typedefs
Definition: StrawT0MultChanContainer.h:34
DataVector< StrawT0ContainerTemplate< ExpandedIdentifier::LAYERWHEEL > >::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.