| Geant4 User's Guide For Application Developers Geometry

## 4.1.3 Logical Volumes

The Logical Volume manages the information associated with detector elements represented by a given Solid and Material, independently from its physical position in the detector.

A Logical Volume knows which physical volumes are contained within it. It is uniquely defined to be their mother volume. A Logical Volume thus represents a hierarchy of unpositioned volumes whose positions relative to one another are well defined. By creating Physical Volumes, which are placed instances of a Logical Volume, this hierarchy or tree can be repeated.

A Logical Volume also manages the information relative to the Visualization attributes (Section 8.6) and user-defined parameters related to tracking, electro-magnetic field or cuts (through the `G4UserLimits` interface).

By default, tracking optimization of the geometry (voxelization) is applied to the volume hierarchy identified by a logical volume. It is possible to change the default behavior by choosing not to apply geometry optimization for a given logical volume. This feature does not apply to the case where the associated physical volume is a parameterised volume; in this case, optimization is always applied.

        G4LogicalVolume( G4VSolid*             pSolid,
                         G4Material*           pMaterial,
                         const G4String&       Name,
                         G4FieldManager*       pFieldMgr=0,
                         G4VSensitiveDetector* pSDetector=0,
                         G4UserLimits*         pULimits=0,
                         G4bool                Optimise=true )

The logical volume provides a way to estimate the mass of a tree of volumes defining a detector or sub-detector. This can be achieved by calling the method:

        G4double GetMass(G4bool forced=false)

The mass of the logical volume tree is computed from the estimated geometrical volume of each solid and material associated with the logical volume and its daughters. Note that this computation may require a considerable amount of time, depending on the complexity of the geometry tree. The returned value is cached by default and can be used for successive calls, unless recomputation is forced by providing `true` for the boolean argument `forced` in input. Computation should be forced if the geometry setup has changed after the previous call.

Finally, the Logical Volume manages the information relative to the Envelopes hierarchy required for fast Monte Carlo parameterisations (Section 5.2.6).

#### 4.1.3.1 Sub-detector Regions

In complex geometry setups, such as those found in large detectors in particle physics experiments, it is useful to think of specific Logical Volumes as representing parts (sub-detectors) of the entire detector setup which perform specific functions. In such setups, the processing speed of a real simulation can be increased by assigning specific production cuts to each of these detector parts. This allows a more detailed simulation to occur only in those regions where it is required.

The concept of detector Region was introduced to address this need. Once the final geometry setup of the detector has been defined, a region can be specified by constructing it with:

        G4Region( const G4String&          rName )

where:

`rName` | String identifier for the detector region

A `G4Region` must then be assigned to a logical volume, in order to make it a Root Logical Volume:

        G4Region* emCalorimeter = new G4Region("EM-Calorimeter");
        emCalorimeter->AddRootLogicalVolume(emCalorimeter);

A root logical volume is the first volume at the top of the hierarchy to which a given region is assigned. Once the region is assigned to the root logical volume, the information is automatically propagated to the volume tree, so that each daughter volume shares the same region. Propagation on a tree branch will be interrupted if an already existing root logical volume is encountered.

A specific Production Cut can be assigned to the region, by defining and assigning to it a `G4ProductionCut` object

        emCalorimeter->SetProductionCuts(emCalCuts);

Section 5.4.2 describes how to define a production cut. The same region can be assigned to more than one root logical volume, and root logical volumes can be removed from an existing region. A logical volume can have only one region assigned to it. Regions will be automatically registered in a store which will take care of destroying them at the end of the job. A default region with a default production cut is automatically created and assigned to the world volume.

About the authors