Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
WLSPhotonDetSD Class Reference

#include <Doxymodules_optical.h>

Inheritance diagram for WLSPhotonDetSD:
G4VSensitiveDetector

Public Member Functions

 WLSPhotonDetSD (G4String)
 
 ~WLSPhotonDetSD () override=default
 
void Initialize (G4HCofThisEvent *) override
 
G4bool ProcessHits (G4Step *, G4TouchableHistory *) override
 
void EndOfEvent (G4HCofThisEvent *) override
 

Private Attributes

WLSPhotonDetHitsCollectionfPhotonDetHitCollection = nullptr
 
G4int fHCID = -1
 

Detailed Description

Definition at line 93 of file Doxymodules_optical.h.

Constructor & Destructor Documentation

◆ WLSPhotonDetSD()

WLSPhotonDetSD::WLSPhotonDetSD ( G4String  name)

Definition at line 46 of file WLSPhotonDetSD.cc.

48{
49 collectionName.insert("PhotonDetHitCollection");
50}

◆ ~WLSPhotonDetSD()

WLSPhotonDetSD::~WLSPhotonDetSD ( )
overridedefault

Member Function Documentation

◆ Initialize()

void WLSPhotonDetSD::Initialize ( G4HCofThisEvent HCE)
override

Definition at line 54 of file WLSPhotonDetSD.cc.

55{
57 new WLSPhotonDetHitsCollection(SensitiveDetectorName, collectionName[0]);
58
59 if(fHCID < 0)
60 {
61 fHCID =
62 G4SDManager::GetSDMpointer()->GetCollectionID(fPhotonDetHitCollection);
63 }
64 HCE->AddHitsCollection(fHCID, fPhotonDetHitCollection);
65}
G4THitsCollection< WLSPhotonDetHit > WLSPhotonDetHitsCollection
WLSPhotonDetHitsCollection * fPhotonDetHitCollection

◆ ProcessHits()

G4bool WLSPhotonDetSD::ProcessHits ( G4Step aStep,
G4TouchableHistory  
)
override

Definition at line 69 of file WLSPhotonDetSD.cc.

70{
71 if(!aStep)
72 return false;
73 G4Track* theTrack = aStep->GetTrack();
74
75 // Need to know if this is an optical photon
76 if(theTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
77 {
78 return false;
79 }
80
81 // Find out information regarding the hit
82 G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
83
84 auto trackInformation =
85 (WLSUserTrackInformation*) theTrack->GetUserInformation();
86
87 auto theTouchable = (G4TouchableHistory*) (thePostPoint->GetTouchable());
88
89 G4ThreeVector photonExit = trackInformation->GetExitPosition();
90 G4ThreeVector photonArrive = thePostPoint->GetPosition();
91 G4double arrivalTime = theTrack->GetGlobalTime();
92 G4double energy = theTrack->GetTotalEnergy();
93
94 // Convert the global coordinate for arriving photons into
95 // the local coordinate of the detector
96 photonArrive =
97 theTouchable->GetHistory()->GetTopTransform().TransformPoint(photonArrive);
98
99 // Creating the hit and add it to the collection
101 new WLSPhotonDetHit(photonExit, photonArrive, arrivalTime, energy));
102
103 return true;
104}

◆ EndOfEvent()

void WLSPhotonDetSD::EndOfEvent ( G4HCofThisEvent )
override

Definition at line 106 of file WLSPhotonDetSD.cc.

107{
108 if ( verboseLevel>1 ) {
109 G4int nofHits = fPhotonDetHitCollection->entries();
110 G4cout << G4endl
111 << "-------->Hits Collection: in this event there are " << nofHits
112 << " hits in the photon detector: " << G4endl;
113 for ( G4int i=0; i<nofHits; i++ ) (*fPhotonDetHitCollection)[i]->Print();
114 }
115}

Member Data Documentation

◆ fPhotonDetHitCollection

WLSPhotonDetHitsCollection* WLSPhotonDetSD::fPhotonDetHitCollection = nullptr
private

Definition at line 57 of file WLSPhotonDetSD.hh.

◆ fHCID

G4int WLSPhotonDetSD::fHCID = -1
private

Definition at line 58 of file WLSPhotonDetSD.hh.


The documentation for this class was generated from the following files:

Applications | User Support | Publications | Collaboration