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 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 //
 27 /// \file VoxelParameterisation.cc
 28 /// \brief Implementation of the VoxelParameterisation class
 29 
 30 #include "VoxelParameterisation.hh"
 31 
 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33 
 34 VoxelParameterisation::VoxelParameterisation(std::map<G4String, 
 35                         G4LogicalVolume*>& voxelMap, std::vector<Voxel>* voxels)
 36     : G4VPVParameterisation(),
 37     fVoxelMap(voxelMap),
 38     fVoxels(voxels)
 39 {
 40 }
 41 
 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 43 
 44 VoxelParameterisation::~VoxelParameterisation()
 45 {
 46     if(fVoxels!=0)
 47         delete fVoxels;
 48 }
 49 
 50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 51 
 52 void VoxelParameterisation::ComputeTransformation(const G4int copyNo, G4VPhysicalVolume* physVol) const
 53 {
 54     // Retrive the correct voxel data for the cpN
 55     Voxel& voxelData = fVoxels->at(copyNo);
 56 
 57     // Set the current physical volume parameters
 58     physVol->SetTranslation(voxelData.fPos);
 59     physVol->SetRotation(voxelData.fpRot);
 60     physVol->SetName(VoxelName(voxelData.fType) );
 61     physVol->SetLogicalVolume(LogicalVoxel(voxelData.fType) );
 62 }
 63 
 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 65 
 66 G4LogicalVolume* VoxelParameterisation::LogicalVoxel(Voxel::VoxelType type) const
 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 registered";
 94         G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
 95     }
 96 
 97     if(voxel==0)
 98     {
 99         G4ExceptionDescription msg;
100         msg << "Voxel is a nullptr";
101         G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
102     }
103 
104     return voxel;
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
109 G4String VoxelParameterisation::VoxelName(Voxel::VoxelType type) const
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 registered";
137         G4Exception("VoxelParameterisation::GetLogicalVoxel", "", FatalException, msg);
138     }
139 
140     return name;
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 
145 
146