Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
20 IBLParameterSvc::IBLParameterSvc(const std::string& name,ISvcLocator* svc)
21  : base_class(name,svc),
22  m_IBLpresent{},
23  m_DBMpresent{},
24  m_LayerColumnsPerFE{},
25  m_LayerRowsPerFE{},
26  m_LayerFEsPerHalfModule_planar{},
27  m_LayerFEsPerHalfModule_3d{},
28  m_layout{},
29  m_geoDbTagSvc("GeoDbTagSvc",name),
30  m_disablePixMapCondDB(false),
31  m_disableSpecialPixels(false),
32  m_disableAlignable(false),
33  m_disableAllClusterSplitting(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 
44 {
45 }
46 
51 {
52  //MsgStream log(msgSvc(), name());
53 
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  }
104  m_LayerFEsPerHalfModule.clear();
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 
IRDBRecord::getInt
virtual int getInt(const std::string &fieldName) const =0
Get int field value.
IBLParameterSvc::m_LayerFEsPerHalfModule_planar
int m_LayerFEsPerHalfModule_planar
Definition: IBLParameterSvc.h:82
IBLParameterSvc::m_IBLpresent
bool m_IBLpresent
Definition: IBLParameterSvc.h:81
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
initialize
void initialize()
Definition: run_EoverP.cxx:894
IRDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const =0
Get string field value.
IBLParameterSvc::IBLParameterSvc
IBLParameterSvc(const std::string &name, ISvcLocator *svc)
Constructor(s)
Definition: IBLParameterSvc.cxx:20
IBLParameterSvc::~IBLParameterSvc
virtual ~IBLParameterSvc()
Definition: IBLParameterSvc.cxx:43
IBLParameterSvc.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
IBLParameterSvc::m_DBMpresent
bool m_DBMpresent
Definition: IBLParameterSvc.h:81
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:85
IBLParameterSvc::m_LayerRowsPerFE
int m_LayerRowsPerFE
Definition: IBLParameterSvc.h:82
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
IBLParameterSvc::m_LayerFEsPerHalfModule_3d
int m_LayerFEsPerHalfModule_3d
Definition: IBLParameterSvc.h:82
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IBLParameterSvc::m_LayerFEsPerHalfModule
std::vector< int > m_LayerFEsPerHalfModule
Definition: IBLParameterSvc.h:83
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
IBLParameterSvc::m_layout
int m_layout
Definition: IBLParameterSvc.h:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DecodeVersionKey.h
IBLParameterSvc::m_LayerColumnsPerFE
int m_LayerColumnsPerFE
Definition: IBLParameterSvc.h:82
IBLParameterSvc::initialize
virtual StatusCode initialize() override
Initialize Service.
Definition: IBLParameterSvc.cxx:50
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecord::isFieldNull
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IBLParameterSvc::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition: IBLParameterSvc.h:85
IBLParameterSvc::finalize
virtual StatusCode finalize() override
Definition: IBLParameterSvc.cxx:128
IGeoDbTagSvc.h
IBLParameterSvc::setIblParameters
StatusCode setIblParameters()
Definition: IBLParameterSvc.cxx:73