ATLAS Offline Software
Loading...
Searching...
No Matches
PixelDetectorTool Class Referencefinal

#include <PixelDetectorTool.h>

Inheritance diagram for PixelDetectorTool:
Collaboration diagram for PixelDetectorTool:

Public Member Functions

 PixelDetectorTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~PixelDetectorTool () override final
virtual StatusCode initialize () override final
virtual StatusCode create () override final
 Create the Detector Node corresponding to this tool.
virtual StatusCode clear () override final
virtual StatusCode align ATLAS_NOT_THREAD_SAFE (IOVSVC_CALLBACK_ARGS) override
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Attributes

bool m_services {true}
bool m_servicesOnLadder {true}
std::string m_detectorName {"PixelDetector"}
ServiceHandle< IIBLParameterSvcm_IBLParameterSvc {this,"IBLParameterSvc","IBLParameterSvc",""}
bool m_dc1Geometry {false}
bool m_alignable {true}
bool m_tweakIBLDist {true}
bool m_initialLayout {false}
bool m_devVersion {false}
bool m_buildDBM {false}
bool m_useDynamicAlignFolders {false}
ToolHandle< IGeoSubDetToolm_bcmTool {this,"BCM_Tool","",""}
ToolHandle< IGeoSubDetToolm_blmTool {this,"BLM_Tool","",""}
PublicToolHandle< IInDetServMatBuilderToolm_serviceBuilderTool {this,"ServiceBuilderTool","",""}
ServiceHandle< IGeometryDBSvcm_geometryDBSvc {this,"GeometryDBSvc","InDetGeometryDBSvc",""}
const InDetDD::PixelDetectorManagerm_manager {nullptr}
std::string m_overrideVersionName
PixelGeoModelAthenaCompsm_athenaComps {}

Detailed Description

Definition at line 25 of file src/PixelDetectorTool.h.

Constructor & Destructor Documentation

◆ PixelDetectorTool()

PixelDetectorTool::PixelDetectorTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

JBdV

Definition at line 36 of file src/PixelDetectorTool.cxx.

37 : GeoModelTool( type, name, parent )
38{
39 declareProperty("Services",m_services);
40 declareProperty("ServicesOnLadder",m_servicesOnLadder);
41 declareProperty("Alignable", m_alignable);
42 declareProperty("TweakIBLDist", m_tweakIBLDist);
43 declareProperty("DC1Geometry",m_dc1Geometry);
44 declareProperty("InitialLayout",m_initialLayout);
45 declareProperty("DevVersion", m_devVersion);
46 declareProperty("OverrideVersionName", m_overrideVersionName);
47 declareProperty("useDynamicAlignFolders", m_useDynamicAlignFolders);
48}
std::string m_overrideVersionName

◆ ~PixelDetectorTool()

PixelDetectorTool::~PixelDetectorTool ( )
finaloverridevirtual

Definition at line 50 of file src/PixelDetectorTool.cxx.

51{
52 delete m_athenaComps;
53}
PixelGeoModelAthenaComps * m_athenaComps

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

virtual StatusCode registerCallback GeoModelTool::ATLAS_NOT_THREAD_SAFE ( )
inlineoverridevirtualinherited

Reimplemented in BCMPrimeDetectorTool, HGTD_DetectorTool, HGTD_GMX_DetectorTool, PLRDetectorTool, and TRT_DetectorTool.

Definition at line 26 of file GeoModelTool.h.

26{return StatusCode::FAILURE;}

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

virtual StatusCode align PixelDetectorTool::ATLAS_NOT_THREAD_SAFE ( IOVSVC_CALLBACK_ARGS )
overridevirtual

Reimplemented from GeoModelTool.

◆ clear()

StatusCode PixelDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 309 of file src/PixelDetectorTool.cxx.

310{
311 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::PixelDetectorManager>::ID(),m_manager->getName());
312 if(proxy) {
313 proxy->reset();
314 m_manager = nullptr;
315 }
316 return StatusCode::SUCCESS;
317}
const InDetDD::PixelDetectorManager * m_manager

