Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
np
nptool
Commits
f3e21701
Commit
f3e21701
authored
Jun 18, 2021
by
Adrien Matta
☠
Browse files
* Progress on Nebula calibration
parent
afdb4c23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
3 deletions
+101
-3
Projects/S034/Calibration/Nebula/gamma.cxx
Projects/S034/Calibration/Nebula/gamma.cxx
+100
-2
Projects/S034/calibration.txt
Projects/S034/calibration.txt
+1
-1
No files found.
Projects/S034/Calibration/Nebula/gamma.cxx
View file @
f3e21701
TChain
*
MakeChain1
();
TChain
*
MakeChain2
();
TChain
*
MakeChain
();
TH2F
*
MakeTH2
();
TH2F
*
GetTH2
();
double
off
;
double
c_light
=
299.792458
;
//mm/ns
auto
chain
=
MakeChain
();
void
process1bar
(
int
b
);
auto
h
=
new
TH2F
(
"h"
,
"h"
,
200
,
0
,
200
,
500
,
0
,
1000
);
auto
r
=
new
TH2F
(
"r"
,
"r"
,
200
,
0
,
200
,
10000
,
17000
,
20000
);
ofstream
output
(
"Calibration/Nebula/offset_gamma.txt"
);
////////////////////////////////////////////////////////////////////////////////
void
gamma
(){
double
beta
=
0.5504
;
// Distance from SBT(-7377.56) to target(3774.7 for FP + a value for each target)
double
D1
=
7377.56
-
3774.7
+
2.795
;
double
D2
=
7377.56
-
3774.7
+
6.972
;
// time offset for each case
double
off1
=
D1
/
(
beta
*
c_light
);
double
off2
=
D2
/
(
beta
*
c_light
);
off
=
(
off1
+
off2
)
*
0.5
;
cout
<<
"Offset1 : "
<<
off1
<<
endl
;
cout
<<
"Offset2 : "
<<
off2
<<
endl
;
cout
<<
"Mean : "
<<
off
<<
endl
;
auto
c
=
new
TCanvas
(
"tof"
,
"tof"
);
chain
->
SetAlias
(
"R"
,
"sqrt(Nebula.PosX*Nebula.PosX+Nebula.PosY*Nebula.PosY+(Nebula.PosZ+3774.7)*(Nebula.PosZ+3774.7))"
);
h
=
GetTH2
();
h
->
Draw
(
"colz"
);
for
(
unsigned
int
i
=
0
;
i
<
160
;
i
++
){
process1bar
(
i
);
}
output
.
close
();
}
////////////////////////////////////////////////////////////////////////////////
void
process1bar
(
int
b
){
new
TCanvas
();
// Get the Radius for the distance to this barre
auto
r1
=
r
->
ProjectionY
(
Form
(
"h%d"
,
b
),
b
,
b
+
1
);
double
R
=
r1
->
GetBinCenter
(
r1
->
GetMaximumBin
());
auto
h1
=
h
->
ProjectionY
(
Form
(
"h%d"
,
b
),
b
,
b
+
1
);
double
max
=
h1
->
GetBinCenter
(
h1
->
GetMaximumBin
());
h1
->
Draw
();
auto
f
=
new
TF1
(
"f"
,
"gaus(0)"
,
max
-
50
,
max
+
50
);
f
->
SetParameter
(
0
,
h1
->
GetMaximum
());
f
->
SetParameter
(
1
,
max
);
f
->
SetParameter
(
2
,
50
);
h1
->
Fit
(
f
,
"R"
);
// V = R/(TOF-off) -> (TOF-off)/R = 1/V
// off = TOF-R/V
double
offset
=
f
->
GetParameter
(
1
)
-
R
/
c_light
;
cout
<<
f
->
GetParameter
(
1
)
<<
" "
<<
offset
<<
" "
<<
R
/
(
f
->
GetParameter
(
1
)
-
offset
)
<<
endl
;
if
(
offset
>
0
)
output
<<
"NEBULA_T_ID"
<<
b
<<
" "
<<
-
offset
<<
endl
;
}
////////////////////////////////////////////////////////////////////////////////
TH2F
*
GetTH2
(){
auto
File
=
new
TFile
(
"Calibration/Nebula/hist_v.root"
);
h
=
(
TH2F
*
)
File
->
FindObjectAny
(
"h"
);
File
=
new
TFile
(
"Calibration/Nebula/hist_r.root"
);
r
=
(
TH2F
*
)
File
->
FindObjectAny
(
"r"
);
return
h
;
}
////////////////////////////////////////////////////////////////////////////////
TH2F
*
MakeTH2
(){
TString
cond
=
Form
(
"(Nebula.TOF-%f)>20&&(Nebula.TOF-%f)<38"
,
off
,
off
);
TString
draw
=
Form
(
"R/(Nebula.TOF-%f):Nebula.DetectorNumber>>h"
,
off
);
chain
->
Draw
(
draw
,
cond
,
"colz"
);
h
->
SaveAs
(
"Calibration/Nebula/hist_v.root"
);
chain
->
Draw
(
"R:Nebula.DetectorNumber>>r"
,
""
,
"colz"
);
r
->
SaveAs
(
"Calibration/Nebula/hist_r.root"
);
return
h
;
}
////////////////////////////////////////////////////////////////////////////////
TChain
*
MakeChain
(){
auto
chain
=
new
TChain
(
"PhysicsTree"
);
chain
->
Add
(
"root/analysis/gamma/run418.root"
);
chain
->
Add
(
"root/analysis/gamma/run*.root"
);
return
chain
;
}
chain
->
Draw
(
"(Nebula.PosZ+4650)/Nebula.TOF:Nebula.DetectorNumber>>h(150,0,150,2000,0,500)"
,
""
,
"colz"
);
////////////////////////////////////////////////////////////////////////////////
TChain
*
MakeChain1
(){
auto
chain
=
new
TChain
(
"PhysicsTree"
);
for
(
unsigned
int
i
=
418
;
i
<
442
;
i
++
){
chain
->
Add
(
Form
(
"root/analysis/gamma/run%d.root"
,
i
));
}
return
chain
;
}
////////////////////////////////////////////////////////////////////////////////
TChain
*
MakeChain2
(){
auto
chain
=
new
TChain
(
"PhysicsTree"
);
for
(
unsigned
int
i
=
488
;
i
<
498
;
i
++
){
chain
->
Add
(
Form
(
"root/analysis/gamma/run%d.root"
,
i
));
}
return
chain
;
}
Projects/S034/calibration.txt
View file @
f3e21701
...
...
@@ -4,5 +4,5 @@ CalibrationFilePath
Calibration/FDC2_Calib.txt
Calibration/FDC0_Calib.txt
Calibration/CalibVDrift/CalibVDrift.txt
Calibration/Nebula/
Nebula_T
.txt
Calibration/Nebula/
offset_gamma
.txt
Calibration/Nebula/Nebula_Y.txt
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment