File: PlacedCutTube.cpp

package info (click to toggle)
vecgeom 1.2.8%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 24,016 kB
  • sloc: cpp: 88,803; ansic: 6,888; python: 1,035; sh: 582; sql: 538; makefile: 23
file content (70 lines) | stat: -rw-r--r-- 1,880 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * PlacedCutTube.cpp
 *
 *  Created on: 03.11.2016
 *      Author: mgheata
 */
#include "VecGeom/volumes/PlacedCutTube.h"
#include "VecGeom/volumes/SpecializedCutTube.h"
#include "VecGeom/base/Vector3D.h"

#ifdef VECGEOM_ROOT
#include "TGeoTube.h"
#endif

#ifdef VECGEOM_GEANT4
#include "G4CutTubs.hh"
#endif

namespace vecgeom {
inline namespace VECGEOM_IMPL_NAMESPACE {

VECCORE_ATT_HOST_DEVICE
void PlacedCutTube::PrintType() const
{
  printf("PlacedCutTube");
}

void PlacedCutTube::PrintType(std::ostream &s) const
{
  s << "PlacedCutTube";
}

#ifndef VECCORE_CUDA

VPlacedVolume const *PlacedCutTube::ConvertToUnspecialized() const
{
  return new SimpleCutTube(GetLabel().c_str(), GetLogicalVolume(), GetTransformation());
}

#ifdef VECGEOM_ROOT
TGeoShape const *PlacedCutTube::ConvertToRoot() const
{
  UnplacedCutTube const *t = static_cast<UnplacedCutTube const *>(GetUnplacedVolume());
  return new TGeoCtub(GetLabel().c_str(), t->rmin(), t->rmax(), t->z(), t->sphi() * (180 / M_PI),
                      (t->sphi() + t->dphi()) * (180 / M_PI), t->BottomNormal().x(), t->BottomNormal().y(),
                      t->BottomNormal().z(), t->TopNormal().x(), t->TopNormal().y(), t->TopNormal().z());
}
#endif

#ifdef VECGEOM_GEANT4
G4VSolid const *PlacedCutTube::ConvertToGeant4() const
{
  UnplacedCutTube const *t = static_cast<UnplacedCutTube const *>(GetUnplacedVolume());
  G4ThreeVector pLowNorm(t->BottomNormal().x(), t->BottomNormal().y(), t->BottomNormal().z());
  G4ThreeVector pHighNorm(t->TopNormal().x(), t->TopNormal().y(), t->TopNormal().z());
  return new G4CutTubs(GetLabel().c_str(), t->rmin(), t->rmax(), t->z(), t->sphi(), t->dphi(), pLowNorm, pHighNorm);
}
#endif

#endif // VECCORE_CUDA

} // End impl namespace

#ifdef VECCORE_CUDA

VECGEOM_DEVICE_INST_PLACED_VOLUME_ALLSPEC(SpecializedCutTube)

#endif // VECCORE_CUDA

} // End global namespace