AculCalibScint.h 3.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//////////////////////////////////////////////////////////////////////////////
//                                                            				//
// This class is intended for ...                             				//
//                                                            				//
// It work like this... User may use such functions ... in such steps.      //
//
// Keywords in parameter file and possible comments
//
// Something about order of keywords
//
// Example of parameter file (with explanations)
//
//			energies	4	#number of energy points
//			crystals	16	#number of crystals in detector
//			files 4
//			#fileID		fileName
//			#fileID not implemented yet
//			data/csi_13_Ealpha16.root
//			data/csi_13_Ealpha21.root
//			data/csi_13_Ealpha26.root
//			data/csi_13_Ealpha30.root
//			#keyword	detector	particle
//			detector	SQ13  Alpha
//			#keyword	energy [MeV/A]
//			energy 66.542
//			#keyword;	filename;	number of cuts in file
//			cutFile cuts/cutsSQ13Alpha.root	2
//			cutsSQ13Alpha16
//			cutSQ13Alpha16Amp
//			#channel	minimum	maximum
//			0	650		830
//			1	920		1150
//\			...
//			15	800		1000
//			#CsI2, energy ~ 21 MeV/A, Alpha
//			energy 85.437
//			#keyword;	filename;	number of cuts in file
//			cutFile cuts/cutsSQ13Alpha.root	2
//			cutSQ13Alpha21
//			cutSQ13Alpha21Amp
//			#channel	minimum	maximum
//			0	1050	1200
//\			\...
//			15	1150	1350
//			#CsI2, energy ~ 26 MeV/A, Alpha
//			energy 105.5
//			...
//
//asdasd
//////////////////////////////////////////////////////////////////////////////


53 54 55 56 57 58
#pragma once

//#include "TObject.h"
//#include "TROOT.h"
#include <iostream>
#include <fstream>
59
//#include <vector>
60 61 62

#include "TFile.h"
#include "TTree.h"
63 64 65
//#include "TCanvas.h"
#include "TH1I.h"
#include "TGraphErrors.h"
66
//#include "TArrayD.h"
67
#include "TF1.h"
68 69 70 71 72

#include "./AculCalib.h"

using std::cout;
using std::endl;
73
//using std::vector;
74 75 76 77 78 79

class AculCalibScint : public AculCalib {

private:
//
	//todo delete this strange double array somewhere
80 81
	TFile **fInFiles;	//! doc of class member
	TTree **fTrees;		//!
82 83

	TFile *fCutFile;
84

85 86
	vector< vector<TH1I*> > fHistFull;
	vector< vector<TH1I*> > fHistCut;
87
//
88
	vector< vector<Double_t> > fMeanPeakPos; //doc of class member
89
	vector< vector<Double_t> > fMeanPeakRMS;
90
//
91 92
	//todo make vector of graphs
	TGraphErrors *gCal[16];
93 94 95 96
//	TFile *fGraphs;

public:
	AculCalibScint();
97 98
	//default constructor

99 100
	AculCalibScint(const char* parfile);
	virtual ~AculCalibScint();
101
	ClassDef (AculCalibScint,1);	//decription right after ClassDef
102 103 104 105 106

	virtual void Init();

	void PrintTrees();

107
	//Description of the function. I think it does not work.
108
	void DrawVariable(const char* variable, Int_t treeID, TCanvas *canvas, Int_t lowRange = 0, Int_t upRange = 4096);
109 110

	//Description of the function. I think it does not work.
111 112
	void DrawBeam(TCanvas *canvas, Int_t file, const char* variable);

113 114 115
	//One of the crucial function. It founds the mean of the peak related to our particle.
	void GetPeakMean(const char* variable, Int_t treeID, TCanvas *canvas,
			const char* beamcut, const Int_t nbins = 4096, Int_t lowRange = 0);
116 117 118 119 120
	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);
121 122 123 124 125 126 127

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

private:
	void OpenFiles();
	void LoadTrees();
128 129 130 131 132

	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 = "");


133 134
//	void SetPars();
};