Geant4  10.00.p01
pyG4Trap.cc
Go to the documentation of this file.
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 // $Id: pyG4Trap.cc 66892 2013-01-17 10:57:59Z gunter $
27 // ====================================================================
28 // pyG4Trap.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include <boost/python.hpp>
33 #include "G4Trap.hh"
34 
35 using namespace boost::python;
36 
37 // ====================================================================
38 // wrappers
39 // ====================================================================
40 namespace pyG4Trap {
41 
43 {
44  return new G4Trap(name);
45 }
46 
47 
49  G4double pTheta, G4double pPhi,
50  G4double pDy1, G4double pDx1, G4double pDx2,
51  G4double pAlp1,
52  G4double pDy2, G4double pDx3, G4double pDx4,
53  G4double pAlp2)
54 {
55  return new G4Trap(name, pDz, pTheta, pPhi,
56  pDy1, pDx1, pDx2, pAlp1,
57  pDy2, pDx3, pDx4, pAlp2);
58 
59 }
60 
61 
63  const std::vector<G4ThreeVector>& pt)
64 {
65  G4ThreeVector ptlist[8];
66  for (G4int i=0; i<8; i++) {
67  ptlist[i]= pt[i];
68  }
69 
70  return new G4Trap(name, ptlist);
71 }
72 
73 
75  G4double pY, G4double pX, G4double pLTX)
76 {
77  return new G4Trap(name, pZ, pY, pX, pLTX);
78 }
79 
80 
82  G4double pDy1, G4double pDy2, G4double pDz)
83 {
84  return new G4Trap(name, pDx1, pDx2, pDy1, pDy2, pDz);
85 }
86 
87 
89  G4double pDz,
90  G4double pAlpha, G4double pTheta, G4double pPhi )
91 {
92  return new G4Trap(name, pDx, pDy, pDz, pAlpha, pTheta, pPhi);
93 }
94 
95 }
96 
97 using namespace pyG4Trap;
98 
99 // ====================================================================
100 // module definition
101 // ====================================================================
103 {
104  class_<G4Trap, G4Trap*, bases<G4VSolid> >
105  ("G4Trap", "Generic trapezoild soild class", no_init)
106  // constructors
107  .def(init<const G4String&>())
108  .def(init<const G4String&, G4double, G4double, G4double, G4double>())
109  .def(init<const G4String&, G4double, G4double, G4double,
110  G4double, G4double>())
111  .def(init<const G4String&, G4double, G4double, G4double,
113  .def(init<const G4String&, G4double, G4double, G4double,
116  // ---
117  .def("GetZHalfLength", &G4Trap::GetZHalfLength)
118  .def("GetYHalfLength1", &G4Trap::GetYHalfLength1)
119  .def("GetXHalfLength1", &G4Trap::GetXHalfLength1)
120  .def("GetXHalfLength2", &G4Trap::GetXHalfLength2)
121  .def("GetTanAlpha1", &G4Trap::GetTanAlpha1)
122  .def("GetYHalfLength2", &G4Trap::GetYHalfLength2)
123  .def("GetXHalfLength3", &G4Trap::GetXHalfLength3)
124  .def("GetXHalfLength4", &G4Trap::GetXHalfLength4)
125  .def("GetTanAlpha2", &G4Trap::GetTanAlpha2)
126  .def("GetSidePlane", &G4Trap::GetSidePlane)
127  .def("GetSymAxis", &G4Trap::GetSymAxis)
128  .def("SetAllParameters", &G4Trap::SetAllParameters)
129  // operators
130  .def(self_ns::str(self))
131  ;
132 
133  // Create solid
134  def("CreateTrap", f1_CreateTrap, return_value_policy<manage_new_object>());
135  def("CreateTrap", f2_CreateTrap, return_value_policy<manage_new_object>());
136  def("CreateTrap", f3_CreateTrap, return_value_policy<manage_new_object>());
137  def("CreateTrap", f4_CreateTrap, return_value_policy<manage_new_object>());
138  def("CreateTrap", f5_CreateTrap, return_value_policy<manage_new_object>());
139  def("CreateTrap", f6_CreateTrap, return_value_policy<manage_new_object>());
140 
141 }
142 
G4double GetXHalfLength4() const
TrapSidePlane GetSidePlane(G4int n) const
G4double GetYHalfLength2() const
CLHEP::Hep3Vector G4ThreeVector
G4Trap * f3_CreateTrap(const G4String &name, const std::vector< G4ThreeVector > &pt)
Definition: pyG4Trap.cc:62
G4String name
Definition: TRTMaterials.hh:40
G4double GetZHalfLength() const
void export_G4Trap()
Definition: pyG4Trap.cc:102
G4Trap * f4_CreateTrap(const G4String &name, G4double pZ, G4double pY, G4double pX, G4double pLTX)
Definition: pyG4Trap.cc:74
int G4int
Definition: G4Types.hh:78
G4double GetXHalfLength2() const
G4double GetTanAlpha2() const
G4double GetXHalfLength1() const
G4double GetXHalfLength3() const
void SetAllParameters(G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pAlp1, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlp2)
Definition: G4Trap.cc:601
G4Trap * f1_CreateTrap(const G4String &name)
Definition: pyG4Trap.cc:42
G4ThreeVector GetSymAxis() const
G4Trap * f2_CreateTrap(const G4String &name, G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pAlp1, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlp2)
Definition: pyG4Trap.cc:48
G4double GetYHalfLength1() const
double G4double
Definition: G4Types.hh:76
G4double GetTanAlpha1() const
G4Trap * f6_CreateTrap(const G4String &name, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: pyG4Trap.cc:88
G4Trap * f5_CreateTrap(const G4String &name, G4double pDx1, G4double pDx2, G4double pDy1, G4double pDy2, G4double pDz)
Definition: pyG4Trap.cc:81