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

#include <TileDetectorTool.h>

Inheritance diagram for TileDetectorTool:
Collaboration diagram for TileDetectorTool:

Public Member Functions

 TileDetectorTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~TileDetectorTool () override final
virtual StatusCode create () override final
virtual StatusCode clear () override final
bool isTestBeam () const
bool isAddPlates () const
int uShape () const
virtual GeoVDetectorManager * manager ()
virtual const GeoVDetectorManager * manager () const
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

StatusCode initIds ()
StatusCode createElements ()
void setSwitch (int &param, int value, const char *name)

Private Attributes

TileSwitches m_switches
Gaudi::Property< std::vector< std::string > > m_volumes {this, "TopVolumes", {}, "List of top-level volumes where crack scintillators will be placed"}
bool m_not_locked
bool m_useNewFactory
std::string m_geometryConfig
TileDetDescrManagerm_manager

Detailed Description

Definition at line 16 of file TileDetectorTool.h.

Constructor & Destructor Documentation

◆ TileDetectorTool()

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

Definition at line 39 of file TileDetectorTool.cxx.

42 : GeoModelTool(type, name, parent)
43 , m_switches(false,true)
44 , m_not_locked(true)
45 , m_useNewFactory(true)
46 , m_geometryConfig("FULL")
47 , m_manager(0)
48{
49 declareProperty("UseNewFactory", m_useNewFactory);
50 declareProperty("GeometryConfig",m_geometryConfig);
51 declareProperty("TestBeam", m_switches.testBeam);
52 // declareProperty("AddPlatesToCellVolume", m_switches.addPlatesToCell); to make user aware that the value is taken from DB rather from JO
53 declareProperty("Ushape",m_switches.uShape);
54 declareProperty("Glue",m_switches.glue);
55 declareProperty("PVT",m_switches.pvt);
56 declareProperty("Steel",m_switches.steel);
57 declareProperty("CsTube",m_switches.csTube);
58 declareProperty("CrackOption",m_switches.crackOption);
59}
TileDetDescrManager * m_manager
TileSwitches m_switches
std::string m_geometryConfig

◆ ~TileDetectorTool()

TileDetectorTool::~TileDetectorTool ( )
finaloverridevirtual

Definition at line 62 of file TileDetectorTool.cxx.

63{
64}

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()

StatusCode TileDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 205 of file TileDetectorTool.cxx.

206{
207 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<TileDetDescrManager>::ID(),m_manager->getName());
208 if (proxy) {
209 proxy->reset();
210 m_manager = 0;
211 }
212 return StatusCode::SUCCESS;
213}

◆ create()

StatusCode TileDetectorTool::create ( )
finaloverridevirtual

Definition at line 83 of file TileDetectorTool.cxx.

