GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TTransition.cxx
Go to the documentation of this file.
1#include "TTransition.h"
2
3#include <iostream>
4
9
11
12void TTransition::Clear(Option_t*)
13{
14 fEnergy = 0;
16 fIntensity = 0;
18}
19
20void TTransition::Print(Option_t*) const
21{
22
23 if(!std::isnan(fEngUncertainty)) {
24 std::cout << "Energy: " << fEnergy << " +/- " << fEngUncertainty << std::endl;
25 } else {
26 std::cout << "Energy: " << fEnergy << std::endl;
27 }
28 if(!std::isnan(fIntensity)) {
29 if(!std::isnan(fIntUncertainty)) {
30 std::cout << "\tIntensity: " << fIntensity << " +/- " << fIntUncertainty << std::endl;
31 } else {
32 std::cout << "\tIntensity: " << fEnergy << std::endl;
33 }
34 } else {
35 std::cout << std::endl;
36 }
37}
38
39std::string TTransition::PrintToString() const
40{
41 std::string toString;
42 toString.append(Form("%f\t", fEnergy));
43 toString.append(Form("%f\t", fEngUncertainty));
44 toString.append(Form("%f\t", fIntensity));
45 toString.append(Form("%f\t", fIntUncertainty));
46
47 return toString;
48}
49
50int TTransition::Compare(const TObject* obj) const
51{
53 return CompareIntensity(obj);
54 }
55 return CompareEnergy(obj);
56}
57
58int TTransition::CompareIntensity(const TObject* obj) const
59{
60 /// Compares the intensities of the TTransitions
61 if(fIntensity > static_cast<const TTransition*>(obj)->fIntensity) {
62 return -1;
63 }
64 if(fIntensity == static_cast<const TTransition*>(obj)->fIntensity) {
65 return 0;
66 }
67 return 1;
68}
69
70int TTransition::CompareEnergy(const TObject* obj) const
71{
72 /// Compares the energies of the TTransitions
73 if(fEnergy < static_cast<const TTransition*>(obj)->fEnergy) {
74 return -1;
75 }
76 if(fEnergy == static_cast<const TTransition*>(obj)->fEnergy) {
77 return 0;
78 }
79 return 1;
80}
void Print(Option_t *opt="") const override
double fEngUncertainty
Uncertainty in the energy of the transition.
Definition TTransition.h:61
double fIntUncertainty
Uncertainty in the intensity.
Definition TTransition.h:63
int CompareIntensity(const TObject *obj) const
int CompareEnergy(const TObject *obj) const
double fIntensity
Intensity of the transition.
Definition TTransition.h:62
int Compare(const TObject *obj) const override
double fEnergy
Energy of the transition.
Definition TTransition.h:60
bool fCompareIntensity
Whether to sort by intensity or energy.
Definition TTransition.h:64
void Clear(Option_t *opt="") override
std::string PrintToString() const