Skip to content

Commit 8d49a7c

Browse files
committed
saving progress before using multithreading in gstreamer example
1 parent 3ca7e50 commit 8d49a7c

30 files changed

Lines changed: 223 additions & 136 deletions

eventDispenser/eventDispenser.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "eventDispenserConventions.h"
2727
#include "eventDispenser_options.h"
2828
#include "eventDispenser.h"
29+
#include "gdynamicdigitizationConventions.h"
30+
2931

3032
// c++
3133
#include <fstream>
@@ -63,7 +65,7 @@ EventDispenser::EventDispenser(GOptions *gopt, map<string, GDynamicDigitization
6365
// A filename was specified; attempt to open the run weights input file.
6466
ifstream in(filename.c_str());
6567
if (!in) {
66-
log->error(EC__EVENTDISTRIBUTIONFILENOTFOUND, "Error: can't open run weights input file ", filename, ". Check your spelling. Exiting.");
68+
log->error(ERR_EVENTDISTRIBUTIONFILENOTFOUND, "Error: can't open run weights input file ", filename, ". Check your spelling. Exiting.");
6769
} else {
6870
log->info(1, "Loading run weights from ", filename);
6971
// Fill the run weight map by reading each line from the file.
@@ -154,10 +156,14 @@ int EventDispenser::processEvents() {
154156
if (runNumber != currentRunno) {
155157
for (auto [digitizationName, digiRoutine] : (*gDigitizationGlobal)) {
156158
log->debug(NORMAL, "Calling ", digitizationName, " loadConstants for run ", runNumber);
157-
digiRoutine->loadConstants(runNumber, variation);
159+
if (digiRoutine->loadConstants(runNumber, variation) == false) {
160+
log->error(ERR_LOADCONSTANTFAIL, "Failed to load constants for ", digitizationName, " for run ", runNumber, " with variation ", variation);
161+
}
158162

159163
log->debug(NORMAL, "Calling ", digitizationName, " loadTT for run ", runNumber);
160-
digiRoutine->loadTT(runNumber, variation);
164+
if (digiRoutine->loadTT(runNumber, variation) == false) {
165+
log->error(ERR_LOADTTFAIL, "Failed to load translation table for ", digitizationName, " for run ", runNumber, " with variation ", variation);
166+
}
161167
}
162168
currentRunno = runNumber;
163169
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#pragma once
22

3-
#define EVENTDISPENSERLOGMSGITEM " ⋿"
4-
53
// error codes in the 700s
6-
#define EC__EVENTDISTRIBUTIONFILENOTFOUND 701
4+
#define ERR_EVENTDISTRIBUTIONFILENOTFOUND 701
75

86

g4dialog/gui_session.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "gui_session.h"
2-
#include "../g4dialog_options.h" // Provides G4DIALOG_LOGGER constant and option definitions
2+
#include "g4dialog_options.h" // Provides G4DIALOG_LOGGER constant and option definitions
33

44
#include <QRegularExpression>
55

g4dialog/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if get_option('i_test')
3232
'headers' : headers,
3333
'moc_headers' : moc_headers,
3434
'dependencies' : [yaml_cpp_dep, qt6_deps, clhep_deps, geant4_deps],
35-
'additional_includes' : ['g4dialog/tabs'],
35+
'additional_includes' : ['g4dialog', 'g4dialog/tabs'],
3636
'examples' : examples
3737
}
3838
else
@@ -42,6 +42,6 @@ else
4242
'headers' : headers,
4343
'moc_headers' : moc_headers,
4444
'dependencies' : [yaml_cpp_dep, qt6_deps, clhep_deps, geant4_deps],
45-
'additional_includes' : ['g4dialog/tabs']
45+
'additional_includes' : ['g4dialog', 'g4dialog/tabs'],
4646
}
4747
endif

g4dialog/tabs/gboard.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// G4Dialog
22
#include "gboard.h"
3-
#include "../gui_session.h"
4-
#include "../g4dialog_options.h" // Provides G4DIALOG_LOGGER constant and option definitions
3+
#include "gui_session.h"
4+
#include "g4dialog_options.h" // Provides G4DIALOG_LOGGER constant and option definitions
55

66

77

g4display/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if get_option('i_test')
4040
'moc_headers' : moc_headers,
4141
'qrc_examples_sources' : qrc_examples_sources,
4242
'dependencies' : [yaml_cpp_dep, qt6_deps, clhep_deps, geant4_deps, ogl_deps, sqlite_dep],
43-
'additional_includes' : ['g4display/tabs'],
43+
'additional_includes' : ['g4display', 'g4display/tabs'],
4444
'examples' : examples
4545
}
4646
else
@@ -50,6 +50,6 @@ else
5050
'headers' : headers,
5151
'moc_headers' : moc_headers,
5252
'dependencies' : [yaml_cpp_dep, qt6_deps, clhep_deps, geant4_deps, ogl_deps, sqlite_dep],
53-
'additional_includes' : ['g4display/tabs']
53+
'additional_includes' : ['g4display', 'g4display/tabs'],
5454
}
5555
endif

