ATLAS Offline Software
SCT_SensorsTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "SCT_SensorsTool.h"
12 
13 SCT_SensorsTool::SCT_SensorsTool(const std::string& type, const std::string& name, const IInterface* parent) :
14  base_class(type, name, parent) {
15 }
16 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
18  // Read Cond Handle Key
20 
21  return StatusCode::SUCCESS;
22 }
23 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
25  return StatusCode::SUCCESS;
26 }
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29 
30 const SCT_SensorCondData* SCT_SensorsTool::getSensorsData(const unsigned int truncatedSerialNumber, const EventContext& ctx) const {
31  const SCT_SensorsCondData* condData{getCondData(ctx)};
32  if (condData==nullptr) return nullptr;
33 
34  SCT_SensorsCondData::const_iterator it{condData->find(truncatedSerialNumber)};
35  if (it!=condData->end()) return &((*it).second);
36  return nullptr;
37 }
38 
39 const SCT_SensorCondData* SCT_SensorsTool::getSensorsData(const unsigned int truncatedSerialNumber) const {
40  const EventContext& ctx{Gaudi::Hive::currentContext()};
41  return getSensorsData(truncatedSerialNumber, ctx);
42 }
43 
44 void SCT_SensorsTool::getSensorsData(std::vector<std::string>& /*userVector*/, const EventContext& /*ctx*/) const {
45  ATH_MSG_WARNING("This void SCT_SensorsTool::getSensorsData(std::vector<std::string>& userVector) method is not implemented.");
46 }
47 
48 void SCT_SensorsTool::getSensorsData(std::vector<std::string>& userVector) const {
49  const EventContext& ctx{Gaudi::Hive::currentContext()};
50  getSensorsData(userVector, ctx);
51 }
52 
53 std::string SCT_SensorsTool::getManufacturer(unsigned int truncatedSerialNumber, const EventContext& ctx) const {
54  std::string manufacturer{""};
55 
56  const SCT_SensorsCondData* condData{getCondData(ctx)};
57  if (condData==nullptr) return manufacturer;
58 
59  SCT_SensorsCondData::const_iterator it{condData->find(truncatedSerialNumber)};
60  if (it!=condData->end()) {
61  manufacturer = (*it).second.getManufacturer();
62  }
63  return manufacturer;
64 }
65 
66 std::string SCT_SensorsTool::getManufacturer(unsigned int truncatedSerialNumber) const {
67  const EventContext& ctx{Gaudi::Hive::currentContext()};
68  return getManufacturer(truncatedSerialNumber, ctx);
69 }
70 
71 void SCT_SensorsTool::printManufacturers(const EventContext& ctx) const {
72  const SCT_SensorsCondData* condData{getCondData(ctx)};
73  if (condData==nullptr) return;
74 
75  for (const std::pair<const CondAttrListCollection::ChanNum, SCT_SensorCondData>& it: *condData) {
76  ATH_MSG_ALWAYS("channel " << it.first << " manufacturer " << (it.second).getManufacturer());
77  }
78 }
79 
81  const EventContext& ctx{Gaudi::Hive::currentContext()};
82  return printManufacturers(ctx);
83 }
84 
86 SCT_SensorsTool::getCondData(const EventContext& ctx) const {
88  return condData.retrieve();
89 }
SCT_SensorsTool::getManufacturer
virtual std::string getManufacturer(unsigned int truncatedSerialNumber, const EventContext &ctx) const override
Definition: SCT_SensorsTool.cxx:53
SCT_SensorsTool::initialize
virtual StatusCode initialize() override
Definition: SCT_SensorsTool.cxx:17
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SCT_SensorsTool::finalize
virtual StatusCode finalize() override
Definition: SCT_SensorsTool.cxx:24
skel.it
it
Definition: skel.GENtoEVGEN.py:423
SCT_SensorsTool::SCT_SensorsTool
SCT_SensorsTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SCT_SensorsTool.cxx:13
SCT_SensorsTool::getSensorsData
virtual void getSensorsData(std::vector< std::string > &userVector, const EventContext &ctx) const override
Definition: SCT_SensorsTool.cxx:44
SCT_SensorsTool::m_condKey
SG::ReadCondHandleKey< SCT_SensorsCondData > m_condKey
Definition: SCT_SensorsTool.h:51
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SCT_SensorsTool::printManufacturers
virtual void printManufacturers() const override
Definition: SCT_SensorsTool.cxx:80
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_MSG_ALWAYS
#define ATH_MSG_ALWAYS(x)
Definition: AthMsgStreamMacros.h:35
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SCT_SensorsTool::getSensorsData
virtual const SCT_SensorCondData * getSensorsData(const unsigned int truncatedSerialNumber) const override
Definition: SCT_SensorsTool.cxx:39
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SCT_SensorsTool.h
SCT_SensorsTool::getCondData
const SCT_SensorsCondData * getCondData(const EventContext &ctx) const
Definition: SCT_SensorsTool.cxx:86
SCT_SensorCondData
Class for data object used in SCT_SensorsCondAlg and SCT_SensorsTool.
Definition: SCT_SensorCondData.h:25
SCT_SensorsCondData
std::map< CondAttrListCollection::ChanNum, SCT_SensorCondData > SCT_SensorsCondData
Class for data object for SCT_SensorsCondAlg and SCT_SensorsTool.
Definition: SCT_SensorsCondData.h:28