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 | #include "LXeTrajectory.hh" |
---|
27 | #include "LXeTrackingAction.hh" |
---|
28 | #include "LXeUserTrackInformation.hh" |
---|
29 | #include "LXeDetectorConstruction.hh" |
---|
30 | #include "RecorderBase.hh" |
---|
31 | |
---|
32 | #include "G4TrackingManager.hh" |
---|
33 | #include "G4Track.hh" |
---|
34 | #include "G4ParticleTypes.hh" |
---|
35 | |
---|
36 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
37 | LXeTrackingAction::LXeTrackingAction(RecorderBase* r) |
---|
38 | :recorder(r) |
---|
39 | {} |
---|
40 | |
---|
41 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
42 | void LXeTrackingAction::PreUserTrackingAction(const G4Track* aTrack) |
---|
43 | { |
---|
44 | //Let this be up to the user via vis.mac |
---|
45 | // fpTrackingManager->SetStoreTrajectory(true); |
---|
46 | |
---|
47 | //Use custom trajectory class |
---|
48 | fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack)); |
---|
49 | |
---|
50 | //This user track information is only relevant to the photons |
---|
51 | fpTrackingManager->SetUserTrackInformation(new LXeUserTrackInformation); |
---|
52 | |
---|
53 | /* const G4VProcess* creator = aTrack->GetCreatorProcess(); |
---|
54 | if(creator) |
---|
55 | G4cout<<creator->GetProcessName()<<G4endl; |
---|
56 | */ |
---|
57 | } |
---|
58 | |
---|
59 | //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |
---|
60 | void LXeTrackingAction::PostUserTrackingAction(const G4Track* aTrack){ |
---|
61 | LXeTrajectory* trajectory=(LXeTrajectory*)fpTrackingManager->GimmeTrajectory(); |
---|
62 | LXeUserTrackInformation* |
---|
63 | trackInformation=(LXeUserTrackInformation*)aTrack->GetUserInformation(); |
---|
64 | |
---|
65 | //Lets choose to draw only the photons that hit the sphere and a pmt |
---|
66 | if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){ |
---|
67 | |
---|
68 | const G4VProcess* creator=aTrack->GetCreatorProcess(); |
---|
69 | if(creator && creator->GetProcessName()=="OpWLS"){ |
---|
70 | trajectory->WLS(); |
---|
71 | trajectory->SetDrawTrajectory(true); |
---|
72 | } |
---|
73 | |
---|
74 | if(LXeDetectorConstruction::GetSphereOn()){ |
---|
75 | if((trackInformation->GetTrackStatus()&hitPMT)&& |
---|
76 | (trackInformation->GetTrackStatus()&hitSphere)){ |
---|
77 | trajectory->SetDrawTrajectory(true); |
---|
78 | } |
---|
79 | } |
---|
80 | else{ |
---|
81 | if(trackInformation->GetTrackStatus()&hitPMT) |
---|
82 | trajectory->SetDrawTrajectory(true); |
---|
83 | } |
---|
84 | } |
---|
85 | else //draw all other trajectories |
---|
86 | trajectory->SetDrawTrajectory(true); |
---|
87 | |
---|
88 | if(trackInformation->GetForceDrawTrajectory()) |
---|
89 | trajectory->SetDrawTrajectory(true); |
---|
90 | |
---|
91 | if(recorder)recorder->RecordTrack(aTrack); |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | |
---|
108 | |
---|