Presentation is loading. Please wait.

Presentation is loading. Please wait.

Detector Description – Part II Ivana Hrivnacova, IPN Orsay Tatiana Nikitina, CERN Aknowledgement: Slides by: J.Apostolakis, G.Cosmo, A. Lechner.

Similar presentations


Presentation on theme: "Detector Description – Part II Ivana Hrivnacova, IPN Orsay Tatiana Nikitina, CERN Aknowledgement: Slides by: J.Apostolakis, G.Cosmo, A. Lechner."— Presentation transcript:

1 Detector Description – Part II Ivana Hrivnacova, IPN Orsay Tatiana Nikitina, CERN Aknowledgement: Slides by: J.Apostolakis, G.Cosmo, A. Lechner

2 PART II Detector Description: Advanced features - Repeated Placements - Touchables - Regions - Optimisation Techniques - Grouping Volumes and Reflection - Magnetic field

3 Repeated Placements - Parameterised Volumes - Replicas

4 Detector Description - Geant4 Course4 Physical Volumes repeated placement Placement: it is one positioned volume Represents one “real” volume Repeated: a volume placed many times can represent any number of volumes reduces use of memory. Replica and Division simple repetition along one axis Parameterised Repetition with respect to copy number A mother volume can contain either many placement volumes OR one repeated volume

5 Detector Description - Geant4 Course5 Parameterised Physical Volumes User written functions define: the size of the solid (dimensions) ‏ Function ComputeDimensions(…)‏ where it is positioned (transformation) ‏ Function ComputeTransformations(…)‏ Optional: the type of the solid Function ComputeSolid(…)‏ the material Function ComputeMaterial(…)‏ Limitations: Applies to simple CSG solids only Daughter volumes allowed only for special cases Very powerful Consider parameterised volumes as “leaf” volumes

6 Detector Description - Geant4 Course6 Uses of Parameterised Volumes Complex detectors with large repetition of volumes regular or irregular Medical applications the material in animal tissue is measured cubes with varying material

7 Detector Description - Geant4 Course7 G4PVParameterised G4PVParameterised(const G4String& pName, G4LogicalVolume* pCurrentLogical, G4LogicalVolume* pMotherLogical, const EAxis pAxis, const G4int nReplicas, G4VPVParameterisation* pParam); Replicates the volume nReplicas times using the parameterisation pParam, within the mother volume The positioning of the replicas is dominant along the specified Cartesian axis If kUndefined is specified as axis, 3D 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 G4VPVParameterisation object Alternative constructor using pointer to physical volume for the mother

8 Detector Description - Geant4 Course8 Parameterisation Example G4VSolid* solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm); G4LogicalVolume* logicChamber = new G4LogicalVolume(solidChamber, chamberMater, "Chamber", 0, 0, 0);... G4VPVParameterisation* chamberParam = new ChamberParameterisation( nofChambers, firstPositionZ, spacingZ, chamberWidth, firstLength, lastLength); G4VPhysicalVolume* physChamber = new G4PVParameterised( "Chamber", logicChamber, logicTracker, kZAxis, NbOfChambers, chamberParam); Use kUndefined for activating 3D voxelisation for optimisation Use kUndefined for activating 3D voxelisation for optimisation See the class definition on the next slide

9 Detector Description - Geant4 Course9 Parameterisation Example (cont.) ‏ class ChamberParameterisation : public G4VPVParameterisation { public: ChamberParameterisation(..); ~ChamberParameterisation(); void ComputeTransformation( G4int copyNo, G4VPhysicalVolume* physVol) const; void ComputeDimensions ( G4Box& trackerLayer, G4int copyNo, const G4VPhysicalVolume* physVol) const; private: G4int fNoChambers; G4double fStartZ; G4double fSpacingZ; G4double fHalfWidth; G4double fHalfLengthFirst; G4double fHalfLengthIncr; };

