G4gspos.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 //
00027 // $Id$
00028 //
00029 // by I.Hrivnacova, 13.10.99
00030 
00031 #include "G3G4Interface.hh"
00032 #include "G3VolTable.hh"
00033 #include "G3toG4.hh"
00034 #include "G3Pos.hh"
00035 #include "globals.hh"
00036 #include "G4SystemOfUnits.hh"
00037 
00038 void G4CreateCloneVTE(G3VolTableEntry* vte, G3VolTableEntry* mvte,
00039               G4double pars[], G4int npar, G4int num,
00040               G4double x, G4double y, G4double z, G4int irot, G4String vonly);
00041 
00042 void PG4gspos(G4String *tokens)
00043 {
00044         // fill the parameter containers
00045     G3fillParams(tokens,PTgspos);
00046   
00047         // interpret the parameters
00048     G4String name = Spar[0];
00049     G4String moth = Spar[1];
00050     G4String only = Spar[2];
00051     G4int num = Ipar[0];
00052     G4int irot = Ipar[1];
00053         // all parameters are passed to G4gsxxx methods
00054         // in G3 default units         
00055     //G4double x = Rpar[0]*cm;
00056     //G4double y = Rpar[1]*cm;
00057     //G4double z = Rpar[2]*cm;
00058     G4double x = Rpar[0];
00059     G4double y = Rpar[1];
00060     G4double z = Rpar[2];
00061   
00062     G4gspos(name, num, moth, x, y, z, irot, only);
00063 }
00064 
00065 void G4gspos(G4String vname, G4int num, G4String vmoth, G4double x,
00066              G4double y, G4double z, G4int irot, G4String vonly)
00067 {
00068   // find VTEs
00069   G3VolTableEntry* vte = G3Vol.GetVTE(vname);
00070   G3VolTableEntry* mvte = G3Vol.GetVTE(vmoth);
00071 
00072   if (vte == 0) {
00073     G4String text = "G4gspos: '" + vname + "' has no VolTableEntry";
00074     G4Exception("G4gspos()", "G3toG40017", FatalException, text);
00075     return;
00076   } 
00077   else if (mvte == 0) {
00078     G4String text = "G4gspos: '" + vmoth + "' has no VolTableEntry";
00079     G4Exception("G4gspos()", "G3toG40018", FatalException, text);
00080     return;
00081   } 
00082   else { 
00083     if (!vte->HasNegPars()) {
00084       // position vector
00085       G4ThreeVector* offset = new G4ThreeVector(x*cm, y*cm, z*cm);
00086 
00087       // create a G3Pos object and add it to the vte
00088       G3Pos* aG3Pos = new G3Pos(vmoth, num, offset, irot, vonly);              
00089       vte->AddG3Pos(aG3Pos);
00090 
00091       // loop over all mothers
00092       for (G4int i=0; i<mvte->GetNoClones(); i++) {
00093                        // (mvte is retrieved from its "master" name
00094                        //  -> there is no need to call GetMasterClone()
00095         G3VolTableEntry* mvteClone = mvte->GetClone(i);
00096         vte->AddMother(mvteClone);
00097         mvteClone->AddDaughter(vte);
00098       }     
00099     } 
00100     else {
00101       // if vte has neg parameters 
00102       // a new vte clone copy is created for each mother (clone copy)  
00103       // and its parameters are derived from it if possible
00104 
00105       G4CreateCloneVTE(vte, mvte, vte->GetRpar(), vte->GetNpar(), num,
00106                      x, y, z, irot, vonly);
00107     }    
00108   }      
00109 }

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