ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
WLSPhotonDetSD.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file WLSPhotonDetSD.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
29
//
30
//
31
#include "
WLSPhotonDetSD.hh
"
32
#include "
WLSPhotonDetHit.hh
"
33
#include "
WLSUserTrackInformation.hh
"
34
35
#include "
G4Track.hh
"
36
#include "
G4ThreeVector.hh
"
37
#include "
G4Step.hh
"
38
#include "
G4ParticleDefinition.hh
"
39
#include "
G4VTouchable.hh
"
40
#include "
G4TouchableHistory.hh
"
41
#include "
G4ios.hh
"
42
#include "
G4ParticleTypes.hh
"
43
#include "
G4ParticleDefinition.hh
"
44
45
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46
47
WLSPhotonDetSD::WLSPhotonDetSD
(
G4String
name
)
48
:
G4VSensitiveDetector
(name), fPhotonDetHitCollection(0)
49
{
50
collectionName
.
insert
(
"PhotonDetHitCollection"
);
51
}
52
53
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55
WLSPhotonDetSD::~WLSPhotonDetSD
() { }
56
57
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
59
void
WLSPhotonDetSD::Initialize
(
G4HCofThisEvent
* HCE)
60
{
61
fPhotonDetHitCollection
=
62
new
WLSPhotonDetHitsCollection
(
SensitiveDetectorName
,
collectionName
[0]);
63
//Store collection with event and keep ID
64
static
G4int
HCID = -1;
65
if
(HCID<0) HCID =
GetCollectionID
(0);
66
HCE->
AddHitsCollection
( HCID,
fPhotonDetHitCollection
);
67
}
68
69
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70
71
G4bool
WLSPhotonDetSD::ProcessHits
(
G4Step
* ,
G4TouchableHistory
* )
72
{
73
return
false
;
74
}
75
76
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
78
G4bool
WLSPhotonDetSD::ProcessHits_constStep
(
const
G4Step
* aStep,
79
G4TouchableHistory
* )
80
//Generates a hit and uses the postStepPoint; PostStepPoint because the hit
81
//is generated manually when the photon hits the detector
82
{
83
if
(aStep == NULL)
return
false
;
84
G4Track
* theTrack = aStep->
GetTrack
();
85
86
// Need to know if this is an optical photon
87
if
(theTrack->
GetDefinition
()
88
!=
G4OpticalPhoton::OpticalPhotonDefinition
())
return
false
;
89
90
// Find out information regarding the hit
91
G4StepPoint
* thePostPoint = aStep->
GetPostStepPoint
();
92
93
WLSUserTrackInformation
* trackInformation
94
= (
WLSUserTrackInformation
*)theTrack->
GetUserInformation
();
95
96
G4TouchableHistory
* theTouchable
97
= (
G4TouchableHistory
*)(thePostPoint->
GetTouchable
());
98
99
G4ThreeVector
photonExit = trackInformation -> GetExitPosition();
100
G4ThreeVector
photonArrive = thePostPoint -> GetPosition();
101
G4double
arrivalTime = theTrack -> GetGlobalTime();
102
103
// Convert the global coordinate for arriving photons into
104
// the local coordinate of the detector
105
photonArrive = theTouchable->
GetHistory
()->
106
GetTopTransform().TransformPoint(photonArrive);
107
108
// Creating the hit and add it to the collection
109
fPhotonDetHitCollection
->
110
insert(
new
WLSPhotonDetHit
(photonExit, photonArrive, arrivalTime));
111
112
return
true
;
113
}
geant4
tree
geant4-10.6-release
examples
extended
optical
wls
src
WLSPhotonDetSD.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:08
using
1.8.2 with
ECCE GitHub integration