Recently (since ROOT version v6.13.04) a new interface to user sensitive detector, TVirtualMCSensitiveDetector, has been added in the set of VMC interfaces. The support for this new way of definig sensitive detector is available since geant3 2.6 and geant4_vmc 4.0.
The user sensitive detectors object should be associated to the selected volumes in the new dedicated MCApplication function:
void TVirtualMCApplication::SetSensitiveDetectors()
using the new TVirtualMC function:
void TVirtualMC::SetSensitiveDetector(
const TString& volumeName,
TVirtualMCSensitiveDetector* userSD);
MCApplication::Stepping()
using the function
void VirtualMC::SetExclusiveSDScoring(Bool_t);
MCApplication::Stepping()
is not called by MC.
To demonstrate the usage of this new interfaces the E03 example was split in two variants:
MCApplication::Stepping
(old way)TVirtualMCSensitiveDetector
interfaceThe VMC interfaces did not provide functions for a user selection of sensitive volumes and (unless the new sensitive detector framework is used) the user MCApplication::Stepping()
is called in all volumes. In order to speed up simulation, in Geant4 VMC (since version 2.13) the user has a possibility to select sensitive volumes. If any selection is provided, the user MCApplication::Stepping()
is called only from the selected sensitive volumes.
The selection of sensitive volumes can be done in two ways:
Via the following Geant4 VMC command:
/mcDet/addSDSelection volName1 [volName2 ...]
The command can be applied more times, the new selection is each time added to the existing ones.
Via labeling volumes directly in TGeo geometry. In this case, user has to notify Geant4 VMC about using the sensitive volumes selection from TGeo by applying Geant4 VMC command:
/mcDet/setSDSelectionFromTGeo true
The volumes in TGeo geometry are set sensitive by setting the option “SV” to TGeoVolume objects:
TGeoVolume* myVolume = ...;
myVolume->SetOption("SV");
/mcDet/setSVLabel MyLabel
Note that the option set via TGeoVolume::SetOption
function is not persistent.