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

Protected Attributes

GeoVDetectorManager * m_detector {nullptr}

Private Member Functions

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

Private Attributes

TileSwitches m_switches {false, true}
Gaudi::Property< bool > m_testBeam {this, "TestBeam", false}
Gaudi::Property< int > m_uShape {this, "Ushape", -1}
Gaudi::Property< int > m_glue {this, "Glue", -1}
Gaudi::Property< int > m_pvt {this, "PVT", -1}
Gaudi::Property< int > m_steel {this, "Steel", -1}
Gaudi::Property< int > m_csTube {this, "CsTube", -1}
Gaudi::Property< int > m_crackOption {this, "CrackOption", 0}
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 {true}
Gaudi::Property< bool > m_useNewFactory {this, "UseNewFactory", true}
Gaudi::Property< std::string > m_geometryConfig {this, "GeometryConfig", "FULL"}
TileDetDescrManager * m_manager {nullptr}

Detailed Description

Definition at line 18 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{
44}

◆ ~TileDetectorTool()

TileDetectorTool::~TileDetectorTool ( )
finaloverridevirtual

Definition at line 47 of file TileDetectorTool.cxx.

48{
49}

Member Function Documentation

◆ align()

virtual StatusCode GeoModelTool::align ( )
inlineoverridevirtualinherited

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

Definition at line 25 of file GeoModelTool.h.

25{return StatusCode::SUCCESS;}

◆ clear()

StatusCode TileDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 204 of file TileDetectorTool.cxx.

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

◆ create()

StatusCode TileDetectorTool::create ( )
finaloverridevirtual

Definition at line 80 of file TileDetectorTool.cxx.

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

◆ createElements()

StatusCode TileDetectorTool::createElements ( )
private

Definition at line 241 of file TileDetectorTool.cxx.

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

◆ fillSwitches()

void TileDetectorTool::fillSwitches ( )
private

Definition at line 52 of file TileDetectorTool.cxx.

53{
54 m_switches = TileSwitches(m_testBeam, true);
55 m_switches.uShape = m_uShape;
56 m_switches.glue = m_glue;
57 m_switches.pvt = m_pvt;
58 m_switches.steel = m_steel;
59 m_switches.csTube = m_csTube;
60 m_switches.crackOption = m_crackOption;
61}
Gaudi::Property< int > m_glue
Gaudi::Property< int > m_uShape
Gaudi::Property< int > m_steel
Gaudi::Property< int > m_pvt
Gaudi::Property< int > m_crackOption
Gaudi::Property< bool > m_testBeam
Gaudi::Property< int > m_csTube

◆ initIds()

StatusCode TileDetectorTool::initIds ( )
private

Definition at line 215 of file TileDetectorTool.cxx.

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

◆ isAddPlates()

bool TileDetectorTool::isAddPlates ( ) const
inline

Definition at line 32 of file TileDetectorTool.h.

32{ return m_switches.addPlatesToCell; }

◆ isTestBeam()

bool TileDetectorTool::isTestBeam ( ) const
inline

Definition at line 31 of file TileDetectorTool.h.

31{ return m_switches.testBeam; }

◆ manager() [1/2]

virtual GeoVDetectorManager * GeoModelTool::manager ( )
inlinevirtualinherited

Definition at line 21 of file GeoModelTool.h.

21{return m_detector;}

◆ manager() [2/2]

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

Definition at line 22 of file GeoModelTool.h.

22{return m_detector;}

◆ setSwitch()

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

Definition at line 64 of file TileDetectorTool.cxx.

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

◆ uShape()

int TileDetectorTool::uShape ( ) const
inline

Definition at line 33 of file TileDetectorTool.h.

33{ return m_switches.uShape; }

Member Data Documentation

◆ m_crackOption

Gaudi::Property<int> TileDetectorTool::m_crackOption {this, "CrackOption", 0}
private

Definition at line 53 of file TileDetectorTool.h.

53{this, "CrackOption", 0};

◆ m_csTube

Gaudi::Property<int> TileDetectorTool::m_csTube {this, "CsTube", -1}
private

Definition at line 52 of file TileDetectorTool.h.

52{this, "CsTube", -1};

◆ m_detector

GeoVDetectorManager* GeoModelTool::m_detector {nullptr}
protectedinherited

Definition at line 28 of file GeoModelTool.h.

28{nullptr};

◆ m_geometryConfig

Gaudi::Property<std::string> TileDetectorTool::m_geometryConfig {this, "GeometryConfig", "FULL"}
private

Definition at line 59 of file TileDetectorTool.h.

59{this, "GeometryConfig", "FULL"}; // FULL, SIMU, RECO --- A note: It's set to FULL by default in the constructor, and it seems that SIMU is never used in Athena code; also, the code that calls the TileAtlasFactory only checks if it's FULL or not: m_geometryConfig=='FULL' (RMB)

◆ m_glue

Gaudi::Property<int> TileDetectorTool::m_glue {this, "Glue", -1}
private

Definition at line 49 of file TileDetectorTool.h.

49{this, "Glue", -1};

◆ m_manager

TileDetDescrManager* TileDetectorTool::m_manager {nullptr}
private

Definition at line 60 of file TileDetectorTool.h.

60{nullptr};

◆ m_not_locked

bool TileDetectorTool::m_not_locked {true}
private

Definition at line 57 of file TileDetectorTool.h.

57{true};

◆ m_pvt

Gaudi::Property<int> TileDetectorTool::m_pvt {this, "PVT", -1}
private

Definition at line 50 of file TileDetectorTool.h.

50{this, "PVT", -1};

◆ m_steel

Gaudi::Property<int> TileDetectorTool::m_steel {this, "Steel", -1}
private

Definition at line 51 of file TileDetectorTool.h.

51{this, "Steel", -1};

◆ m_switches

TileSwitches TileDetectorTool::m_switches {false, true}
private

Definition at line 43 of file TileDetectorTool.h.

43{false, true};

◆ m_testBeam

Gaudi::Property<bool> TileDetectorTool::m_testBeam {this, "TestBeam", false}
private

Definition at line 46 of file TileDetectorTool.h.

46{this, "TestBeam", false};

◆ m_useNewFactory

Gaudi::Property<bool> TileDetectorTool::m_useNewFactory {this, "UseNewFactory", true}
private

Definition at line 58 of file TileDetectorTool.h.

58{this, "UseNewFactory", true};

◆ m_uShape

Gaudi::Property<int> TileDetectorTool::m_uShape {this, "Ushape", -1}
private

Definition at line 48 of file TileDetectorTool.h.

48{this, "Ushape", -1};

◆ 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 55 of file TileDetectorTool.h.

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

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