10 Detector Description - Geant4 Course10 Parameterisation Example (cont) ‏ void ChamberParameterisation::ComputeTransformation ( G4int copyNo, G4VPhysicalVolume* physVol) const { G4double zPosition= fStartZ + (copyNo+1) * fSpacingZ; physVol->SetTranslation(G4ThreeVector(0, 0, zPosition)); physVol->SetRotation(0); } void ChamberParameterisation::ComputeDimensions ( G4Box& trackerChamber, G4int copyNo, const G4VPhysicalVolume* physVol) const { G4double halfLength = fHalfLengthFirst + copyNo * fHalfLengthIncr; trackerChamber.SetXHalfLength(halfLength); trackerChamber.SetYHalfLength(halfLength); trackerChamber.SetZHalfLength(fHalfWidth); }

11 Detector Description - Geant4 Course11 Replicated Physical Volumes repeated The mother volume is sliced into replicas, all of the same size and dimensions. Represents many touchable detector elements differing only in their positioning. Depending on the mother shape, replication may occur along: Cartesian axes (X, Y, Z) – slices are considered perpendicular to the axis of replication Coordinate system at the center of each replica Radial axis (Rho) – cons/tubs sections centered on the origin and un-rotated Coordinate system same as the mother 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

12 Detector Description - Geant4 Course12 G4PVReplica G4PVReplica(const G4String& pName, G4LogicalVolume* pCurrentLogical, G4LogicalVolume* pMotherLogical, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset=0); Alternative constructor: using pointer to physical volume for the mother An offset can only be associated to a mother offset along the axis of replication Features and restrictions: 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 a daughter volume to be replicated mother volume

13 Detector Description - Geant4 Course13 Replica – axis, width, offset Cartesian axes - kXaxis, kYaxis, kZaxis offset shall not be used Center of n-th daughter is given as -width*(nReplicas-1)*0.5+n*width Radial axis - kRho Center of n-th daughter is given as width*(n+0.5)+offset Phi axis - kPhi Center of n-th daughter is given as width*(n+0.5)+offset offset width offset width

14 Detector Description - Geant4 Course14 Replica Example G4double tube_dPhi = 360.*deg; G4VSolid* tube = new G4Tubs("tube", 20*cm, 50*cm, 30*cm, 0., tube_dPhi); G4LogicalVolume* tube_log = new G4LogicalVolume(tube, Ar, "tubeL", 0, 0, 0); G4VPhysicalVolume* tube_phys = new G4PVPlacement(0, G4ThreeVector(-200.*cm, 0., 0.*cm), "tubeP", tube_log, world_phys, false, 0); G4double divided_tube_dPhi = tube_dPhi/6.; G4VSolid* divided_tube = new G4Tubs("divided_tube", 20*cm, 50*cm, 30*cm, -divided_tube_dPhi/2., divided_tube_dPhi); G4LogicalVolume* divided_tube_log = new G4LogicalVolume(divided_tube, Ar, "div_tubeL", 0, 0, 0); G4VPhysicalVolume* divided_tube_phys = new G4PVReplica("divided_tube_phys", divided_tube_log, tube_log, kPhi, 6, divided_tube_dPhi);

15 Detector Description - Geant4 Course15 Divided Physical Volumes Implemented as “special” kind of parameterised volumes Applies to CSG-like and some specific solids only (box, tubs, cons, para, trd, polycone, polyhedra) ‏ Divides a volume along one of its axis (copies are not strictly identical) ‏ E.g. - a tube divided along its radial axis Offsets can be specified The possible axes of division vary according to the supported solid type G4PVDivision is the class defining the division The parameterisation is calculated automatically using the values provided in input

16 Touchables - Definition of Touchables - Benefits in Track - Examples

17 Detector Description - Geant4 Course17 How to identify a volume uniquely? Suppose a geometry is made of sensitive layers C which are placed in a volume B T he volume A has a 24 positions in the world While in the 'logical' geometry tree the volume C is represented by just one physical volume, in the real world there are many C 'volumes' How can we then identify these volumes C ? Volume B is a daughter volume of a divided volume A B C B A

