-
Notifications
You must be signed in to change notification settings - Fork 0
/
binning.C
executable file
·105 lines (84 loc) · 2.87 KB
/
binning.C
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
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
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <stdio.h>
#include <TMinuit.h>
#include <TCanvas.h>
#include <TFile.h>
#include <TH1.h>
#include <TH2.h>
#include <TH3.h>
#include <TF1.h>
#include <TF2.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TLegend.h>
#include <TLine.h>
#include <TMath.h>
#include <TPad.h>
#include <TSystem.h>
#include <TGraphErrors.h>
#include <TFile.h>
#include <TTree.h>
#include <TChain.h>
#include <TFitResult.h>
#include <TMatrixDSym.h>
#include <TPaveText.h>
#include <TGaxis.h>
#include <settings.h>
#endif
void binning(){
gSystem -> CompileMacro("settings.h");
//============================================================================
//CONVERSION FACTOR cost
//============================================================================
double diff = 0;
for(int i = 0;i < N_cost_bins;i++){
width_cost[i+1] = ((max_cost - min_cost)/(double) N_TH3_cost_bins)*(bins_cost[i+1] - bins_cost[i]);
}
for(int i = 0;i < dim_cost;i++){
diff += width_cost[i];
value_cost[i] = min_cost + diff;
if(TMath::Abs(value_cost[i]) < 0.01){value_cost[i] = 0.;}
}
//============================================================================
// COMPUTE D(cost)
//============================================================================
for(int i = 0;i < N_cost_bins;i++){
Dcost[i] = value_cost[i+1] - value_cost[i];
}
//============================================================================
//CONVERSION FACTOR phi
//============================================================================
for(int i = 0;i < N_phi_bins;i++){
width_phi[i+1] = ((max_phi - min_phi)/(double) N_TH3_phi_bins)*(bins_phi[i+1] - bins_phi[i]);
}
diff = 0;
for(int i = 0;i < dim_phi;i++){
diff += width_phi[i];
value_phi[i] = min_phi + diff;
if(TMath::Abs(value_phi[i]) < 0.01){value_phi[i] = 0.;}
}
//============================================================================
// COMPUTE D(phi)
//============================================================================
double Dphi[N_phi_bins];
for(int i = 0;i < N_phi_bins;i++){
Dphi[i] = value_phi[i+1] - value_phi[i];
}
//============================================================================
// COMPUTE THE BIN AREA
//============================================================================
for(int i = 0;i < N_cost_bins;i++){
for(int j = 0;j < N_phi_bins;j++){
bin_area[i][j] = Dcost[i]*Dphi[j];
}
}
//============================================================================
// GENERATE LINES
//============================================================================
for(int i = 0;i < N_line_cost;i++){
line_cost[i] = new TLine(value_cost[i+1],0,value_cost[i+1],PI);
}
for(int i = 0;i < N_line_phi;i++){
line_phi[i] = new TLine(-1,value_phi[i+1],1,value_phi[i+1]);
}
}