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/wls/src/WLSTrajectoryPoint.c 26 /// \file optical/wls/src/WLSTrajectoryPoint.cc 28 /// \brief Implementation of the WLSTrajectory 27 /// \brief Implementation of the WLSTrajectoryPoint class 29 // 28 // 30 // 29 // >> 30 // >> 31 31 #include "WLSTrajectoryPoint.hh" 32 #include "WLSTrajectoryPoint.hh" 32 33 33 #include "G4AttDef.hh" << 34 #include "G4AttDefStore.hh" << 35 #include "G4AttValue.hh" << 36 #include "G4Step.hh" 34 #include "G4Step.hh" 37 #include "G4StepStatus.hh" << 38 #include "G4Track.hh" 35 #include "G4Track.hh" 39 #include "G4UIcommand.hh" << 40 #include "G4UnitsTable.hh" << 41 #include "G4VProcess.hh" 36 #include "G4VProcess.hh" >> 37 #include "G4StepStatus.hh" >> 38 >> 39 #include "G4AttDef.hh" >> 40 #include "G4AttValue.hh" >> 41 #include "G4AttDefStore.hh" 42 42 43 G4ThreadLocal G4Allocator<WLSTrajectoryPoint>* << 43 #include "G4UnitsTable.hh" 44 44 45 //....oooOO0OOooo........oooOO0OOooo........oo << 45 //#define G4ATTDEBUG >> 46 #ifdef G4ATTDEBUG >> 47 #include "G4AttCheck.hh" >> 48 #endif >> 49 >> 50 G4Allocator<WLSTrajectoryPoint> WLSTrajPointAllocator; >> 51 >> 52 WLSTrajectoryPoint::WLSTrajectoryPoint() >> 53 : fTime(0.), fMomentum(0.,0.,0.), >> 54 fStepStatus(fUndefined), fVolumeName("") { } 46 55 47 WLSTrajectoryPoint::WLSTrajectoryPoint(const G 56 WLSTrajectoryPoint::WLSTrajectoryPoint(const G4Step* aStep) 48 : G4TrajectoryPoint(aStep->GetPostStepPoint( << 57 : G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition()) 49 { 58 { 50 auto postStepPoint = aStep->GetPostStepPoint << 59 fTime = aStep->GetPostStepPoint()->GetGlobalTime(); 51 fTime = postStepPoint->GetGlobalTime(); << 60 fMomentum = aStep->GetPostStepPoint()->GetMomentum(); 52 fMomentum = postStepPoint->GetMomentum(); << 61 fStepStatus = aStep->GetPostStepPoint()->GetStepStatus(); 53 fStepStatus = postStepPoint->GetStepStatus() << 62 if (aStep->GetPostStepPoint()->GetPhysicalVolume()) 54 if (postStepPoint->GetPhysicalVolume()) { << 63 { 55 fVolumeName = postStepPoint->GetPhysicalVo << 64 fVolumeName = aStep->GetPostStepPoint()-> 56 } << 65 GetPhysicalVolume()->GetName(); 57 else { << 66 } else { 58 fVolumeName = G4String(" "); << 67 fVolumeName = " "; 59 } << 68 } 60 } 69 } 61 70 62 //....oooOO0OOooo........oooOO0OOooo........oo << 63 << 64 WLSTrajectoryPoint::WLSTrajectoryPoint(const G 71 WLSTrajectoryPoint::WLSTrajectoryPoint(const G4Track* aTrack) 65 : G4TrajectoryPoint(aTrack->GetPosition()) << 72 : G4TrajectoryPoint(aTrack->GetPosition()) 66 { 73 { 67 fTime = aTrack->GetGlobalTime(); << 74 fTime = aTrack->GetGlobalTime(); 68 fMomentum = aTrack->GetMomentum(); << 75 fMomentum = aTrack->GetMomentum(); 69 fStepStatus = fUndefined; << 76 fStepStatus = fUndefined; 70 fVolumeName = aTrack->GetVolume()->GetName() << 77 fVolumeName = aTrack->GetVolume()->GetName(); 71 } 78 } 72 79 73 //....oooOO0OOooo........oooOO0OOooo........oo << 80 WLSTrajectoryPoint::WLSTrajectoryPoint(const WLSTrajectoryPoint &right) 74 << 81 : G4TrajectoryPoint(right) 75 WLSTrajectoryPoint::WLSTrajectoryPoint(const W << 76 { 82 { 77 fTime = right.fTime; << 83 fTime = right.fTime; 78 fMomentum = right.fMomentum; << 84 fMomentum = right.fMomentum; 79 fStepStatus = right.fStepStatus; << 85 fStepStatus = right.fStepStatus; 80 fVolumeName = right.fVolumeName; << 86 fVolumeName = right.fVolumeName; 81 } 87 } 82 88 83 //....oooOO0OOooo........oooOO0OOooo........oo << 89 WLSTrajectoryPoint::~WLSTrajectoryPoint() { } 84 90 85 const std::map<G4String, G4AttDef>* WLSTraject << 91 const std::map<G4String,G4AttDef>* WLSTrajectoryPoint::GetAttDefs() const 86 { 92 { 87 G4bool isNew; 93 G4bool isNew; 88 std::map<G4String, G4AttDef>* store = G4AttD << 94 std::map<G4String,G4AttDef>* store >> 95 = G4AttDefStore::GetInstance("TrajectoryPoint",isNew); 89 if (isNew) { 96 if (isNew) { 90 G4String Pos("Pos"); 97 G4String Pos("Pos"); 91 (*store)[Pos] = G4AttDef(Pos, "Position", << 98 (*store)[Pos] = >> 99 G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector"); 92 100 93 G4String Time("Time"); 101 G4String Time("Time"); 94 (*store)[Time] = G4AttDef(Time, "Time", "P << 102 (*store)[Time] = >> 103 G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double"); 95 104 96 G4String Momentum("Momentum"); 105 G4String Momentum("Momentum"); 97 (*store)[Momentum] = G4AttDef(Momentum, "M << 106 (*store)[Momentum] = >> 107 G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector"); 98 108 99 G4String StepStatus("StepStatus"); 109 G4String StepStatus("StepStatus"); 100 (*store)[StepStatus] = G4AttDef(StepStatus << 110 (*store)[StepStatus] = >> 111 G4AttDef(StepStatus, "StepStatus", "Physics", "", "G4StepStatus"); 101 112 102 G4String VolumeName("VolumeName"); 113 G4String VolumeName("VolumeName"); 103 (*store)[VolumeName] = G4AttDef(VolumeName << 114 (*store)[VolumeName] = >> 115 G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String"); >> 116 104 } 117 } 105 return store; 118 return store; 106 } 119 } 107 120 108 //....oooOO0OOooo........oooOO0OOooo........oo << 109 << 110 std::vector<G4AttValue>* WLSTrajectoryPoint::C 121 std::vector<G4AttValue>* WLSTrajectoryPoint::CreateAttValues() const 111 { 122 { 112 auto values = new std::vector<G4AttValue>; << 123 std::vector<G4AttValue>* values = new std::vector<G4AttValue>; >> 124 >> 125 values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),"")); >> 126 >> 127 values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),"")); >> 128 >> 129 values->push_back(G4AttValue("StepStatus",fStepStatus,"")); >> 130 >> 131 values->push_back(G4AttValue("VolumeName",fVolumeName,"")); 113 132 114 values->push_back(G4AttValue("Time", G4BestU << 133 #ifdef G4ATTDEBUG 115 values->push_back(G4AttValue("Momentum", G4B << 134 G4cout << G4AttCheck(values,GetAttDefs()); 116 values->push_back(G4AttValue("StepStatus", G << 135 #endif 117 values->push_back(G4AttValue("VolumeName", f << 118 136 119 return values; 137 return values; 120 } 138 } 121 139