12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Detector Definition and ResponseG4int collectionID = fSDM->GetCollectionID("collection_name");const G4Event* currentEvent = fRM->GetCurrentEvent();G4HCofThisEvent* HCofEvent = currentEvent->GetHCofThisEvent();MyHitsCollection* myCollection = (MyHitsCollection*)(HC0fEvent->GetHC(collectionID));4.4.5. G4MultiFunctionalDetector and G4VPrimitiveScorerG4MultiFunctionalDetector is a concrete class derived from G4VSensitiveDetector. Instead of implementing auser-specific detector class, G4MultiFunctionalDetector allows the user to register G4VPrimitiveScorer classesto build up the sensitivity. G4MultiFunctionalDetector should be instantiated in the users detector constructionwith its unique name and should be assigned to one or more G4LogicalVolumes.G4VPrimitiveScorer is an abstract base class representing a class to be registered to G4MultiFunctionalDetectorthat creates a G4THitsMap object of one physics quantity <strong>for</strong> an event. <strong>Geant4</strong> provides many concrete primitivescorer classes listed in Section 4.4.6, and the user can also implement his/her own primitive scorers. Each primitivescorer object must be instantiated with a name that must be unique among primitive scorers registered ina G4MultiFunctionalDetector. Please note that a primitive scorer object must not be shared by more than oneG4MultiFunctionalDetector object.As mentioned in Section 4.4.1, each G4VPrimitiveScorer generates one G4THitsMap object per event. The nameof the map object is the same as the name of the primitive scorer. Each of the concrete primitive scorers listedin Section 4.4.6 generates a G4THitsMap that maps a G4double value to its key integer number.By default, the key is taken as the copy number of the G4LogicalVolume to which G4MultiFunctionalDetectoris assigned. In case the logical volume is uniquely placed in its mother volume and the mother is replicated,the copy number of its mother volume can be taken by setting the second argument of the G4VPrimitiveScorerconstructor, "depth" to 1, i.e. one level up. Furthermore, in case the key must consider more than one copy numberof a different geometry hierarchy, the user can derive his/her own primitive scorer from the provided concreteclass and implement the GetIndex(G4Step*) virtual method to return the unique key.Example 4.15 shows an example of primitive sensitivity class definitions.130

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!