Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
d9f2bb84
Commit
d9f2bb84
authored
Oct 16, 2018
by
Simon Spannagel
Browse files
Fix some compiler warnings in core classes
parent
e60a776b
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/core/Analysis.cpp
View file @
d9f2bb84
...
...
@@ -357,7 +357,7 @@ void Analysis::run() {
// Check if we have an event or track limit:
int
number_of_events
=
global_config
.
get
<
int
>
(
"number_of_events"
,
-
1
);
int
number_of_tracks
=
global_config
.
get
<
int
>
(
"number_of_tracks"
,
-
1
);
float
run_time
=
global_config
.
get
<
float
>
(
"run_time"
,
Units
::
convert
(
-
1.0
,
"s"
));
auto
run_time
=
global_config
.
get
<
double
>
(
"run_time"
,
static_cast
<
double
>
(
Units
::
convert
(
-
1.0
,
"s"
))
)
;
// Loop over all events, running each module on each "event"
LOG
(
STATUS
)
<<
"========================| Event loop |========================"
;
...
...
@@ -417,8 +417,8 @@ void Analysis::run() {
}
// Print statistics:
Tracks
*
tracks
=
(
Tracks
*
)
m_clipboard
->
get
(
"tracks"
);
m_tracks
+=
(
tracks
==
NULL
?
0
:
tracks
->
size
());
Tracks
*
tracks
=
reinterpret_cast
<
Tracks
*
>
(
m_clipboard
->
get
(
"tracks"
)
)
;
m_tracks
+=
(
tracks
==
nullptr
?
0
:
tracks
->
size
());
bool
update_progress
=
false
;
if
(
m_events
%
100
==
0
&&
m_events
!=
events_prev
)
{
...
...
@@ -433,7 +433,7 @@ void Analysis::run() {
events_prev
=
m_events
;
LOG_PROGRESS
(
STATUS
,
"event_loop"
)
<<
"Ev: +"
<<
m_events
<<
"
\\
"
<<
skipped
<<
" Tr: "
<<
m_tracks
<<
" ("
<<
std
::
setprecision
(
3
)
<<
(
(
double
)
m_tracks
/
m_events
)
<<
"/ev)"
<<
(
static_cast
<
double
>
(
m_tracks
)
/
m_events
)
<<
"/ev)"
<<
(
m_clipboard
->
has_persistent
(
"eventStart"
)
?
" t = "
+
Units
::
display
(
m_clipboard
->
get_persistent
(
"eventStart"
),
{
"ns"
,
"us"
,
"ms"
,
"s"
})
:
""
);
...
...
@@ -441,12 +441,16 @@ void Analysis::run() {
// Clear objects from this iteration from the clipboard
m_clipboard
->
clear
();
// Check if any of the modules return a value saying it should stop
if
(
!
run
)
if
(
!
run
)
{
break
;
}
// Increment event number
if
(
!
noData
)
if
(
!
noData
)
{
m_events
++
;
}
// Check for user termination and stop the event loop:
if
(
m_terminate
)
{
...
...
src/core/clipboard/Clipboard.cpp
View file @
d9f2bb84
...
...
@@ -19,8 +19,9 @@ void Clipboard::put_persistent(std::string name, double value) {
}
Objects
*
Clipboard
::
get
(
std
::
string
name
,
std
::
string
type
)
{
if
(
m_data
.
count
(
name
+
type
)
==
0
)
return
NULL
;
if
(
m_data
.
count
(
name
+
type
)
==
0
)
{
return
nullptr
;
}
return
m_data
[
name
+
type
];
}
...
...
src/core/detector/Detector.cpp
View file @
d9f2bb84
...
...
@@ -377,7 +377,7 @@ int Detector::winding_number(std::pair<int, int> probe, std::vector<std::vector<
// loop through all edges of the polygon
// edge from V[i] to V[i+1]
for
(
in
t
i
=
0
;
i
<
polygon
.
size
();
i
++
)
{
for
(
size_
t
i
=
0
;
i
<
polygon
.
size
();
i
++
)
{
auto
point_this
=
std
::
make_pair
(
polygon
.
at
(
i
).
at
(
0
),
polygon
.
at
(
i
).
at
(
1
));
auto
point_next
=
(
i
+
1
<
polygon
.
size
()
?
std
::
make_pair
(
polygon
.
at
(
i
+
1
).
at
(
0
),
polygon
.
at
(
i
+
1
).
at
(
1
))
:
std
::
make_pair
(
polygon
.
at
(
0
).
at
(
0
),
polygon
.
at
(
0
).
at
(
1
)));
...
...
src/core/detector/Detector.hpp
View file @
d9f2bb84
...
...
@@ -24,9 +24,8 @@
#include
"core/utils/log.h"
#include
"objects/Track.h"
using
namespace
ROOT
::
Math
;
namespace
corryvreckan
{
using
namespace
ROOT
::
Math
;
/**
* @brief Role of the detector
...
...
@@ -60,9 +59,9 @@ namespace corryvreckan {
Configuration
getConfiguration
();
ROOT
::
Math
::
XYVector
size
()
{
return
ROOT
::
Math
::
XYVector
(
m_pitch
.
X
()
*
m_nPixelsX
,
m_pitch
.
Y
()
*
m_nPixelsY
);
}
ROOT
::
Math
::
XYVector
pitch
()
{
return
m_pitch
;
}
ROOT
::
Math
::
XYVector
resolution
()
{
return
m_resolution
;
}
XYVector
size
()
{
return
XYVector
(
m_pitch
.
X
()
*
m_nPixelsX
,
m_pitch
.
Y
()
*
m_nPixelsY
);
}
XYVector
pitch
()
{
return
m_pitch
;
}
XYVector
resolution
()
{
return
m_resolution
;
}
int
nPixelsX
()
{
return
m_nPixelsX
;
}
int
nPixelsY
()
{
return
m_nPixelsY
;
}
...
...
@@ -72,15 +71,15 @@ namespace corryvreckan {
void
displacementX
(
double
x
)
{
m_displacement
.
SetX
(
x
);
}
void
displacementY
(
double
y
)
{
m_displacement
.
SetY
(
y
);
}
void
displacementZ
(
double
z
)
{
m_displacement
.
SetZ
(
z
);
}
void
displacement
(
ROOT
::
Math
::
XYZPoint
displacement
)
{
m_displacement
=
displacement
;
}
ROOT
::
Math
::
XYZPoint
displacement
()
{
return
m_displacement
;
}
void
displacement
(
XYZPoint
displacement
)
{
m_displacement
=
displacement
;
}
XYZPoint
displacement
()
{
return
m_displacement
;
}
// Functions to set and retrieve basic rotation parameters
void
rotationX
(
double
rx
)
{
m_orientation
.
SetX
(
rx
);
}
void
rotationY
(
double
ry
)
{
m_orientation
.
SetY
(
ry
);
}
void
rotationZ
(
double
rz
)
{
m_orientation
.
SetZ
(
rz
);
}
ROOT
::
Math
::
XYZVector
rotation
()
{
return
m_orientation
;
}
void
rotation
(
ROOT
::
Math
::
XYZVector
rotation
)
{
m_orientation
=
rotation
;
}
XYZVector
rotation
()
{
return
m_orientation
;
}
void
rotation
(
XYZVector
rotation
)
{
m_orientation
=
rotation
;
}
PositionVector3D
<
Cartesian3D
<
double
>>
normal
()
{
return
m_normal
;
};
...
...
@@ -120,8 +119,8 @@ namespace corryvreckan {
double
inPixelX
(
PositionVector3D
<
Cartesian3D
<
double
>>
localPosition
);
double
inPixelY
(
PositionVector3D
<
Cartesian3D
<
double
>>
localPosition
);
ROOT
::
Math
::
XYZPoint
localToGlobal
(
ROOT
::
Math
::
XYZPoint
local
)
{
return
m_localToGlobal
*
local
;
};
ROOT
::
Math
::
XYZPoint
globalToLocal
(
ROOT
::
Math
::
XYZPoint
global
)
{
return
m_globalToLocal
*
global
;
};
XYZPoint
localToGlobal
(
XYZPoint
local
)
{
return
m_localToGlobal
*
local
;
};
XYZPoint
globalToLocal
(
XYZPoint
global
)
{
return
m_globalToLocal
*
global
;
};
bool
isWithinROI
(
const
Track
*
track
);
bool
isWithinROI
(
Cluster
*
cluster
);
...
...
@@ -132,8 +131,8 @@ namespace corryvreckan {
// Detector information
std
::
string
m_detectorType
;
std
::
string
m_detectorName
;
ROOT
::
Math
::
XYVector
m_pitch
;
ROOT
::
Math
::
XYVector
m_resolution
;
XYVector
m_pitch
;
XYVector
m_resolution
;
int
m_nPixelsX
;
int
m_nPixelsY
;
double
m_timingOffset
;
...
...
src/objects/Cluster.h
View file @
d9f2bb84
...
...
@@ -25,7 +25,7 @@ namespace corryvreckan {
m_rowWidth
=
0.
;
m_split
=
false
;
}
virtual
~
Cluster
()
{}
// Copy constructor
Cluster
(
Cluster
*
cluster
)
{
m_global
=
cluster
->
global
();
...
...
@@ -129,7 +129,7 @@ namespace corryvreckan {
std
::
map
<
int
,
bool
>
m_columnHits
;
// ROOT I/O class definition - update version number when you change this class!
ClassDef
(
Cluster
,
7
)
ClassDef
(
Cluster
,
8
)
};
// Vector type declaration
...
...
src/objects/Object.cpp
View file @
d9f2bb84
...
...
@@ -12,27 +12,28 @@ Object::Object() = default;
Object
::
Object
(
std
::
string
detectorID
)
:
m_detectorID
(
std
::
move
(
detectorID
))
{}
Object
::
Object
(
double
timestamp
)
:
m_timestamp
(
timestamp
)
{}
Object
::
Object
(
std
::
string
detectorID
,
double
timestamp
)
:
m_detectorID
(
std
::
move
(
detectorID
)),
m_timestamp
(
timestamp
)
{}
Object
::
Object
(
const
Object
&
)
=
default
;
Object
::~
Object
()
=
default
;
// Return class type for fixed object types (that don't depend on detector type)
Object
*
Object
::
Factory
(
std
::
string
objectType
,
Object
*
object
)
{
// Track class
if
(
objectType
==
"tracks"
)
{
return
(
object
==
NULL
)
?
new
Track
()
:
new
Track
(
*
static_cast
<
Track
*>
(
object
));
return
(
object
==
nullptr
)
?
new
Track
()
:
new
Track
(
*
static_cast
<
Track
*>
(
object
));
}
return
new
Object
();
}
// Return class type for objects which change with detector type
Object
*
Object
::
Factory
(
std
::
string
detectorType
,
std
::
string
objectType
,
Object
*
object
)
{
Object
*
Object
::
Factory
(
std
::
string
,
std
::
string
objectType
,
Object
*
object
)
{
if
(
objectType
==
"pixels"
)
{
return
(
object
==
NULL
)
?
new
Pixel
()
:
new
Pixel
(
*
static_cast
<
Pixel
*>
(
object
));
return
(
object
==
nullptr
)
?
new
Pixel
()
:
new
Pixel
(
*
static_cast
<
Pixel
*>
(
object
));
}
else
if
(
objectType
==
"clusters"
)
{
return
(
object
==
NULL
)
?
new
Cluster
()
:
new
Cluster
(
*
static_cast
<
Cluster
*>
(
object
));
return
(
object
==
nullptr
)
?
new
Cluster
()
:
new
Cluster
(
*
static_cast
<
Cluster
*>
(
object
));
}
else
if
(
objectType
==
"mcparticles"
)
{
return
(
object
==
NULL
)
?
new
MCParticle
()
:
new
MCParticle
(
*
static_cast
<
MCParticle
*>
(
object
));
return
(
object
==
nullptr
)
?
new
MCParticle
()
:
new
MCParticle
(
*
static_cast
<
MCParticle
*>
(
object
));
}
return
new
Object
();
...
...
src/objects/Object.hpp
View file @
d9f2bb84
...
...
@@ -41,6 +41,7 @@ namespace corryvreckan {
explicit
Object
(
std
::
string
detectorID
);
explicit
Object
(
double
timestamp
);
Object
(
std
::
string
detectorID
,
double
timestamp
);
Object
(
const
Object
&
);
/**
* @brief Required virtual destructor
...
...
@@ -59,13 +60,13 @@ namespace corryvreckan {
void
setDetectorID
(
std
::
string
detectorID
)
{
m_detectorID
=
std
::
move
(
detectorID
);
}
// Function to get instantiation of inherited class (given a string, give back an object of type 'daughter')
static
Object
*
Factory
(
std
::
string
,
Object
*
object
=
NULL
);
static
Object
*
Factory
(
std
::
string
,
std
::
string
,
Object
*
object
=
NULL
);
static
Object
*
Factory
(
std
::
string
,
Object
*
object
=
nullptr
);
static
Object
*
Factory
(
std
::
string
,
std
::
string
,
Object
*
object
=
nullptr
);
/**
* @brief ROOT class definition
*/
ClassDefOverride
(
Object
,
3
);
ClassDefOverride
(
Object
,
4
);
protected:
// Member variables
...
...
src/objects/Pixel.h
View file @
d9f2bb84
...
...
@@ -10,7 +10,6 @@ namespace corryvreckan {
public:
// Constructors and destructors
Pixel
()
=
default
;
virtual
~
Pixel
()
{}
Pixel
(
std
::
string
detectorID
,
int
row
,
int
col
,
int
tot
)
:
Pixel
(
detectorID
,
row
,
col
,
tot
,
0.
)
{}
Pixel
(
std
::
string
detectorID
,
int
row
,
int
col
,
int
tot
,
double
timestamp
)
:
Object
(
detectorID
,
timestamp
),
m_row
(
row
),
m_column
(
col
),
m_adc
(
tot
),
m_charge
(
tot
)
{}
...
...
@@ -34,7 +33,7 @@ namespace corryvreckan {
/**
* @brief ROOT class definition
*/
ClassDefOverride
(
Pixel
,
4
);
ClassDefOverride
(
Pixel
,
5
);
private:
// Member variables
...
...
src/objects/Track.h
View file @
d9f2bb84
...
...
@@ -23,7 +23,6 @@ namespace corryvreckan {
m_direction
.
SetZ
(
1.
);
m_state
.
SetZ
(
0.
);
}
// virtual ~Track() {}
// Copy constructor (also copies clusters from the original track)
Track
(
Track
*
track
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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