G4gsdvn.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, V.Berejnoi, 29 Oct 99
00030 
00031 #include "G3G4Interface.hh"
00032 #include "G3Division.hh"
00033 #include "G3VolTableEntry.hh"
00034 #include "G3VolTable.hh"
00035 #include "globals.hh"
00036 #include "G3toG4.hh"
00037 
00038 void PG4gsdvn(G4String *tokens)
00039 {
00040   // fill the parameter containers
00041   G3fillParams(tokens,PTgsdvn);
00042   
00043   // interpret the parameters
00044   G4String vname = Spar[0];
00045   G4String vmoth = Spar[1];
00046   G4int ndiv = Ipar[0];
00047   G4int iaxis = Ipar[1];
00048   
00049   G4gsdvn(vname, vmoth, ndiv, iaxis);
00050 }
00051 
00052 void G4CreateCloneVTEWithDivision(G4String vname, G3VolTableEntry* mvte,
00053         G3DivType divType, G4int nofDivisions, G4int iaxis, G4int, 
00054         G4double c0, G4double step)
00055 {       
00056   G3VolTableEntry* vte=0;
00057 
00058   // loop over all mothers
00059   for (G4int i=0; i<mvte->GetNoClones(); i++) {
00060     G3VolTableEntry* mvteClone =  mvte->GetClone(i);
00061     G4String shape = mvteClone->GetShape();
00062     G4int    nmed  = mvteClone->GetNmed();
00063     G4String mvteName = mvteClone->GetName();
00064     
00065     G4String newName = vname;
00066     if (i>0) {
00067       char index[5]; sprintf(index, "%d", i);
00068       newName.append(gSeparator); newName = newName + index;
00069     }   
00070 
00071     // create new VTE with 0 solid
00072     // and let vol table know about it
00073     G3VolTableEntry* vteClone
00074       = new G3VolTableEntry(newName, shape, 0, 0, nmed, 0, true);
00075     G3Vol.PutVTE(vteClone);
00076 
00077     // set mother <-> daughter
00078     // (mother/daughter are reset in case an envelope
00079     //  needs to be created in G3Division::UpdateVTE)
00080     mvteClone->AddDaughter(vteClone);
00081     vteClone->AddMother(mvteClone);
00082 
00083     // create new G3Division 
00084     G3Division* division
00085       = new G3Division(divType, vteClone, mvteClone,
00086                        nofDivisions, iaxis, nmed, c0, step);
00087 
00088     // set division to vte and update it
00089     vteClone->SetDivision(division);
00090     division->UpdateVTE();
00091       
00092     if (i == 0) {
00093       // keep the first clone copy
00094       vte = vteClone;
00095     }
00096     else {              
00097       // let vte know about this clone copy
00098       vte->AddClone(vteClone);     
00099     }
00100   }
00101 }    
00102 
00103 void G4gsdvn(G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
00104 {
00105   // find mother VTE
00106   G3VolTableEntry* mvte = G3Vol.GetVTE(vmoth);
00107  
00108   if (mvte == 0) {
00109     G4String text = "G4gsdvn:'" + vmoth + "' has no VolTableEntry";
00110     G4Exception("G4gsdvn()", "G3toG40013", FatalException, text);
00111     return;
00112   }  
00113   else {
00114     // a new vte clone copy with division is created
00115     // for each mother (clone copy)
00116     
00117     G4CreateCloneVTEWithDivision(vname, mvte, kDvn, ndiv, iaxis, 0, 0., 0.); 
00118   }  
00119 }

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