84{
85 MsgStream log(msgSvc(), name());
86 ATH_MSG_INFO(" Entering TileDetectorTool::create()");
87
88 // Get the detector configuration
89 SmartIF<IGeoModelSvc> geoModel{service("GeoModelSvc")};
90 ATH_CHECK(geoModel.isValid());
91
92 std::string atlasVersion = geoModel->atlasVersion();
93 std::string tileVersion = geoModel->tileVersionOverride();
94
95 std::string versionTag = tileVersion.empty()? atlasVersion : tileVersion;
96 std::string versionNode = tileVersion.empty()? "ATLAS" : "TileCal";
97
98 if (versionTag == "AUTO") {
99 versionTag = "TileCal-00";
100 versionNode = "TileCal";
101 }
102 if (atlasVersion.compare(0,9,"ATLAS-CTB") == 0 || tileVersion.compare(0,6,"TileTB") == 0) {
103 ATH_MSG_INFO("CTB geometry detected: " << atlasVersion << " " << tileVersion);
104 m_switches.testBeam = true;
105 }
106
107 //Locate the top level experiment node
108 GeoModelExperiment* theExpt = nullptr;
109 CHECK( detStore()->retrieve(theExpt, "ATLAS") );
110
111 if ( 0 == m_detector ) {
112 // Get the detector configuration.
113 ServiceHandle<IGeoDbTagSvc> geoDbTag("GeoDbTagSvc",name());
114 ATH_CHECK(geoDbTag.retrieve());
115
116 // Get the 'new' accessSvc to get parameters / DB data from the DD SQLite input file.
117 ServiceHandle<IRDBAccessSvc> accessSvc(geoDbTag->getParamSvcName(),name());
118 ATH_CHECK(accessSvc.retrieve());
119
120 // Get the SQLite reader, if specified in the jobOption
121 GeoModelIO::ReadGeoModel* sqliteReader = geoDbTag->getSqliteReader();
122
123 // Get the Tile 'DDDB' and 'DetDescr' managers
124 // Note: we need to pass the raw IRDBAccess* to the TildDddbManager constructor.
125 bool sqliteInput = false;
126 if (sqliteReader) sqliteInput = true;
127 TileDddbManager_ptr dbManager(new TileDddbManager(&*accessSvc,versionTag,versionNode, sqliteInput));
128 m_manager = new TileDetDescrManager(dbManager);
129
130 // check what factory can be used
131 if (0==dbManager->GetNumberOfEnv() && m_useNewFactory) {
132 ATH_MSG_WARNING("New TileAtlasFactory can not be used because TileGlobals do not exist in Database");
133 ATH_MSG_WARNING("Use old TileDetectorFactory instead");
134 m_useNewFactory = false;
135 }
136
137 CHECK( initIds() );
138
139 m_switches.addPlatesToCell = dbManager->addPlatesToCell();
140 setSwitch(m_switches.uShape, dbManager->uShape(), "Ushape");
141 setSwitch(m_switches.glue, dbManager->glue(), "Glue");
142 setSwitch(m_switches.pvt, dbManager->PVT(), "PVT");
143 setSwitch(m_switches.steel, dbManager->steel(), "Steel");
144 setSwitch(m_switches.csTube, dbManager->csTube(), "CsTube");
145
146 m_not_locked = false;
147
148 GeoPhysVol *world=&*theExpt->getPhysVol();
149
150 // build the geometry from the standalone SQLite file
151 if (sqliteReader) {
152 TileDetectorFactoryLite theTileFactoryLite(detStore().operator->(),
153 m_manager,
154 sqliteReader,
155 accessSvc.operator->(),
157 &log,
158 true);
159 theTileFactoryLite.create(world);
160 } else {
161 // build the geometry from the Oracle-based GeometryDB
162 if (m_switches.testBeam) {
163 // TileTBFactory is not thread-safe. But since this code should only be
164 // ever called once (and this is "only" for test beam geometry), we use
165 // this rather ugly hack to silence the thread-checker warnings:
166 [[maybe_unused]] static const bool do_once ATLAS_THREAD_SAFE = [&]() ATLAS_NOT_THREAD_SAFE {
167 TileCablingService::getInstance_nc()->setTestBeam(true);
168 TileTBFactory theTileTBFactory = TileTBFactory(detStore().operator->(),m_manager,m_switches,&log);
169 theTileTBFactory.create(world);
170 return true;
171 }();
172
173 } else if (m_useNewFactory) {
174 std::vector<GeoPhysVol *> volumePtrs;
175 std::vector<double> volumePositions;
176 TileAtlasFactory theTileFactory(detStore().operator->(),m_manager,m_switches,m_volumes,volumePtrs,volumePositions,&log,m_geometryConfig=="FULL");
177 theTileFactory.create(world);
178
179 } else {
180 TileDetectorFactory theTileFactory(detStore().operator->(),m_manager,m_switches,&log);
181 theTileFactory.create(world);
182 }
183 } // end of building the geometry from the GeometryDB
184 ATH_MSG_DEBUG( "The Tile raw geometry has been built.");
185
187
188 // Register the TileDetDescrManager instance with the Transient Detector Store
189 CHECK( detStore()->record(m_manager, m_manager->getName()) );
190 theExpt->addManager(m_manager);
191
192 // For reco jobs: release DB manager. Cannot do it here for simulation jobs, they
193 // release DB manager as part of global GeoModel release
194 if (m_geometryConfig=="RECO")
195 m_manager->releaseDbManager();
196
197 return StatusCode::SUCCESS;
198
199 }
200
201 return StatusCode::FAILURE;
202}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
std::shared_ptr< TileDddbManager > TileDddbManager_ptr
#define ATLAS_THREAD_SAFE
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
GeoVDetectorManager * m_detector
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE() override
void setSwitch(int &param, int value, const char *name)
Gaudi::Property< std::vector< std::string > > m_volumes
StatusCode createElements()
virtual void create(GeoPhysVol *world) override
Creation of Test Beam Tile geometry.
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ createElements()

