ATLAS Offline Software
Loading...
Searching...
No Matches
IBLParameterSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "IBLParameterSvc.h"
6#include "GaudiKernel/ServiceHandle.h"
7#include "GaudiKernel/PathResolver.h"
8
9//Includes related to determining presence of IBL
15
16
20IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc)
21 : base_class(name,svc),
28 m_layout{},
29 m_geoDbTagSvc("GeoDbTagSvc",name),
32 m_disableAlignable(false),
34 m_disableDCS(true) {
35 declareProperty("GeoDbTagSvc",m_geoDbTagSvc);
36 declareProperty("DisablePixMapCondDB",m_disablePixMapCondDB);
37 declareProperty("DisableSpecialPixels",m_disableSpecialPixels);
38 declareProperty("DisableAlignable",m_disableAlignable);
39 declareProperty("DisableAllClusterSplitting",m_disableAllClusterSplitting);
40 declareProperty("DisableDCS",m_disableDCS);
41}
42
46
51{
52 //MsgStream log(msgSvc(), name());
53
54 StatusCode result = AthService::initialize();
55 if (result.isFailure())
56 {
57 ATH_MSG_FATAL ( "Unable to initialize the service!" );
58 return result;
59 }
60 // read Charge Collection Probability Maps
61 //
62 // get the PixelDigitization random stream
63 //
64
65 if (!setIblParameters().isSuccess()) return StatusCode::FAILURE;
66
67 ATH_MSG_DEBUG ( "initialized service!" );
68 return result;
69
70}
71
72//Determine if IBL is present and set appropriate parameters
74 ATH_CHECK(m_geoDbTagSvc.retrieve());
75
76
77 std::string versionTag{}, versionNode{};
78 if(!m_geoDbTagSvc->getSqliteReader()) {
79 DecodeVersionKey detectorKey{m_geoDbTagSvc.get(),"Pixel"};
80 versionTag = detectorKey.tag();
81 versionNode = detectorKey.node();
82 }
83
84 SmartIF<IRDBAccessSvc> rdbAccess{Gaudi::svcLocator()->service(m_geoDbTagSvc->getParamSvcName())};
85 if (!rdbAccess) {
86 ATH_MSG_FATAL("Could not locate RDBAccessSvc");
87 return StatusCode::FAILURE;
88 }
89 IRDBRecordset_ptr switchSet = rdbAccess->getRecordsetPtr("PixelSwitches", versionTag, versionNode);
90 const IRDBRecord *switchTable = (*switchSet)[0];
91 std::string versionName("");
92 if (!switchTable->isFieldNull("VERSIONNAME")) versionName=switchTable->getString("VERSIONNAME");
93 m_DBMpresent=false;
94 if (!switchTable->isFieldNull("BUILDDBM")) m_DBMpresent=switchTable->getInt("BUILDDBM");
95 if (versionName=="IBL") {
96 m_IBLpresent = true;
97 ATH_MSG_INFO("IBL geometry");
98 }
99 else {
100 m_IBLpresent = false;
101 ATH_MSG_VERBOSE("Default geometry");
102 }
105 if (m_IBLpresent) {
106 IRDBRecordset_ptr PixelReadout = rdbAccess->getRecordsetPtr("PixelReadout", versionTag, versionNode);
107 IRDBRecordset_ptr PixelStave = rdbAccess->getRecordsetPtr("PixelStave", versionTag, versionNode);
108 const IRDBRecord *IBLreadout = (*PixelReadout)[1];
109 if (!IBLreadout->isFieldNull("COLSPERCHIP")) m_LayerColumnsPerFE=IBLreadout->getInt("COLSPERCHIP");
110 if (!IBLreadout->isFieldNull("ROWSPERCHIP")) m_LayerRowsPerFE=IBLreadout->getInt("ROWSPERCHIP");
111 if (!IBLreadout->isFieldNull("NCHIPSETA")) m_LayerFEsPerHalfModule_planar=IBLreadout->getInt("NCHIPSETA");
112 if ((*PixelReadout).size()>2) {
113 const IRDBRecord *IBL3Dreadout = (*PixelReadout)[2];
114 if (!IBL3Dreadout->isFieldNull("NCHIPSETA")) m_LayerFEsPerHalfModule_3d=IBL3Dreadout->getInt("NCHIPSETA");
115 }
116 const IRDBRecord *IBLstave = (*PixelStave)[1];
117 if (!IBLstave->isFieldNull("LAYOUT")) m_layout=IBLstave->getInt("LAYOUT");
118 if (m_layout==4) for (int i = 0; i < 16; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_planar);
119 if (m_layout==5) {
120 for (int i =0; i < 4; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_3d);
121 for (int i =0; i < 12; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_planar);
122 for (int i =0; i < 4; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_3d);
123 }
124 }
125 return StatusCode::SUCCESS;
126}
127
129{
130 return StatusCode::SUCCESS;
131}
132
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
const std::string & tag() const
Return version tag.
const std::string & node() const
Return the version node.
StatusCode setIblParameters()
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
virtual StatusCode initialize() override
Initialize Service.
bool m_disableAllClusterSplitting
int m_LayerFEsPerHalfModule_planar
virtual StatusCode finalize() override
IBLParameterSvc(const std::string &name, ISvcLocator *svc)
Constructor(s)
virtual ~IBLParameterSvc()
std::vector< int > m_LayerFEsPerHalfModule
IRDBRecord is one record in the IRDBRecordset object.
Definition IRDBRecord.h:27
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual int getInt(const std::string &fieldName) const =0
Get int field value.