AlcapDAQ
1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
www
html
online
trend_plots
runsummary
tutorials
Quad.cxx
Go to the documentation of this file.
1
#include <math.h>
2
#include "Riostream.h"
3
#include "
Quad.h
"
4
5
Quad::Quad
(Float_t a,Float_t b,Float_t
c
)
6
{
7
fA
= a;
8
fB
= b;
9
fC
=
c
;
10
}
11
12
Quad::~Quad
()
13
{
14
cout <<
"deleting object with coeffts: "
15
<<
fA
<<
","
<<
fB
<<
","
<<
fC
<< endl;
16
}
17
18
void
Quad::Solve
()
const
19
{
20
Float_t temp =
fB
*
fB
-4*
fA
*
fC
;
21
if
(temp > 0) {
22
temp = sqrt(temp);
23
cout <<
"There are two roots: "
24
<< ( -
fB
- temp ) / (2.*
fA
)
25
<<
" and "
26
<< ( -
fB
+ temp ) / (2.*
fA
)
27
<< endl;
28
}
else
{
29
if
(temp == 0) {
30
cout <<
"There are two equal roots: "
31
<< -
fB
/ (2.*
fA
) << endl;
32
}
else
{
33
cout <<
"There are no roots"
<< endl;
34
}
35
}
36
}
37
38
Float_t
Quad::Evaluate
(Float_t x)
const
39
{
40
return
fA
*x*x +
fB
*x +
fC
;
41
return
0;
42
}
Generated by
1.8.4