Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
b162143e
Commit
b162143e
authored
Oct 11, 2017
by
Simon Spannagel
Browse files
TestAlgorithm: make generic: can be used for all detector types now
parent
9cb210e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/algorithms/TestAlgorithm.cpp
View file @
b162143e
...
...
@@ -9,18 +9,24 @@ TestAlgorithm::TestAlgorithm(Configuration config, std::vector<Detector*> detect
LOG
(
DEBUG
)
<<
"Setting makeCorrelations to: "
<<
makeCorrelations
;
}
void
TestAlgorithm
::
initialise
(
Parameters
*
)
{
void
TestAlgorithm
::
initialise
(
Parameters
*
par
)
{
parameters
=
par
;
// Make histograms for each Timepix3
for
(
auto
&
detector
:
m_detectors
)
{
// Check if they are a Timepix3
if
(
detector
->
type
()
!=
"Timepix3"
)
continue
;
LOG
(
DEBUG
)
<<
"Booking histograms for detector "
<<
detector
->
name
();
// Simple hit map
string
name
=
"hitmap_"
+
detector
->
name
();
hitmap
[
detector
->
name
()]
=
new
TH2F
(
name
.
c_str
(),
name
.
c_str
(),
256
,
0
,
256
,
256
,
0
,
256
);
hitmap
[
detector
->
name
()]
=
new
TH2F
(
name
.
c_str
(),
name
.
c_str
(),
detector
->
nPixelsX
(),
0
,
detector
->
nPixelsX
(),
detector
->
nPixelsY
(),
0
,
detector
->
nPixelsY
());
// Cluster plots
name
=
"clusterSize_"
+
detector
->
name
();
...
...
@@ -50,11 +56,6 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
// Loop over all Timepix3 and make plots
for
(
auto
&
detector
:
m_detectors
)
{
// Check if they are a Timepix3
if
(
detector
->
type
()
!=
"Timepix3"
)
continue
;
// Get the pixels
Pixels
*
pixels
=
(
Pixels
*
)
clipboard
->
get
(
detector
->
name
(),
"pixels"
);
if
(
pixels
==
NULL
)
{
...
...
@@ -63,14 +64,9 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
}
// Loop over all pixels and make hitmaps
for
(
int
iP
=
0
;
iP
<
pixels
->
size
();
iP
++
)
{
// Get the pixel
Pixel
*
pixel
=
(
*
pixels
)[
iP
];
for
(
auto
&
pixel
:
(
*
pixels
))
{
// Hitmap
hitmap
[
detector
->
name
()]
->
Fill
(
pixel
->
m_column
,
pixel
->
m_row
);
// Timing plots
eventTimes
[
detector
->
name
()]
->
Fill
((
double
)
pixel
->
m_timestamp
/
(
4096.
*
40000000.
));
}
...
...
@@ -90,11 +86,7 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
}
// Loop over all clusters and fill histograms
for
(
int
iCluster
=
0
;
iCluster
<
clusters
->
size
();
iCluster
++
)
{
// Get the cluster
Cluster
*
cluster
=
(
*
clusters
)[
iCluster
];
for
(
auto
&
cluster
:
(
*
clusters
))
{
// Fill cluster histograms
clusterSize
[
detector
->
name
()]
->
Fill
(
cluster
->
size
());
clusterTot
[
detector
->
name
()]
->
Fill
(
cluster
->
tot
());
...
...
@@ -105,9 +97,8 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
continue
;
if
(
referenceClusters
==
NULL
)
continue
;
for
(
int
iRefCluster
=
0
;
iRefCluster
<
referenceClusters
->
size
();
iRefCluster
++
)
{
Cluster
*
refCluster
=
(
*
referenceClusters
)[
iRefCluster
];
for
(
auto
&
refCluster
:
(
*
referenceClusters
))
{
long
long
int
timeDifferenceInt
=
(
refCluster
->
timestamp
()
-
cluster
->
timestamp
())
/
4096
;
double
timeDifference
=
(
double
)(
refCluster
->
timestamp
()
-
cluster
->
timestamp
())
/
(
4096.
*
40000000.
);
...
...
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