18 Detector Description - Geant4 Course18 Basics of Touchables A touchable for a volume serves the purpose of providing a unique identification for a detector element It is a geometrical entity (volume or solid) which has a unique placement in a detector description It can be uniquely identified by providing the copy numbers for all daughters in the geometry hierarchy In our case these are CopyNo of C in B: 1 CopyNo of B in A: 1,2,3 CopyNo of A in the world: 1,.., 24 Example of touchable identification: A.3/B.2/C.1 A.1 A.2 A.3 A.4... C.1 B.1 B.2 B.3

19 Detector Description - Geant4 Course19 What can a touchable do ? G4VTouchable - a base class for all touchable implementations – defines the following 'requests' (methods) which all touchable have to respond, where depth means always the number of levels up in the tree to be considered: depth = 0 : the bottom level (volume C in B) ‏ depth = 1 : the level of its mother volume (volume B in A) ‏ depth = 2 : the grandmother volume (volume A in world) ‏ GetCopyNumber (G4int depth =0) returns the copy number of the given level GetTranslation (G4int depth = 0); GetRotation (G4int depth=0)‏ return the components of the volume's transformation GetSolid (G4int depth =0)‏ returns the solid GetVolume (G4int depth =0)‏ returns the physical volume

20 Detector Description - Geant4 Course20 Benefits of Touchables in track A1A1 A2A2 Full geometrical information available to processes, to sensitive detectors, to hits All the geometrical information of the particular step should be taken from “PreStepPoint” Available in G4TouchableHistory object Copy-number, transformations Accessible via Handles (or smart-pointers) to touchables Note: Geometrical information associated with G4Track is basically same as “PostStepPoint”

21 Detector Description - Geant4 Course21 Using Touchable: examples Touchable has information of geometrical hierarchy of the point G4StepPoint* preStepPoint =... ; G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle(); // Get copyNo, motherCopyNo G4int copyNo = theTouchable->GetReplicaNumber(); G4int motherCopyNo = theTouchable->GetReplicaNumber(1); // Convert point in local coordinates (local to the current volume)‏ G4ThreeVector worldPos = preStepPoint->GetPosition(); G4ThreeVector localPos = theTouchable->GetHistory()‏ -> GetTopTransform().TransformPoint(worldPos);

22 Regions - Cuts by Region - Concept of Region - Example

23 Detector Description - Geant4 Course23 Cuts by Region Geant4 used to have a unique production threshold (‘cut’) expressed in length (i.e. minimum range of secondary) ‏ For all volumes, but possibly different for each particle(e+,e-,gamma) ‏ Appropriate length scales can vary greatly between different areas of a large detector E.g. a vertex detector (5 m) and a muon detector (2.5 cm) ‏ Having a unique (low) cut can create a performance penalty Geant4 allows for several cuts Globally or per particle Enabling the tuning of production thresholds at the level of a sub- detector, i.e. region Cuts are applied only for gamma, electron and positron and only for processes which have infrared divergence

24 Detector Description - Geant4 Course24 Detector Region Concept of region: Set of geometry volumes, typically of a sub-system barrel + end-caps of the calorimeter; “Deep” areas of support structures can be a region. Or any group of volumes A set of cuts in range is associated to a region a different range cut for each particle among gamma, e-, e+ is allowed in a region Is unique in the region Region B Region B Default Region Region B Region A C C

25 Detector Description - Geant4 Course 25 World Volume - Default Region Region and cut World volume is recognized as the default region. The default cuts defined in Physics list are used for it. User is not allowed to define a region to the world volume or a cut to the default region A logical volume becomes a root logical volume once it is assigned to a region. All daughter volumes belonging to the root logical volume share the same region (and properties), unless a daughter volume itself becomes to another root logical volume Important restriction : No logical volume can be shared by more than one regions, regardless of root volume or not Root logical - Region A Root logical - Region B

