ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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 ()
 The Detector Node corresponding to this tool. More...
 
virtual const GeoVDetectorManager * manager () const
 
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE () override
 
virtual StatusCode align (IOVSVC_CALLBACK_ARGS) override
 

Protected Attributes

GeoVDetectorManager * m_detector
 

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.

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
58  declareProperty("CrackOption",m_switches.crackOption);
59 }

◆ ~TileDetectorTool()

TileDetectorTool::~TileDetectorTool ( )
finaloverridevirtual

Definition at line 62 of file TileDetectorTool.cxx.

63 {
64 }

Member Function Documentation

◆ align()

StatusCode GeoModelTool::align ( IOVSVC_CALLBACK_ARGS  )
overridevirtualinherited

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

Definition at line 33 of file GeoModelTool.cxx.

34 {
35  return StatusCode::SUCCESS;
36 }

◆ ATLAS_NOT_THREAD_SAFE()

virtual StatusCode registerCallback GeoModelTool::ATLAS_NOT_THREAD_SAFE ( )
overridevirtualinherited

◆ clear()

StatusCode TileDetectorTool::clear ( )
finaloverridevirtual

Reimplemented from GeoModelTool.

Definition at line 205 of file TileDetectorTool.cxx.

206 {
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  IGeoModelSvc *geoModel;
90  ATH_CHECK(service ("GeoModelSvc",geoModel));
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->(),
156  m_switches,
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 
186  CHECK( createElements() );
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")
196 
197  return StatusCode::SUCCESS;
198 
199  }
200 
201  return StatusCode::FAILURE;
202 }

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

◆ 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]

GeoVDetectorManager * GeoModelTool::manager ( )
virtualinherited

The Detector Node corresponding to this tool.

Definition at line 21 of file GeoModelTool.cxx.

21  {
22  return m_detector;
23 }

◆ manager() [2/2]

const GeoVDetectorManager * GeoModelTool::manager ( ) const
virtualinherited

Definition at line 24 of file GeoModelTool.cxx.

24  {
25  return m_detector;
26 }

◆ 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
protectedinherited

Definition at line 36 of file GeoModelTool.h.

◆ 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.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
TileTBFactory::create
virtual void create(GeoPhysVol *world) override
Creation of Test Beam Tile geometry.
Definition: TileTBFactory.cxx:65
TileDddbManager_ptr
std::shared_ptr< TileDddbManager > TileDddbManager_ptr
Definition: TileDetDescrManager.h:28
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IGeoModelSvc
Definition: IGeoModelSvc.h:17
TileCablingService::getInstance
static const TileCablingService * getInstance()
get pointer to service instance
Definition: TileCablingService.cxx:24
TileAtlasFactory
Definition: TileAtlasFactory.h:27
TileAtlasFactory::create
virtual void create(GeoPhysVol *world)
Creation of Tile geometry.
Definition: TileAtlasFactory.cxx:100
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
TileDetectorTool::m_volumes
Gaudi::Property< std::vector< std::string > > m_volumes
Definition: TileDetectorTool.h:40
GeoModelExperiment
Definition: GeoModelExperiment.h:32
athena.value
value
Definition: athena.py:122
TileSwitches::testBeam
bool testBeam
setting up testbeam geometry or ATLAS geometry
Definition: TileSwitches.h:31
TileDetectorTool::m_not_locked
bool m_not_locked
Definition: TileDetectorTool.h:42
TileDetDescrManager::create_elements
void create_elements()
Definition: TileDetDescrManager.cxx:139
TileDetectorTool::m_useNewFactory
bool m_useNewFactory
Definition: TileDetectorTool.h:43
GeoModelTool::GeoModelTool
GeoModelTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor(s)
Definition: GeoModelTool.cxx:12
TileSwitches::steel
int steel
0: Absorber is pure Iron 1: Absorber is tile::Steel defined in DB
Definition: TileSwitches.h:51
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileSwitches::uShape
int uShape
0: simulation without U-shape 1: simulation with U-shape
Definition: TileSwitches.h:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileSwitches::glue
int glue
0: glue layer is removed and replaced by iron, 1: simulation with glue, 2: glue is replaced by iron +...
Definition: TileSwitches.h:43
TileDetectorFactory::create
virtual void create(GeoPhysVol *world)
Creation of Tile geometry.
Definition: TileDetectorFactory.cxx:63
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
TileTBFactory
Definition: TileTBFactory.h:28
TileDetectorTool::m_switches
TileSwitches m_switches
Definition: TileDetectorTool.h:39
TileDetDescrManager
Definition: TileDetDescrManager.h:33
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileDetectorFactoryLite::create
virtual void create(GeoPhysVol *world)
Creation of Tile geometry.
Definition: TileDetectorFactoryLite.cxx:61
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
TileDetDescrManager::set_helper
void set_helper(const TileID *id)
Definition: TileDetDescrManager.h:190
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileDetectorFactoryLite
Definition of the TileDetectorFactoryLite class. The TileDetectorFactoryLite is invoked by the TileDe...
Definition: TileDetectorFactoryLite.h:42
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileDetectorTool::m_manager
TileDetDescrManager * m_manager
Definition: TileDetectorTool.h:45
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
GeoModelTool::ATLAS_NOT_THREAD_SAFE
virtual StatusCode registerCallback ATLAS_NOT_THREAD_SAFE() override
TileDetectorFactory
Definition: TileDetectorFactory.h:25
TileCablingService
Definition: TileCablingService.h:23
TileDetectorTool::createElements
StatusCode createElements()
Definition: TileDetectorTool.cxx:242
TileSwitches::csTube
int csTube
0: without Cesium tubes 1: with cesium tubes
Definition: TileSwitches.h:55
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
TileSwitches::addPlatesToCell
bool addPlatesToCell
calculate cell volumes with or without front-plates and end-plates
Definition: TileSwitches.h:34
GeoModelTool::m_detector
GeoVDetectorManager * m_detector
Definition: GeoModelTool.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TileDetectorTool::initIds
StatusCode initIds()
Definition: TileDetectorTool.cxx:216
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
TileSwitches::crackOption
int crackOption
0: crack scintillators in ext.barrel top-level envelopes 1: crack scintillators in separate TileCal t...
Definition: TileSwitches.h:70
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileSwitches::pvt
int pvt
0: all scintillators are polystyrene 1: crack scrintillators are PVT, others - polystyrene
Definition: TileSwitches.h:47
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
TileDetectorTool::setSwitch
void setSwitch(int &param, int value, const char *name)
Definition: TileDetectorTool.cxx:67
TileDetDescrManager::releaseDbManager
void releaseDbManager()
Definition: TileDetDescrManager.cxx:100
IGeoModelSvc::atlasVersion
virtual const std::string & atlasVersion() const =0
TileDddbManager
This class provides access to constants in the Geometry DB.
Definition: TileDddbManager.h:38
SG::DataProxy
Definition: DataProxy.h:44
IGeoModelSvc::tileVersionOverride
virtual const std::string & tileVersionOverride() const =0
TileDetectorTool::m_geometryConfig
std::string m_geometryConfig
Definition: TileDetectorTool.h:44
ServiceHandle< IGeoDbTagSvc >