Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // << 27 /// \file optical/LXe/src/LXeTrackingAction.cc << 28 /// \brief Implementation of the LXeTrackingAc << 29 // << 30 // << 31 #include "LXeTrackingAction.hh" << 32 << 33 #include "LXeDetectorConstruction.hh" << 34 #include "LXeTrajectory.hh" 26 #include "LXeTrajectory.hh" >> 27 #include "LXeTrackingAction.hh" 35 #include "LXeUserTrackInformation.hh" 28 #include "LXeUserTrackInformation.hh" >> 29 #include "LXeDetectorConstruction.hh" >> 30 #include "RecorderBase.hh" 36 31 37 #include "G4OpticalPhoton.hh" << 38 #include "G4Track.hh" << 39 #include "G4TrackingManager.hh" 32 #include "G4TrackingManager.hh" >> 33 #include "G4Track.hh" >> 34 #include "G4ParticleTypes.hh" 40 35 41 //....oooOO0OOooo........oooOO0OOooo........oo << 36 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ >> 37 LXeTrackingAction::LXeTrackingAction(RecorderBase* r) >> 38 :recorder(r) >> 39 {} 42 40 >> 41 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 43 void LXeTrackingAction::PreUserTrackingAction( 42 void LXeTrackingAction::PreUserTrackingAction(const G4Track* aTrack) 44 { 43 { 45 // Let this be up to the user via vis.mac << 44 //Let this be up to the user via vis.mac 46 // fpTrackingManager->SetStoreTrajectory(tr 45 // fpTrackingManager->SetStoreTrajectory(true); 47 << 46 48 // Use custom trajectory class << 47 //Use custom trajectory class 49 fpTrackingManager->SetTrajectory(new LXeTraj 48 fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack)); 50 49 51 // This user track information is only relev << 50 //This user track information is only relevant to the photons 52 fpTrackingManager->SetUserTrackInformation(n 51 fpTrackingManager->SetUserTrackInformation(new LXeUserTrackInformation); 53 } << 54 52 55 //....oooOO0OOooo........oooOO0OOooo........oo << 53 /* const G4VProcess* creator = aTrack->GetCreatorProcess(); >> 54 if(creator) >> 55 G4cout<<creator->GetProcessName()<<G4endl; >> 56 */ >> 57 } 56 58 57 void LXeTrackingAction::PostUserTrackingAction << 59 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ 58 { << 60 void LXeTrackingAction::PostUserTrackingAction(const G4Track* aTrack){ 59 auto trajectory = (LXeTrajectory*)fpTracking << 61 LXeTrajectory* trajectory=(LXeTrajectory*)fpTrackingManager->GimmeTrajectory(); 60 auto trackInformation = (LXeUserTrackInforma << 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()){ 61 67 62 // Let's choose to draw only the photons tha << 68 const G4VProcess* creator=aTrack->GetCreatorProcess(); 63 if (aTrack->GetDefinition() == G4OpticalPhot << 69 if(creator && creator->GetProcessName()=="OpWLS"){ 64 const G4VProcess* creator = aTrack->GetCre << 65 if (creator && creator->GetProcessName() = << 66 trajectory->WLS(); 70 trajectory->WLS(); 67 trajectory->SetDrawTrajectory(true); 71 trajectory->SetDrawTrajectory(true); 68 } 72 } 69 73 70 if (LXeDetectorConstruction::GetSphereOn() << 74 if(LXeDetectorConstruction::GetSphereOn()){ 71 if ((trackInformation->GetTrackStatus() << 75 if((trackInformation->GetTrackStatus()&hitPMT)&& 72 && (trackInformation->GetTrackStatus << 76 (trackInformation->GetTrackStatus()&hitSphere)){ 73 { << 77 trajectory->SetDrawTrajectory(true); 74 trajectory->SetDrawTrajectory(true); << 75 } 78 } 76 } 79 } 77 else { << 80 else{ 78 if (trackInformation->GetTrackStatus() & << 81 if(trackInformation->GetTrackStatus()&hitPMT) >> 82 trajectory->SetDrawTrajectory(true); 79 } 83 } 80 } 84 } 81 // draw all other (not optical photon) traje << 85 else //draw all other trajectories 82 else << 83 trajectory->SetDrawTrajectory(true); 86 trajectory->SetDrawTrajectory(true); 84 87 85 if (trackInformation->GetForceDrawTrajectory << 88 if(trackInformation->GetForceDrawTrajectory()) >> 89 trajectory->SetDrawTrajectory(true); >> 90 >> 91 if(recorder)recorder->RecordTrack(aTrack); 86 } 92 } >> 93 >> 94 >> 95 >> 96 >> 97 >> 98 >> 99 >> 100 >> 101 >> 102 >> 103 >> 104 >> 105 >> 106 >> 107 >> 108 87 109