26 Detector Description - Geant4 Course26 Example // Create a region G4Region* emCalorimeter = new G4Region(“EM-Calorimeter”); // Attach a logical volume to the region emCalorimeter->AddRootLogicalVolume(emCalorimeterLV); […] // Retrieve the region by its name G4Region* region = G4RegionStore::GetInstance()->GetRegion(“EM-Calorimeter”); // Create production cuts cuts = new G4ProductionCuts; cuts->SetProductionCut(0.01*mm, G4ProductionCuts::GetIndex(“gamma”)); cuts->SetProductionCut(0.1*mm, G4ProductionCuts::GetIndex(“e-”)); cuts->SetProductionCut(0.1*mm, G4ProductionCuts::GetIndex(“e+”)); // Attach cuts to the region region->SetProductionCuts(cuts);

27 Optimisation Techniques - Smart voxels

28 Detector Description - Geant4 Course28 Smart voxels For each mother volume a one-dimensional virtual division is performed the virtual division is along a chosen axis the axis is chosen by using an heuristic Subdivisions (slices) containing same volumes are gathered into one Subdivisions containing many volumes are refined applying a virtual division again using a second Cartesian axis the third axis can be used for a further refinement, in case Smart voxels are computed at initialisation time When the detector geometry is closed Do not require large memory or computing resources At tracking time, searching is done in a hierarchy of virtual divisions

29 Detector Description - Geant4 Course29 Detector description tuning Some geometry topologies may require ‘special’ tuning for ideal and efficient optimisation For example: a dense nucleus of volumes included in very large mother volume Granularity of voxelisation can be explicitly set Methods Set/GetSmartless() from G4LogicalVolume Critical regions for optimisation can be detected Helper class G4SmartVoxelStat for monitoring time spent in detector geometry optimisation Automatically activated if /run/verbose greater than 1 Percent Memory Heads Nodes Pointers Total CPU Volume ------- ------ ----- ----- -------- --------- ----------- 91.70 1k 1 50 50 0.00 Calorimeter 8.30 0k 1 3 4 0.00 Layer

30 Detector Description - Geant4 Course30 Visualising voxel structure The computed voxel structure can be visualized with the final detector geometry Helper class G4DrawVoxels Visualize voxels given a logical volume G4DrawVoxels::DrawVoxels(const G4LogicalVolume*)‏ Allows setting of visualization attributes for voxels G4DrawVoxels::SetVoxelsVisAttributes(…)‏ useful for debugging purposes Can also be done through a visualization command at run-time: /vis/scene/add/logicalVolume [ ]

31 Detector Description - Geant4 Course31 Customising optimisation Detector regions may be excluded from optimisation (ex. for debug purposes or in case of dynamic geometries ) Optional argument in constructor of G4LogicalVolume or through provided set methods SetOptimisation/IsToOptimise()‏ Optimisation is turned on by default Optimisation for parameterised volumes can be chosen Along one single Cartesian axis Specifying the axis in the constructor for G4PVParameterised Using 3D voxelisation along the 3 Cartesian axes Specifying in kUndefined in the constructor for G4PVParameterised

32 Debugging geometries Debugging tools: - Optional checks at Construction - David - Run-time commands - OLAP

33 Detector Description - Geant4 Course33 Debugging geometries An overlapping volume is a contained volume which actually protrudes from its mother volume Volumes are also often positioned in a same volume with the intent of not provoking intersections between themselves. When volumes in a common mother actually intersect themselves are defined as overlapping Geant4 does not allow for malformed geometries The problem of detecting overlaps between volumes is bounded by the complexity of the solid models description Utilities are provided for detecting wrong positioning Graphical tools Kernel run-time commands protrudingoverlapping

34 34 Constructors of G4PVPlacement and G4PVParameterised have an optional argument “pSurfChk”: G4PVPlacement(G4RotationMatrix* pRot,...,, G4bool pSurfChk=false); If this flag is true, overlap check is done at construction. Some number of points(1000 by default) are randomly sampled on the surface of creating volume. Each of these points are examined If it is outside of the mother volume, or If it is inside of already existing other volumes in the same mother volume. This check may requires lots of CPU time( depending on the complexity of geometry), but it is worth to try at least once when you implement your geometry of some complexity. Debugging tools: Overlapping check at Construction Overlapping check at Construction Detector Description - Geant4 Course

