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

#include <PixelDetectorTool.h>

Inheritance diagram for PixelDetectorTool:
Collaboration diagram for PixelDetectorTool:

Public Member Functions

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

Gaudi::Property< bool > m_services {this, "Services", true}
Gaudi::Property< bool > m_servicesOnLadder {this, "ServicesOnLadder", true}
std::string m_detectorName {"PixelDetector"}
ServiceHandle< IIBLParameterSvc > m_IBLParameterSvc {this,"IBLParameterSvc","IBLParameterSvc",""}
Gaudi::Property< bool > m_dc1Geometry {this, "DC1Geometry", false}
Gaudi::Property< bool > m_alignable {this, "Alignable", true}
Gaudi::Property< bool > m_tweakIBLDist {this, "TweakIBLDist", true, "whether to tweak L3 transforms with IBLDist"}
Gaudi::Property< bool > m_initialLayout {this, "InitialLayout", false}
Gaudi::Property< bool > m_devVersion {this, "DevVersion", false}
bool m_buildDBM {false}
Gaudi::Property< bool > m_useDynamicAlignFolders {this, "useDynamicAlignFolders", false}
ToolHandle< IGeoSubDetTool > m_bcmTool {this,"BCM_Tool","",""}
ToolHandle< IGeoSubDetTool > m_blmTool {this,"BLM_Tool","",""}
PublicToolHandle< IInDetServMatBuilderTool > m_serviceBuilderTool {this,"ServiceBuilderTool","",""}
const InDetDD::PixelDetectorManager * m_manager {nullptr}
Gaudi::Property< std::string > m_overrideVersionName {this, "OverrideVersionName", ""}
PixelGeoModelAthenaComps * m_athenaComps {}

Detailed Description

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

Constructor & Destructor Documentation

◆ ~PixelDetectorTool()

PixelDetectorTool::~PixelDetectorTool ( )
finaloverridevirtual

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

37{
38 delete m_athenaComps;
39}
PixelGeoModelAthenaComps * m_athenaComps

Member Function Documentation

◆ align()

StatusCode PixelDetectorTool::align ( )
overridevirtual

Reimplemented from GeoModelTool.

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

289{
290 if (!m_manager) {
291 ATH_MSG_WARNING("Manager does not exist" );
292 return StatusCode::FAILURE;
293 }
294 if (m_alignable) {
295 return const_cast<InDetDD::PixelDetectorManager*>(m_manager)->align();
296 } else{
297 ATH_MSG_DEBUG("Alignment disabled. No alignments applied" );
298 return StatusCode::SUCCESS;
299 }
300}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
virtual StatusCode align() override
const InDetDD::PixelDetectorManager * m_manager
Gaudi::Property< bool > m_alignable

◆ clear()

StatusCode PixelDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

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

277{
278 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::PixelDetectorManager>::ID(),m_manager->getName());
279 if(proxy) {
280 proxy->reset();
281 m_manager = nullptr;
282 }
283 return StatusCode::SUCCESS;
284}

◆ create()

StatusCode PixelDetectorTool::create ( )
finaloverridevirtual

Create the Detector Node corresponding to this tool.

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

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

◆ initialize()

StatusCode PixelDetectorTool::initialize ( )
finaloverridevirtual

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

43{
44 if (!m_bcmTool.empty()) {
45 ATH_CHECK( m_bcmTool.retrieve() );
46 }
47 if (!m_blmTool.empty()) {
48 ATH_CHECK( m_blmTool.retrieve() );
49 }
50 return StatusCode::SUCCESS;
51}

◆ 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

Gaudi::Property<bool> PixelDetectorTool::m_alignable {this, "Alignable", true}
private

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

47{this, "Alignable", 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

Gaudi::Property<bool> PixelDetectorTool::m_dc1Geometry {this, "DC1Geometry", false}
private

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

46{this, "DC1Geometry", 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

Gaudi::Property<bool> PixelDetectorTool::m_devVersion {this, "DevVersion", false}
private

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

50{this, "DevVersion", 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

Gaudi::Property<bool> PixelDetectorTool::m_initialLayout {this, "InitialLayout", false}
private

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

49{this, "InitialLayout", false};

◆ m_manager

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

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

56{nullptr};

◆ m_overrideVersionName

Gaudi::Property<std::string> PixelDetectorTool::m_overrideVersionName {this, "OverrideVersionName", ""}
private

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

57{this, "OverrideVersionName", ""};

◆ m_serviceBuilderTool

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

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

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

◆ m_services

Gaudi::Property<bool> PixelDetectorTool::m_services {this, "Services", true}
private

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

42{this, "Services", true};

◆ m_servicesOnLadder

Gaudi::Property<bool> PixelDetectorTool::m_servicesOnLadder {this, "ServicesOnLadder", true}
private

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

43{this, "ServicesOnLadder", true}; //JBdV

◆ m_tweakIBLDist

Gaudi::Property<bool> PixelDetectorTool::m_tweakIBLDist {this, "TweakIBLDist", true, "whether to tweak L3 transforms with IBLDist"}
private

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

48{this, "TweakIBLDist", true, "whether to tweak L3 transforms with IBLDist"};

◆ m_useDynamicAlignFolders

Gaudi::Property<bool> PixelDetectorTool::m_useDynamicAlignFolders {this, "useDynamicAlignFolders", false}
private

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

52{this, "useDynamicAlignFolders", false};

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