A hit is created by a sensitive detector when a step goes through
it. Thus, the sensitive detector is associated to the corresponding
G4LogicalVolume
object(s). On the other hand, a digit is
created using information of hits and/or other digits by a
digitizer module. The digitizer module is not associated with any
volume, and you have to implicitly invoke the Digitize()
method of your concrete G4VDigitizerModule
class.
Typical usages of digitizer module include:
G4VDigi
is an abstract base class which represents a
digit. You have to inherit this base class and derive your own
concrete digit class(es). The member data of your concrete digit
class should be defined by yourself. G4VDigi
has two virtual
methods, Draw()
and Print()
.
As with G4VHit
, authors of subclasses must declare
templated G4Allocator
s for their digit class. They
must also implement operator new()
and operator delete() which use these allocators.
G4TDigiCollection
is a template class for digits
collections, which is derived from the abstract base class
G4VDigiCollection
. G4Event
has a
G4DCofThisEvent
object, which is a container class of
collections of digits. The usages of G4VDigi
and
G4TDigiCollection
are almost the same as G4VHit
and
G4THitsCollection
, respectively, explained in the previous
section.
As with G4THitsCollection
, authors of subclasses must
declare templated G4Allocator
s for their collection
class. They must also implement operator new()
and operator delete() which use these allocators.
G4VDigitizerModule
is an abstract base class which
represents a digitizer module. It has a pure virtual method,
Digitize()
. A concrete digitizer module must have an
implementation of this virtual method. The Geant4 kernel classes do
not have a ``built-in'' invocation to the Digitize()
method. You have to implement your code to invoke this method of
your digitizer module.
In the Digitize()
method, you construct your
G4VDigi
concrete class objects and store them to your
G4TDigiCollection
concrete class object(s). Your
collection(s) should be associated with the G4DCofThisEvent
object.
G4DigiManager
is the singleton manager class of the
digitizer modules. All of your concrete digitizer modules should be
registered to G4DigiManager
with their unique names.
G4DigiManager * fDM = G4DigiManager::GetDMpointer(); MyDigitizer * myDM = new MyDigitizer( "/myDet/myCal/myEMdigiMod" ); fDM->AddNewModule(myDM);
Your concrete digitizer module can be accessed from your code using the unique module name.
G4DigiManager * fDM = G4DigiManager::GetDMpointer(); MyDigitizer * myDM = fDM->FindDigitizerModule( "/myDet/myCal/myEMdigiMod" ); myDM->Digitize();
Also, G4DigiManager
has a Digitize()
method which takes the unique module name.
G4DigiManager * fDM = G4DigiManager::GetDMpointer(); MyDigitizer * myDM = fDM->Digitize( "/myDet/myCal/myEMdigiMod" );
G4DigiManager
has the following methods to access to the
hits or digi collections of the currently processing event or of
previous events.
First, you have to get the collection ID number of the hits or digits collection.
G4DigiManager * fDM = G4DigiManager::GetDMpointer(); G4int myHitsCollID = fDM->GetHitsCollectionID( "hits_collection_name" ); G4int myDigiCollID = fDM->GetDigiCollectionID( "digi_collection_name" );
Then, you can get the pointer to your concrete
G4THitsCollection
object or
G4TDigiCollection
object of the currently processing event.
MyHitsCollection * HC = fDM->GetHitsCollection( myHitsCollID ); MyDigiCollection * DC = fDM->GetDigiCollection( myDigiCollID );
In case you want to access to the hits or digits collection of previous events, add the second argument.
MyHitsCollection * HC = fDM->GetHitsCollection( myHitsCollID, n ); MyDigiCollection * DC = fDM->GetDigiCollection( myDigiCollID, n );
where, n
indicates the hits or digits collection of the
n
th previous event.