ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RealQuadraticEquation.hpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RealQuadraticEquation.hpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2017-2018 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
10
// RealQuadraticEquation.h, Acts project
12
13
#pragma once
14
#include <cmath>
15
#include <utility>
16
17
namespace
Acts {
18
namespace
detail {
19
46
47
struct
RealQuadraticEquation
{
48
double
first
;
49
double
second
;
50
int
solutions
;
51
57
RealQuadraticEquation
(
double
alpha
,
double
beta,
double
gamma)
58
:
first
(0.),
second
(0.) {
59
double
discriminant = beta * beta - 4 * alpha * gamma;
60
if
(discriminant < 0) {
61
solutions
= 0;
62
}
else
{
63
solutions
= (discriminant == 0) ? 1 : 2;
64
double
q = -0.5 * (beta + (beta > 0 ? std::sqrt(discriminant)
65
: -std::sqrt(discriminant)));
66
first
= q /
alpha
;
67
second
= gamma / q;
68
}
69
}
70
};
71
72
}
// namespace detail
73
}
// namespace Acts
acts
blob
master
Core
include
Acts
Utilities
detail
RealQuadraticEquation.hpp
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:22
using
1.8.2 with
ECCE GitHub integration