AculCalibScint.h 2.09 KB
Newer Older
1 2 3 4 5 6
#pragma once

//#include "TObject.h"
//#include "TROOT.h"
#include <iostream>
#include <fstream>
7
//#include <vector>
8 9 10

#include "TFile.h"
#include "TTree.h"
11 12 13
//#include "TCanvas.h"
#include "TH1I.h"
#include "TGraphErrors.h"
14
//#include "TArrayD.h"
15
#include "TF1.h"
16 17 18 19 20

#include "./AculCalib.h"

using std::cout;
using std::endl;
21
//using std::vector;
22 23 24 25 26 27 28 29 30 31 32 33

class AculCalibScint : public AculCalib {

private:
//
	//todo delete this strange double array somewhere
	TFile **fInFiles;
	TTree **fTrees;

	TFile *fCutFile;
//	TClonesArray cutsCol;
//
34 35 36 37
//	TH1I *fHistFull[NOCALFILES][16];
	vector< vector<TH1I*> > fHistFull;
//	TH1I *fHistCut[NOCALFILES][16];
	vector< vector<TH1I*> > fHistCut;
38
//
39 40 41 42
//	Double_t fMeanPeakPos[NOCALFILES][16];
	vector< vector<Double_t> > fMeanPeakPos;
//	Double_t fMeanPeakRMS[NOCALFILES][16];
	vector< vector<Double_t> > fMeanPeakRMS;
43
//
44 45
	//todo make vector of graphs
	TGraphErrors *gCal[16];
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
//	TFile *fGraphs;

public:
//	AculCalibScint() : a(0), b(0), c(0), p(0){};
	AculCalibScint();
	AculCalibScint(const char* parfile);
	virtual ~AculCalibScint();
	// Define the class for the cint dictionary
	ClassDef (AculCalibScint,1);

	virtual void Init();

//	void SetParFile(const char* parfile);

	void PrintTrees();
//	void PrintParameters(const char* option = "");
//	void PrintPeakRanges();

64 65 66 67 68 69 70 71 72
	void DrawVariable(const char* variable, Int_t treeID, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096);
	void DrawBeam(TCanvas *canvas, Int_t file, const char* variable);

	void GetPeakMean(const char* variable, Int_t treeID, Int_t energy, TCanvas *canvas, const char* beamcut, const Int_t nbins = 4096, Int_t lowRange = 0);
	void Calibrate(TCanvas *canvas, Bool_t savefile = 0, const char* filename = "", const char* option = "READ");

	void WriteClbParameters(const char* filename);

	TTree* GetTree(Int_t treeID);
73 74 75 76 77 78 79

//private functions:
//	void LoadCuts();

private:
	void OpenFiles();
	void LoadTrees();
80 81 82 83 84

	void SaveClbGraphs(const char* filename, const char* option = "READ");
	void FillGraph(TGraphErrors *g, Int_t npoints, /*Double_t *energies,*/ Int_t graphNumber, const char* option = "");


85 86
//	void SetPars();
};