| 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 | // $Id: G4tgrPlaceDivRep.cc,v 1.4 2008/11/21 15:37:18 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4tgrPlaceDivRep
|
|---|
| 32 |
|
|---|
| 33 | // History:
|
|---|
| 34 | // - Created. P.Arce, CIEMAT (November 2007)
|
|---|
| 35 | // -------------------------------------------------------------------------
|
|---|
| 36 |
|
|---|
| 37 | #include "G4tgrPlaceDivRep.hh"
|
|---|
| 38 | #include "G4tgrUtils.hh"
|
|---|
| 39 | #include "G4tgrMessenger.hh"
|
|---|
| 40 | #include "G4tgrVolume.hh"
|
|---|
| 41 |
|
|---|
| 42 | //-------------------------------------------------------------
|
|---|
| 43 | G4tgrPlaceDivRep::G4tgrPlaceDivRep()
|
|---|
| 44 | {
|
|---|
| 45 | theOffset = 0.;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | //-------------------------------------------------------------
|
|---|
| 50 | G4tgrPlaceDivRep::~G4tgrPlaceDivRep()
|
|---|
| 51 | {
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | //-------------------------------------------------------------
|
|---|
| 55 | G4tgrPlaceDivRep::G4tgrPlaceDivRep( const std::vector<G4String>& wl )
|
|---|
| 56 | {
|
|---|
| 57 | theDivType = DivByNdivAndWidth;
|
|---|
| 58 |
|
|---|
| 59 | // Name parent axis nrep width offset
|
|---|
| 60 | G4tgrUtils::CheckWLsize( wl, 6, WLSIZE_GE,
|
|---|
| 61 | "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
|
|---|
| 62 | G4tgrUtils::CheckWLsize( wl, 7, WLSIZE_LE,
|
|---|
| 63 | "G4tgrPlaceDivRep::G4tgrPlaceDivRep" );
|
|---|
| 64 |
|
|---|
| 65 | theParentName = G4tgrUtils::GetString(wl[2]);
|
|---|
| 66 | theAxis = BuildAxis( G4tgrUtils::GetString(wl[3]) );
|
|---|
| 67 | theNDiv = G4tgrUtils::GetInt( wl[4] );
|
|---|
| 68 | theWidth = G4tgrUtils::GetDouble(wl[5])*mm; // check if it is deg
|
|---|
| 69 | if( wl.size() == 7 )
|
|---|
| 70 | {
|
|---|
| 71 | theOffset = G4tgrUtils::GetDouble(wl[6])*mm; // check if it is deg
|
|---|
| 72 | }
|
|---|
| 73 | else
|
|---|
| 74 | {
|
|---|
| 75 | theOffset = 0.;
|
|---|
| 76 | }
|
|---|
| 77 |
|
|---|
| 78 | #ifdef G4VERBOSE
|
|---|
| 79 | if( G4tgrMessenger::GetVerboseLevel() >= 1 )
|
|---|
| 80 | {
|
|---|
| 81 | G4cout << " Created " << *this << G4endl;
|
|---|
| 82 | }
|
|---|
| 83 | #endif
|
|---|
| 84 |
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 | //-------------------------------------------------------------
|
|---|
| 89 | EAxis G4tgrPlaceDivRep::BuildAxis( const G4String& axisName )
|
|---|
| 90 | {
|
|---|
| 91 | if( axisName == "X" ) {
|
|---|
| 92 | return kXAxis;
|
|---|
| 93 | } else if( axisName == "Y" ) {
|
|---|
| 94 | return kYAxis;
|
|---|
| 95 | } else if( axisName == "Z" ) {
|
|---|
| 96 | return kZAxis;
|
|---|
| 97 | } else if( axisName == "R" ) {
|
|---|
| 98 | return kRho;
|
|---|
| 99 | } else if( axisName == "PHI" ) {
|
|---|
| 100 | return kPhi;
|
|---|
| 101 | }
|
|---|
| 102 | else
|
|---|
| 103 | {
|
|---|
| 104 | G4String ErrMessage = "Axis type not found: " + axisName
|
|---|
| 105 | + ". Only valid axis are: X, Y, Z, R, PHI !";
|
|---|
| 106 | G4Exception("G4tgrVolumeDivision::GetReplicaAxis()",
|
|---|
| 107 | "InvalidAxis", FatalException, ErrMessage);
|
|---|
| 108 | }
|
|---|
| 109 | return kXAxis; // to avoid warning errors
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 | // -------------------------------------------------------------------------
|
|---|
| 114 | std::ostream& operator<<(std::ostream& os, const G4tgrPlaceDivRep& obj)
|
|---|
| 115 | {
|
|---|
| 116 | os << "G4tgrPlaceDivRep= in " << obj.theParentName
|
|---|
| 117 | << " NDiv= " << obj.theNDiv << " Width= " << obj.theWidth
|
|---|
| 118 | << " Axis= " << obj.theAxis << " Offset= " << obj.theOffset
|
|---|
| 119 | << " DivType= " << obj.theDivType << G4endl;
|
|---|
| 120 |
|
|---|
| 121 | return os;
|
|---|
| 122 | }
|
|---|