35 35 Debugging tools: DAVID DAVID is a graphical debugging tool for detecting potential intersections of volumes Accuracy of the graphical representation can be tuned to the exact geometrical description. physical-volume surfaces are automatically decomposed into 3D polygons intersections of the generated polygons are parsed. If a polygon intersects with another one, the physical volumes associated to these polygons are highlighted in color (red is the default). DAVID can be downloaded from the Web as external tool for Geant4 http://geant4.kek.jp/GEANT4/vis/DAWN/About_DAVID.html

36 Detector Description - Geant4 Course36 Debugging run-time commands Built-in run-time commands to activate verification tests for the user geometry. Tests can be applied recursively to all depth levels (may require CPU time!): [recursion_flag] geometry/test/run [recursion_flag] or geometry/test/grid_test [recursion_flag]  to start verification of geometry for overlapping regions based on a standard grid setup geometry/test/cylinder_test [recursion_flag]  shoots lines according to a cylindrical pattern geometry/test/line_test [recursion_flag]  to shoot a line along a specified direction and position geometry/test/position and geometry/test/direction  to specify position & direction for the line_test  Resolution/dimensions of grid/cylinders can be tuned

37 Detector Description - Geant4 Course37 Debugging run-time commands - 2 Example layout: GeomTest: no daughter volume extending outside mother detected. GeomTest Error: Overlapping daughter volumes The volumes Tracker[0] and Overlap[0], both daughters of volume World[0], appear to overlap at the following points in global coordinates: (list truncated)‏ length (cm) ----- start position (cm) ----- ----- end position (cm) ----- 240 -240 -145.5 -145.5 0 -145.5 -145.5 Which in the mother coordinate system are: length (cm) ----- start position (cm) ----- ----- end position (cm) -----... Which in the coordinate system of Tracker[0] are: length (cm) ----- start position (cm) ----- ----- end position (cm) -----... Which in the coordinate system of Overlap[0] are: length (cm) ----- start position (cm) ----- ----- end position (cm) -----...

38 Detector Description - Geant4 Course38 Debugging tools: OLAP Uses tracking of neutral particles to verify boundary crossing in opposite directions Stand-alone batch application Provided as extended example Can be combined with a graphical environment and GUI (ex. Qt library) ‏ Integrated in the CMS Iguana Framework

39 Detector Description - Geant4 Course39 Debugging tools: OLAP

40 Detector Description Advanced features - Grouping volumes - Reflections of volumes and hierarchies

41 Detector Description - Geant4 Course41 Grouping volumes To represent a regular pattern of positioned volumes, composing a more or less complex structure structures which are hard to describe with simple replicas or parameterised volumes structures which may consist of different shapes Assembly volume : G4AssemblyVolume acts as an envelope for its daughter volumes its role is over once its logical volume has been placed daughter physical volumes become independent copies in the final structure

42 Detector Description - Geant4 Course42 G4AssemblyVolume G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* volume, G4ThreeVector& translation, G4RotationMatrix* rotation); Helper class to combine logical volumes in arbitrary way Participating logical volumes are treated as triplets logical volume, translation, rotation Imprints of the assembly volume are made inside a mother logical volume through G4AssemblyVolume::MakeImprint(…)‏ Each physical volume name is generated automatically Format: av_WWW_impr_XXX_YYY_ZZZ WWW – assembly volume instance number XXX – assembly volume imprint number YYY – name of the placed logical volume in the assembly ZZZ – index of the associated logical volume Generated physical volumes (and related transformations) are automatically managed (creation and destruction) ‏

