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
70db5e6c
Commit
70db5e6c
authored
Oct 09, 2017
by
Simon Spannagel
Browse files
Obey "numer_of_events" parameter
parent
d4ebcf0e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/core/Analysis.C
View file @
70db5e6c
...
...
@@ -27,24 +27,24 @@ Analysis::Analysis(std::string config_file_name) : m_terminate(false) {
conf_mgr_
->
addIgnoreHeaderName
(
"Ignore"
);
// Fetch the global configuration
corryvreckan
::
Configuration
global
_config
=
conf_mgr_
->
getGlobalConfiguration
();
m
_config
=
conf_mgr_
->
getGlobalConfiguration
();
// FIXME translate new configuration to parameters:
m_parameters
=
new
Parameters
();
// Define DUT and reference
m_parameters
->
DUT
=
global
_config
.
get
<
std
::
string
>
(
"DUT"
);
m_parameters
->
reference
=
global
_config
.
get
<
std
::
string
>
(
"reference"
);
m_parameters
->
DUT
=
m
_config
.
get
<
std
::
string
>
(
"DUT"
);
m_parameters
->
reference
=
m
_config
.
get
<
std
::
string
>
(
"reference"
);
m_parameters
->
detectorToAlign
=
m_parameters
->
DUT
;
m_parameters
->
excludedFromTracking
[
m_parameters
->
DUT
]
=
true
;
std
::
vector
<
std
::
string
>
excluding
=
global
_config
.
getArray
<
std
::
string
>
(
"excludeFromTracking"
);
std
::
vector
<
std
::
string
>
excluding
=
m
_config
.
getArray
<
std
::
string
>
(
"excludeFromTracking"
);
for
(
auto
&
ex
:
excluding
)
{
m_parameters
->
excludedFromTracking
[
ex
]
=
true
;
}
std
::
vector
<
std
::
string
>
masking
=
global
_config
.
getArray
<
std
::
string
>
(
"masked"
);
std
::
vector
<
std
::
string
>
masking
=
m
_config
.
getArray
<
std
::
string
>
(
"masked"
);
for
(
auto
&
m
:
masking
)
{
m_parameters
->
masked
[
m
]
=
true
;
}
...
...
@@ -54,13 +54,13 @@ Analysis::Analysis(std::string config_file_name) : m_terminate(false) {
// parameters->readCommandLineOptions(argc,argv);
// Load alignment parameters
std
::
string
conditionsFile
=
global
_config
.
get
<
std
::
string
>
(
"conditionsFile"
);
std
::
string
conditionsFile
=
m
_config
.
get
<
std
::
string
>
(
"conditionsFile"
);
m_parameters
->
conditionsFile
=
conditionsFile
;
if
(
!
m_parameters
->
readConditions
())
throw
ConfigFileUnavailableError
(
conditionsFile
);
// Load mask file for the dut (if specified)
m_parameters
->
dutMaskFile
=
global
_config
.
get
<
std
::
string
>
(
"dutMaskFile"
,
"defaultMask.dat"
);
m_parameters
->
dutMaskFile
=
m
_config
.
get
<
std
::
string
>
(
"dutMaskFile"
,
"defaultMask.dat"
);
m_parameters
->
readDutMask
();
// FIXME per-algorithm settings:
...
...
@@ -82,7 +82,7 @@ void Analysis::add(Algorithm* algorithm) {
void
Analysis
::
load
()
{
std
::
vector
<
Configuration
>
configs
=
conf_mgr_
->
getConfigurations
();
Configuration
global
_config_
=
conf_mgr_
->
getGlobalConfiguration
();
Configuration
m
_config_
=
conf_mgr_
->
getGlobalConfiguration
();
// Create histogram output file
m_histogramFile
=
new
TFile
(
m_parameters
->
histogramFile
.
c_str
(),
"RECREATE"
);
...
...
@@ -106,8 +106,8 @@ void Analysis::load() {
if
(
loaded_libraries_
.
count
(
lib_name
)
==
0
)
{
// If library is not loaded then try to load it first from the config
// directories
if
(
global
_config_
.
has
(
"library_directories"
))
{
std
::
vector
<
std
::
string
>
lib_paths
=
global
_config_
.
getPathArray
(
"library_directories"
,
true
);
if
(
m
_config_
.
has
(
"library_directories"
))
{
std
::
vector
<
std
::
string
>
lib_paths
=
m
_config_
.
getPathArray
(
"library_directories"
,
true
);
for
(
auto
&
lib_path
:
lib_paths
)
{
std
::
string
full_lib_path
=
lib_path
;
full_lib_path
+=
"/"
;
...
...
@@ -233,6 +233,9 @@ Algorithm* Analysis::create_algorithm(void* library, Configuration config, Clipb
// Run the analysis loop - this initialises, runs and finalises all algorithms
void
Analysis
::
run
()
{
// Check if we have an event limit:
int
number_of_events
=
m_config
.
get
<
int
>
(
"number_of_events"
,
0
);
// Loop over all events, running each algorithm on each "event"
LOG
(
STATUS
)
<<
"========================| Event loop |========================"
;
m_events
=
1
;
...
...
@@ -269,7 +272,7 @@ void Analysis::run() {
if
(
!
run
)
break
;
// Check if we have reached the maximum number of events
if
(
m_parameters
->
nE
vents
>
0
&&
m_events
=
=
m_parameters
->
nE
vents
)
if
(
number_of_e
vents
>
0
&&
m_events
>
=
number_of_e
vents
)
break
;
// Increment event number
if
(
!
noData
)
...
...
src/core/Analysis.h
View file @
70db5e6c
...
...
@@ -52,8 +52,8 @@ namespace corryvreckan {
// Member variables
Parameters
*
m_parameters
;
std
::
unique_ptr
<
corryvreckan
::
ConfigManager
>
conf_mgr_
;
Clipboard
*
m_clipboard
;
Configuration
m_config
;
vector
<
Algorithm
*>
m_algorithms
;
TFile
*
m_histogramFile
;
TDirectory
*
m_directory
;
...
...
@@ -62,6 +62,7 @@ namespace corryvreckan {
private:
std
::
atomic
<
bool
>
m_terminate
;
std
::
unique_ptr
<
corryvreckan
::
ConfigManager
>
conf_mgr_
;
};
}
#endif // ANALYSIS_H
src/core/Parameters.C
View file @
70db5e6c
...
...
@@ -12,7 +12,6 @@ Parameters::Parameters() {
conditionsFile
=
"cond.dat"
;
dutMaskFile
=
"defaultMask.dat"
;
inputDirectory
=
""
;
nEvents
=
0
;
align
=
false
;
produceMask
=
false
;
currentTime
=
0
.;
// seconds
...
...
@@ -77,10 +76,6 @@ void Parameters::readCommandLineOptions(int argc, char* argv[]) {
histogramFile
=
(
string
)
temp
;
LOG
(
INFO
)
<<
"Writing histograms to: "
<<
histogramFile
;
break
;
case
'n'
:
sscanf
(
optarg
,
"%d"
,
&
nEvents
);
LOG
(
INFO
)
<<
"Running over "
<<
nEvents
<<
" events"
;
break
;
case
'o'
:
sscanf
(
optarg
,
"%lf"
,
&
currentTime
);
LOG
(
INFO
)
<<
"Starting at time: "
<<
currentTime
<<
" s"
;
...
...
@@ -145,8 +140,7 @@ bool Parameters::readConditions() {
conditions
.
open
(
conditionsFile
.
c_str
());
string
line
;
LOG
(
INFO
)
<<
"---------------------------------------------------------------"
"----------------------------------------------------"
;
LOG
(
INFO
)
<<
"-------------------------------------------- Reading conditions ---------------------------------------------------"
;
// Loop over file
while
(
getline
(
conditions
,
line
))
{
...
...
src/core/Parameters.h
View file @
70db5e6c
...
...
@@ -298,7 +298,6 @@ public:
string
dut
;
double
currentTime
;
double
eventLength
;
int
nEvents
;
bool
align
;
bool
eventDisplay
;
bool
gui
;
...
...
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