GRSISort
Created by P.C. Bender
Developement Team: P.C. Bender, R. Dunlop, V. Bildstein
An extension of the ROOT analysis Framework
TEfficiencyCal.cxx
Go to the documentation of this file.
1 #include "TEfficiencyCal.h"
2 
3 /// \cond CLASSIMP
5 /// \endcond
6 
8 {
9 }
10 
12 
14 {
15  copy.Copy(*this);
16 }
17 
18 void TEfficiencyCal::Copy(TObject& obj) const
19 {
20  static_cast<TEfficiencyCal&>(obj).fScaleFactor = fScaleFactor;
21  TCal::Copy(obj);
22 }
23 
24 void TEfficiencyCal::ScaleGraph(Double_t scaleFactor)
25 {
26  if(GetN() == 0) {
27  Error("ScaleGraph", "Graph does not exist");
28  return;
29  }
30 
31  for(int i = 0; i < GetN(); i++) {
32  GetY()[i] *= scaleFactor;
33  GetEY()[i] *= scaleFactor;
34  }
35 
36  fScaleFactor = scaleFactor;
37 }
38 
40 {
41  if(peak == nullptr) {
42  Error("AddPoint", "Peak is empty");
43  return;
44  }
45  AddPoint(peak->GetCentroid(), peak->GetArea(), peak->GetCentroidErr(), peak->GetAreaErr());
46 }
47 
48 void TEfficiencyCal::AddPoint(Double_t energy, Double_t area, Double_t dEnergy, Double_t dArea)
49 {
50  if(GetNucleus() == nullptr) {
51  Error("AddPoint", "No nucleus set");
52  return;
53  }
54  // Will eventually write a method that doesn't need a nucleus
55 
56  Double_t efficiency, dEfficiency;
57  Double_t intensity = 1.0; // nuc;
58 
59  efficiency = area / intensity;
60  dEfficiency = dArea / intensity;
61  // dEfficiency = efficiency*TMath::Sqrt(TMath::Power(dEfficiency/efficiency,2.0) + TMath::Power(dArea/area,2.0));
62 
63  SetPoint(GetN(), energy, efficiency);
64  SetPointError(GetN() - 1, dEnergy, dEfficiency);
65 
66  Sort(); // This keeps the points in order of energy;
67 }
68 
69 void TEfficiencyCal::Print(Option_t*) const
70 {
71  TCal::Print();
72 }
73 
74 void TEfficiencyCal::Clear(Option_t*)
75 {
76  fScaleFactor = 1.0;
77  TCal::Clear();
78 }
void Print(Option_t *opt="") const override
Double_t GetCentroidErr() const
Definition: TPeak.h:50
void ScaleGraph(Double_t scaleFactor)
Double_t fScaleFactor
void Copy(TObject &obj) const override
Definition: TCal.cxx:46
void Print(Option_t *opt="") const override
Definition: TCal.cxx:154
Double_t GetCentroid() const
Definition: TPeak.h:49
Definition: TPeak.h:28
Definition: TCal.h:44
virtual TNucleus * GetNucleus() const
Definition: TCal.h:75
void Copy(TObject &obj) const override
void Clear(Option_t *opt="") override
Definition: TCal.cxx:146
Double_t GetAreaErr() const
Definition: TPeak.h:52
ClassImp(TGRSIMnemonic) void TGRSIMnemonic
void AddPoint(Double_t energy, Double_t area, Double_t dEnergy=0.0, Double_t dArea=0.0)
Double_t GetArea() const
Definition: TPeak.h:51
void Clear(Option_t *opt="") override
~TEfficiencyCal() override