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 // 27 /// \file VoxelParameterisation.cc 28 /// \brief Implementation of the VoxelParamete 29 30 #include "VoxelParameterisation.hh" 31 32 //....oooOO0OOooo........oooOO0OOooo........oo 33 34 VoxelParameterisation::VoxelParameterisation(s 35 G4LogicalVolume*>& vox 36 : G4VPVParameterisation(), 37 fVoxelMap(voxelMap), 38 fVoxels(voxels) 39 { 40 } 41 42 //....oooOO0OOooo........oooOO0OOooo........oo 43 44 VoxelParameterisation::~VoxelParameterisation( 45 { 46 if(fVoxels!=0) 47 delete fVoxels; 48 } 49 50 //....oooOO0OOooo........oooOO0OOooo........oo 51 52 void VoxelParameterisation::ComputeTransformat 53 { 54 // Retrive the correct voxel data for the 55 Voxel& voxelData = fVoxels->at(copyNo); 56 57 // Set the current physical volume paramet 58 physVol->SetTranslation(voxelData.fPos); 59 physVol->SetRotation(voxelData.fpRot); 60 physVol->SetName(VoxelName(voxelData.fType 61 physVol->SetLogicalVolume(LogicalVoxel(vox 62 } 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 G4LogicalVolume* VoxelParameterisation::Logica 67 { 68 G4LogicalVolume* voxel = 0; 69 70 if(type==Voxel::Straight) 71 voxel = fVoxelMap.at("VoxelStraight"); 72 else if(type==Voxel::Right) 73 voxel =fVoxelMap.at("VoxelRight"); 74 else if(type==Voxel::Left) 75 voxel =fVoxelMap.at("VoxelLeft"); 76 else if(type==Voxel::Up) 77 voxel =fVoxelMap.at("VoxelUp"); 78 else if(type==Voxel::Down) 79 voxel =fVoxelMap.at("VoxelDown"); 80 else if(type==Voxel::Straight2) 81 voxel = fVoxelMap.at("VoxelStraight2") 82 else if(type==Voxel::Right2) 83 voxel =fVoxelMap.at("VoxelRight2"); 84 else if(type==Voxel::Left2) 85 voxel =fVoxelMap.at("VoxelLeft2"); 86 else if(type==Voxel::Up2) 87 voxel =fVoxelMap.at("VoxelUp2"); 88 else if(type==Voxel::Down2) 89 voxel =fVoxelMap.at("VoxelDown2"); 90 else 91 { 92 G4ExceptionDescription msg; 93 msg << "Voxel type "<<type<<" is not r 94 G4Exception("VoxelParameterisation::Ge 95 } 96 97 if(voxel==0) 98 { 99 G4ExceptionDescription msg; 100 msg << "Voxel is a nullptr"; 101 G4Exception("VoxelParameterisation::Ge 102 } 103 104 return voxel; 105 } 106 107 //....oooOO0OOooo........oooOO0OOooo........oo 108 109 G4String VoxelParameterisation::VoxelName(Voxe 110 { 111 G4String name (""); 112 113 if(type==Voxel::Straight) 114 name = "VoxelStraight"; 115 else if(type==Voxel::Right) 116 name = "VoxelRight"; 117 else if(type==Voxel::Left) 118 name = "VoxelLeft"; 119 else if(type==Voxel::Up) 120 name = "VoxelUp"; 121 else if(type==Voxel::Down) 122 name = "VoxelDown"; 123 else if(type==Voxel::Straight2) 124 name = "VoxelStraight2"; 125 else if(type==Voxel::Right2) 126 name = "VoxelRight2"; 127 else if(type==Voxel::Left2) 128 name = "VoxelLeft2"; 129 else if(type==Voxel::Up2) 130 name = "VoxelUp2"; 131 else if(type==Voxel::Down2) 132 name = "VoxelDown2"; 133 else 134 { 135 G4ExceptionDescription msg; 136 msg << "Voxel type "<<type<<" is not r 137 G4Exception("VoxelParameterisation::Ge 138 } 139 140 return name; 141 } 142 143 //....oooOO0OOooo........oooOO0OOooo........oo 144 145 146