ATLAS Offline Software
IBLParameterSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
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_rdbAccessSvc("RDBAccessSvc",name),
31  m_disablePixMapCondDB(false),
32  m_disableSpecialPixels(false),
33  m_disableAlignable(false),
34  m_disableAllClusterSplitting(false),
35  m_disableDCS(true)
36 {
37  declareProperty("GeoDbTagSvc",m_geoDbTagSvc);
38  declareProperty("RDBAccessSvc",m_rdbAccessSvc);
39  declareProperty("DisablePixMapCondDB",m_disablePixMapCondDB);
40  declareProperty("DisableSpecialPixels",m_disableSpecialPixels);
41  declareProperty("DisableAlignable",m_disableAlignable);
42  declareProperty("DisableAllClusterSplitting",m_disableAllClusterSplitting);
43  declareProperty("DisableDCS",m_disableDCS);
44 }
45 
47 {
48 }
49 
50 inline StatusCode IBLParameterSvc::queryInterface(const InterfaceID& riid, void** ppvIf)
51 {
52  if (riid == IBLParameterSvc::interfaceID()){
53  *ppvIf = dynamic_cast<IBLParameterSvc*>(this);
54  addRef();
55  return StatusCode::SUCCESS;
56  }
57  return base_class::queryInterface( riid, ppvIf );
58 
59 }
60 
65 {
66  //MsgStream log(msgSvc(), name());
67 
69  if (result.isFailure())
70  {
71  ATH_MSG_FATAL ( "Unable to initialize the service!" );
72  return result;
73  }
74  // read Charge Collection Probability Maps
75  //
76  // get the PixelDigitization random stream
77  //
78 
79  if (!setIblParameters().isSuccess()) return StatusCode::FAILURE;
80 
81  ATH_MSG_DEBUG ( "initialized service!" );
82  return result;
83 
84 }
85 
86 //Determine if IBL is present and set appropriate parameters
88  if (m_geoDbTagSvc.retrieve().isFailure()) {
89  msg(MSG::FATAL) << "Could not locate GeoDbTagSvc" << endmsg;
90  return (StatusCode::FAILURE);
91  }
92  DecodeVersionKey versionKey(&*m_geoDbTagSvc, "Pixel");
93 
94  if (m_rdbAccessSvc.retrieve().isFailure()) {
95  msg(MSG::FATAL) << "Could not locate RDBAccessSvc" << endmsg;
96  return (StatusCode::FAILURE);
97  }
98  IRDBRecordset_ptr switchSet = m_rdbAccessSvc->getRecordsetPtr("PixelSwitches", versionKey.tag(), versionKey.node());
99  const IRDBRecord *switchTable = (*switchSet)[0];
100  std::string versionName("");
101  if (!switchTable->isFieldNull("VERSIONNAME")) versionName=switchTable->getString("VERSIONNAME");
102  m_DBMpresent=false;
103  if (!switchTable->isFieldNull("BUILDDBM")) m_DBMpresent=switchTable->getInt("BUILDDBM");
104  if (versionName=="IBL") {
105  m_IBLpresent = true;
106  ATH_MSG_INFO("IBL geometry");
107  }
108  else {
109  m_IBLpresent = false;
110  ATH_MSG_VERBOSE("Default geometry");
111  }
113  m_LayerFEsPerHalfModule.clear();
114  if (m_IBLpresent) {
115  IRDBRecordset_ptr PixelReadout = m_rdbAccessSvc->getRecordsetPtr("PixelReadout", versionKey.tag(), versionKey.node());
116  IRDBRecordset_ptr PixelStave = m_rdbAccessSvc->getRecordsetPtr("PixelStave", versionKey.tag(), versionKey.node());
117  const IRDBRecord *IBLreadout = (*PixelReadout)[1];
118  if (!IBLreadout->isFieldNull("COLSPERCHIP")) m_LayerColumnsPerFE=IBLreadout->getInt("COLSPERCHIP");
119  if (!IBLreadout->isFieldNull("ROWSPERCHIP")) m_LayerRowsPerFE=IBLreadout->getInt("ROWSPERCHIP");
120  if (!IBLreadout->isFieldNull("NCHIPSETA")) m_LayerFEsPerHalfModule_planar=IBLreadout->getInt("NCHIPSETA");
121  if ((*PixelReadout).size()>2) {
122  const IRDBRecord *IBL3Dreadout = (*PixelReadout)[2];
123  if (!IBL3Dreadout->isFieldNull("NCHIPSETA")) m_LayerFEsPerHalfModule_3d=IBL3Dreadout->getInt("NCHIPSETA");
124  }
125  const IRDBRecord *IBLstave = (*PixelStave)[1];
126  if (!IBLstave->isFieldNull("LAYOUT")) m_layout=IBLstave->getInt("LAYOUT");
127  if (m_layout==4) for (int i = 0; i < 16; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_planar);
128  if (m_layout==5) {
129  for (int i =0; i < 4; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_3d);
130  for (int i =0; i < 12; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_planar);
131  for (int i =0; i < 4; i++) m_LayerFEsPerHalfModule.push_back(m_LayerFEsPerHalfModule_3d);
132  }
133  }
134  return StatusCode::SUCCESS;
135 }
136 
138 {
139  return StatusCode::SUCCESS;
140 }
141 
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:87
IBLParameterSvc::m_IBLpresent
bool m_IBLpresent
Definition: IBLParameterSvc.h:86
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
get_generator_info.result
result
Definition: get_generator_info.py:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
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::interfaceID
static const InterfaceID & interfaceID()
Definition: IBLParameterSvc.h:105
IBLParameterSvc::~IBLParameterSvc
virtual ~IBLParameterSvc()
Definition: IBLParameterSvc.cxx:46
DecodeVersionKey::node
const std::string & node() const
Return the version node.
Definition: DecodeVersionKey.cxx:99
IBLParameterSvc.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
IBLParameterSvc::m_DBMpresent
bool m_DBMpresent
Definition: IBLParameterSvc.h:86
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
lumiFormat.i
int i
Definition: lumiFormat.py:92
IBLParameterSvc::m_LayerRowsPerFE
int m_LayerRowsPerFE
Definition: IBLParameterSvc.h:87
IBLParameterSvc
Definition: IBLParameterSvc.h:30
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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:87
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:93
IBLParameterSvc::m_LayerFEsPerHalfModule
std::vector< int > m_LayerFEsPerHalfModule
Definition: IBLParameterSvc.h:88
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
IBLParameterSvc::m_rdbAccessSvc
ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc
Definition: IBLParameterSvc.h:91
IBLParameterSvc::m_layout
int m_layout
Definition: IBLParameterSvc.h:87
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DecodeVersionKey.h
IBLParameterSvc::m_LayerColumnsPerFE
int m_LayerColumnsPerFE
Definition: IBLParameterSvc.h:87
IBLParameterSvc::initialize
virtual StatusCode initialize() override
Initialize Service.
Definition: IBLParameterSvc.cxx:64
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
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IBLParameterSvc::queryInterface
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvIf) override
Definition: IBLParameterSvc.cxx:50
IBLParameterSvc::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition: IBLParameterSvc.h:90
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
IBLParameterSvc::finalize
virtual StatusCode finalize() override
Definition: IBLParameterSvc.cxx:137
IGeoDbTagSvc.h
IBLParameterSvc::setIblParameters
StatusCode setIblParameters()
Definition: IBLParameterSvc.cxx:87