Warning, file /geant4/examples/advanced/dna/dsbandrepair/src/VoxelParameterisation.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include "VoxelParameterisation.hh"
0031
0032
0033
0034 VoxelParameterisation::VoxelParameterisation(std::map<G4String,
0035 G4LogicalVolume*>& voxelMap, std::vector<Voxel>* voxels)
0036 : G4VPVParameterisation(),
0037 fVoxelMap(voxelMap),
0038 fVoxels(voxels)
0039 {
0040 }
0041
0042
0043
0044 VoxelParameterisation::~VoxelParameterisation()
0045 {
0046 if(fVoxels!=0)
0047 delete fVoxels;
0048 }
0049
0050
0051
0052 void VoxelParameterisation::ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
0053 {
0054
0055 Voxel& voxelData = fVoxels->at(copyNo);
0056
0057
0058 physVol->SetTranslation(voxelData.fPos);
0059 physVol->SetRotation(voxelData.fpRot);
0060 physVol->SetName(VoxelName(voxelData.fType) );
0061 physVol->SetLogicalVolume(LogicalVoxel(voxelData.fType) );
0062 }
0063
0064
0065
0066 G4LogicalVolume* VoxelParameterisation::LogicalVoxel(Voxel::VoxelType type) const
0067 {
0068 G4LogicalVolume* voxel = 0;
0069
0070 if(type==Voxel::Straight)
0071 voxel = fVoxelMap.at("VoxelStraight");
0072 else if(type==Voxel::Right)
0073 voxel =fVoxelMap.at("VoxelRight");
0074 else if(type==Voxel::Left)
0075 voxel =fVoxelMap.at("VoxelLeft");
0076 else if(type==Voxel::Up)
0077 voxel =fVoxelMap.at("VoxelUp");
0078 else if(type==Voxel::Down)
0079 voxel =fVoxelMap.at("VoxelDown");
0080 else if(type==Voxel::Straight2)
0081 voxel = fVoxelMap.at("VoxelStraight2");
0082 else if(type==Voxel::Right2)
0083 voxel =fVoxelMap.at("VoxelRight2");
0084 else if(type==Voxel::Left2)
0085 voxel =fVoxelMap.at("VoxelLeft2");
0086 else if(type==Voxel::Up2)
0087 voxel =fVoxelMap.at("VoxelUp2");
0088 else if(type==Voxel::Down2)
0089 voxel =fVoxelMap.at("VoxelDown2");
0090 else
0091 {
0092 G4ExceptionDescription msg;
0093 msg << "Voxel type "<<type<<" is not registered";
0094 G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
0095 }
0096
0097 if(voxel==0)
0098 {
0099 G4ExceptionDescription msg;
0100 msg << "Voxel is a nullptr";
0101 G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
0102 }
0103
0104 return voxel;
0105 }
0106
0107
0108
0109 G4String VoxelParameterisation::VoxelName(Voxel::VoxelType type) const
0110 {
0111 G4String name ("");
0112
0113 if(type==Voxel::Straight)
0114 name = "VoxelStraight";
0115 else if(type==Voxel::Right)
0116 name = "VoxelRight";
0117 else if(type==Voxel::Left)
0118 name = "VoxelLeft";
0119 else if(type==Voxel::Up)
0120 name = "VoxelUp";
0121 else if(type==Voxel::Down)
0122 name = "VoxelDown";
0123 else if(type==Voxel::Straight2)
0124 name = "VoxelStraight2";
0125 else if(type==Voxel::Right2)
0126 name = "VoxelRight2";
0127 else if(type==Voxel::Left2)
0128 name = "VoxelLeft2";
0129 else if(type==Voxel::Up2)
0130 name = "VoxelUp2";
0131 else if(type==Voxel::Down2)
0132 name = "VoxelDown2";
0133 else
0134 {
0135 G4ExceptionDescription msg;
0136 msg << "Voxel type "<<type<<" is not registered";
0137 G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
0138 }
0139
0140 return name;
0141 }
0142
0143
0144
0145