File: boolminustest2.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 (77 lines) | stat: -rw-r--r-- 2,816 bytes parent folder | download
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
71
72
73
74
75
76
77
/*
 * boolminustest.cpp
 *
 *  Created on: Aug 13, 2014
 *      Author: swenzel
 */

#include "VecGeom/base/Transformation3D.h"
#include "VecGeom/base/Vector3D.h"
#include "VecGeom/volumes/Box.h"
#include "VecGeom/volumes/Tube.h"
#include "VecGeom/volumes/TBooleanMinusVolume.h"
#include "VecGeom/management/GeoManager.h"
#include "VecGeomTest/Benchmarker.h"

using namespace vecgeom;

// now create a specialized box by hand (instead of the factory)
// we know that it is only translated
typedef SpecializedBox<translation::kIdentity, rotation::kIdentity> OriginBox_t;
typedef SpecializedBox<translation::kGeneric, rotation::kIdentity> TranslatedBox_t;
// typedef TUnplacedBooleanMinusVolume<
//             OriginBox_t, TranslatedBox_t > BoxMinusBox_t;
typedef TUnplacedBooleanMinusVolume BoxMinusBox_t;

typedef TSpecializedBooleanMinusVolume<OriginBox_t, TranslatedBox_t, translation::kGeneric, rotation::kIdentity>
    SpecializedVol_t;

int main()
{
  UnplacedBox worldUnplaced(10., 10., 10.);
  LogicalVolume world("world", &worldUnplaced);

  // components for boolean solid
  UnplacedBox motherbox(5., 5., 5.);
  UnplacedBox subtractedbox(2., 2., 2);
  // translation for boolean solid right shape
  Transformation3D translation(-2.5, 0, 0);

  VPlacedVolume *worldPlaced = world.Place();
  GeoManager::Instance().SetWorld(worldPlaced);

  // now create a specialized box by hand (instead of the factory)
  // we know that it is only translated
  typedef SpecializedBox<translation::kIdentity, rotation::kIdentity> OriginBox_t;
  typedef SpecializedBox<translation::kGeneric, rotation::kIdentity> TranslatedBox_t;

  TranslatedBox_t const *placedsubtractedbox = new TranslatedBox_t(new LogicalVolume("", &subtractedbox), &translation);

  // now create a specialized box by hand (instead of the factory)
  // we know that it is only translated
  OriginBox_t const *placedmotherbox = new OriginBox_t(new LogicalVolume("", &motherbox), &Transformation3D::kIdentity);

  // now make the unplaced boolean solid
  BoxMinusBox_t booleansolid(placedmotherbox, placedsubtractedbox);
  LogicalVolume booleanlogical("booleanL", &booleansolid);
  // placement of boolean solid
  Transformation3D placement(5, 5, 5);

  // make a special solid by hand ( need to sort out factory later )
  SpecializedVol_t *sp = new SpecializedVol_t("booleanspecialized", &booleanlogical, &placement);
  // booleansolid.CreateSpecializedVolume()
  // world.PlaceDaughter("boolean", &booleanlogical, &placement);

  // add this boolean solid to the world
  world.PlaceDaughter(sp);

  Benchmarker tester(GeoManager::Instance().GetWorld());
  tester.SetVerbosity(3);
  tester.SetPoolMultiplier(1);
  tester.SetRepetitions(1024);
  tester.SetPointCount(1 << 10);
  tester.RunInsideBenchmark();
  tester.RunToOutBenchmark();

  return 0;
}