LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
pyG4Polycone.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 // ====================================================================
27 // pyG4Polycone.cc
28 //
29 // 2007 Q
30 // ====================================================================
31 #include <boost/python.hpp>
32 #include "G4Polycone.hh"
33 
34 using namespace boost::python;
35 
36 // ====================================================================
37 // thin wrappers
38 // ====================================================================
39 namespace pyG4Polycone {
40 
41 // create solid methods
42 
43 G4Polycone* f1_CreatePolycone(const G4String& name, G4double phiStart,
44  G4double phiTotal, G4int numZPlanes,
45  const std::vector<G4double>& zPlane,
46  const std::vector<G4double>& rInner,
47  const std::vector<G4double>& rOuter)
48 {
49  G4double zlist[numZPlanes];
50  G4double r0list[numZPlanes];
51  G4double r1list[numZPlanes];
52 
53  for (G4int i=0; i< numZPlanes; i++) {
54  zlist[i]= zPlane[i];
55  r0list[i]= rInner[i];
56  r1list[i]= rOuter[i];
57  }
58 
59  return new G4Polycone(name, phiStart, phiTotal, numZPlanes,
60  zlist, r0list, r1list);
61 }
62 
63 
64 G4Polycone* f2_CreatePolycone(const G4String& name, G4double phiStart,
65  G4double phiTotal, G4int numRZ,
66  const std::vector<G4double>& r,
67  const std::vector<G4double>& z)
68 {
69  G4double zlist[numRZ];
70  G4double rlist[numRZ];
71 
72  for (G4int i=0; i< numRZ; i++) {
73  rlist[i]= r[i];
74  zlist[i]= z[i];
75  }
76 
77  return new G4Polycone(name, phiStart, phiTotal, numRZ,
78  rlist, zlist);
79 
80 }
81 
82 }
83 
84 using namespace pyG4Polycone;
85 
86 
87 // ====================================================================
88 // module definition
89 // ====================================================================
91 {
92  class_<G4Polycone, G4Polycone*, bases<G4VSolid> >
93  ("G4Polycone", "Polycone solid class", no_init)
94  // ---
95  .def("GetStartPhi", &G4Polycone::GetStartPhi)
96  .def("GetEndPhi", &G4Polycone::GetEndPhi)
97  .def("IsOpen", &G4Polycone::IsOpen)
98  .def("GetNumRZCorner", &G4Polycone::GetNumRZCorner)
99 
100  // operators
101  .def(self_ns::str(self))
102  ;
103 
104  // Create solid
105  def("CreatePolycone", f1_CreatePolycone,
106  return_value_policy<manage_new_object>());
107  def("CreatePolycone", f2_CreatePolycone,
108  return_value_policy<manage_new_object>());
109 
110 }
111 
TRandom r
Definition: spectrum.C:23
G4Polycone * f1_CreatePolycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numZPlanes, const std::vector< G4double > &zPlane, const std::vector< G4double > &rInner, const std::vector< G4double > &rOuter)
Definition: pyG4Polycone.cc:43
void export_G4Polycone()
Definition: pyG4Polycone.cc:90
G4Polycone * f2_CreatePolycone(const G4String &name, G4double phiStart, G4double phiTotal, G4int numRZ, const std::vector< G4double > &r, const std::vector< G4double > &z)
Definition: pyG4Polycone.cc:64
Double_t z
Definition: plot.C:276