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

#include <ToyDetectorTool.h>

Inheritance diagram for ToyDetectorTool:
Collaboration diagram for ToyDetectorTool:

Public Member Functions

 ToyDetectorTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~ToyDetectorTool () override final
virtual StatusCode create () override final
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const
virtual StatusCode clear () override
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override
virtual StatusCode align ATLAS_NOT_THREAD_SAFE (IOVSVC_CALLBACK_ARGS) override

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Member Functions

void printVolume (GeoPVConstLink volime, int level=0)

Detailed Description

Definition at line 11 of file ToyDetectorTool.h.

Constructor & Destructor Documentation

◆ ToyDetectorTool()

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

Definition at line 18 of file ToyDetectorTool.cxx.

19 : GeoModelTool( type, name, parent )
20{
21}

◆ ~ToyDetectorTool()

ToyDetectorTool::~ToyDetectorTool ( )
finaloverridevirtual

Definition at line 23 of file ToyDetectorTool.cxx.

24{
25 delete m_detector;
26}
GeoVDetectorManager * m_detector

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 GeoModelTool::ATLAS_NOT_THREAD_SAFE ( IOVSVC_CALLBACK_ARGS )
inlineoverridevirtualinherited

Reimplemented in HGTD_DetectorTool, LArDetectorToolNV, PixelDetectorTool, SCT_DetectorTool, and TRT_DetectorTool.

Definition at line 27 of file GeoModelTool.h.

27{return StatusCode::SUCCESS;}

◆ clear()

◆ create()

StatusCode ToyDetectorTool::create ( )
finaloverridevirtual

Definition at line 28 of file ToyDetectorTool.cxx.

29{
30 ATH_MSG_INFO("ToyDetectorTool::create() ...");
31
32 // Locate the top level experiment
33 GeoModelExperiment* theExpt = nullptr;
34 ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
35
36 ToyDetectorFactory theToyFactory(detStore().operator->());
37 if(m_detector==nullptr) {
38 // Build geometry
39 try {
40 //
41 // This strange way of casting is to avoid an
42 // utterly brain damaged compiler warning.
43 //
44 GeoPhysVol *world=theExpt->getPhysVol();
45 theToyFactory.create(world);
46 printVolume(world);
47 }
48 catch (const std::bad_alloc&) {
49 ATH_MSG_FATAL("Could not Toy Detector Geometry!");
50 return StatusCode::FAILURE;
51 }
52 // Add detector manager to AtlasExperiment and also record it into DetStore
53 theExpt->addManager(theToyFactory.getDetectorManager());
54 if (detStore()->record(theToyFactory.getDetectorManager(),theToyFactory.getDetectorManager()->getName()).isSuccess()) return StatusCode::SUCCESS;
55 ATH_MSG_FATAL("Failed to record Toy Detector Manager into Detector Store!");
56 }
57 else {
58 ATH_MSG_FATAL("Attempt to build Toy Detector Geometry one more time. The geometry can be built only once!");
59 }
60 return StatusCode::FAILURE;
61}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
void printVolume(GeoPVConstLink volime, int level=0)
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ manager() [1/2]

virtual GeoVDetectorManager * GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 22 of file GeoModelTool.h.

22{return m_detector;}

◆ manager() [2/2]

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

Definition at line 23 of file GeoModelTool.h.

23{return m_detector;}

◆ printVolume()

void ToyDetectorTool::printVolume ( GeoPVConstLink volime,
int level = 0 )
private

Definition at line 63 of file ToyDetectorTool.cxx.

64{
65 GeoVolumeCursor cursor(volume);
66 while(!cursor.atEnd()) {
67 GeoPVConstLink physChild = cursor.getVolume();
68 GeoTrf::Transform3D position = cursor.getTransform();
69 for(int k{0};k<level;++k) std::cout << "... ";
70 std::cout << cursor.getName() << " " << (cursor.getId()?std::to_string(cursor.getId().value()).c_str():"N/A")
71 << " Transform:" << "\n";
72 for(int i{0};i<3;++i) {
73 for(int j{0};j<4;++j) {
74 std::cout << position(i,j) << " ";
75 }
76 std::cout << "\n";
77 }
78 printVolume(physChild, level+1);
79 cursor.next();
80 }
81}

Member Data Documentation

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 30 of file GeoModelTool.h.

30{nullptr};

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