Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DigitizationCsvOutput.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DigitizationCsvOutput.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 
12 
13 #include <fstream>
14 
15 namespace ActsFatras {
16 
24  void writeLine(std::ostream& outf, const Acts::Vector2& p0,
25  const Acts::Vector2& p1) const {
26  outf << "l," << p0.x() << "," << p0.y() << "," << p1.x() << "," << p1.y()
27  << "\n";
28  };
29 
36  void writeArc(std::ostream& outf, double r, double phiMin,
37  double phiMax) const {
38  outf << "a," << r << "," << r << "," << phiMin << "," << phiMax << "\n";
39  };
40 
45  void writePolygon(std::ostream& outf,
46  const std::vector<Acts::Vector2>& vertices,
47  const Acts::Vector2& shift = Acts::Vector2(0., 0.)) const {
48  auto nvertices = vertices.size();
49  for (unsigned long iv = 1; iv < nvertices; ++iv) {
50  writeLine(outf, vertices[iv - 1] + shift, vertices[iv] + shift);
51  }
52  writeLine(outf, vertices[nvertices - 1] + shift, vertices[0] + shift);
53  };
54 };
55 
56 } // namespace ActsFatras