ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::ServiceVolumeMaker Class Reference

#include <ServiceVolumeMaker.h>

Collaboration diagram for InDetDD::ServiceVolumeMaker:

Public Member Functions

 ServiceVolumeMaker (const std::string &label, IRDBRecordset_ptr table, const ServiceVolumeSchema &schema, InDetDD::AthenaComps *)
 ServiceVolumeMaker (const ServiceVolumeMaker &)=delete
ServiceVolumeMakeroperator= (const ServiceVolumeMaker &)=delete
 ~ServiceVolumeMaker ()
const std::vector< const ServiceVolume * > & makeAll ()
ServiceVolumemake (int index)
unsigned int numElements () const

Private Attributes

std::string m_label
ServiceVolumeMakerMgrm_mgr
std::vector< const ServiceVolume * > m_services
std::vector< double > m_layerShift

Detailed Description

Definition at line 133 of file ServiceVolumeMaker.h.

Constructor & Destructor Documentation

◆ ServiceVolumeMaker() [1/2]

InDetDD::ServiceVolumeMaker::ServiceVolumeMaker ( const std::string & label,
IRDBRecordset_ptr table,
const ServiceVolumeSchema & schema,
InDetDD::AthenaComps * athenaComps )

Definition at line 259 of file ServiceVolumeMaker.cxx.

262 : m_label(label) {
263 m_mgr = new ServiceVolumeMakerMgr(std::move(table), schema, athenaComps);
264 m_layerShift = m_mgr->readLayerShift();
265 }
std::vector< double > m_layerShift
ServiceVolumeMakerMgr * m_mgr
std::string label(const std::string &format, int i)
Definition label.h:19

◆ ServiceVolumeMaker() [2/2]

InDetDD::ServiceVolumeMaker::ServiceVolumeMaker ( const ServiceVolumeMaker & )
delete

◆ ~ServiceVolumeMaker()

InDetDD::ServiceVolumeMaker::~ServiceVolumeMaker ( )

Definition at line 267 of file ServiceVolumeMaker.cxx.

267 {
268 for (unsigned int i = 0; i < m_services.size(); i++) {
269 delete m_services[i];
270 }
271 delete m_mgr;
272 }
std::vector< const ServiceVolume * > m_services

Member Function Documentation

◆ make()

ServiceVolume * InDetDD::ServiceVolumeMaker::make ( int index)

Definition at line 288 of file ServiceVolumeMaker.cxx.