◆ create()

StatusCode PixelDetectorTool::create ( )
finaloverridevirtual

Create the Detector Node corresponding to this tool.

Definition at line 70 of file src/PixelDetectorTool.cxx.

71{
72 if (m_devVersion) ATH_MSG_WARNING("You are using a development version. There are no guarantees of stability");
73
74 // Get the detector configuration.
75 ServiceHandle<IGeoDbTagSvc> geoDbTagSvc("GeoDbTagSvc",name());
76 ATH_CHECK(geoDbTagSvc.retrieve());
77
78 ServiceHandle<IRDBAccessSvc> rdbAccessSvc(geoDbTagSvc->getParamSvcName(),name());
79 ATH_CHECK(rdbAccessSvc.retrieve());
80
81
82 GeoModelExperiment* theExpt = nullptr;
83 ATH_CHECK(detStore()->retrieve(theExpt,"ATLAS"));
84
85 GeoPhysVol *world=theExpt->getPhysVol();
86 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTagSvc->getSqliteReader();
87
88 std::string detectorKey{""};
89 std::string detectorNode{""};
90 if(!sqliteReader) {
91 DecodeVersionKey decodeVersion(geoDbTagSvc.operator->(), "Pixel");
92 detectorKey = decodeVersion.tag();
93 detectorNode = decodeVersion.node();
94 if(decodeVersion.custom()) {
95 ATH_MSG_WARNING("PixelDetectorTool: Detector Information coming from a custom configuration!!" );
96 }
97 }
98
99 IRDBRecordset_ptr switchSet = rdbAccessSvc->getRecordsetPtr("PixelSwitches", detectorKey, detectorNode);
100 const IRDBRecord *switchTable = (*switchSet)[0];
101
102 std::string versionName;
103 std::string descrName="noDescr";
104
105 m_dc1Geometry = switchTable->getInt("DC1GEOMETRY");
106 m_initialLayout = switchTable->getInt("INITIALLAYOUT");
107 if (!switchTable->isFieldNull("VERSIONNAME")) {
108 versionName = switchTable->getString("VERSIONNAME");
109 }
110 if (!switchTable->isFieldNull("DESCRIPTION")) {
111 descrName = switchTable->getString("DESCRIPTION");
112 }
113 m_buildDBM = switchTable->getInt("BUILDDBM");
114
115 // Initialize switches
116 PixelSwitches switches;
117
118 switches.setServices(m_services);
120 switches.setAlignable(m_alignable);
122 switches.setDBM(m_buildDBM); //DBM flag
124
125 //JBdV
127 switches.setServices(m_services); //Overwrite there for the time being.
128
129 const PixelID * idHelper = nullptr;
130 ATH_CHECK(detStore()->retrieve(idHelper, "PixelID"));
131
132 // Retrieve the Geometry DB Interface
133 ATH_CHECK(m_geometryDBSvc.retrieve());
134
135 // Pass athena services to factory, etc
136 m_athenaComps = new PixelGeoModelAthenaComps;
137 m_athenaComps->setDetStore(detStore().operator->());
138 m_athenaComps->setGeoDbTagSvc(&*geoDbTagSvc);
139 m_athenaComps->setRDBAccessSvc(&*rdbAccessSvc);
140 m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc);
141 m_athenaComps->setIdHelper(idHelper);
142
143 // BCM Tool.
144 if (!m_bcmTool.empty()) {
145 if (!m_bcmTool.retrieve().isFailure()) {
146 ATH_MSG_INFO("BCM_GeoModel tool retrieved: " << m_bcmTool );
147 } else {
148 ATH_MSG_INFO("Could not retrieve " << m_bcmTool << " - BCM will not be built" );
149 }
150 m_athenaComps->setBCM(&*m_bcmTool);
151 }
152 else {
153 ATH_MSG_INFO("BCM not requested." );
154 }
155
156 // BLM Tool.
157 if (!m_blmTool.empty()) {
158 if (!m_blmTool.retrieve().isFailure()) {
159 ATH_MSG_INFO("BLM_GeoModel tool retrieved: " << m_blmTool );
160 }
161 else {
162 ATH_MSG_INFO("Could not retrieve " << m_blmTool << " - BLM will not be built" );
163 }
164 m_athenaComps->setBLM(&*m_blmTool);
165 }
166 else {
167 ATH_MSG_INFO("BLM not requested." );
168 }
169
170 // Service builder tool
171 if (!m_serviceBuilderTool.empty()) {
172 if (!m_serviceBuilderTool.retrieve().isFailure()) {
173 ATH_MSG_INFO("Service builder tool retrieved: " << m_serviceBuilderTool );
174 m_athenaComps->setServiceBuilderTool(&*m_serviceBuilderTool);
175 }
176 else {
177 ATH_MSG_ERROR("Could not retrieve " << m_serviceBuilderTool << ", some services will not be built." );
178 }
179 }
180 else {
181 if (versionName == "SLHC") { // TODO
182 ATH_MSG_ERROR("Service builder tool not specified. Some services will not be built" );
183 }
184 else {
185 ATH_MSG_INFO("Service builder tool not specified." );
186 }
187 }
188
189 if(sqliteReader) {
190 // ---------------------- Build from SQLite file --------------------------
191 ATH_MSG_INFO("Building the geometry from the SQLite file");
192
193 ATH_MSG_DEBUG("Creating the Pixel ");
194 ATH_MSG_DEBUG("Pixel Geometry Options:");
195 ATH_MSG_DEBUG(" Services = " << (m_services ? "true" : "false"));
196 ATH_MSG_DEBUG(" Alignable = " << (m_alignable ? "true" : "false"));
197 ATH_MSG_DEBUG(" DC1Geometry = " << (m_dc1Geometry ? "true" : "false"));
198 ATH_MSG_DEBUG(" InitialLayout = " << (m_initialLayout ? "true" : "false"));
199 ATH_MSG_DEBUG(" VersioName = " << versionName );
200
201 if (versionName == "IBL") switches.setIBL();
202
203 PixelDetectorFactoryLite thePixelFactory(sqliteReader,m_athenaComps,switches);
204 thePixelFactory.create(world);
205 m_manager=thePixelFactory.getDetectorManager();
206 }
207 else {
208 // ---------------------- Build from GeometryDB --------------------------
209 ATH_MSG_INFO("Building Pixel Detector with Version Tag: " << detectorKey
210 << " at Node: " << detectorNode);
211
212 ATH_MSG_INFO("Building the geometry in the standard way");
213
214 // Print the version tag:
215 std::string pixelVersionTag = rdbAccessSvc->getChildTag("Pixel", detectorKey, detectorNode);
216 ATH_MSG_INFO("Pixel Version: " << pixelVersionTag );
217
218 // Check if version is empty. If so, then the Pixel cannot be built. This may or may not be intentional.
219 // We just issue an INFO message.
220 if (pixelVersionTag.empty()) {
221 ATH_MSG_INFO("No Pixel Version. Pixel Detector will not be built." );
222 return StatusCode::SUCCESS;
223 }
224
225 // Unless we are using custom pixel, the switch positions are going to
226 // come from the database:
227
228 ATH_MSG_DEBUG("PixelDetectorTool: Detector Information coming from the database and job options IGNORED." );
229 ATH_MSG_DEBUG("Keys for Pixel Switches are " << detectorKey << " " << detectorNode );
230
231 if (versionName.empty()) {
232 if (m_dc1Geometry) {
233 versionName = "DC1";
234 }
235 else {
236 versionName = "DC2";
237 }
238 }
239
240 if (!m_overrideVersionName.empty()) {
241 versionName = m_overrideVersionName;
242 ATH_MSG_INFO("Overriding version name: " << versionName );
243 }
244
245 ATH_MSG_DEBUG("Creating the Pixel " );
246 ATH_MSG_DEBUG("Pixel Geometry Options:" );
247 ATH_MSG_DEBUG(" Services = " << (m_services ? "true" : "false") );
248 ATH_MSG_DEBUG(" Alignable = " << (m_alignable ? "true" : "false"));
249 ATH_MSG_DEBUG(" DC1Geometry = " << (m_dc1Geometry ? "true" : "false"));
250 ATH_MSG_DEBUG(" InitialLayout = " << (m_initialLayout ? "true" : "false"));
251 ATH_MSG_DEBUG(" VersioName = " << versionName );
252
253 if (m_IBLParameterSvc.retrieve().isFailure()) {
254 ATH_MSG_WARNING( "Could not retrieve IBLParameterSvc");
255 }
256 else {
257 m_IBLParameterSvc->setBoolParameters(m_alignable,"alignable");
258 }
259
260 if (versionName == "IBL") switches.setIBL();
261
262 if (!m_devVersion) {
263
264 if(versionName == "DC1" || versionName == "DC2") {
265 // DC1/DC2 version
266 PixelDetectorFactoryDC2 thePixel(m_athenaComps, switches);
267 thePixel.create(world);
268 m_manager = thePixel.getDetectorManager();
269 }
270 else if (versionName == "SR1") {
271 // SR1. Same a DC3 but only 1 part (barrel, ec A or ec C) built
272 PixelDetectorFactorySR1 thePixel(m_athenaComps, switches);
273 thePixel.create(world);
274 m_manager = thePixel.getDetectorManager();
275 }
276 else {
277 // DC3, SLHC, IBL
278 PixelDetectorFactory thePixel(m_athenaComps, switches);
279 if(descrName.compare("TrackingGeometry")!=0) {
280 thePixel.create(world);
281 }
282 else {
283 ATH_MSG_INFO("Pixel - TrackingGeometry tag - no geometry built" );
284 }
285 m_manager = thePixel.getDetectorManager();
286 }
287
288 }
289 else {
290 // DEVELOPMENT VERSIONS
291 PixelDetectorFactory thePixel(m_athenaComps, switches);
292 thePixel.create(world);
293 m_manager = thePixel.getDetectorManager();
294 }
295 }
296
297 // Register the manager to the Det Store
298 ATH_CHECK(detStore()->record(m_manager, m_manager->getName()));
299 // Add the manager to the experiment
300 theExpt->addManager(m_manager);
301
302 // Symlink the manager
303 const SiDetectorManager * siDetManager = m_manager;
304 ATH_CHECK(detStore()->symLink(m_manager, siDetManager));
305
306 return StatusCode::SUCCESS;
307}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
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.
ToolHandle< IGeoSubDetTool > m_bcmTool
ToolHandle< IGeoSubDetTool > m_blmTool
ServiceHandle< IGeometryDBSvc > m_geometryDBSvc
ServiceHandle< IIBLParameterSvc > m_IBLParameterSvc
PublicToolHandle< IInDetServMatBuilderTool > m_serviceBuilderTool
void setInitialLayout(bool flag)
void setIBL(bool flag=true)
void setServices(bool flag)
void setServicesOnLadder(bool flag)
void setDC1Geometry(bool flag)
void setDBM(bool flag=false)
void setDynamicAlignFolders(const bool useDynAlignFolders)
void setAlignable(bool flag)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ initialize()

