G4GDMLParameterisation.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 //
00028 // class G4GDMLParameterisation Implementation
00029 //
00030 // History:
00031 // - Created.                                  Zoltan Torzsok, November 2007
00032 // -------------------------------------------------------------------------
00033 
00034 #include "G4GDMLParameterisation.hh"
00035 
00036 G4int G4GDMLParameterisation::GetSize() const
00037 {
00038    return (G4int)parameterList.size();
00039 }
00040 
00041 void G4GDMLParameterisation::AddParameter(const PARAMETER& newParameter)
00042 {
00043    parameterList.push_back(newParameter);
00044 }
00045 
00046 void G4GDMLParameterisation::
00047 ComputeTransformation(const G4int index,G4VPhysicalVolume* physvol) const
00048 {
00049    physvol->SetTranslation(parameterList[index].position);
00050    physvol->SetRotation(parameterList[index].pRot);
00051 }
00052 
00053 void G4GDMLParameterisation::
00054 ComputeDimensions(G4Box& box,const G4int index,const G4VPhysicalVolume*) const
00055 {
00056    box.SetXHalfLength(parameterList[index].dimension[0]);
00057    box.SetYHalfLength(parameterList[index].dimension[1]);
00058    box.SetZHalfLength(parameterList[index].dimension[2]);
00059 }
00060 
00061 void G4GDMLParameterisation::
00062 ComputeDimensions(G4Trd& trd,const G4int index,const G4VPhysicalVolume*) const
00063 {
00064    trd.SetXHalfLength1(parameterList[index].dimension[0]);
00065    trd.SetXHalfLength2(parameterList[index].dimension[1]);
00066    trd.SetYHalfLength1(parameterList[index].dimension[2]);
00067    trd.SetYHalfLength2(parameterList[index].dimension[3]);
00068    trd.SetZHalfLength(parameterList[index].dimension[4]);
00069 }
00070 
00071 void G4GDMLParameterisation::
00072 ComputeDimensions(G4Trap& trap,const G4int index,const G4VPhysicalVolume*) const
00073 {
00074    trap.SetAllParameters(parameterList[index].dimension[0], // Dz
00075                          parameterList[index].dimension[1], // Theta
00076                          parameterList[index].dimension[2], // Phi
00077                          parameterList[index].dimension[3], // Dy1
00078                          parameterList[index].dimension[4], // Dx1
00079                          parameterList[index].dimension[5], // Dx2
00080                          parameterList[index].dimension[6], // pAlp1,
00081                          parameterList[index].dimension[7], // pDy2,
00082                          parameterList[index].dimension[8], // pDx3,
00083                          parameterList[index].dimension[9], // pDx4,
00084                          parameterList[index].dimension[10]); // pAlp2
00085 }
00086 
00087 void G4GDMLParameterisation::
00088 ComputeDimensions(G4Tubs& tubs,const G4int index,const G4VPhysicalVolume*) const
00089 {
00090    tubs.SetInnerRadius(parameterList[index].dimension[0]);
00091    tubs.SetOuterRadius(parameterList[index].dimension[1]);
00092    tubs.SetZHalfLength(parameterList[index].dimension[2]);
00093    tubs.SetStartPhiAngle(parameterList[index].dimension[3]);
00094    tubs.SetDeltaPhiAngle(parameterList[index].dimension[4]);
00095 }
00096 
00097 void G4GDMLParameterisation::
00098 ComputeDimensions(G4Cons& cons,const G4int index,const G4VPhysicalVolume*) const
00099 {
00100    cons.SetInnerRadiusMinusZ(parameterList[index].dimension[0]);
00101    cons.SetOuterRadiusMinusZ(parameterList[index].dimension[1]);
00102    cons.SetInnerRadiusPlusZ(parameterList[index].dimension[2]);
00103    cons.SetOuterRadiusPlusZ(parameterList[index].dimension[3]);
00104    cons.SetZHalfLength(parameterList[index].dimension[4]);
00105    cons.SetStartPhiAngle(parameterList[index].dimension[5]);
00106    cons.SetDeltaPhiAngle(parameterList[index].dimension[6]);
00107 }
00108 
00109 void G4GDMLParameterisation::
00110 ComputeDimensions(G4Sphere& sphere,const G4int index,const G4VPhysicalVolume*) const
00111 {
00112    sphere.SetInsideRadius(parameterList[index].dimension[0]);
00113    sphere.SetOuterRadius(parameterList[index].dimension[1]);
00114    sphere.SetStartPhiAngle(parameterList[index].dimension[2]);
00115    sphere.SetDeltaPhiAngle(parameterList[index].dimension[3]);
00116    sphere.SetStartThetaAngle(parameterList[index].dimension[4]);
00117    sphere.SetDeltaThetaAngle(parameterList[index].dimension[5]);
00118 }
00119 
00120 void G4GDMLParameterisation::
00121 ComputeDimensions(G4Orb& orb,const G4int index,const G4VPhysicalVolume*) const
00122 {
00123    orb.SetRadius(parameterList[index].dimension[0]);
00124 }
00125 
00126 void G4GDMLParameterisation::
00127 ComputeDimensions(G4Torus& torus,const G4int index,const G4VPhysicalVolume*) const
00128 {
00129    torus.SetAllParameters(parameterList[index].dimension[0], // pRmin
00130                           parameterList[index].dimension[1], // pRmax
00131                           parameterList[index].dimension[2], // pRtor
00132                           parameterList[index].dimension[3], // pSPhi
00133                           parameterList[index].dimension[4]); // pDPhi
00134 }
00135 
00136 void G4GDMLParameterisation::
00137 ComputeDimensions(G4Para& para,const G4int index,const G4VPhysicalVolume*) const
00138 {
00139    para.SetXHalfLength(parameterList[index].dimension[0]);
00140    para.SetYHalfLength(parameterList[index].dimension[1]);
00141    para.SetZHalfLength(parameterList[index].dimension[2]);
00142    para.SetAlpha(parameterList[index].dimension[3]);
00143    para.SetTanAlpha(std::tan(parameterList[index].dimension[3]));
00144    para.SetThetaAndPhi(parameterList[index].dimension[4],parameterList[index].dimension[5]);
00145 }
00146 
00147 void G4GDMLParameterisation::
00148 ComputeDimensions(G4Hype& hype,const G4int index,const G4VPhysicalVolume*) const
00149 {
00150    hype.SetInnerRadius(parameterList[index].dimension[0]);
00151    hype.SetOuterRadius(parameterList[index].dimension[1]);
00152    hype.SetZHalfLength(parameterList[index].dimension[4]);
00153    hype.SetInnerStereo(parameterList[index].dimension[2]);
00154    hype.SetOuterStereo(parameterList[index].dimension[3]);
00155 }
00156 
00157 void G4GDMLParameterisation::
00158 ComputeDimensions(G4Polycone&,const G4int,const G4VPhysicalVolume*) const
00159 {
00160    G4Exception("G4GDMLParameterisation::ComputeDimensions()",
00161                "InvalidSetup", FatalException,
00162                "Parameterisation of G4Polycone not implemented yet. Sorry!");
00163 }
00164 
00165 void G4GDMLParameterisation::
00166 ComputeDimensions(G4Polyhedra&,const G4int,const G4VPhysicalVolume*) const
00167 {
00168    G4Exception("G4GDMLParameterisation::ComputeDimensions()",
00169                "InvalidSetup", FatalException,
00170                "Parameterisation of G4Polyhedra not implemented yet. Sorry!");
00171 }

Generated on Mon May 27 17:48:19 2013 for Geant4 by  doxygen 1.4.7