ATLAS Offline Software
Loading...
Searching...
No Matches
InDetGeoModelUtils/InDetGeoModelUtils/ServiceVolume.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef InDetDD_ServiceVolume_H
6#define InDetDD_ServiceVolume_H
7
9#include "GeoModelKernel/GeoShape.h"
10#include "GeoModelKernel/GeoIntrusivePtr.h"
11#include <cmath>
12#include <mutex>
13#include <string>
14
15class GeoMaterial;
16class GeoShape;
17
18namespace InDetDD {
19
20 // class to hold GeoShape pointer. This takes care of the GeoShape ref counting and
21 // avoids needing to write a copy constructor for ServiceVolume
22 using GeoShapeHolder = GeoIntrusivePtr<const GeoShape>;
23
25
26 public:
29 void setRmin(double rmin) {m_rmin = rmin; resetGeoShape();}
30 void setRmax(double rmax) {m_rmax = rmax; resetGeoShape();}
33 void setZmin(double zmin) {m_zmin = zmin; resetGeoShape();}
34 void setZmax(double zmax) {m_zmax = zmax; resetGeoShape();}
35 //void setVolId(int num) {m_volId = num;}
36 void setZsymm(bool zsymm) {m_zsymm = zsymm;}
37 void setMaterial(const std::string & mat) {m_materialName = mat;}
38 void setMaterial(const GeoMaterial * mat) {m_material = mat;}
39 void setVolName(const std::string & name) {m_volName = name;}
40 void setShapeType(const std::string & shapeType) {m_shapeType = shapeType; setSplittable();}
43 void setNeedsRotation(bool flag) {m_needsRotation = flag;}
45 void setNCopies(int num) {m_nCopies = num;}
46 void setRegion(const std::string & region) {m_region = region;}
47 void setLabel(const std::string & name, int volId);
48 void setLabel(const std::string & name) {m_label = name;}
49 void addLabel(const std::string & name) {m_label += name;}
50 //void setLength() {m_origLength = std::abs(m_zmax - m_zmin);}
52 void resetGeoShape() {if (!m_lockGeoShape) m_geoShape.reset();}
53 void reduceSize(double safety);
54 // Set a custom shape. A volume can be specified.
55 // This should be used when the shapes volume calculation is unreliable (eg boolean volumes)
56 // NB. rmin,rmax,zmin,zmax should still be set to determine z position and to determine which zone it belongs.
57 void setGeoShape(const GeoShape * geoShape, double volume=0);
58 void setEnvelopeNum(int num) { m_envNum=num; }
59 void setParentEnvelope(int num) { m_envParentNum=num; }
60 void setZShift(double shift) { m_zShift=shift; }
61
62 double rmin() const {return m_rmin;}
63 double rmax() const {return m_rmax;}
64 double rmin2() const {return m_rmin2;}
65 double rmax2() const {return m_rmax2;}
66 double zmin() const {return m_zmin+m_safety;}
67 double zmax() const {return m_zmax-m_safety;}
68 //int volId() const {return m_volId;}
69 bool zsymm() const {return m_zsymm;}
70 const std::string & materialName() const {return m_materialName;}
71 const GeoMaterial * material() const {return m_material;}
72 const std::string & volName() const {return m_volName;}
73 const std::string & shapeType() const {return m_shapeType;}
74 double phiLoc() const {return m_phiLoc;}
75 double phiWidth() const {return m_phiWidth;}
76 bool needsRotation() const {return m_needsRotation;}
77 int sides() const {return m_sides;}
78 int nCopies() const {return m_nCopies;}
79 //double origLength() const {return m_origLength;}
80 const std::string & region() const {return m_region;}
81 std::string fullLabel() const;
82 double length() const {return std::abs(m_zmax - m_zmin) - 2*m_safety;}
83 double zposition() const {return 0.5 * (m_zmin + m_zmax);}
84 double rposition() const {return 0.5 * (m_rmin + m_rmax);}
85 //double fractionInRegion() const {return std::abs(m_zmax - m_zmin)/m_origLength;}
86 double volume() const;
87 double origVolume() const;
88 const GeoShape * getShape() const;
89 bool splittableInR() const {return m_splittableR;}
90 bool splittableInZ() const {return m_splittableZ;}
91 int envelopeNum() const {return m_envNum; }
92 int envelopeParent() const {return m_envParentNum; }
93 double zShift() const {return m_zShift; }
94
95 // For debugging
96 void print() const;
97
98 private:
99 void setSplittable();
100
101 double m_rmin;
102 double m_rmax;
103 double m_rmin2;
104 double m_rmax2;
105 double m_zmin;
106 double m_zmax;
107 //int m_volId;
109 mutable GeoShapeHolder m_geoShape ATLAS_THREAD_SAFE; // Guarded by m_mutex
110 const GeoMaterial * m_material;
111 std::string m_materialName;
112 std::string m_volName;
113 std::string m_shapeType;
114 double m_phiLoc;
119 //double m_origLength;
121 mutable double m_volume ATLAS_THREAD_SAFE; // Guarded by m_mutex
122 double m_safety;
123 std::string m_region;
124 std::string m_label;
128
131 double m_zShift;
132
133 mutable std::mutex m_mutex;
134 };
135
136} // End namespace
137
138
139#endif
Define macros for attributes used to control the static checker.
void setGeoShape(const GeoShape *geoShape, double volume=0)
void setLabel(const std::string &name, int volId)
Message Stream Member.
GeoIntrusivePtr< const GeoShape > GeoShapeHolder