G4tgrPlaceDivRep.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: G4tgrPlaceDivRep.cc 69803 2013-05-15 15:24:50Z gcosmo $
00028 //
00029 //
00030 // class G4tgrPlaceDivRep
00031 
00032 // History:
00033 // - Created.                                 P.Arce, CIEMAT (November 2007)
00034 // -------------------------------------------------------------------------
00035 
00036 #include "G4tgrPlaceDivRep.hh"
00037 
00038 #include "G4SystemOfUnits.hh"
00039 #include "G4tgrUtils.hh"
00040 #include "G4tgrMessenger.hh"
00041 #include "G4tgrVolume.hh"
00042 
00043 //-------------------------------------------------------------
00044 G4tgrPlaceDivRep::G4tgrPlaceDivRep()
00045   : theNDiv(0), theWidth(0.), theAxis(kUndefined),
00046     theOffset(0.), theDivType(DivByNdivAndWidth) 
00047 {
00048 }
00049 
00050 
00051 //-------------------------------------------------------------
00052 G4tgrPlaceDivRep::~G4tgrPlaceDivRep()
00053 {
00054 }
00055 
00056 //-------------------------------------------------------------
00057 G4tgrPlaceDivRep::G4tgrPlaceDivRep( const std::vector<G4String>& wl ) 
00058 {
00059   theDivType = DivByNdivAndWidth;
00060 
00061   // Name parent axis nrep width offset
00062   G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE,
00063                            "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
00064   G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_LE,
00065                            "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
00066 
00067   theParentName = G4tgrUtils::GetString(wl[2]); 
00068   theAxis = BuildAxis( G4tgrUtils::GetString(wl[3]) ); 
00069   theNDiv = G4tgrUtils::GetInt( wl[4] );
00070   theWidth = G4tgrUtils::GetDouble(wl[5])*mm; // check if it is deg
00071   if( wl.size() == 7 )
00072   {
00073     theOffset = G4tgrUtils::GetDouble(wl[6])*mm;  // check if it is deg
00074   }
00075   else
00076   {
00077     theOffset = 0.;
00078   }
00079 
00080 #ifdef G4VERBOSE
00081   if( G4tgrMessenger::GetVerboseLevel() >= 1 )
00082   {
00083      G4cout << " Created " << *this << G4endl;
00084   }
00085 #endif
00086 
00087 }
00088 
00089 
00090 //-------------------------------------------------------------
00091 EAxis G4tgrPlaceDivRep::BuildAxis( const G4String& axisName ) 
00092 {
00093   if( axisName == "X" ) {
00094     return kXAxis;
00095   } else if( axisName == "Y" ) {
00096     return kYAxis;
00097   } else if( axisName == "Z" ) {
00098     return kZAxis;
00099   } else if( axisName == "R" ) {
00100     return kRho;
00101   } else if( axisName == "PHI" ) {
00102     return kPhi;
00103   }
00104   else
00105   {
00106     G4String ErrMessage = "Axis type not found: " + axisName
00107                         + ". Only valid axis are: X, Y, Z, R, PHI !";
00108     G4Exception("G4tgrVolumeDivision::GetReplicaAxis()",
00109                 "InvalidAxis", FatalException, ErrMessage);
00110   }
00111   return kXAxis; // to avoid warning errors  
00112 }
00113 
00114 
00115 // -------------------------------------------------------------------------
00116 std::ostream& operator<<(std::ostream& os, const G4tgrPlaceDivRep& obj)
00117 {
00118   os << "G4tgrPlaceDivRep= in " << obj.theParentName
00119      << " NDiv= " << obj.theNDiv << " Width= " << obj.theWidth
00120      << " Axis= " << obj.theAxis << " Offset= " << obj.theOffset
00121      << " DivType= " << obj.theDivType << G4endl;
00122 
00123   return os;
00124 }

Generated on Mon May 27 17:49:59 2013 for Geant4 by  doxygen 1.4.7