288 {
289 //
290 // Retrieve/calculate the parameters for the volume.
291 //
292 ServiceVolume* param = new ServiceVolume;
293
294 param->setMaterial(m_mgr->materialName(ii));
295 param->setRmin(m_mgr->rmin(ii));
296 param->setRmax(m_mgr->rmax(ii));
297 param->setZmin(m_mgr->zmin(ii));
298 param->setZmax(m_mgr->zmax(ii));
299 param->setZsymm(m_mgr->zsymm(ii));
300 param->setVolName(m_mgr->volName(ii));
301
302 double zShift = 0.; // the famous IBL Z shift
303 if (m_mgr->shiftFlag(ii) > 0) zShift = m_layerShift[m_mgr->shiftFlag(ii) - 100];
304 param->setZShift(zShift);
305
306 int volId = m_mgr->volId(ii);
307 if (volId == 0) volId = ii + 1;
308
309 bool needsRotation = false;
310
311 // For TUBE there is no need to read the rest
312 std::string shapeType = m_mgr->shapeType(ii);
313 if (!m_mgr->schema().simple() && !shapeType.empty() && shapeType != "TUBE") {
314 double rmin2 = m_mgr->rmin2(ii);
315 double rmax2 = m_mgr->rmax2(ii);
316
317 if (rmin2 <= 0) rmin2 = param->rmin();
318 if (rmax2 <= 0) rmax2 = param->rmax();
319
320 int radialDiv = m_mgr->radialDiv(ii);
321
322 double phiDelta = m_mgr->phiDelta(ii);
323
324 bool fullPhiSector = false;
325 if (phiDelta == 0 || phiDelta >= 359.9 * Gaudi::Units::degree) {
326 phiDelta = 360 * Gaudi::Units::degree;
327 fullPhiSector = true;
328 }
329 //else {
330 //phiDelta -= 2*phiepsilon;
331 //phiStart += phiepsilon;
332 // }
333
334 if (shapeType == "UNKNOWN") {
335 if (radialDiv > 0) {
336 shapeType = "RADIAL";
337 } else if (param->rmin() == rmin2 && param->rmax() == rmax2) {
338 if (fullPhiSector) {
339 shapeType = "TUBE";
340 } else {
341 shapeType = "TUBS";
342 }
343 } else {
344 shapeType = "CONS";
345 }
346 }
347
348
349 int repeat = m_mgr->repeat(ii);
350 if (repeat == 0) repeat = 1;
351
352 double phiStart = m_mgr->phiStart(ii);
353 double phiWidth = phiDelta;
354
355 if (shapeType == "CONS" || shapeType == "TUBS") {
356 const double phiepsilon = 0.001 * Gaudi::Units::degree;
357 phiWidth -= 2 * phiepsilon;
358 phiStart += phiepsilon;
359 }
360
361 // Can be in degree or mm. Usually it is deg expect for BOX, TRAP and ROD shape
362 // Geometry manager makes no assumptions about units. So we must interpret here.
363 if (shapeType == "BOX" || shapeType == "ROD" || shapeType == "ROD2" || shapeType == "TRAP") {
364 phiWidth = m_mgr->width(ii); // in mm
365 }
366
367 if (shapeType == "PGON" || shapeType == "PGON2" ||
368 shapeType == "CONE" || shapeType == "CONS" ||
369 shapeType == "PGON3" || shapeType == "PGON4") {
370 if ((rmin2 != param->rmin()) || (rmax2 != param->rmax())) {
371 needsRotation = true;
372 }
373 }
374
375 int sides = 0;
376 int nCopies = 1;
377 if (shapeType == "PGON" || shapeType == "PGON2" ||
378 shapeType == "PGON3" || shapeType == "PGON4") {
379 sides = repeat;
380 } else {
381 nCopies = repeat;
382 }
383
384 // Force nCopies to 1 for TUBE and CONE
385 if (shapeType.empty() || shapeType == "TUBE" || shapeType == "CONE") {
386 nCopies = 1;
387 }
388
389 param->setShapeType(shapeType);
390 param->setRmin2(rmin2);
391 param->setRmax2(rmax2);
392 param->setPhiLoc(phiStart);
393 param->setPhiWidth(phiWidth);
394 param->setSides(sides);
395 param->setNCopies(nCopies);
396 //param->setRadialDiv(radialDiv);
397 //param->setPhiStep(phiStep);
398 }
399
400 param->setNeedsRotation(needsRotation);
401
402
403 //
404 // If zin is 0... (within 10^-5) this is a volume symmetric around
405 // the origin
406 //
407 if (std::abs(param->zmin()) < 0.000001) {
408 param->setZmin(-param->zmax());
409 param->setZsymm(false);
410 }
411
412 param->setLabel(m_label, volId);
413
414 return param;
415 }
std::initializer_list< unsigned int > constexpr sides
Definition RPDUtils.h:17

◆ makeAll()

const std::vector< const ServiceVolume * > & InDetDD::ServiceVolumeMaker::makeAll ( )

Definition at line 275 of file ServiceVolumeMaker.cxx.

275 {
276 for (unsigned int ii = 0; ii < numElements(); ++ii) {
277 m_services.push_back(make(ii));
278 }
279 return m_services;
280 }
ServiceVolume * make(int index)

◆ numElements()

unsigned int InDetDD::ServiceVolumeMaker::numElements ( ) const

Definition at line 283 of file ServiceVolumeMaker.cxx.

283 {
284 return m_mgr->numElements();
285 }

◆ operator=()

ServiceVolumeMaker & InDetDD::ServiceVolumeMaker::operator= ( const ServiceVolumeMaker & )
delete

Member Data Documentation

◆ m_label

std::string InDetDD::ServiceVolumeMaker::m_label
private

Definition at line 147 of file ServiceVolumeMaker.h.

◆ m_layerShift

std::vector<double> InDetDD::ServiceVolumeMaker::m_layerShift
private

Definition at line 150 of file ServiceVolumeMaker.h.

◆ m_mgr

ServiceVolumeMakerMgr* InDetDD::ServiceVolumeMaker::m_mgr
private

Definition at line 148 of file ServiceVolumeMaker.h.

◆ m_services

std::vector<const ServiceVolume *> InDetDD::ServiceVolumeMaker::m_services
private

Definition at line 149 of file ServiceVolumeMaker.h.


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