43 Detector Description - Geant4 Course43 Assembly of volumes: Example (first part) ‏ // Define a plate G4VSolid* PlateBox = new G4Box( "PlateBox",...); G4LogicalVolume* plateLV = new G4LogicalVolume( PlateBox, Pb, "PlateLV"); // Define one layer as one assembly volume G4AssemblyVolume* assemblyDetector = new G4AssemblyVolume(); // Define transformations of each plate inside the assembly: // transform3D_1, transform3D_2, transform3D_3, transform3D_4, // Fill the assembly by the plates assemblyDetector->AddPlacedVolume( plateLV, transform3D_1 ); assemblyDetector->AddPlacedVolume( plateLV, transform3D_2 ); assemblyDetector->AddPlacedVolume( plateLV, transform3D_3 ); assemblyDetector->AddPlacedVolume( plateLV, transform3D_4 ); // Now instantiate (place) the layers for( unsigned int i = 0; i < layers; i++ ) { // Translation of the assembly inside the world G4ThreeVector Tm(0, 0, i*(caloZ + caloCaloOffset) - firstCaloPos); assemblyDetector->MakeImprint( worldLV, G4Transform3D(Rm,Tm) ); }

44 Detector Description - Geant4 Course44 Assembly of volumes: Example (cont.) ‏

45 Detector Description - Geant4 Course45 Reflecting volumes Reflecting volumes G4ReflectedSolid utility class representing a solid shifted from its original reference frame to a new symmetric one the reflection ( G4Reflect[X/Y/Z]3D ) is applied directly to a solid, and a reflected solid is placed with “pure” rotation and translation G4ReflectionFactory Singleton object using G4ReflectedSolid for generating placements of reflected volumes Provides tools to detect/return a reflected volume Reflections can be applied to CSG and specific solids

46 Detector Description - Geant4 Course46 Reflecting hierarchies of volumes - 1 G4ReflectionFactory::Place(…)‏ Used for normal placements: i.Performs the transformation decomposition ii.Generates a new reflected solid and logical volume  Retrieves it from a map if the reflected object is already created iii.Transforms any daughter and places them in the given mother iv.Returns a pair of physical volumes, the second being a placement in the reflected mother G4PhysicalVolumesPair Place(const G4Transform3D& transform3D, // the transformation const G4String& name, // the actual name G4LogicalVolume* LV, // the logical volume G4LogicalVolume* motherLV, // the mother volume G4bool noBool, // currently unused G4int copyNo) // optional copy number

47 Detector Description - Geant4 Course47 Reflecting hierarchies of volumes - 2 G4ReflectionFactory::Replicate(…)‏ Creates replicas in the given mother volume Returns a pair of physical volumes, the second being a replica in the reflected mother G4PhysicalVolumesPair Replicate(const G4String& name, // the actual name G4LogicalVolume* LV, // the logical volume G4LogicalVolume* motherLV, // the mother volume Eaxis axis // axis of replication G4int replicaNo // number of replicas G4int width, // width of single replica G4int offset=0) // optional mother offset

48 Magnetic field - Defining Magnetic Field

49 Detector Description - Geant4 Course49 Magnetic field - 1 Magnetic field class Uniform field : G4UniformMagField class object: G4MagneticField* magField = new G4UniformMagField(G4ThreeVector(0, 0, 1.*Tesla)); Non-uniform field : User has to define his own concrete class derived from G4MagneticField, which implements the method GetFieldValue(..)‏

50 Detector Description - Geant4 Course 50 Magnetic field - 2 Set your Field as the ‘global’ Field 1. Retrieve the global Field Manager from G4TransportationManager G4FieldManager* fieldMgr = G4TransportationManager::GetTransportationManager()‏ ->GetFieldManager(); 2. Register the field to the Field Manager fieldMgr->SetDetectorField(magField); 3. Create a Chord Finder fieldMgr->CreateChordFinder(magField); Tune the parameters of tracking in Field in order to adjust accuracy (ex.microbeam or planet) and performance Details are described in section 4.3 (Electromagnetic Field) in the Application Developers Guide. Novice example N04 is a good starting point


Download ppt "Detector Description – Part II Ivana Hrivnacova, IPN Orsay Tatiana Nikitina, CERN Aknowledgement: Slides by: J.Apostolakis, G.Cosmo, A. Lechner."

Similar presentations


Ads by Google