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 () override
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const

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

◆ align()

StatusCode PixelDetectorTool::align ( )
overridevirtual

Reimplemented from GeoModelTool.

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

311{
312 if (!m_manager) {
313 ATH_MSG_WARNING("Manager does not exist" );
314 return StatusCode::FAILURE;
315 }
316 if (m_alignable) {
317 return const_cast<InDetDD::PixelDetectorManager*>(m_manager)->align();
318 } else{
319 ATH_MSG_DEBUG("Alignment disabled. No alignments applied" );
320 return StatusCode::SUCCESS;
321 }
322}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
virtual StatusCode align() override
const InDetDD::PixelDetectorManager * m_manager

◆ clear()

StatusCode PixelDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

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

299{
300 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::PixelDetectorManager>::ID(),m_manager->getName());
301 if(proxy) {
302 proxy->reset();
303 m_manager = nullptr;
304 }
305 return StatusCode::SUCCESS;
306}

◆ 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 m_athenaComps->setBCM(m_bcmTool.get());
146 }
147 else {
148 ATH_MSG_INFO("BCM not requested." );
149 }
150
151 // BLM Tool.
152 if (!m_blmTool.empty()) {
153 m_athenaComps->setBLM(m_blmTool.get());
154 }
155 else {
156 ATH_MSG_INFO("BLM not requested." );
157 }
158
159 // Service builder tool
160 if (!m_serviceBuilderTool.empty()) {
161 if (!m_serviceBuilderTool.retrieve().isFailure()) {
162 ATH_MSG_INFO("Service builder tool retrieved: " << m_serviceBuilderTool );
163 m_athenaComps->setServiceBuilderTool(&*m_serviceBuilderTool);
164 }
165 else {
166 ATH_MSG_ERROR("Could not retrieve " << m_serviceBuilderTool << ", some services will not be built." );
167 }
168 }
169 else {
170 if (versionName == "SLHC") { // TODO
171 ATH_MSG_ERROR("Service builder tool not specified. Some services will not be built" );
172 }
173 else {
174 ATH_MSG_INFO("Service builder tool not specified." );
175 }
176 }
177
178 if(sqliteReader) {
179 // ---------------------- Build from SQLite file --------------------------
180 ATH_MSG_INFO("Building the geometry from the SQLite file");
181
182 ATH_MSG_DEBUG("Creating the Pixel ");
183 ATH_MSG_DEBUG("Pixel Geometry Options:");
184 ATH_MSG_DEBUG(" Services = " << (m_services ? "true" : "false"));
185 ATH_MSG_DEBUG(" Alignable = " << (m_alignable ? "true" : "false"));
186 ATH_MSG_DEBUG(" DC1Geometry = " << (m_dc1Geometry ? "true" : "false"));
187 ATH_MSG_DEBUG(" InitialLayout = " << (m_initialLayout ? "true" : "false"));
188 ATH_MSG_DEBUG(" VersioName = " << versionName );
189
190 if (versionName == "IBL") switches.setIBL();
191
192 PixelDetectorFactoryLite thePixelFactory(sqliteReader,m_athenaComps,switches);
193 thePixelFactory.create(world);
194 m_manager=thePixelFactory.getDetectorManager();
195 }
196 else {
197 // ---------------------- Build from GeometryDB --------------------------
198 ATH_MSG_INFO("Building Pixel Detector with Version Tag: " << detectorKey
199 << " at Node: " << detectorNode);
200
201 ATH_MSG_INFO("Building the geometry in the standard way");
202
203 // Print the version tag:
204 std::string pixelVersionTag = rdbAccessSvc->getChildTag("Pixel", detectorKey, detectorNode);
205 ATH_MSG_INFO("Pixel Version: " << pixelVersionTag );
206
207 // Check if version is empty. If so, then the Pixel cannot be built. This may or may not be intentional.
208 // We just issue an INFO message.
209 if (pixelVersionTag.empty()) {
210 ATH_MSG_INFO("No Pixel Version. Pixel Detector will not be built." );
211 return StatusCode::SUCCESS;
212 }
213
214 // Unless we are using custom pixel, the switch positions are going to
215 // come from the database:
216
217 ATH_MSG_DEBUG("PixelDetectorTool: Detector Information coming from the database and job options IGNORED." );
218 ATH_MSG_DEBUG("Keys for Pixel Switches are " << detectorKey << " " << detectorNode );
219
220 if (versionName.empty()) {
221 if (m_dc1Geometry) {
222 versionName = "DC1";
223 }
224 else {
225 versionName = "DC2";
226 }
227 }
228
229 if (!m_overrideVersionName.empty()) {
230 versionName = m_overrideVersionName;
231 ATH_MSG_INFO("Overriding version name: " << versionName );
232 }
233
234 ATH_MSG_DEBUG("Creating the Pixel " );
235 ATH_MSG_DEBUG("Pixel Geometry Options:" );
236 ATH_MSG_DEBUG(" Services = " << (m_services ? "true" : "false") );
237 ATH_MSG_DEBUG(" Alignable = " << (m_alignable ? "true" : "false"));
238 ATH_MSG_DEBUG(" DC1Geometry = " << (m_dc1Geometry ? "true" : "false"));
239 ATH_MSG_DEBUG(" InitialLayout = " << (m_initialLayout ? "true" : "false"));
240 ATH_MSG_DEBUG(" VersioName = " << versionName );
241
242 if (m_IBLParameterSvc.retrieve().isFailure()) {
243 ATH_MSG_WARNING( "Could not retrieve IBLParameterSvc");
244 }
245 else {
246 m_IBLParameterSvc->setBoolParameters(m_alignable,"alignable");
247 }
248
249 if (versionName == "IBL") switches.setIBL();
250
251 if (!m_devVersion) {
252
253 if(versionName == "DC1" || versionName == "DC2") {
254 // DC1/DC2 version
255 PixelDetectorFactoryDC2 thePixel(m_athenaComps, switches);
256 thePixel.create(world);
257 m_manager = thePixel.getDetectorManager();
258 }
259 else if (versionName == "SR1") {
260 // SR1. Same a DC3 but only 1 part (barrel, ec A or ec C) built
261 PixelDetectorFactorySR1 thePixel(m_athenaComps, switches);
262 thePixel.create(world);
263 m_manager = thePixel.getDetectorManager();
264 }
265 else {
266 // DC3, SLHC, IBL
267 PixelDetectorFactory thePixel(m_athenaComps, switches);
268 if(descrName.compare("TrackingGeometry")!=0) {
269 thePixel.create(world);
270 }
271 else {
272 ATH_MSG_INFO("Pixel - TrackingGeometry tag - no geometry built" );
273 }
274 m_manager = thePixel.getDetectorManager();
275 }
276
277 }
278 else {
279 // DEVELOPMENT VERSIONS
280 PixelDetectorFactory thePixel(m_athenaComps, switches);
281 thePixel.create(world);
282 m_manager = thePixel.getDetectorManager();
283 }
284 }
285
286 // Register the manager to the Det Store
287 ATH_CHECK(detStore()->record(m_manager, m_manager->getName()));
288 // Add the manager to the experiment
289 theExpt->addManager(m_manager);
290
291 // Symlink the manager
292 const SiDetectorManager * siDetManager = m_manager;
293 ATH_CHECK(detStore()->symLink(m_manager, siDetManager));
294
295 return StatusCode::SUCCESS;
296}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(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 21 of file GeoModelTool.h.

21{return m_detector;}
GeoVDetectorManager * m_detector

◆ manager() [2/2]

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

Definition at line 22 of file GeoModelTool.h.

22{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 28 of file GeoModelTool.h.

28{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: