Newer
Older
Yero1990
committed
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
//SHMS DC Calibration Class
#ifndef DC_CALIB_H
#define DC_CALIB_H
#define NPLANES 12
#define NBINS 400
#define MINBIN -50.5
#define MAXBIN 349.5
#define TOTAL_BINS 274
class DC_calib
{
public:
//consructor and destructor
DC_calib(TString a, TString b, const Int_t c, Long64_t d);
~DC_calib();
//Define Functions
void printInitVar();
void SetPlaneNames();
void GetDCLeafs();
void AllocateDynamicArrays();
void CreateHistoNames();
void EventLoop();
void WriteToFile(Int_t debug);
void CalcT0Historical();
void Calculate_tZero();
void GetTwentyPercent_Peak();
void FitWireDriftTime();
void WriteTZeroParam();
void ApplyTZeroCorrection();
void WriteLookUpTable();
private:
Int_t run_NUM;
Long64_t num_evts;
TTree *tree;
Long64_t nentries;
TString SPECTROMETER;
Yero1990
committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
TString spec;
TString DETECTOR;
TString plane_names[NPLANES];
TString base_name;
TString ndatatime;
TString ndatawirenum;
TString drifttime;
TString wirenum;
TString ntrack;
TString etracknorm;
Double_t dc_ntrack;
Double_t psh_etracknorm;
Int_t wire;
Int_t ndata_time[NPLANES];
Double_t drift_time[NPLANES][1000];
Int_t ndata_wirenum[NPLANES];
Double_t wire_num[NPLANES][1000];
Int_t nwires[NPLANES];
//Declare variables to plot and save histo (dt = drift time)
TString plane_dt_name;
TString plane_dt_title;
TString plane_dt_name_corr;
TString plane_dt_title_corr;
TString cell_dt_name;
TString cell_dt_title;
TString fitted_cell_dt_name;
TString fitted_cell_dt_title;
TString dt_vs_wire_name;
TString dt_vs_wire_title;
TString ifile_name;
TString ofile_name;
TString itxtfile_name;
TString otxtfile_name;
//Declare variables to store histograms
TH1F *plane_dt;
TH1F *plane_dt_corr;
TH1F **cell_dt;
TH1F **cell_dt_corr;
TH1F **fitted_cell_dt;
TH2F *dt_vs_wire;
TH2F *dt_vs_wire_corr;
//Read/Write ROOT files
TFile *in_file;
TFile *out_file;
//Read/Write txt files
ifstream in_txtFILE;
ofstream out_txtFILE;
TDirectory *main_dir;
//Declare 2d dynamic arrays to get histogram bin properties
Int_t **bin_max;
Int_t **bin_maxContent;
Double_t **time_max;
Double_t **twenty_perc_maxContent;
Double_t **ref_time;
//variables to be used in loop over bins for wire drift time
Int_t content_bin; //stores content for each bin
Int_t counts; //a counter used to count the number of bins that have >20% max bin content for a plane
vector<Int_t> content; //stores bin content
vector <Int_t> bin_num; //stores bin number
//Declare 'FIT' related variables
Int_t **entries; //wire drift time histo entries
Int_t binx;
Double_t time_init; //start fit value
Double_t time_final; //end fit value
TF1 *tZero_fit; //linear fit function
Double_t m; //slope
Double_t y_int; //y-intercept
Double_t m_err;
Double_t y_int_err;
Double_t std_dev;
Double_t **t_zero;
Double_t **t_zero_err;
//declare variables to make plot of tzero v. wire number
TGraphErrors *graph;
TString graph_title;
TCanvas *gr1_canv;
//Declare varibales to write LoookUp Table
Int_t bin_count;
Int_t bin_t0[NPLANES];
Int_t bin_final[NPLANES];
Int_t bin_Content[NPLANES];
Double_t binContent_TOTAL[NPLANES];
Double_t binSUM[NPLANES];
Double_t lookup_value[NPLANES];
TString lookup_table;
TString headers;
};
#endif //DC_CALIBRATION_H