-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetector.cc
More file actions
42 lines (27 loc) · 1.17 KB
/
detector.cc
File metadata and controls
42 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "detector.hh"
#include <iostream>
MySensitiveDetector::MySensitiveDetector(G4String name) : G4VSensitiveDetector(name)
{
}
MySensitiveDetector::~MySensitiveDetector()
{
}
G4bool MySensitiveDetector::ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
{
//position of photon
G4Track *track = aStep->GetTrack();
track->SetTrackStatus(fStopAndKill);//when pothon enter detector it is kill
//when the photon enter the sensitive detector
G4StepPoint *preStepPoint = aStep->GetPreStepPoint(); //prepoint: photon enter detector
G4StepPoint *posStepPoint = aStep->GetPostStepPoint(); //posepoint: phton exist detector
G4ThreeVector posPhoton = preStepPoint->GetPosition();
std::cout << "Photon position: " << posPhoton<<std::endl;
G4cout << "Photon position: " << G4endl;
const G4VTouchable *touchable = aStep->GetPreStepPoint()->GetTouchable();
G4int copyNo = touchable->GetCopyNumber();
G4cout << "copy num:" << copyNo << G4endl;
G4VPhysicalVolume *physVol = touchable->GetVolume();
G4ThreeVector posDetector = physVol->GetTranslation();
G4cout << "Detector position:" <<posDetector << G4endl;
//return true;
}