ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyG4Trap.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pyG4Trap.cc
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 // pyG4Trap.cc
28 //
29 // 2005 Q
30 // ====================================================================
31 #include <boost/python.hpp>
32 #include "G4Trap.hh"
33 
34 using namespace boost::python;
35 
36 // ====================================================================
37 // wrappers
38 // ====================================================================
39 namespace pyG4Trap {
40 
42 {
43  return new G4Trap(name);
44 }
45 
46 
48  G4double pTheta, G4double pPhi,
49  G4double pDy1, G4double pDx1, G4double pDx2,
50  G4double pAlp1,
51  G4double pDy2, G4double pDx3, G4double pDx4,
52  G4double pAlp2)
53 {
54  return new G4Trap(name, pDz, pTheta, pPhi,
55  pDy1, pDx1, pDx2, pAlp1,
56  pDy2, pDx3, pDx4, pAlp2);
57 
58 }
59 
60 
62  const std::vector<G4ThreeVector>& pt)
63 {
64  G4ThreeVector ptlist[8];
65  for (G4int i=0; i<8; i++) {
66  ptlist[i]= pt[i];
67  }
68 
69  return new G4Trap(name, ptlist);
70 }
71 
72 
74  G4double pY, G4double pX, G4double pLTX)
75 {
76  return new G4Trap(name, pZ, pY, pX, pLTX);
77 }
78 
79 
81  G4double pDy1, G4double pDy2, G4double pDz)
82 {
83  return new G4Trap(name, pDx1, pDx2, pDy1, pDy2, pDz);
84 }
85 
86 
88  G4double pDz,
89  G4double pAlpha, G4double pTheta, G4double pPhi )
90 {
91  return new G4Trap(name, pDx, pDy, pDz, pAlpha, pTheta, pPhi);
92 }
93 
94 }
95 
96 using namespace pyG4Trap;
97 
98 // ====================================================================
99 // module definition
100 // ====================================================================
102 {
103  class_<G4Trap, G4Trap*, bases<G4VSolid> >
104  ("G4Trap", "Generic trapezoild soild class", no_init)
105  // constructors
106  .def(init<const G4String&>())
107  .def(init<const G4String&, G4double, G4double, G4double, G4double>())
108  .def(init<const G4String&, G4double, G4double, G4double,
109  G4double, G4double>())
110  .def(init<const G4String&, G4double, G4double, G4double,
112  .def(init<const G4String&, G4double, G4double, G4double,
115  // ---
116  .def("GetZHalfLength", &G4Trap::GetZHalfLength)
117  .def("GetYHalfLength1", &G4Trap::GetYHalfLength1)
118  .def("GetXHalfLength1", &G4Trap::GetXHalfLength1)
119  .def("GetXHalfLength2", &G4Trap::GetXHalfLength2)
120  .def("GetTanAlpha1", &G4Trap::GetTanAlpha1)
121  .def("GetYHalfLength2", &G4Trap::GetYHalfLength2)
122  .def("GetXHalfLength3", &G4Trap::GetXHalfLength3)
123  .def("GetXHalfLength4", &G4Trap::GetXHalfLength4)
124  .def("GetTanAlpha2", &G4Trap::GetTanAlpha2)
125  .def("GetSidePlane", &G4Trap::GetSidePlane)
126  .def("GetSymAxis", &G4Trap::GetSymAxis)
127  .def("SetAllParameters", &G4Trap::SetAllParameters)
128  // operators
129  .def(self_ns::str(self))
130  ;
131 
132  // Create solid
133  def("CreateTrap", f1_CreateTrap, return_value_policy<manage_new_object>());
134  def("CreateTrap", f2_CreateTrap, return_value_policy<manage_new_object>());
135  def("CreateTrap", f3_CreateTrap, return_value_policy<manage_new_object>());
136  def("CreateTrap", f4_CreateTrap, return_value_policy<manage_new_object>());
137  def("CreateTrap", f5_CreateTrap, return_value_policy<manage_new_object>());
138  def("CreateTrap", f6_CreateTrap, return_value_policy<manage_new_object>());
139 
140 }
141