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","",""}
const InDetDD::PixelDetectorManagerm_manager {nullptr}
std::string m_overrideVersionName
PixelGeoModelAthenaCompsm_athenaComps {}

Detailed Description

Definition at line 24 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 305 of file src/PixelDetectorTool.cxx.

307{
308 if (!m_manager) {
309 ATH_MSG_WARNING("Manager does not exist" );
310 return StatusCode::FAILURE;
311 }
312 if (m_alignable) {
313 return const_cast<InDetDD::PixelDetectorManager*>(m_manager)->align();
314 } else{
315 ATH_MSG_DEBUG("Alignment disabled. No alignments applied" );
316 return StatusCode::SUCCESS;
317 }
318}
#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 294 of file src/PixelDetectorTool.cxx.

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

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

47{true};

◆ m_athenaComps

PixelGeoModelAthenaComps* PixelDetectorTool::m_athenaComps {}
private

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

59{};

◆ m_bcmTool

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

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

53{this,"BCM_Tool","",""};

◆ m_blmTool

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

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

54{this,"BLM_Tool","",""};

◆ m_buildDBM

bool PixelDetectorTool::m_buildDBM {false}
private

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

51{false};

◆ m_dc1Geometry

bool PixelDetectorTool::m_dc1Geometry {false}
private

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

46{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 44 of file src/PixelDetectorTool.h.

44{"PixelDetector"};

◆ m_devVersion

bool PixelDetectorTool::m_devVersion {false}
private

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

50{false};

◆ m_IBLParameterSvc

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

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

45{this,"IBLParameterSvc","IBLParameterSvc",""};

◆ m_initialLayout

bool PixelDetectorTool::m_initialLayout {false}
private

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

49{false};

◆ m_manager

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

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

56{nullptr};

◆ m_overrideVersionName

std::string PixelDetectorTool::m_overrideVersionName
private

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

◆ m_serviceBuilderTool

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

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

55{this,"ServiceBuilderTool","",""};

◆ m_services

bool PixelDetectorTool::m_services {true}
private

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

42{true};

◆ m_servicesOnLadder

bool PixelDetectorTool::m_servicesOnLadder {true}
private

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

43{true}; //JBdV

◆ m_tweakIBLDist

bool PixelDetectorTool::m_tweakIBLDist {true}
private

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

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

◆ m_useDynamicAlignFolders

bool PixelDetectorTool::m_useDynamicAlignFolders {false}
private

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

52{false};

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