Initial version of BM1DOpen class
This commit is contained in:
parent
6e81657b76
commit
23d23ef466
|
@ -0,0 +1,41 @@
|
|||
// Created by Baranyai David on 2017. 11. 02.
|
||||
|
||||
#ifndef BM1DOpen_h
|
||||
#define BM1DOpen_h 1
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <cmath>
|
||||
|
||||
#include "TROOT.h"
|
||||
#include "TTree.h"
|
||||
#include "TFile.h"
|
||||
|
||||
class BM1DOpen {
|
||||
public:
|
||||
BM1DOpen();
|
||||
~BM1DOpen();
|
||||
void OpenfromTree(const char* filename);
|
||||
std::vector<Double_t> GetT();
|
||||
std::vector<Double_t> GetX();
|
||||
Double_t GetMu1();
|
||||
Double_t GetMu2();
|
||||
Double_t GetSigma1();
|
||||
Double_t GetSigma2();
|
||||
Double_t Getx1();
|
||||
Double_t Getx2();
|
||||
Int_t GetP0();
|
||||
Int_t GetP1();
|
||||
Int_t GetSteps();
|
||||
Int_t GetnRuns();
|
||||
private:
|
||||
TFile* fIn;
|
||||
TTree *T2, *T3;
|
||||
Long64_t nentries;
|
||||
std::vector<Double_t> t;
|
||||
std::vector<Double_t> x;
|
||||
Double_t InnerMean,ExternalMean,InnerSigma,ExternalSigma,tl,xl,x1,x2;
|
||||
Double_t P0, P1, Steps, NumberofRuns,BottomLayer,UpperLayer;
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,118 @@
|
|||
// Created by Baranyai David on 2017. 11. 02.
|
||||
|
||||
#include "BM1DOpen.hh"
|
||||
|
||||
BM1DOpen::BM1DOpen()
|
||||
{
|
||||
|
||||
}
|
||||
BM1DOpen::~BM1DOpen()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BM1DOpen::OpenfromTree(const char *filename)
|
||||
{
|
||||
fIn = new TFile(filename,"READ");
|
||||
if (fIn->IsZombie())
|
||||
{
|
||||
std::cout << "Error opening file" << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
T2 = (TTree*)fIn->Get("BM1DTree");
|
||||
T3 = (TTree*)fIn->Get("DataTree");
|
||||
|
||||
T2->SetBranchAddress("xl",&xl);
|
||||
T2->SetBranchAddress("tl",&tl);
|
||||
|
||||
T3->SetBranchAddress("P0",&P0);
|
||||
T3->SetBranchAddress("P1",&P1);
|
||||
T3->SetBranchAddress("Steps",&Steps);
|
||||
T3->SetBranchAddress("NumberofRuns",&NumberofRuns);
|
||||
T3->SetBranchAddress("BottomLayer",&BottomLayer);
|
||||
T3->SetBranchAddress("UpperLayer",&UpperLayer);
|
||||
T3->SetBranchAddress("InnerMean",&InnerMean);
|
||||
T3->SetBranchAddress("ExternalMean",&ExternalMean);
|
||||
T3->SetBranchAddress("InnerSigma",&InnerSigma);
|
||||
T3->SetBranchAddress("ExternalSigma",&ExternalSigma);
|
||||
|
||||
nentries = T2->GetEntries();
|
||||
|
||||
for (Long64_t i=0;i<nentries;i++)
|
||||
{
|
||||
T2->GetEntry(i);
|
||||
t.push_back(tl);
|
||||
x.push_back(xl);
|
||||
}
|
||||
|
||||
nentries = T3->GetEntries();
|
||||
for (Long64_t i=0;i<nentries;i++)
|
||||
{
|
||||
T3->GetEntry(i);
|
||||
}
|
||||
|
||||
fIn->Close();
|
||||
|
||||
}
|
||||
|
||||
std::vector<Double_t> BM1DOpen::GetT()
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
std::vector<Double_t> BM1DOpen::GetX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::GetMu1()
|
||||
{
|
||||
return InnerMean;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::GetMu2()
|
||||
{
|
||||
return ExternalMean;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::GetSigma1()
|
||||
{
|
||||
return InnerSigma;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::GetSigma2()
|
||||
{
|
||||
return ExternalMean;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::Getx1()
|
||||
{
|
||||
return BottomLayer;
|
||||
}
|
||||
|
||||
Double_t BM1DOpen::Getx2()
|
||||
{
|
||||
return UpperLayer;
|
||||
}
|
||||
|
||||
Int_t BM1DOpen::GetP0()
|
||||
{
|
||||
return (Int_t)P0;
|
||||
}
|
||||
|
||||
Int_t BM1DOpen::GetP1()
|
||||
{
|
||||
return (Int_t)P1;
|
||||
}
|
||||
|
||||
Int_t BM1DOpen::GetSteps()
|
||||
{
|
||||
return (Int_t)Steps;
|
||||
}
|
||||
|
||||
Int_t BM1DOpen::GetnRuns()
|
||||
{
|
||||
return (Int_t)NumberofRuns;
|
||||
}
|
Loading…
Reference in New Issue