New class for data analysis

This commit is contained in:
Gitea 2018-04-03 20:21:22 +02:00
parent db0bf22c79
commit 08e8b33016
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,35 @@
//
// MedtechAnalysis.hh
// medtech
//
// Created by Baranyai David on 2018. 04. 03..
//
#ifndef MedtechAnalysis_hh
#define MedtechAnalysis_hh
#include <stdio.h>
#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 */

36
src/MedtechAnalysis.cc Normal file
View File

@ -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();
}