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
de6d02b0
Commit
de6d02b0
authored
Jun 02, 2021
by
Charlie Paxman
Browse files
* Correcting beamDir vector
parent
017cd118
Pipeline
#122335
passed with stages
in 3 minutes and 32 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
22 deletions
+52
-22
Projects/e793s/Analysis.cxx
Projects/e793s/Analysis.cxx
+1
-1
Projects/e793s/macro/BeamSpot/BeamSpot.C
Projects/e793s/macro/BeamSpot/BeamSpot.C
+51
-21
No files found.
Projects/e793s/Analysis.cxx
View file @
de6d02b0
...
...
@@ -138,7 +138,7 @@ void Analysis::TreatEvent(){
}
}
TVector3
BeamDirection
(
XBeam
,
YBeam
,
1
);
TVector3
BeamDirection
(
0.
,
0.
,
1
.
);
BeamImpact
=
TVector3
(
XBeam
,
YBeam
,
m_DetectorManager
->
GetTargetZ
());
ParticleMult
=
M2
->
Si_E
.
size
()
+
MG
->
DSSD_E
.
size
();
...
...
Projects/e793s/macro/BeamSpot/BeamSpot.C
View file @
de6d02b0
...
...
@@ -8,6 +8,8 @@
#include <fstream>
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
//Root
#include <TVector3.h>
//NPTool
...
...
@@ -30,23 +32,23 @@ void BeamSpot(){
vector
<
double
>
Xd
,
Yd
,
Zd
;
//Vector of particle direction. Calculated as Xp-Xb, Yp-Yb...
ifstream
MugastDataFile
;
double
ThetaNormalTarget
;
TVector3
beamDir
{
0
.
0
,
0
.
0
,
1
.
0
};
gErrorIgnoreLevel
=
kWarning
;
// Suppress ".pdf created" lines
/*** ITERATIVE GRID CONTROLS ***/
/***** pos varied as offset ****/
/**/
double
xmin
=
+
0
.
0
2
0
;
/**/
/**/
double
xmax
=
+
0
.
0
8
0
;
/**/
/**/
unsigned
int
xdiv
=
1
2
;
/**/
/**/
double
xmin
=
-
8
.
0
0
0
;
/**/
/**/
double
xmax
=
+
2
.
0
0
0
;
/**/
/**/
unsigned
int
xdiv
=
1
0
;
/**/
/**/
/**/
/**/
double
ymin
=
-
0
.
0
5
0
;
/**/
/**/
double
ymax
=
+
0
.
0
5
0
;
/**/
/**/
double
ymin
=
-
5
.
0
0
0
;
/**/
/**/
double
ymax
=
+
5
.
0
0
0
;
/**/
/**/
unsigned
int
ydiv
=
10
;
/**/
/**/
/**/
/**/
double
zmin
=
-
0
.
0
5
0
;
/**/
/**/
double
zmax
=
+
0
.
0
5
0
;
/**/
/**/
unsigned
int
zdiv
=
2
;
/**/
/**/
double
zmin
=
-
5
.
0
0
0
;
/**/
/**/
double
zmax
=
+
5
.
0
0
0
;
/**/
/**/
unsigned
int
zdiv
=
10
;
/**/
/**/
/**/
/***** thick varied as %ge *****/
/**/
unsigned
int
tmin
=
7
;
/**/
...
...
@@ -56,19 +58,48 @@ void BeamSpot(){
/******* METRIC CONTROLS *******/
/**/
double
peakE
=
0
.
143
;
/**/
/**/
double
sigMultip
=
0
.
1
;
/**/
/**/
double
sigMultip
=
0
.
05
;
/**/
/*******************************/
// File name controls
const
char
*
XYZE_file
=
"XYZE_gammaGated_Full_TestThetaNormalTarget.txt"
;
const
char
*
outputMetric
=
"output_Run63_metrics_ThetaNormal.txt"
;
const
char
*
outputHisto
=
"output_Run63_histograms_ThetaNormal.root"
;
string
tag
;
string
addtag
;
cout
<<
"==================================================="
<<
endl
;
cout
<<
" Enter the version tag "
<<
endl
;
cout
<<
" (i.e. Run63_BeamDirectionCorrection)"
<<
endl
;
cout
<<
" - - - - - - - - - - - - - - - - - - - - - - - - - "
<<
endl
;
getline
(
cin
,
tag
);
cout
<<
" - - - - - - - - - - - - - - - - - - - - - - - - - "
<<
endl
;
cout
<<
" Additional output tagging? Coarse, fine? "
<<
endl
;
cout
<<
" - - - - - - - - - - - - - - - - - - - - - - - - - "
<<
endl
;
getline
(
cin
,
addtag
);
string
XYZE_string
=
"XYZE_"
;
XYZE_string
.
append
(
tag
);
XYZE_string
.
append
(
".txt"
);
string
out_string
=
"output_"
;
out_string
.
append
(
tag
);
out_string
.
append
(
"_"
);
out_string
.
append
(
addtag
);
string
met_string
=
out_string
;
met_string
.
append
(
"_metrics.txt"
);
string
hst_string
=
out_string
;
hst_string
.
append
(
"_histograms.root"
);
const
char
*
XYZE_file
=
XYZE_string
.
c_str
();
const
char
*
outputMetric
=
met_string
.
c_str
();
const
char
*
outputHisto
=
hst_string
.
c_str
();
// Calculate size of iteratve steps
double
xstp
=
(
xmax
-
xmin
)
/
((
double
)
xdiv
);
double
ystp
=
(
ymax
-
ymin
)
/
((
double
)
ydiv
);
double
zstp
=
(
zmax
-
zmin
)
/
((
double
)
zdiv
);
cout
<<
"Xstp = "
<<
xstp
<<
" Ystp = "
<<
ystp
<<
" Zstp = "
<<
zstp
<<
endl
;
cout
<<
"==================================================="
<<
endl
;
cout
<<
" X: "
<<
xmin
<<
" to "
<<
xmax
<<
" in steps of "
<<
xstp
<<
endl
;
cout
<<
" Y: "
<<
ymin
<<
" to "
<<
ymax
<<
" in steps of "
<<
ystp
<<
endl
;
cout
<<
" Z: "
<<
zmin
<<
" to "
<<
zmax
<<
" in steps of "
<<
zstp
<<
endl
;
cout
<<
"==================================================="
<<
endl
;
// Vectors of the normal for each detector. UPDATE WITH NEW POSITIONS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
TVector3
MugastNormal1
{
-
0
.
453915
,
+
0
.
455463
,
-
0
.
765842
};
...
...
@@ -157,7 +188,6 @@ void BeamSpot(){
ThetaNormalTarget
=
tempTheta
=
ELab
=
Ex
=
0
.
0
;
switch
(
DetNum
[
i
]){
case
1
:
tempTheta
=
particleDir
.
Angle
(
MugastNormal1
);
...
...
@@ -182,9 +212,9 @@ void BeamSpot(){
return
;
// Exit code
}
// Change beam
spot
vector to inverse beam direction
vector
beam
Spot
.
SetZ
(
-
1
.
0
);
ThetaNormalTarget
=
particleDir
.
Angle
(
beam
Spot
);
// Change beam
Dir
vector to inverse beam direction
beam
Dir
.
SetZ
(
-
1
.
0
);
ThetaNormalTarget
=
particleDir
.
Angle
(
beam
Dir
);
//micrometer defined in NPSystemOfUnits.h
ELab
=
LightAl
.
EvaluateInitialEnergy
(
...
...
@@ -196,9 +226,9 @@ void BeamSpot(){
0
.
5
*
TargetThickness
,
//pass through half target
ThetaNormalTarget
);
//angle leaving target
// Change beam
spot
vector
to beam
direction
vector
beam
Spot
.
SetZ
(
1
.
0
);
Ex
=
reaction
.
ReconstructRelativistic
(
ELab
,
particleDir
.
Angle
(
beam
Spot
));
// Change beam
Dir
vector
back to forward
direction
beam
Dir
.
SetZ
(
1
.
0
);
Ex
=
reaction
.
ReconstructRelativistic
(
ELab
,
particleDir
.
Angle
(
beam
Dir
));
// Fill Ex histograms
tempHist
->
Fill
(
Ex
);
...
...
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