StatusCode PixelDetectorTool::initialize ( )
finaloverridevirtual

Definition at line 56 of file src/PixelDetectorTool.cxx.

57{
58 if (!m_bcmTool.empty()) {
59 ATH_CHECK( m_bcmTool.retrieve() );
60 }
61 if (!m_blmTool.empty()) {
62 ATH_CHECK( m_blmTool.retrieve() );
63 }
64 return StatusCode::SUCCESS;
65}

◆ manager() [1/2]

virtual GeoVDetectorManager * GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 22 of file GeoModelTool.h.

22{return m_detector;}
GeoVDetectorManager * m_detector

◆ manager() [2/2]

virtual const GeoVDetectorManager * GeoModelTool::manager ( ) const
inlinevirtualinherited

Definition at line 23 of file GeoModelTool.h.

23{return m_detector;}

Member Data Documentation

◆ m_alignable

bool PixelDetectorTool::m_alignable {true}
private

Definition at line 48 of file src/PixelDetectorTool.h.

48{true};

◆ m_athenaComps

PixelGeoModelAthenaComps* PixelDetectorTool::m_athenaComps {}
private

Definition at line 61 of file src/PixelDetectorTool.h.

61{};

◆ m_bcmTool

ToolHandle< IGeoSubDetTool > PixelDetectorTool::m_bcmTool {this,"BCM_Tool","",""}
private

Definition at line 54 of file src/PixelDetectorTool.h.

54{this,"BCM_Tool","",""};

◆ m_blmTool

ToolHandle< IGeoSubDetTool > PixelDetectorTool::m_blmTool {this,"BLM_Tool","",""}
private

Definition at line 55 of file src/PixelDetectorTool.h.

55{this,"BLM_Tool","",""};

◆ m_buildDBM

bool PixelDetectorTool::m_buildDBM {false}
private

Definition at line 52 of file src/PixelDetectorTool.h.

52{false};

◆ m_dc1Geometry

bool PixelDetectorTool::m_dc1Geometry {false}
private

Definition at line 47 of file src/PixelDetectorTool.h.

47{false};

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 30 of file GeoModelTool.h.

30{nullptr};

◆ m_detectorName

std::string PixelDetectorTool::m_detectorName {"PixelDetector"}
private

Definition at line 45 of file src/PixelDetectorTool.h.

45{"PixelDetector"};

◆ m_devVersion

bool PixelDetectorTool::m_devVersion {false}
private

Definition at line 51 of file src/PixelDetectorTool.h.

51{false};

◆ m_geometryDBSvc

ServiceHandle< IGeometryDBSvc > PixelDetectorTool::m_geometryDBSvc {this,"GeometryDBSvc","InDetGeometryDBSvc",""}
private

