ATLAS Offline Software
Loading...
Searching...
No Matches
InDetServMatGeoModel/src/ServiceVolume.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef INDETSERVMATGEOMODEL_SERVICEVOLUME_H
6#define INDETSERVMATGEOMODEL_SERVICEVOLUME_H
7
8#include "ServiceMaterial.h"
9#include <vector>
10#include <string>
11
12class ServicesLayer;
13
15public:
16
18
19 typedef std::vector<const ServicesLayer*> LayerContainer;
20
21 ServiceVolume( Shape sh, double rmin, double rmax, double zmin, double zmax, const std::string& name) :
22 m_shape(sh), m_rMin( rmin), m_rMax(rmax), m_zMin(zmin), m_zMax(zmax), m_name(name),
23 m_layers(), m_previous(0), m_next(0) {}
24
26 void addLayer( const ServicesLayer* l) {
27 m_layers.push_back(l);
28 }
29
30 void addLayers( const LayerContainer& lc) {
31 m_layers.insert( m_layers.end(), lc.begin(), lc.end());
32 }
33
34 void addEosServices( const ServicesLayer* l);
35
36 Shape shape() const {return m_shape;}
37
38 double zPos() const {return 0.5*(m_zMin+m_zMax);}
39
40 double rMin() const {return m_rMin;}
41
42 double rMax() const {return m_rMax;}
43
44 double zMin() const {return m_zMin;}
45
46 double zMax() const {return m_zMax;}
47
48 double radius() const {return 0.5*(rMin() + rMax());}
49
50 double position() const {
51 if (shape() == Cylinder) return zPos();
52 else return radius();
53 }
54
55 double length() const {
56 if (shape() == Cylinder) return zMax()-zMin();
57 else return rMax() - rMin();
58 }
59
60 const std::string& name() const {return m_name;}
61
62 bool contains( double x) const {
63 // one-dimensional check, radial for disks and along Z for cylinders)
64 double eps = 0.0001; // hard-wired tolerance
65 if (shape()==Disk) return (x > rMin()-eps && x < rMax()+eps);
66 else return (x > zMin()-eps && x < zMax()+eps);
67 }
68
69 const LayerContainer& layers() const {return m_layers;}
70
72
73 void addPrevious( ServiceVolume* prev) { m_previous.push_back(prev);}
74
76
77 void dump( bool dumpMaterial = true) const;
78
79 const std::vector<ServiceMaterial>& materials() const {return m_materials;}
80
81 void setMaterials( const std::vector<ServiceMaterial>& mat) {m_materials = mat;}
82
83 void addMaterial( const ServiceMaterial& mat) {m_materials.push_back( mat);}
84
85 bool isEOS() const {
86 if (m_name.size() < 4) return false;
87 if (m_name.substr(m_name.size()-3) == "EOS") return true;
88 return false;
89 }
90
91private:
92
94 double m_rMin;
95 double m_rMax;
96 double m_zMin;
97 double m_zMax;
98 std::string m_name;
99
100 LayerContainer m_layers; // All layers the services of which are routed through this volume
101
102 std::vector<ServiceVolume*> m_previous;
104
105 std::vector<ServiceMaterial> m_materials;
106
107};
108
109#endif
#define x
std::vector< const ServicesLayer * > LayerContainer
void setMaterials(const std::vector< ServiceMaterial > &mat)
void setNext(ServiceVolume *next)
std::vector< ServiceVolume * > m_previous
std::vector< ServiceMaterial > m_materials
const LayerContainer & layers() const
const std::string & name() const
ServiceVolume(Shape sh, double rmin, double rmax, double zmin, double zmax, const std::string &name)
void addLayer(const ServicesLayer *l)
Add a layer the services of which are routed through this volume.
const std::vector< ServiceMaterial > & materials() const
void addMaterial(const ServiceMaterial &mat)
void addLayers(const LayerContainer &lc)
void addPrevious(ServiceVolume *prev)
void addEosServices(const ServicesLayer *l)
-event-from-file