StatusCode TileDetectorTool::createElements ( )
private

Definition at line 242 of file TileDetectorTool.cxx.

243{
244 m_manager->create_elements(true);
245 return StatusCode::SUCCESS;
246}

◆ initIds()

StatusCode TileDetectorTool::initIds ( )
private

Definition at line 216 of file TileDetectorTool.cxx.

217{
218 const TileID* tileID;
219 const CaloCell_ID* cellID;
220 const TileHWID* tileHWID;
221
222 // Retrieve all helpers from the detector store
223 CHECK( detStore()->retrieve(tileID, "TileID") );
224 CHECK( detStore()->retrieve(tileHWID, "TileHWID") );
225 CHECK( detStore()->retrieve(cellID, "CaloCell_ID") );
226
227 m_manager->set_helper(tileID);
228 m_manager->set_helper(cellID);
229 m_manager->set_helper(tileHWID);
230
231 // instantiate Cabling Svc to initialize pointers to helpers there
232 const TileCablingService * cabling = TileCablingService::getInstance();
233 if (cabling==0) {
234 ATH_MSG_ERROR("Could not get instance of TileCablingService");
235 return StatusCode::FAILURE;
236 }
237
238 return StatusCode::SUCCESS;
239}
#define ATH_MSG_ERROR(x)
static const TileCablingService * getInstance()
get pointer to service instance

◆ isAddPlates()

bool TileDetectorTool::isAddPlates ( ) const
inline

Definition at line 30 of file TileDetectorTool.h.

30{ return m_switches.addPlatesToCell; }

◆ isTestBeam()

bool TileDetectorTool::isTestBeam ( ) const
inline

Definition at line 29 of file TileDetectorTool.h.

29{ return m_switches.testBeam; }

◆ 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;}

◆ setSwitch()

void TileDetectorTool::setSwitch ( int & param,
int value,
const char * name )
private

Definition at line 67 of file TileDetectorTool.cxx.

68{
69 if (param < 0) {
70 param = value;
71 ATH_MSG_INFO(name << " parameter from database is: " << param);
72 } else {
73 if (param != value) {
74 ATH_MSG_WARNING("Overriding " << name << " value from DB by value from jobOptions, using "
75 << param << " instead of " << value);
76 } else {
77 ATH_MSG_INFO(name << " parameter from jobOptions is: " << param);
78 }
79 }
80}

◆ uShape()

int TileDetectorTool::uShape ( ) const
inline

Definition at line 31 of file TileDetectorTool.h.

31{ return m_switches.uShape; }

Member Data Documentation

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 30 of file GeoModelTool.h.

30{nullptr};

◆ m_geometryConfig

std::string TileDetectorTool::m_geometryConfig
private

Definition at line 44 of file TileDetectorTool.h.

◆ m_manager

TileDetDescrManager* TileDetectorTool::m_manager
private

Definition at line 45 of file TileDetectorTool.h.

◆ m_not_locked

bool TileDetectorTool::m_not_locked
private

Definition at line 42 of file TileDetectorTool.h.

◆ m_switches

TileSwitches TileDetectorTool::m_switches
private

Definition at line 39 of file TileDetectorTool.h.

◆ m_useNewFactory

bool TileDetectorTool::m_useNewFactory
private

Definition at line 43 of file TileDetectorTool.h.

◆ m_volumes

Gaudi::Property<std::vector<std::string> > TileDetectorTool::m_volumes {this, "TopVolumes", {}, "List of top-level volumes where crack scintillators will be placed"}
private

Definition at line 40 of file TileDetectorTool.h.

40{this, "TopVolumes", {}, "List of top-level volumes where crack scintillators will be placed"};

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