Definition at line 57 of file src/PixelDetectorTool.h.

57{this,"GeometryDBSvc","InDetGeometryDBSvc",""};

◆ m_IBLParameterSvc

ServiceHandle<IIBLParameterSvc> PixelDetectorTool::m_IBLParameterSvc {this,"IBLParameterSvc","IBLParameterSvc",""}
private

Definition at line 46 of file src/PixelDetectorTool.h.

46{this,"IBLParameterSvc","IBLParameterSvc",""};

◆ m_initialLayout

bool PixelDetectorTool::m_initialLayout {false}
private

Definition at line 50 of file src/PixelDetectorTool.h.

50{false};

◆ m_manager

const InDetDD::PixelDetectorManager* PixelDetectorTool::m_manager {nullptr}
private

Definition at line 58 of file src/PixelDetectorTool.h.

58{nullptr};

◆ m_overrideVersionName

std::string PixelDetectorTool::m_overrideVersionName
private

Definition at line 59 of file src/PixelDetectorTool.h.

◆ m_serviceBuilderTool

PublicToolHandle< IInDetServMatBuilderTool > PixelDetectorTool::m_serviceBuilderTool {this,"ServiceBuilderTool","",""}
private

Definition at line 56 of file src/PixelDetectorTool.h.

56{this,"ServiceBuilderTool","",""};

◆ m_services

bool PixelDetectorTool::m_services {true}
private

Definition at line 43 of file src/PixelDetectorTool.h.

43{true};

◆ m_servicesOnLadder

bool PixelDetectorTool::m_servicesOnLadder {true}
private

Definition at line 44 of file src/PixelDetectorTool.h.

44{true}; //JBdV

◆ m_tweakIBLDist

bool PixelDetectorTool::m_tweakIBLDist {true}
private

Definition at line 49 of file src/PixelDetectorTool.h.

49{true}; // whether to tweak L3 transforms with IBLDist

◆ m_useDynamicAlignFolders

bool PixelDetectorTool::m_useDynamicAlignFolders {false}
private

Definition at line 53 of file src/PixelDetectorTool.h.

53{false};

The documentation for this class was generated from the following files: