Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlanarSurfaceTestBeds.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PlanarSurfaceTestBeds.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
23 
24 #include <array>
25 #include <tuple>
26 #include <vector>
27 
28 #include "BoundRandomValues.hpp"
29 
30 namespace ActsFatras {
31 
32 using Randomizer = std::function<Acts::Vector2(double, double)>;
33 
34 using PlanarTestBed =
35  std::tuple<std::string, std::shared_ptr<const Acts::Surface>,
37 
46  std::vector<PlanarTestBed> operator()(double rScale) const {
47  double irScale = (2. - rScale);
48 
49  // Pixel test in Rectangle
50  double xhalf = 3.;
51  double yhalf = 6.5;
52  auto rectangle = std::make_shared<Acts::RectangleBounds>(xhalf, yhalf);
53  auto rSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
54  Acts::Transform3::Identity(), rectangle);
55  Acts::BinUtility pixelated(15, -xhalf, xhalf, Acts::open, Acts::binX);
56  pixelated += Acts::BinUtility(26, -yhalf, yhalf, Acts::open, Acts::binY);
57  RectangleRandom rRandom(xhalf * rScale, yhalf * rScale);
58 
59  // Cartesian strip test in Trapezoid
60  double xhalfminy = 2.;
61  double xhalfmaxy = 3.5;
62  yhalf = 4.;
63  auto trapezoid =
64  std::make_shared<Acts::TrapezoidBounds>(xhalfminy, xhalfmaxy, yhalf);
65  auto tSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
66  Acts::Transform3::Identity(), trapezoid);
67  Acts::BinUtility stripsX(35, -xhalfmaxy, xhalfmaxy, Acts::open, Acts::binX);
68  stripsX += Acts::BinUtility(1, -yhalf, yhalf, Acts::open, Acts::binY);
69  TrapezoidRandom tRandom(xhalfminy * rScale, xhalfmaxy * rScale,
70  yhalf * rScale);
71 
72  // Phi strip test in DiscTrapezoid
73  double rmin = 2.;
74  double rmax = 7.5;
75  double xmin = 2.;
76  double xmax = 3.5;
77  double ymax = std::sqrt(rmax * rmax - xmax * xmax);
78  double alpha = std::max(atan2(xmin, rmin), atan2(xmax, ymax));
79 
80  auto discTrapezoid =
81  std::make_shared<Acts::DiscTrapezoidBounds>(xmin, xmax, rmin, rmax);
82  auto dtSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
83  Acts::Transform3::Identity(), discTrapezoid);
84  Acts::BinUtility stripsPhi(1, rmin, rmax, Acts::open, Acts::binR);
85  stripsPhi += Acts::BinUtility(25, M_PI_2 - alpha, M_PI_2 + alpha,
87  TrapezoidRandom dtRandom(xmin * rScale, xmax * rScale, rmin * irScale,
88  ymax * rScale);
89 
90  // Raidal disc test
91  auto discRadial =
92  std::make_shared<Acts::RadialBounds>(rmin, rmax, M_PI_4, M_PI_2);
93  auto dSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
94  Acts::Transform3::Identity(), discRadial);
95  Acts::BinUtility rphiseg(10, rmin, rmax, Acts::open, Acts::binR);
96  rphiseg += Acts::BinUtility(20, (M_PI_2 - M_PI_4), (M_PI_2 + M_PI_4),
98 
99  DiscRandom dRandom(rmin * irScale, rmax * rScale,
100  (M_PI_2 - M_PI_4) * irScale, (M_PI_2 + M_PI_4) * rScale);
101 
102  // Annulus disc test
103  rmin = 2.5;
104  rmax = 5.5;
105  Acts::Vector2 aorigin(0.1, -0.3);
106  double phimin = -0.25;
107  double phimax = 0.38;
108  auto annulus = std::make_shared<Acts::AnnulusBounds>(rmin, rmax, phimin,
109  phimax, aorigin);
110  auto aSurface = Acts::Surface::makeShared<Acts::DiscSurface>(
111  Acts::Transform3::Identity() *
112  Acts::Translation3(-aorigin.x(), -aorigin.y(), 0.),
113  annulus);
114 
115  auto vertices = annulus->vertices(72);
116  std::for_each(vertices.begin(), vertices.end(), [&](Acts::Vector2& v) {
117  double r = Acts::VectorHelpers::perp(v);
118  rmin = std::min(rmin, r);
119  rmax = std::max(rmax, r);
120  });
121 
122  Acts::BinUtility stripsPhiA(1, rmin, rmax, Acts::open, Acts::binR);
123  stripsPhiA +=
124  Acts::BinUtility(12, phimin, phimax, Acts::open, Acts::binPhi);
125  AnnulusRandom aRandom(rmin * irScale, rmax * rScale, phimin * rScale,
126  phimax * rScale, aorigin.x(), aorigin.y());
127 
128  return {{"Rectangle", std::move(rSurface), pixelated, rRandom},
129  {"Trapezoid", std::move(tSurface), stripsX, tRandom},
130  {"DiscTrapezoid", std::move(dtSurface), stripsPhi, dtRandom},
131  {"DiscRadial", std::move(dSurface), rphiseg, dRandom},
132  {"Annulus", std::move(aSurface), stripsPhiA, aRandom}};
133  }
134 };
135 
136 } // namespace ActsFatras