g4display/tabs/g4displayview.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "g4displayview.h"
2-
#include "../g4display_options.h"
2+
#include "g4display_options.h"
33
#include "gutilities.h"
44

55
using namespace g4display;

gdata/event/gDigitizedData.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
#include "gDigitizedData.h"
7-
#include "../gdataConventions.h"
7+
#include "gdataConventions.h"
88
#include <string>
99
#include <map>
1010
#include <vector>
@@ -71,14 +71,14 @@ int GDigitizedData::getTimeAtElectronics() {
7171

7272
int GDigitizedData::getIntObservable(const std::string& varName) {
7373
if (intObservablesMap.find(varName) == intObservablesMap.end()) {
74-
log->error(EC__VARIABLENOTFOUND, "variable name <" + varName + "> not found in GDigitizedData::intObservablesMap");
74+
log->error(ERR_VARIABLENOTFOUND, "variable name <" + varName + "> not found in GDigitizedData::intObservablesMap");
7575
}
7676
return intObservablesMap[varName];
7777
}
7878

7979
double GDigitizedData::getDblObservable(const std::string& varName) {
8080
if (doubleObservablesMap.find(varName) == doubleObservablesMap.end()) {
81-
log->error(EC__VARIABLENOTFOUND, "variable name <" + varName + "> not found in GDigitizedData::doubleObservablesMap");
81+
log->error(ERR_VARIABLENOTFOUND, "variable name <" + varName + "> not found in GDigitizedData::doubleObservablesMap");
8282
}
8383
return doubleObservablesMap[varName];
8484
}

gdata/frame/gFrameDataCollection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "gFrameDataCollectionHeader.h"
1111
#include "gIntegralPayload.h"
12-
#include "../gdataConventions.h"
12+
#include "gdataConventions.h"
1313
#include <vector>
1414
#include <string>
1515

@@ -59,7 +59,7 @@ class GFrameDataCollection {
5959
log->debug(NORMAL, " adding integral payload for crate ", crate, " slot ", slot, " channel ", channel,
6060
" charge ", charge, " time ", time);
6161
}
62-
else { log->error(EC__WRONGPAYLOAD, "payload size is not 5 but ", payload.size()); }
62+
else { log->error(ERR_WRONGPAYLOAD, "payload size is not 5 but ", payload.size()); }
6363
}
6464

6565
// Placeholder: Add event-specific data.

gdata/gdataConventions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
* The constants below are used for error reporting and as string identifiers in various modules.
1919
*/
2020

21-
constexpr int EC__GSDETECTORNOTFOUND = 601; ///< Exit code when a detector is not found.
22-
constexpr int EC__VARIABLENOTFOUND = 602; ///< Exit code when a variable is not found.
23-
constexpr int EC__WRONGPAYLOAD = 603; ///< Exit code when a payload is of the wrong size.
21+
constexpr int ERR_GSDETECTORNOTFOUND = 601; ///< Exit code when a detector is not found.
22+
constexpr int ERR_VARIABLENOTFOUND = 602; ///< Exit code when a variable is not found.
23+
constexpr int ERR_WRONGPAYLOAD = 603; ///< Exit code when a payload is of the wrong size.
2424

2525
constexpr const char* CRATESTRINGID = "crate"; ///< Identifier for crate.
2626
constexpr const char* SLOTSTRINGID = "slot"; ///< Identifier for slot.

0 commit comments

Comments
 (0)