forked from AlexandruHau/PET-material
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCompare.C
118 lines (90 loc) · 3.11 KB
/
Compare.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
106
107
108
109
110
111
112
113
114
115
116
117
118
#include "TFile.h"
#include "TString.h"
#include "TH1.h"
#include "TTree.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TRandom3.h"
#include "TMath.h"
#include <iostream>
using namespace std;
using namespace TMath;
void Compare(){
// INPUT
// Declaration of the leaf types
Double_t x11;
Double_t x12;
Double_t y11;
Double_t y12;
Double_t z11;
Double_t z12;
Double_t x21;
Double_t x22;
Double_t y21;
Double_t y22;
Double_t z21;
Double_t z22;
// List of branches
TBranch *E_abs;
// Input files
TFile *inputFileNoGauss = new TFile("BasicNoGaussGary.root", "read");
TFile *inputFileWithGauss = new TFile("BasicWithGaussGary.root", "read");
// Output variables
Double_t d1;
Double_t d2;
TTree *inputTreeNoGauss;
TTree *inputTreeWithGauss;
inputFileNoGauss->GetObject("BasicWithGauss", inputTreeNoGauss);
inputFileWithGauss->GetObject("BasicWithGauss", inputTreeWithGauss);
inputTreeNoGauss->SetBranchAddress("x1", &x11);
inputTreeNoGauss->SetBranchAddress("x2", &x12);
inputTreeNoGauss->SetBranchAddress("y1", &y11);
inputTreeNoGauss->SetBranchAddress("y2", &y12);
inputTreeNoGauss->SetBranchAddress("z1", &z11);
inputTreeNoGauss->SetBranchAddress("z2", &z12);
inputTreeWithGauss->SetBranchAddress("x1", &x21);
inputTreeWithGauss->SetBranchAddress("x2", &x22);
inputTreeWithGauss->SetBranchAddress("y1", &y21);
inputTreeWithGauss->SetBranchAddress("y2", &y22);
inputTreeWithGauss->SetBranchAddress("z1", &z21);
inputTreeWithGauss->SetBranchAddress("z2", &z22);
Long64_t nentries = inputTreeWithGauss->GetEntriesFast();
TH1D * d = new TH1D("d",
"Differences between hits with and without the non-collinearity(mm)",
100, 0, 2000);
for(Long64_t entry = 0; entry < nentries; entry++){
inputTreeWithGauss->GetEntry(entry);
inputTreeNoGauss->GetEntry(entry);
d1 = Sqrt( pow((x11-x21),2) + pow((y11-y21),2) + pow((z11-z21),2) );
d2 = Sqrt( pow((x12-x22),2) + pow((y12-y22),2) + pow((z12-z22),2) );
/* cout << "x-coordinate of hit 1 for no gauss deviation: " << x11 << endl; *\/ */
/* cout << "x-coordinate of hit 2 for no gauss deviation: " << x12 << endl; *\/ */
/* cout << "x-coordinate of hit 1 with gauss deviation: " << x21 << endl; */
/* cout << "x-coordinate of hit 2 with gauss deviation: " << x22 << endl; */
cout << endl;
cout << " x11 = " << x11 << endl;
cout << " x21 = " << x21 << endl;
cout << endl;
cout << " y11 = " << y11 << endl;
cout << " y21 = " << y21 << endl;
cout << endl;
cout << " z12 = " << z12 << endl;
cout << " z22 = " << z22 << endl;
cout << endl;
cout << " x12 = " << x12 << endl;
cout << " x22 = " << x22 << endl;
cout << endl;
cout << " y12 = " << y12 << endl;
cout << " y22 = " << y22 << endl;
cout << endl;
cout << " z12 = " << z12 << endl;
cout << " z22 = " << z22 << endl;
cout << "Distance d1 is: " << d1 << endl;
cout << "Distance d2 is: " << d2 << endl;
// d->Fill();
d->Fill(d1);
d->Fill(d2);
}
d->SetLineColor(kBlue);
d->Draw();
}