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#include <cmath>
5
6#include "TString.h"
7
12
14
15void TTransition::Clear(Option_t*)
16{
17 fEnergy = 0;
19 fIntensity = 0;
21}
22
23void TTransition::Print(Option_t*) const
24{
25
26 if(!std::isnan(fEngUncertainty)) {
27 std::cout << "Energy: " << fEnergy << " +/- " << fEngUncertainty << std::endl;
28 } else {
29 std::cout << "Energy: " << fEnergy << std::endl;
30 }
31 if(!std::isnan(fIntensity)) {
32 if(!std::isnan(fIntUncertainty)) {
33 std::cout << "\tIntensity: " << fIntensity << " +/- " << fIntUncertainty << std::endl;
34 } else {
35 std::cout << "\tIntensity: " << fEnergy << std::endl;
36 }
37 } else {
38 std::cout << std::endl;
39 }
40}
41
42std::string TTransition::PrintToString() const
43{
44 std::string toString;
45 toString.append(Form("%f\t", fEnergy));
46 toString.append(Form("%f\t", fEngUncertainty));
47 toString.append(Form("%f\t", fIntensity));
48 toString.append(Form("%f\t", fIntUncertainty));
49
50 return toString;
51}
52
53int TTransition::Compare(const TObject* obj) const
54{
56 return CompareIntensity(obj);
57 }
58 return CompareEnergy(obj);
59}
60
61int TTransition::CompareIntensity(const TObject* obj) const
62{
63 /// Compares the intensities of the TTransitions
64 if(fIntensity > static_cast<const TTransition*>(obj)->fIntensity) {
65 return -1;
66 }
67 if(fIntensity == static_cast<const TTransition*>(obj)->fIntensity) {
68 return 0;
69 }
70 return 1;
71}
72
73int TTransition::CompareEnergy(const TObject* obj) const
74{
75 /// Compares the energies of the TTransitions
76 if(fEnergy < static_cast<const TTransition*>(obj)->fEnergy) {
77 return -1;
78 }
79 if(fEnergy == static_cast<const TTransition*>(obj)->fEnergy) {
80 return 0;
81 }
82 return 1;
83}
void Print(Option_t *opt="") const override
double fEngUncertainty
Uncertainty in the energy of the transition.
Definition TTransition.h:60
double fIntUncertainty
Uncertainty in the intensity.
Definition TTransition.h:62
int CompareIntensity(const TObject *obj) const
int CompareEnergy(const TObject *obj) const
double fIntensity
Intensity of the transition.
Definition TTransition.h:61
int Compare(const TObject *obj) const override
double fEnergy
Energy of the transition.
Definition TTransition.h:59
bool fCompareIntensity
Whether to sort by intensity or energy.
Definition TTransition.h:63
void Clear(Option_t *opt="") override
std::string PrintToString() const