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