[807] | 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 | //// $Id: MedLinacPhantomSD.cc,v 1.7 2006/06/29 16:04:37 gunter Exp $ |
---|
| 27 | // |
---|
| 28 | // |
---|
| 29 | // Code developed by: M. Piergentili |
---|
| 30 | |
---|
| 31 | // |
---|
| 32 | // |
---|
| 33 | #include "MedLinacPhantomSD.hh" |
---|
| 34 | #include "MedLinacPhantomMessenger.hh" |
---|
| 35 | #include "MedLinacPhantomHit.hh" |
---|
| 36 | #include "MedLinacAnalysisManager.hh" |
---|
| 37 | #include "MedLinacPhantomMessenger.hh" |
---|
| 38 | #include "MedLinacDetectorConstruction.hh" |
---|
| 39 | #include "G4Track.hh" |
---|
| 40 | #include "G4LogicalVolume.hh" |
---|
| 41 | #include "G4VPhysicalVolume.hh" |
---|
| 42 | #include "G4Step.hh" |
---|
| 43 | #include "G4VTouchable.hh" |
---|
| 44 | #include "G4TouchableHistory.hh" |
---|
| 45 | #include "G4SDManager.hh" |
---|
| 46 | #include "G4ParticleDefinition.hh" |
---|
| 47 | |
---|
| 48 | //.... |
---|
| 49 | |
---|
| 50 | MedLinacPhantomSD::MedLinacPhantomSD(G4String name):G4VSensitiveDetector(name) |
---|
| 51 | { |
---|
| 52 | phantomMessenger = new MedLinacPhantomMessenger(this); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | MedLinacPhantomSD::~MedLinacPhantomSD() |
---|
| 56 | { |
---|
| 57 | delete phantomMessenger; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | void MedLinacPhantomSD::Initialize(G4HCofThisEvent*) |
---|
| 61 | { |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | void MedLinacPhantomSD::SetPhantomDimension (G4double val) |
---|
| 65 | { |
---|
| 66 | phantomDimension = val; |
---|
| 67 | //G4cout <<"2==============================phantomDim "<< phantomDimension/mm<<"mm"<<G4endl; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | void MedLinacPhantomSD::SetNumberOfPhantomVoxels (G4int val) |
---|
| 71 | { |
---|
| 72 | numberOfPhantomVoxels = val; |
---|
| 73 | //G4cout <<"2==============================numberOfVoxels "<< numberOfPhantomVoxels<<G4endl; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | G4bool MedLinacPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist) |
---|
| 77 | { |
---|
| 78 | if(!ROhist) |
---|
| 79 | return false; |
---|
| 80 | |
---|
| 81 | if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "Phantom_phys") |
---|
| 82 | return false; |
---|
| 83 | |
---|
| 84 | G4double energyDep = aStep->GetTotalEnergyDeposit(); |
---|
| 85 | if(energyDep == 0.) |
---|
| 86 | return false; |
---|
| 87 | |
---|
| 88 | // Read Voxel indexes: i is the x index, k is the z index |
---|
| 89 | G4int k = ROhist->GetReplicaNumber(1); |
---|
| 90 | G4int i = ROhist->GetReplicaNumber(2); |
---|
| 91 | G4int j = ROhist->GetReplicaNumber(); |
---|
| 92 | |
---|
| 93 | //G4int numberOfVoxelZ = 150; |
---|
| 94 | //G4double voxelWidthZ = 2. *mm; |
---|
| 95 | G4int numberOfVoxelZ = numberOfPhantomVoxels; |
---|
| 96 | G4double voxelWidthZ = phantomDimension/numberOfVoxelZ; |
---|
| 97 | //G4cout <<"########## phantomDimension "<< phantomDimension/mm<<"mm"<<G4endl; |
---|
| 98 | //G4cout <<"########## numberOfVoxelZ "<<numberOfVoxelZ <<G4endl; |
---|
| 99 | //G4cout <<"########## voxelWidthZ "<<voxelWidthZ <<G4endl; |
---|
| 100 | |
---|
| 101 | G4double x = (-numberOfVoxelZ+1+2*i)*voxelWidthZ; |
---|
| 102 | G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ; |
---|
| 103 | G4double z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ; |
---|
| 104 | |
---|
| 105 | if(energyDep != 0) |
---|
| 106 | { |
---|
| 107 | #ifdef G4ANALYSIS_USE |
---|
| 108 | MedLinacAnalysisManager* analysis = |
---|
| 109 | MedLinacAnalysisManager::getInstance(); |
---|
| 110 | //**** PDD in isocenter (Y and X Thickness = 5. mm) *********** |
---|
| 111 | if(energyDep != 0) |
---|
| 112 | { |
---|
| 113 | if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 114 | { |
---|
| 115 | if(x<=2.5*mm){if (x>= -2.5*mm) |
---|
| 116 | {analysis->FillHistogram1WithEnergy(z,energyDep/MeV);} |
---|
| 117 | } |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | } |
---|
| 121 | //***** flatness along x ***** Depth=build-up (15 mm)************************* |
---|
| 122 | if(energyDep != 0) |
---|
| 123 | { |
---|
| 124 | if (z<=137.5*mm){if (z>= 132.5*mm) |
---|
| 125 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 126 | {analysis->FillHistogram2WithEnergy(x,energyDep/MeV);} |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | //***** flatness along x ***** Depth=50mm 5********************************* |
---|
| 133 | if(energyDep != 0) |
---|
| 134 | { |
---|
| 135 | if (z<=102.5*mm){if (z>= 97.5*mm) |
---|
| 136 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 137 | {analysis->FillHistogram3WithEnergy(x,energyDep/MeV);} |
---|
| 138 | }}}} |
---|
| 139 | |
---|
| 140 | //***** flatness along x ***** Depth=100 mm******************************** |
---|
| 141 | if(energyDep != 0) |
---|
| 142 | { |
---|
| 143 | if (z<=52.5*mm){if (z>= 47.5*mm) |
---|
| 144 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 145 | {analysis->FillHistogram4WithEnergy(x,energyDep/MeV);} |
---|
| 146 | }}}} |
---|
| 147 | //***** flatness along x ***** Depth=200 mm******************************** |
---|
| 148 | if(energyDep != 0) |
---|
| 149 | { |
---|
| 150 | if (z<=-47.5*mm){if (z>= -52.5*mm) |
---|
| 151 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 152 | {analysis->FillHistogram5WithEnergy(x,energyDep/MeV);} |
---|
| 153 | }}}} |
---|
| 154 | //**** PDD in isocenter (Y and X Thickness = 5. mm) *********** |
---|
| 155 | if(energyDep != 0) |
---|
| 156 | { |
---|
| 157 | if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 158 | { |
---|
| 159 | if(x<=2.5*mm){if (x>= -2.5*mm) |
---|
| 160 | {analysis->FillHistogram6WithEnergy(z,energyDep/MeV);} |
---|
| 161 | }}}} |
---|
| 162 | |
---|
| 163 | //***** flatness along x ***** Depth=build-up (15 mm)************************* |
---|
| 164 | if(energyDep != 0) |
---|
| 165 | { |
---|
| 166 | if (z<=137.5*mm){if (z>= 132.5*mm) |
---|
| 167 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 168 | {analysis->FillHistogram7WithEnergy(x,energyDep/MeV);} |
---|
| 169 | }}}} |
---|
| 170 | //***** flatness along x ***** Depth=50mm********************************* |
---|
| 171 | if(energyDep != 0) |
---|
| 172 | { |
---|
| 173 | if (z<=102.5*mm){if (z>= 97.5*mm) |
---|
| 174 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 175 | {analysis->FillHistogram8WithEnergy(x,energyDep/MeV);} |
---|
| 176 | }}}} |
---|
| 177 | //***** flatness along x ***** Depth=100 mm******************************** |
---|
| 178 | if(energyDep != 0) |
---|
| 179 | { |
---|
| 180 | if (z<=52.5*mm){if (z>= 47.5*mm) |
---|
| 181 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 182 | {analysis->FillHistogram9WithEnergy(x,energyDep/MeV);} |
---|
| 183 | }}}} |
---|
| 184 | //***** flatness along x ***** Depth=200 mm******************************** |
---|
| 185 | if(energyDep != 0) |
---|
| 186 | { |
---|
| 187 | if (z<=-47.5*mm){if (z>= -52.5*mm) |
---|
| 188 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 189 | {analysis->FillHistogram10WithEnergy(x,energyDep/MeV);} |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | } |
---|
| 193 | } |
---|
| 194 | |
---|
| 195 | //**** PDD in isocenter (Y and X Thickness = 5. mm) *********** |
---|
| 196 | if(energyDep != 0) |
---|
| 197 | { |
---|
| 198 | if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 199 | { |
---|
| 200 | if(x<=2.5*mm){if (x>= -2.5*mm) |
---|
| 201 | {analysis->FillHistogram11WithEnergy(z,energyDep/MeV);} |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | } |
---|
| 205 | } |
---|
| 206 | //***** flatness along x ***** Depth=build-up (15 mm)************************* |
---|
| 207 | if(energyDep != 0) |
---|
| 208 | { |
---|
| 209 | if (z<=137.5*mm){if (z>= 132.5*mm) |
---|
| 210 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 211 | {analysis->FillHistogram12WithEnergy(x,energyDep/MeV);} |
---|
| 212 | } |
---|
| 213 | } |
---|
| 214 | } |
---|
| 215 | } |
---|
| 216 | //***** flatness along x ***** Depth=50mm 5********************************* |
---|
| 217 | if(energyDep != 0) |
---|
| 218 | { |
---|
| 219 | if (z<=102.5*mm){if (z>= 97.5*mm) |
---|
| 220 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 221 | {analysis->FillHistogram13WithEnergy(x,energyDep/MeV);} |
---|
| 222 | }}}} |
---|
| 223 | //***** flatness along x ***** Depth=100 mm******************************** |
---|
| 224 | if(energyDep != 0) |
---|
| 225 | { |
---|
| 226 | if (z<=52.5*mm){if (z>= 47.5*mm) |
---|
| 227 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 228 | {analysis->FillHistogram14WithEnergy(x,energyDep/MeV);} |
---|
| 229 | }}}} |
---|
| 230 | //***** flatness along x ***** Depth=200 mm******************************** |
---|
| 231 | if(energyDep != 0) |
---|
| 232 | { |
---|
| 233 | if (z<=-47.5*mm){if (z>= -52.5*mm) |
---|
| 234 | { if (y<=2.5*mm){if (y>= -2.5*mm) |
---|
| 235 | {analysis->FillHistogram15WithEnergy(x,energyDep/MeV);} |
---|
| 236 | }}}} |
---|
| 237 | |
---|
| 238 | #endif |
---|
| 239 | } |
---|
| 240 | return true; |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | void MedLinacPhantomSD::EndOfEvent(G4HCofThisEvent*) |
---|
| 244 | { |
---|
| 245 | } |
---|
| 246 | |
---|
| 247 | void MedLinacPhantomSD::clear() |
---|
| 248 | { |
---|
| 249 | } |
---|
| 250 | |
---|
| 251 | void MedLinacPhantomSD::DrawAll() |
---|
| 252 | { |
---|
| 253 | } |
---|
| 254 | |
---|
| 255 | void MedLinacPhantomSD::PrintAll() |
---|
| 256 | { |
---|
| 257 | } |
---|
| 258 | |
---|