diff --git a/include/MedtechAnalysis.hh b/include/MedtechAnalysis.hh new file mode 100644 index 0000000..3a3a8d5 --- /dev/null +++ b/include/MedtechAnalysis.hh @@ -0,0 +1,35 @@ +// +// MedtechAnalysis.hh +// medtech +// +// Created by Baranyai David on 2018. 04. 03.. +// + +#ifndef MedtechAnalysis_hh +#define MedtechAnalysis_hh + +#include +#include "TTree.h" +#include "TFile.h" + +class MedtechAnalysis +{ +private: + /* Here will be the instance stored. */ + static MedtechAnalysis* instance; + + /* Private constructor to prevent instancing. */ + TTree *tree; + TFile *file; +public: + /* Static access method. */ + MedtechAnalysis(); + ~MedtechAnalysis(); + + void Fill(double, double, double); + void Close(); + + static MedtechAnalysis* getInstance(); +}; + +#endif /* MedtechAnalysis_hh */ diff --git a/src/MedtechAnalysis.cc b/src/MedtechAnalysis.cc new file mode 100644 index 0000000..8dcf3e5 --- /dev/null +++ b/src/MedtechAnalysis.cc @@ -0,0 +1,36 @@ +// +// MedtechAnalysis.cc +// medtech +// +// Created by Baranyai David on 2018. 04. 03.. +// + +#include "MedtechAnalysis.hh" + +MedtechAnalysis::MedtechAnalysis() +{ + tree = new TTree("tree", "tree"); + file = new TFile("data.root","RECREATE"); + instance = this; +} + +MedtechAnalysis::~MedtechAnalysis() +{ + +} + +void MedtechAnalysis::Fill(double x, double y, double e) +{ + tree -> Branch("x", &x, "x/D"); + tree -> Branch("y", &y, "y/D"); + tree -> Branch("e", &e, "e/D"); + + tree -> Fill(); + //tree -> ChangeFile(file); +} + +void MedtechAnalysis::Close() +{ + tree -> Write(); + file -> Close(); +}