forked from lbrl/CaenToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtreemaker.C
More file actions
38 lines (36 loc) · 1.46 KB
/
Copy pathtreemaker.C
File metadata and controls
38 lines (36 loc) · 1.46 KB
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
// Usage:
// $ root treemaker.C
// $ root 'treemaker.C(string)'
// $ root 'treemaker.C("path/to/file.dat")'
// $ root 'treemaker.C("path/to/file.dat")' -q -b
//
// Tested with: ROOT 6.06/00.
#include "TTree.h"
#include "TFile.h"
// Input parameters:
// fname --- the input file name, where data of peaks' positions and widths contained.
void treemaker(
string fname = "C:/File/output.dat"){
// Create an output file.
TFile Fout("C:/File/tree.root", "RECREATE");
// Create a TTree object to put in it data.
TTree t("t", "gain data");
// Read data from the input file into the tree.
// The tree will have 8 branches:
// snum --- the serial number [integer]
// npix --- the number of fired pixels [integer]
// volt --- the supply voltage of a MPPC [V, float]
// temp --- the MPPC temperature [Celsium degrees, float]
// m --- the peak position [ADC channel, float]
// me --- the peak position determinition error [ADC channel, float]
// s --- the peak Gaussian sigma [ADC channel, float]
// se --- the peak Gaussian sigma determinition error
// [ADC channel, float]
t.ReadFile(fname.c_str(), "snum/I:npix:volt/F:temp:m:me:s:se");
// Change the marker style from default points to small crosses.
t.SetMarkerStyle(6);
// Write the tree into the output file.
t.Write();
// Close the output file, guarantee that data are safe.
Fout.Close();
}