Detector Description basic concepts http cern chgeant 4
Detector Description – basic concepts http: //cern. ch/geant 4 The full set of lecture notes of this Geant 4 Course is available at http: //www. ge. infn. it/geant 4/events/pisa_jan 2006/geant 4 course. html G. Cosmo, Detector Description - Geant 4 Course
Detector Description Part I II IV The Basics Logical and physical volumes Solids, touchables Optimisation technique & Advanced features G. Cosmo, Detector Description - Geant 4 Course
PART 1 Detector Description: the Basics G. Cosmo, Detector Description - Geant 4 Course
Describe your detector n n Derive your own concrete class from G 4 VUser. Detector. Construction abstract base class. Implementing the method Construct(): n Modularize it according to each detector component or sub-detector: • Construct all necessary materials • Define shapes/solids required to describe the geometry • Construct and place volumes of your detector geometry Ø Define sensitive detectors and identify detector volumes which to associate them Ø Associate magnetic field to detector regions Ø Define visualization attributes for the detector elements G. Cosmo, Detector Description - Geant 4 Course 4
Creating a Detector Volume n Start with its Shape & Size n n material, B/E field, make it sensitive Place it in another volume n n Solid n Logical-Volume n Physical-Volume Box 3 x 5 x 7 cm, sphere R=8 m Add properties: n n in one place repeatedly using a function G. Cosmo, Detector Description - Geant 4 Course 5
Define detector geometry n Three conceptual layers n n n G 4 VSolid -- shape, size G 4 Logical. Volume -- daughter physical volumes, material, sensitivity, user limits, etc. G 4 VPhysical. Volume -- position, rotation G 4 VSolid G 4 Logical. Volume G 4 Material G 4 Box G 4 Tubs G 4 Vis. Attributes G 4 VSensitive. Detector G. Cosmo, Detector Description - Geant 4 Course G 4 VPhysical. Volume G 4 PVPlacement G 4 PVParameterised 6
Define detector geometry n Basic strategy G 4 VSolid* p. Box. Solid = new G 4 Box(“a. Box. Solid”, 1. *m, 2. *m, 3. *m); G 4 Logical. Volume* p. Box. Log = new G 4 Logical. Volume( p. Box. Solid, p. Box. Material, “a. Box. Log”, 0, 0, 0); G 4 VPhysical. Volume* a. Box. Phys = new G 4 PVPlacement( p. Rotation, G 4 Three. Vector(pos. X, pos. Y, pos. Z), p. Box. Log, “a. Box. Phys”, p. Mother. Log, 0, copy. No); n A unique physical volume which represents the experimental area must exist and fully contains all other components Ø The world volume G. Cosmo, Detector Description - Geant 4 Course 7
PART II Detector Description: Logical and Physical Volumes G. Cosmo, Detector Description - Geant 4 Course
G 4 Logical. Volume(G 4 VSolid* p. Solid, G 4 Material* p. Material, const G 4 String& name, G 4 Field. Manager* p. Field. Mgr=0, G 4 VSensitive. Detector* p. SDetector=0, G 4 User. Limits* p. ULimits=0, G 4 bool optimise=true); n Contains all information of volume except position: • • • n n Shape and dimension (G 4 VSolid) Material, sensitivity, visualization attributes Position of daughter volumes Magnetic field, User limits Shower parameterisation Physical volumes of same type can share a logical volume. The pointers to solid and material must be NOT null Once created it is automatically entered in the LV store It is not meant to act as a base class G. Cosmo, Detector Description - Geant 4 Course 9
G 4 VPhysical. Volume n G 4 PVPlacement n G 4 PVParameterised 1 Placement = One Volume • A volume instance positioned once in a mother volume 1 Parameterised = Many Volumes • Parameterised by the copy number • Shape, size, material, position and rotation can be parameterised, by implementing a concrete class of G 4 VPVParameterisation. • Reduction of memory consumption • Currently: parameterisation can be used only for volumes that either a) have no further daughters or b) are identical in size & shape. n G 4 PVReplica 1 Replica = Many Volumes • Slicing a volume into smaller pieces (if it has a symmetry) G. Cosmo, Detector Description - Geant 4 Course 10
Physical Volumes n n Placement: it is one positioned volume Repeated: a volume placed many times n n n can represent any number of volumes reduces use of memory. Replica • n n placement simple repetition, similar to G 3 divisions Parameterised A mother volume can contain either n n many placement volumes OR one repeated volume repeated G. Cosmo, Detector Description - Geant 4 Course 11
G 4 PVPlacement(G 4 Rotation. Matrix* p. Rot, const G 4 Three. Vector& tlate, G 4 Logical. Volume* p. Current. Logical, const G 4 String& p. Name, G 4 Logical. Volume* p. Mother. Logical, G 4 bool p. Many, G 4 int p. Copy. No); n Single volume positioned relatively to the mother volume n n In a frame rotated and translated relative to the coordinate system of the mother volume Three additional constructors: n n n A simple variation: specifying the mother volume as a pointer to its physical volume instead of its logical volume. Using G 4 Transform 3 D to represent the direct rotation and translation of the solid instead of the frame The combination of the two variants above G. Cosmo, Detector Description - Geant 4 Course 12
Parameterised Physical Volumes n User written functions define: n the size of the solid (dimensions) • Function Compute. Dimensions(…) n where it is positioned (transformation) • Function Compute. Transformations(…) n Optional: n the type of the solid • Function Compute. Solid(…) n the material • Function Compute. Material(…) n Limitations: n n n Applies to simple CSG solids only Daughter volumes allowed only for special cases Very powerful n Consider parameterised volumes as “leaf” volumes G. Cosmo, Detector Description - Geant 4 Course 13
Uses of Parameterised Volumes n Complex detectors n with large repetition of volumes • regular or irregular n Medical applications n the material in animal tissue is measured • cubes with varying material G. Cosmo, Detector Description - Geant 4 Course 14
G 4 PVParameterised(const G 4 String& p. Name, G 4 Logical. Volume* p. Current. Logical, G 4 Logical. Volume* p. Mother. Logical, const EAxis p. Axis, const G 4 int n. Replicas, G 4 VPVParameterisation* p. Param); n n Replicates the volume n. Replicas times using the parameterisation p. Param, within the mother volume The positioning of the replicas is dominant along the specified Cartesian axis n n n If k. Undefined is specified as axis, 3 D voxelisation for optimisation of the geometry is adopted Represents many touchable detector elements differing in their positioning and dimensions. Both are calculated by means of a G 4 VPVParameterisation object Alternative constructor using pointer to physical volume for the mother G. Cosmo, Detector Description - Geant 4 Course 15
Parameterisation example - 1 G 4 VSolid* solid. Chamber = new G 4 Box("chamber", 100*cm, 10*cm); G 4 Logical. Volume* logic. Chamber = new G 4 Logical. Volume(solid. Chamber, Chamber. Mater, "Chamber", 0, 0, 0); G 4 double first. Position = -tracker. Size + 0. 5*Chamber. Width; G 4 double first. Length = f. Tracker. Length/10; G 4 double last. Length = f. Tracker. Length; G 4 VPVParameterisation* chamber. Param = new Chamber. Parameterisation( Nb. Of. Chambers, first. Position, Chamber. Spacing, Chamber. Width, first. Length, last. Length); G 4 VPhysical. Volume* phys. Chamber = new G 4 PVParameterised( "Chamber", logic. Chamber, logic. Tracker, k. ZAxis, Nb. Of. Chambers, chamber. Param); Use k. Undefined for activating 3 D voxelisation for optimisation G. Cosmo, Detector Description - Geant 4 Course 16
Parameterisation example - 2 class Chamber. Parameterisation : public G 4 VPVParameterisation { public: Chamber. Parameterisation( G 4 int No. Chambers, G 4 double start. Z, G 4 double spacing, G 4 double width. Chamber, G 4 double len. Initial, G 4 double len. Final ); ~Chamber. Parameterisation(); void Compute. Transformation (const G 4 int copy. No, G 4 VPhysical. Volume* phys. Vol) const; void Compute. Dimensions (G 4 Box& tracker. Layer, const G 4 int copy. No, const G 4 VPhysical. Volume* phys. Vol) const; : } G. Cosmo, Detector Description - Geant 4 Course 17
Parameterisation example - 3 void Chamber. Parameterisation: : Compute. Transformation (const G 4 int copy. No, G 4 VPhysical. Volume* phys. Vol) const { G 4 double Zposition= f. Start. Z + (copy. No+1) * f. Spacing; G 4 Three. Vector origin(0, 0, Zposition); phys. Vol->Set. Translation(origin); phys. Vol->Set. Rotation(0); } void Chamber. Parameterisation: : Compute. Dimensions (G 4 Box& tracker. Chamber, const G 4 int copy. No, const G 4 VPhysical. Volume* phys. Vol) const { G 4 double half. Length= f. Half. Length. First + copy. No * f. Half. Length. Incr; tracker. Chamber. Set. XHalf. Length(half. Length ); tracker. Chamber. Set. YHalf. Length(half. Length ); tracker. Chamber. Set. ZHalf. Length(f. Half. Width ); } G. Cosmo, Detector Description - Geant 4 Course 18
Replicated Physical Volumes n The mother volume is sliced into replicas, all of the same size and dimensions. n Represents many touchable detector elements differing only in their positioning. n Replication may occur along: n Cartesian axes (X, Y, Z) – slices are considered perpendicular to the axis of replication • Coordinate system at the center of each replica n Radial axis (Rho) – cons/tubs sections centered on the origin and un-rotated • Coordinate system same as the mother n Phi axis (Phi) – phi sections or wedges, of cons/tubs form • Coordinate system rotated such as that the X axis bisects the angle made by each wedge G. Cosmo, Detector Description - Geant 4 Course repeated 19
G 4 PVReplica(const G 4 String& p. Name, G 4 Logical. Volume* p. Current. Logical, G 4 Logical. Volume* p. Mother. Logical, const EAxis p. Axis, const G 4 int n. Replicas, const G 4 double width, const G 4 double offset=0); a daughter volume to be replicated mother volume n Alternative constructor: using pointer to physical volume for the mother n An offset can only be associated to a mother offset along the axis of replication n Features and restrictions: n n Replicas can be placed inside other replicas Normal placement volumes can be placed inside replicas, assuming no intersection/overlaps with the mother volume or with other replicas No volume can be placed inside a radial replication Parameterised volumes cannot be placed inside a replica G. Cosmo, Detector Description - Geant 4 Course 20
Replica – axis, width, offset n Cartesian axes - k. Xaxis, k. Yaxis, k. Zaxis n offset shall not be used n Center of n-th daughter is given as width -width*(n. Replicas-1)*0. 5+n*width n width Radial axis - k. Raxis n Center of n-th daughter is given as width*(n+0. 5)+offset n offset Phi axis - k. Phi n Center of n-th daughter is given as width*(n+0. 5)+offset width offset G. Cosmo, Detector Description - Geant 4 Course 21
Replication example G 4 double tube_d. Phi = 2. * M_PI; G 4 VSolid* tube = new G 4 Tubs("tube", 20*cm, 50*cm, 30*cm, 0. , tube_d. Phi*rad); G 4 Logical. Volume * tube_log = new G 4 Logical. Volume(tube, Ar, "tube. L", 0, 0, 0); G 4 VPhysical. Volume* tube_phys = new G 4 PVPlacement(0, G 4 Three. Vector(-200. *cm, 0. *cm), "tube. P", tube_log, world_phys, false, 0); G 4 double divided_tube_d. Phi = tube_d. Phi/6. ; G 4 VSolid* divided_tube = new G 4 Tubs("divided_tube", 20*cm, 50*cm, 30*cm, -divided_tube_d. Phi/2. *rad, divided_tube_d. Phi*rad); G 4 Logical. Volume* divided_tube_log = new G 4 Logical. Volume(divided_tube, Ar, "div_tube. L", 0, 0, 0); G 4 VPhysical. Volume* divided_tube_phys = new G 4 PVReplica("divided_tube_phys", divided_tube_log, k. Phi, 6, divided_tube_d. Phi); G. Cosmo, Detector Description - Geant 4 Course 22
Divided Physical Volumes n Implemented as “special” kind of parameterised volumes n Applies to CSG-like solids only (box, tubs, cons, para, trd, polycone, polyhedra) n Divides a volume in identical copies along one of its axis (copies are not strictly identical) • e. g. - a tube divided along its radial axis • Offsets can be specified n The possible axes of division vary according to the supported solid type n Represents many touchable detector elements differing only in their positioning n G 4 PVDivision is the class defining the division n The parameterisation is calculated automatically using the values provided in input G. Cosmo, Detector Description - Geant 4 Course 23
PART III Detector Description: Solids & Touchables G. Cosmo, Detector Description - Geant 4 Course
G 4 VSolid n Abstract class. All solids in Geant 4 derive from it n Defines but does not implement all functions required to: • compute distances to/from the shape • check whether a point is inside the shape • compute the extent of the shape • compute the surface normal to the shape at a given point n Once constructed, each solid is automatically registered in a specific solid store G. Cosmo, Detector Description – Geant 4 Course G. Cosmo, Detector Description - Geant 4 Course 24 25
Solids n Solids defined in Geant 4: n CSG (Constructed Solid Geometry) solids • G 4 Box, G 4 Tubs, G 4 Cons, G 4 Trd, … • Analogous to simple GEANT 3 CSG solids n Specific solids (CSG like) • G 4 Polycone, G 4 Polyhedra, G 4 Hype, … n BREP (Boundary REPresented) solids • G 4 BREPSolid. Polycone, G 4 BSpline. Surface, … • Any order surface n Boolean solids • G 4 Union. Solid, G 4 Subtraction. Solid, … G. Cosmo, Detector Description – Geant 4 Course G. Cosmo, Description - Geant 4 25 26
CSG: G 4 Tubs, G 4 Cons G 4 Tubs(const G 4 String& G 4 double G 4 double pname, p. Rmin, p. Rmax, p. Dz, p. Sphi, p. Dphi); // name G 4 Cons(const G 4 String& G 4 double G 4 double pname, p. Rmin 1, p. Rmax 1, p. Rmin 2, p. Rmax 2, p. Dz, p. Sphi, p. Dphi); // name // inner radius // outer radius // Z half length // starting Phi // segment angle // inner radius -p. Dz // // // outer radius -p. Dz inner radius +p. Dz outer radius +p. Dz Z half length starting Phi segment angle G. Cosmo, Detector Description - Geant 4 Course 27
Specific CSG Solids: G 4 Polycone(const G 4 String& p. Name, G 4 double phi. Start, G 4 double phi. Total, G 4 int num. RZ, const G 4 double r[], const G 4 double z[]); n - numbers of corners in the r, z space r, z - coordinates of corners n Additional constructor using planes n num. RZ G. Cosmo, Detector Description - Geant 4 Course 28
BREP Solids n BREP = Boundary REPresented Solid n Listing all its surfaces specifies a solid n n e. g. 6 squares for a cube Surfaces can be n planar, 2 nd or higher order • elementary BREPS n Splines, B-Splines, NURBS (Non-Uniform B-Splines) • advanced BREPS n Few elementary BREPS pre-defined n box, cons, tubs, sphere, torus, polycone, polyhedra n Advanced BREPS built through CAD systems G. Cosmo, Detector Description - Geant 4 Course 29
BREPS: G 4 BREPSolid. Polyhedra(const G 4 String& p. Name, G 4 double phi. Start, G 4 double phi. Total, G 4 int sides, G 4 int n. Zplanes, G 4 double z. Start, const G 4 double zval[], const G 4 double rmin[], const G 4 double rmax[]); n sides - numbers of sides of each polygon in the x-y plane n. Zplanes - numbers of planes perpendicular to the z axis zval[] - z coordinates of each plane n rmin[], rmax[] n n - Radii of inner and outer polygon at each plane G. Cosmo, Detector Description - Geant 4 Course 30
Boolean Solids n G 4 Union. Solid G 4 Subtraction. Solid G 4 Intersection. Solids can be combined using boolean operations: n n G 4 Union. Solid, G 4 Subtraction. Solid, G 4 Intersection. Solid Requires: 2 solids, 1 boolean operation, and an (optional) transformation for the 2 nd solid • 2 nd solid is positioned relative to the coordinate system of the 1 st solid n Example: G 4 Box box(“Box", 20, 30, 40); G 4 Tubs cylinder(“Cylinder”, 0, 50, 0, 2*M_PI); // r: 0 -> 50 // z: -50 -> 50 // phi: 0 -> 2 pi G 4 Union. Solid union("Box+Cylinder", & box, &cylinder); G 4 Intersection. Solid intersect("Box Intersect Cylinder", & box, &cylinder); G 4 Subtraction. Solid subtract("Box-Cylinder", & box, &cylinder); n n Solids can be either CSG or other Boolean solids Note: tracking cost for the navigation in a complex Boolean solid is proportional to the number of constituent solids G. Cosmo, Detector Description - Geant 4 Course 31
How to identify a volume uniquely? • Need to identify a volume uniquely • Is a physical volume pointer enough? NO! Step p. PV 4 5 4 Later 4 4 5 1 2 3 Touchable 5 1 • Touchable G. Cosmo, Detector Description - Geant 4 Course 2 32
What can a touchable do ? n All generic touchables can reply to these queries: n positioning information (rotation, position) • Get. Translation(), Get. Rotation() n Specific types of touchable also know: n n (solids) - their associated shape: Get. Solid() (volumes) - their physical volume: Get. Volume() (volumes) - their replication number: Get. Replica. Number() (volumes hierarchy or touchable history): • info about its hierarchy of placements: Get. History. Depth() • At the top of the history tree is the world volume • modify/update touchable: Move. Up. History(), Update. Yourself() • take additional arguments G. Cosmo, Detector Description - Geant 4 Course 33
Benefits of Touchables in track n Permanent information stored n n to avoid implications with a “live” volume tree Full geometrical information available n n n to processes to sensitive detectors to hits • A 1 G. Cosmo, Detector Description - Geant 4 Course • A 2 34
Touchable - 1 n G 4 Step has two G 4 Step. Point objects as its starting and ending points. All the geometrical information of the particular step should be got from “Pre. Step. Point” n n Geometrical information associated with G 4 Track is basically same as “Post. Step. Point” Each G 4 Step. Point object has: n n position in world coordinate system global and local time material G 4 Touchable. History for geometrical information • Copy-number, transformations n Handles (or smart-pointers) to touchables are intrinsically used. Touchables are reference counted G. Cosmo, Detector Description - Geant 4 Course 35
Touchable - 2 n G 4 Touchable. History has information of geometrical hierarchy of the point G 4 Step* a. Step =. . ; G 4 Step. Point* pre. Step. Point = a. Step->Get. Pre. Step. Point(); G 4 Touchable. Handle the. Touchable = pre. Step. Point->Get. Touchable. Handle(); G 4 int copy. No = the. Touchable->Get. Replica. Number(); G 4 int mother. Copy. No = the. Touchable->Get. Replica. Number(1); G 4 Three. Vector world. Pos = pre. Step. Point->Get. Position(); G 4 Three. Vector local. Pos = the. Touchable->Get. History()-> Get. Top. Transform(). Transform. Point(world. Pos); G. Cosmo, Detector Description - Geant 4 Course 36
Copy numbers Suppose a calorimeter is made of 4 x 5 cells n and it is implemented by two levels of replica. In reality, there is only one physical volume object for each level. Its position is parameterized by its copy number To get the copy number of each level, suppose what happens if a step belongs to two cells n n n 0 1 Copy. No 2 =0 3 4 0 1 Copy. No 2 =1 3 4 0 1 Copy. No 2 =2 3 4 0 1 Copy. No 2 =3 3 4 Remember geometrical information in G 4 Track is identical to "Post. Step. Point". You cannot get the collect copy number for "Pre. Step. Point" if you directly access to the physical volume Use touchable to get the proper copy number, transform matrix, … n n G. Cosmo, Detector Description - Geant 4 Course 37
- Slides: 37