File: TrdBenchmark.cpp

package info (click to toggle)
vecgeom 1.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,928 kB
  • sloc: cpp: 88,717; ansic: 6,894; python: 1,035; sh: 582; sql: 538; makefile: 29
file content (53 lines) | stat: -rw-r--r-- 1,600 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
// This file is part of VecGeom and is distributed under the
// conditions in the file LICENSE.txt in the top directory.
// For the full list of authors see CONTRIBUTORS.txt and `git log`.

/// Benchmark for Trd
/// @file test/benchmark/TrdParallelepiped.cpp

#include "VecGeom/volumes/LogicalVolume.h"
#include "VecGeom/volumes/Box.h"
#include "VecGeom/volumes/Trd.h"
#include "VecGeomBenchmark/Benchmarker.h"
#include "VecGeom/management/GeoManager.h"
#include "ArgParser.h"

using namespace vecgeom;

double dmax(double d1, double d2)
{
  if (d1 > d2) return d1;
  return d2;
}

int main(int argc, char *argv[])
{
  OPTION_INT(npoints, 50000);
  OPTION_INT(nrep, 1);
  OPTION_DOUBLE(dx1, 3.);
  OPTION_DOUBLE(dx2, 4.);
  OPTION_DOUBLE(dy1, 5.);
  OPTION_DOUBLE(dy2, 6.);
  OPTION_DOUBLE(dz, 7.);

  UnplacedBox worldUnplaced = UnplacedBox(dmax(dx1, dx2) * 4, dmax(dy1, dy2) * 4, dz * 4);
  auto trdUnplaced          = GeoManager::MakeInstance<UnplacedTrd>(dx1, dx2, dy1, dy2, dz);
  // UnplacedTrd(dx1, dx2, dy1, dy2, dz);

  LogicalVolume world("world", &worldUnplaced);
  // LogicalVolume trd("trdLogicalVolume", &trdUnplaced);
  LogicalVolume trd("trdLogicalVolume", trdUnplaced);
  Transformation3D placement(5., 5., 5.);
  world.PlaceDaughter("trdPlaced", &trd, &placement);

  VPlacedVolume *worldPlaced = world.Place();

  GeoManager::Instance().SetWorldAndClose(worldPlaced);

  Benchmarker tester(GeoManager::Instance().GetWorld());
  tester.SetVerbosity(3);
  tester.SetRepetitions(nrep);
  tester.SetPointCount(npoints);
  tester.SetPoolMultiplier(1);
  return tester.RunBenchmark();
}