Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
vpalladi
HgcTpgSim
Commits
a6f040e9
Commit
a6f040e9
authored
Jun 02, 2016
by
dauncey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several changes; mainly for BH and adding HepMC pointer to Particle
parent
c53719a0
Pipeline
#12575
skipped
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
84 additions
and
19 deletions
+84
-19
doc/wup.pdf
doc/wup.pdf
+0
-0
doc/wup.tex
doc/wup.tex
+47
-0
interface/AnalysisPhoton.hh
interface/AnalysisPhoton.hh
+1
-1
interface/Event.hh
interface/Event.hh
+8
-7
interface/Geometry.hh
interface/Geometry.hh
+1
-1
interface/Particle.hh
interface/Particle.hh
+12
-1
interface/SimDetBh.hh
interface/SimDetBh.hh
+3
-4
src/DetIdTest.cpp
src/DetIdTest.cpp
+3
-3
src/readSimHitsTest.cpp
src/readSimHitsTest.cpp
+9
-2
No files found.
doc/wup.pdf
View file @
a6f040e9
No preview for this file type
doc/wup.tex
View file @
a6f040e9
...
...
@@ -15,6 +15,53 @@
\bigskip
\centerline
{
\large
May 2016
}
\section
{
Optimisation of layer weights
}
Each event
$
e
$
gives some values
$
d
_{
e,i
}$
of the deposited energy in
layer
$
i
$
; these
can be in any units, e.g. MIPs.
Assume these are to be multiplied by some constant coefficients
$
a
_
i
$
(which
are approximately the integrated dE/dx values if the
$
d
_{
e,i
}$
are in MIPs)
to give the estimate of the incoming EM photon or electron energy.
Hence, the energy
estimation for event
$
e
$
is
\begin{equation}
E
_
e =
\sum
_
i a
_
i d
_{
e,i
}
\end{equation}
To find the optimal coefficients, then we need to know the truth energy per
event
$
T
_
e
$
. For a given set of coefficients, the RMS
$^
2
$
of the energy
around the truth value is given by
\begin{equation}
\mathrm
{
RMS
}^
2 =
\frac
{
1
}{
N
}
\sum
_
e (E
_
e - T
_
e)
^
2
=
\frac
{
1
}{
N
}
\sum
_
e
\left
(
\sum
_
i a
_
i d
_{
e,i
}
- T
_
e
\right
)
^
2
\end{equation}
This can be thought of as similar to a chi-squared; we want to minimise this
expression. If all the
$
a
_
i
$
are considered as independent parameters (so 28 for
the EE only), then explicitly
\begin{equation}
\frac
{
\partial
\mathrm
{
RMS
}^
2
}{
\partial
a
_
j
}
=
\frac
{
1
}{
N
}
\sum
_
e 2d
_{
e,j
}
\left
(
\sum
_
i a
_
i d
_{
e,i
}
- T
_
e
\right
)
=
\frac
{
2
}{
N
}
\sum
_
i a
_
i
\left
(
\sum
_
e d
_{
e,j
}
d
_{
e,i
}
\right
)
-
\frac
{
2
}{
N
}
\sum
_
e d
_{
e,j
}
T
_
e
\end{equation}
Hence, for the minimum, we require
\begin{equation}
\sum
_
i
\frac
{
\sum
_
e d
_{
e,j
}
d
_{
e,i
}}{
N
}
a
_
i
=
\frac
{
\sum
_
e d
_{
e,j
}
T
_
e
}{
N
}
\end{equation}
Writing in matrix notation with
$
M
$
and
$
v
$
defined as
\begin{equation}
M
_{
ji
}
=
\frac
{
\sum
_
e d
_{
e,j
}
d
_{
e,i
}}{
N
}
,
\qquad
v
_
j =
\frac
{
\sum
_
e d
_{
e,j
}
T
_
e
}{
N
}
\end{equation}
then the requirement is
\begin{equation}
M a = v
\qquad\mathrm
{
so
}
\qquad
a = M
^{
-1
}
v
\end{equation}
Inverting the large matrix
$
M
$
is required to give the solution for the
optimal
$
a
_
i
$
.
Note,
$
M
$
is similar (but not identical) to the error matrix of the
$
d
_
i
$
.
\section
{
Units
}
Keeping quantities to 16-bit integers.
...
...
interface/AnalysisPhoton.hh
View file @
a6f040e9
...
...
@@ -63,7 +63,6 @@ public:
fNum
=
1.0
;
}
/*
TMatrixDSym
fitMatrix
()
const
{
TMatrixDSym
fm
(
40
);
for
(
unsigned
i
(
0
);
i
<
40
;
i
++
)
{
...
...
@@ -74,6 +73,7 @@ public:
return
fm
;
}
/*
TMatrixDSym errorMatrix() const {
TMatrixDSym em(40);
for(unsigned i(0);i<40;i++) {
...
...
interface/Event.hh
View file @
a6f040e9
...
...
@@ -177,15 +177,15 @@ public:
void
fillGenVertex
(
HepMC
::
GenVertex
*
vtx
,
bool
signal
=
false
)
{
if
(
vtx
==
0
)
return
;
std
::
cout
<<
"New vertex with barcode "
<<
vtx
->
barcode
()
<<
std
::
endl
;
//
std::cout << "New vertex with barcode " << vtx->barcode() << std::endl;
// Loop over all particles from the vertex
for
(
HepMC
::
GenVertex
::
particles_out_const_iterator
p
(
vtx
->
particles_out_const_begin
());
p
!=
vtx
->
particles_out_const_end
();
++
p
)
{
const
HepMC
::
GenParticle
&
ptc
(
*
(
*
p
));
int
pdgId
(
ptc
.
pdg_id
());
std
::
cout
<<
"New particle with barcode "
<<
ptc
.
barcode
()
<<
(
abs
(
pdgId
)
==
11
?
" ELECTRON!!!"
:
""
)
<<
std
::
endl
;
//
std::cout << "New particle with barcode " << ptc.barcode()
//
<< (abs(pdgId)==11?" ELECTRON!!!":"") << std::endl;
HepMC
::
FourVector
ptc4
(
ptc
.
momentum
());
unsigned
e
(
ptc4
.
z
()
<
0.0
?
0
:
1
);
...
...
@@ -228,15 +228,15 @@ public:
void
fillGenVertexList
(
const
HepMC
::
GenVertex
*
vtx
,
std
::
vector
<
Particle
>
&
v
)
{
if
(
vtx
==
0
)
return
;
std
::
cout
<<
"New vertex with barcode "
<<
vtx
->
barcode
()
<<
std
::
endl
;
//
std::cout << "New vertex with barcode " << vtx->barcode() << std::endl;
// Loop over all particles from the vertex
for
(
HepMC
::
GenVertex
::
particles_out_const_iterator
p
(
vtx
->
particles_out_const_begin
());
p
!=
vtx
->
particles_out_const_end
();
++
p
)
{
const
HepMC
::
GenParticle
&
ptc
(
*
(
*
p
));
int
pdgId
(
ptc
.
pdg_id
());
std
::
cout
<<
"New particle with barcode "
<<
ptc
.
barcode
()
<<
(
abs
(
pdgId
)
==
11
?
" ELECTRON!!!"
:
""
)
<<
std
::
endl
;
//
int pdgId(ptc.pdg_id());
//
std::cout << "New particle with barcode " << ptc.barcode()
//
<< (abs(pdgId)==11?" ELECTRON!!!":"") << std::endl;
HepMC
::
FourVector
ptc4
(
ptc
.
momentum
());
//unsigned e(ptc4.z()<0.0?0:1);
...
...
@@ -301,6 +301,7 @@ public:
if
(
abs
(
pdgId
)
==
15
)
{
std
::
cout
<<
std
::
endl
<<
"New tau "
<<
std
::
endl
;
vTau
[
e
].
push_back
(
Particle
(
ptc
));
vTau
[
e
][
vTau
[
e
].
size
()
-
1
].
print
();
vTauDaughters
[
e
].
push_back
(
std
::
vector
<
Particle
>
());
fillGenVertexList
(
&
vtx
,
vTauDaughters
[
e
][
vTauDaughters
[
e
].
size
()
-
1
]);
std
::
cout
<<
std
::
endl
<<
"New tau daughters = "
...
...
interface/Geometry.hh
View file @
a6f040e9
...
...
@@ -233,7 +233,7 @@ public:
}
for
(
unsigned
i
(
0
);
i
<
kNumberOfBHLayers
;
i
++
)
{
fLayerZBh
[
i
]
=
42
0
.0
+
10
.0
*
i
;
// NOT CORRECT!!!
fLayerZBh
[
i
]
=
42
1
.0
+
9
.0
*
i
;
// NOT
EXACTLY
CORRECT!!!
}
std
::
ifstream
fin
;
...
...
interface/Particle.hh
View file @
a6f040e9
...
...
@@ -68,10 +68,12 @@ public:
return
q
;
}
Particle
()
{
Particle
()
:
pGenParticle
(
0
)
{
}
Particle
(
const
HepMC
::
GenParticle
&
p
)
{
pGenParticle
=&
p
;
fPdgId
=
p
.
pdg_id
();
HepMC
::
GenVertex
*
v
(
p
.
production_vertex
());
...
...
@@ -86,6 +88,10 @@ public:
~
Particle
()
{
}
const
HepMC
::
GenParticle
*
genParticle
()
const
{
return
pGenParticle
;
}
Point
position
()
const
{
return
fPosition
;
}
...
...
@@ -108,6 +114,8 @@ public:
Particle
project
(
double
z
)
const
{
Particle
p
;
p
.
pGenParticle
=
pGenParticle
;
p
.
fPdgId
=
fPdgId
;
double
dz
(
z
-
fPosition
.
z
());
...
...
@@ -142,12 +150,15 @@ public:
std
::
cout
<<
"Particle PDG Id = "
<<
fPdgId
<<
std
::
endl
;
std
::
cout
<<
" Position "
;
fPosition
.
print
();
std
::
cout
<<
" Momentum "
;
fMomentum
.
print
();
std
::
cout
<<
" "
;
pGenParticle
->
print
();
}
private:
static
const
double
fBField
;
const
HepMC
::
GenParticle
*
pGenParticle
;
int
fPdgId
;
Point
fPosition
;
Point
fMomentum
;
...
...
interface/SimDetBh.hh
View file @
a6f040e9
...
...
@@ -21,10 +21,9 @@ public:
assert
(
h
<
1024
);
assert
(
f
<
1024
);
fDetId
=
(
5
<<
29
)
+
(
t
<<
26
)
+
(
l
<<
21
)
+
(
e
<<
20
)
+
(
h
<<
10
)
+
f
;
fDetId
=
(
5
<<
29
)
+
(
t
<<
26
)
+
(
(
l
+
7
)
<<
21
)
+
(
e
<<
20
)
+
(
(
h
+
1
)
<<
10
)
+
(
f
+
1
)
;
}
~
SimDetBh
()
{
}
...
...
@@ -53,7 +52,7 @@ public:
}
uint32_t
eta
()
const
{
return
((
fDetId
&
0x000
7
fc00
)
>>
10
)
-
1
;
return
((
fDetId
&
0x000
f
fc00
)
>>
10
)
-
1
;
}
uint32_t
endcap
()
const
{
...
...
@@ -93,7 +92,7 @@ public:
}
void
setSignal
()
{
fDetId
|=
0x000
8
0000
;
fDetId
|=
0x
1
0000000
;
}
void
flipEndcap
()
{
...
...
src/DetIdTest.cpp
View file @
a6f040e9
...
...
@@ -86,11 +86,11 @@ int main(int argc, const char **argv) {
}
std
::
cout
<<
" BH "
;
for
(
unsigned
l
(
0
);
l
<
3
2
;
l
++
)
{
for
(
unsigned
l
(
0
);
l
<
2
5
;
l
++
)
{
std
::
cout
<<
"."
<<
std
::
flush
;
for
(
unsigned
t
(
0
);
t
<
4
;
t
++
)
{
for
(
unsigned
h
(
0
);
h
<
512
;
h
++
)
{
for
(
unsigned
f
(
0
);
f
<
102
4
;
f
++
)
{
for
(
unsigned
h
(
0
);
h
<
1023
;
h
++
)
{
for
(
unsigned
f
(
0
);
f
<
102
3
;
f
++
)
{
SimDetBh
s
(
e
,
l
,
t
,
h
,
f
);
assert
(
s
.
endcap
()
==
e
);
assert
(
s
.
layer
()
==
l
);
...
...
src/readSimHitsTest.cpp
View file @
a6f040e9
...
...
@@ -222,7 +222,8 @@ int main(int argc, const char **argv) {
TH1F
*
hBhSimNumber
,
*
hBhSimDetector
,
*
hBhSimSubdetector
,
*
hBhSimEndcap
,
*
hBhSimLayer
,
*
hBhSimEta
;
TH2F
*
hBhSimPhiVsEta
,
*
hBhSimDepthVsLayer
;
TH2F
*
hBhSimPhiVsEta
,
*
hBhSimLayerVsEta
,
*
hBhSimDepthVsLayer
,
*
hBhSimSelDepthVsLayer
;
hBhSimNumber
=
new
TH1F
(
"BhSimNumber"
,
"Sim "
,
100
,
0.0
,
5000.0
);
hBhSimDetector
=
new
TH1F
(
"BhSimDetector"
,
"Sim "
,
10
,
0.0
,
10.0
);
...
...
@@ -233,8 +234,12 @@ int main(int argc, const char **argv) {
hBhSimPhiVsEta
=
new
TH2F
(
"BhSimPhiVsEta"
,
"Sim "
,
100
,
0.0
,
100
,
360
,
0.0
,
360.0
);
hBhSimLayerVsEta
=
new
TH2F
(
"BhSimLayerVsEta"
,
"Sim "
,
100
,
0.0
,
100
,
12
,
0.0
,
12.0
);
hBhSimDepthVsLayer
=
new
TH2F
(
"BhSimDepthVsLayer"
,
"Sim "
,
20
,
0.0
,
20
,
4
,
0.0
,
4.0
);
12
,
0.0
,
12
,
4
,
0.0
,
4.0
);
hBhSimSelDepthVsLayer
=
new
TH2F
(
"BhSimSelDepthVsLayer"
,
"Sim "
,
12
,
0.0
,
12
,
4
,
0.0
,
4.0
);
///////////////////////////////////////////////////////////////////
...
...
@@ -350,7 +355,9 @@ int main(int argc, const char **argv) {
hBhSimEta
->
Fill
(
vEvtSimHbh
[
evt
][
i
].
eta
());
hBhSimPhiVsEta
->
Fill
(
vEvtSimHbh
[
evt
][
i
].
eta
(),
vEvtSimHbh
[
evt
][
i
].
phi
());
hBhSimLayerVsEta
->
Fill
(
vEvtSimHbh
[
evt
][
i
].
eta
(),
vEvtSimHbh
[
evt
][
i
].
layer
());
hBhSimDepthVsLayer
->
Fill
(
vEvtSimHbh
[
evt
][
i
].
layer
(),
vEvtSimHbh
[
evt
][
i
].
depth
());
if
(
vEvtSimHbh
[
evt
][
i
].
eta
()
>=
16
)
hBhSimSelDepthVsLayer
->
Fill
(
vEvtSimHbh
[
evt
][
i
].
layer
(),
vEvtSimHbh
[
evt
][
i
].
depth
());
}
}
...
...
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