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 136 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 249 of file ServiceVolumeMaker.cxx.

252 : m_label(label) {
253 m_mgr = new ServiceVolumeMakerMgr(std::move(table), schema, athenaComps);
254 m_layerShift = m_mgr->readLayerShift();
255 // std::cout<<"LAYER SHIFT "<<m_layerShift[0]<<" "<<m_layerShift[1]<<" "<<m_layerShift[2]<<"
256 // "<<m_layerShift[3]<<std::endl;
257 }
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 259 of file ServiceVolumeMaker.cxx.

259 {
260 for (unsigned int i = 0; i < m_services.size(); i++) {
261 delete m_services[i];
262 }
263 delete m_mgr;
264 }
std::vector< const ServiceVolume * > m_services

Member Function Documentation

◆ make()

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

Definition at line 280 of file ServiceVolumeMaker.cxx.

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

◆ makeAll()

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

Definition at line 267 of file ServiceVolumeMaker.cxx.

267 {
268 for (unsigned int ii = 0; ii < numElements(); ++ii) {
269 m_services.push_back(make(ii));
270 }
271 return m_services;
272 }
ServiceVolume * make(int index)

◆ numElements()

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

Definition at line 275 of file ServiceVolumeMaker.cxx.

275 {
276 return m_mgr->numElements();
277 }

◆ operator=()

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

Member Data Documentation

◆ m_label

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

Definition at line 150 of file ServiceVolumeMaker.h.

◆ m_layerShift

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

Definition at line 153 of file ServiceVolumeMaker.h.

◆ m_mgr

ServiceVolumeMakerMgr* InDetDD::ServiceVolumeMaker::m_mgr
private

Definition at line 151 of file ServiceVolumeMaker.h.

◆ m_services

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

Definition at line 152 of file ServiceVolumeMaker.h.


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