Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file biasing/ReverseMC01/src/RMC01SD.cc 27 /// \brief Implementation of the RMC01SD class 28 // 29 // 30 ////////////////////////////////////////////// 31 // Class Name: RMC01SD 32 // Author: L. Desorgher 33 // Organisation: SpaceIT GmbH 34 // Contract: ESA contract 21435/ 35 // Customer: ESA/ESTEC 36 ////////////////////////////////////////////// 37 38 //....oooOO0OOooo........oooOO0OOooo........oo 39 //....oooOO0OOooo........oooOO0OOooo........oo 40 41 #include "RMC01SD.hh" 42 43 #include "G4HCofThisEvent.hh" 44 #include "G4LogicalVolume.hh" 45 #include "G4LogicalVolumeStore.hh" 46 #include "G4ParticleDefinition.hh" 47 #include "G4PhysicalVolumeStore.hh" 48 #include "G4SDManager.hh" 49 #include "G4Step.hh" 50 #include "G4Track.hh" 51 #include "G4VPhysicalVolume.hh" 52 #include "G4VProcess.hh" 53 #include "G4ios.hh" 54 55 // #include "G4AdjointAnalysisManager.hh" 56 #include "G4Electron.hh" 57 #include "G4Gamma.hh" 58 #include "G4Proton.hh" 59 #include "G4RunManager.hh" 60 #include "G4THitsCollection.hh" 61 62 class G4Step; 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 RMC01SD::RMC01SD(G4String name) 67 : G4VSensitiveDetector(name), 68 fTotalEventEdep(0.), 69 fEventEdepCollection(0), 70 fProtonCurrentCollection(0), 71 fGammaCurrentCollection(0), 72 fElectronCurrentCollection(0) 73 { 74 collectionName.insert("edep"); 75 collectionName.insert("current_electron"); 76 collectionName.insert("current_proton"); 77 collectionName.insert("current_gamma"); 78 } 79 80 //....oooOO0OOooo........oooOO0OOooo........oo 81 82 RMC01SD::~RMC01SD() 83 { 84 ; 85 } 86 87 //....oooOO0OOooo........oooOO0OOooo........oo 88 89 void RMC01SD::Initialize(G4HCofThisEvent* HCE) 90 { 91 fTotalEventEdep = 0.; 92 static G4int HCID = -1; 93 94 fEventEdepCollection = 95 new G4THitsCollection<RMC01DoubleWithWeigh 96 HCID = GetCollectionID(0); 97 HCE->AddHitsCollection(HCID, fEventEdepColle 98 99 fElectronCurrentCollection = 100 new G4THitsCollection<RMC01DoubleWithWeigh 101 HCID = GetCollectionID(1); 102 HCE->AddHitsCollection(HCID, fElectronCurren 103 104 fProtonCurrentCollection = 105 new G4THitsCollection<RMC01DoubleWithWeigh 106 HCID = GetCollectionID(2); 107 HCE->AddHitsCollection(HCID, fProtonCurrentC 108 109 fGammaCurrentCollection = 110 new G4THitsCollection<RMC01DoubleWithWeigh 111 HCID = GetCollectionID(3); 112 HCE->AddHitsCollection(HCID, fGammaCurrentCo 113 } 114 115 //....oooOO0OOooo........oooOO0OOooo........oo 116 117 G4bool RMC01SD::ProcessHits(G4Step* aStep, G4T 118 { 119 G4double weight = aStep->GetTrack()->GetWeig 120 G4double edep = aStep->GetTotalEnergyDeposit 121 if (edep > 0) fEventEdepCollection->insert(n 122 123 G4StepPoint* preStepPoint = aStep->GetPreSte 124 125 if (preStepPoint->GetStepStatus() == fGeomBo 126 // Entering the sensitive volume 127 weight = preStepPoint->GetWeight(); 128 G4double eKin = preStepPoint->GetKineticEn 129 G4ParticleDefinition* thePartDef = aStep-> 130 if (thePartDef == G4Electron::Electron()) 131 fElectronCurrentCollection->insert(new R 132 else if (thePartDef == G4Gamma::Gamma()) 133 fGammaCurrentCollection->insert(new RMC0 134 else if (thePartDef == G4Proton::Proton()) 135 fProtonCurrentCollection->insert(new RMC 136 } 137 return true; 138 } 139 140 //....oooOO0OOooo........oooOO0OOooo........oo 141 142 void RMC01SD::EndOfEvent(G4HCofThisEvent*) 143 { 144 fEventEdepCollection->insert(new RMC01Double 145 } 146 147 //....oooOO0OOooo........oooOO0OOooo........oo 148 149 void RMC01SD::Clear() 150 { 151 ; 152 } 153 154 //....oooOO0OOooo........oooOO0OOooo........oo 155 156 void RMC01SD::DrawAll() 157 { 158 ; 159 } 160 161 //....oooOO0OOooo........oooOO0OOooo........oo 162 163 void RMC01SD::PrintAll() 164 { 165 ; 166 } 167 168 //....oooOO0OOooo........oooOO0OOooo........oo 169