Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hallc_replay
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jlab
hallc
exp
polhe3
hallc_replay
Commits
ca2fd43c
Commit
ca2fd43c
authored
5 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
added facilities to ensure output directories are writable, debug replay script
parent
22bca8e0
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
SCRIPTS/PRODUCTION/replay_shms.cxx
+7
-10
7 additions, 10 deletions
SCRIPTS/PRODUCTION/replay_shms.cxx
SCRIPTS/replay_shms.sh
+24
-3
24 additions, 3 deletions
SCRIPTS/replay_shms.sh
with
33 additions
and
14 deletions
.gitignore
+
2
−
1
View file @
ca2fd43c
...
...
@@ -21,6 +21,7 @@ ROOTfiles
raw
raw.copiedtotape
cache
logs
# Symbolic links
hcana
\ No newline at end of file
hcana
This diff is collapsed.
Click to expand it.
SCRIPTS/PRODUCTION/replay_shms.cxx
+
7
−
10
View file @
ca2fd43c
...
...
@@ -37,7 +37,7 @@ using namespace std;
#include
"THcTrigDet.h"
std
::
string
coda_file_pattern
(
bool
do_coin
)
{
return
fmt
::
format
(
"{}_all_{{:05d}}.dat"
,
do_coin
?
"coin"
,
"shms"
);
return
fmt
::
format
(
"{}_all_{{:05d}}.dat"
,
do_coin
?
"coin"
:
"shms"
);
}
std
::
string
output_file_pattern
(
string_view
path
,
string_view
content
,
string_view
extension
,
bool
do_coin
,
bool
do_all
)
{
...
...
@@ -45,8 +45,8 @@ std::string output_file_pattern(string_view path, string_view content, string_vi
do_all
?
"all_"
:
""
,
extension
);
}
void
replay_shms
(
Int_t
RunNumber
=
7160
,
Int_t
MaxEvent
=
0
,
string_view
mode
=
"shms"
,
const
bool
do_all
=
false
)
{
int
replay_shms
(
Int_t
RunNumber
=
7160
,
Int_t
MaxEvent
=
-
1
,
Int_t
FirstEvent
=
0
,
const
bool
do_coin
=
false
,
const
bool
do_all
=
false
)
{
// ===========================================================================
// Setup logging
spdlog
::
set_level
(
spdlog
::
level
::
warn
);
...
...
@@ -68,11 +68,6 @@ void replay_shms(Int_t RunNumber = 7160, Int_t MaxEvent = 0, string_view mode =
return
-
1
;
}
}
if
(
mode
!=
"shms"
&&
mode
!=
"SHMS"
&&
mode
!=
"coin"
&&
mode
!=
"COIN"
)
{
cerr
<<
"Invalid mode `"
<<
mode
<<
"`, has to be either `coin` or `shms`
\n
"
;
return
-
1
;
}
const
bool
do_coin
=
(
mode
==
"coin"
||
mode
==
"COIN"
);
// ===========================================================================
// Create file name patterns.
...
...
@@ -252,7 +247,7 @@ void replay_shms(Int_t RunNumber = 7160, Int_t MaxEvent = 0, string_view mode =
// File to record accounting information for cuts
analyzer
->
SetSummaryFile
(
fmt
::
format
(
output_file_pattern
(
"REPORT_OUTPUT/PRODUCTION"
,
"summary"
,
"report"
,
do_coin
,
do_all
),
Run
Number
,
MaxEvent
)
RunNumber
,
MaxEvent
)
.
c_str
());
// Start the actual analysis.
analyzer
->
Process
(
run
);
...
...
@@ -261,8 +256,10 @@ void replay_shms(Int_t RunNumber = 7160, Int_t MaxEvent = 0, string_view mode =
"TEMPLATES/SHMS/PRODUCTION/pstackana_production.template"
,
fmt
::
format
(
output_file_pattern
(
"REPORT_OUTPUT/PRODUCTION"
,
"replay_production"
,
"report"
,
do_coin
,
do_all
),
Run
Number
,
MaxEvent
)
RunNumber
,
MaxEvent
)
.
c_str
());
delete
analyzer
;
return
0
;
}
This diff is collapsed.
Click to expand it.
SCRIPTS/replay_shms.sh
+
24
−
3
View file @
ca2fd43c
...
...
@@ -12,6 +12,16 @@ function print_the_help {
exit
}
function
io_error
{
echo
ERROR: cannot create or write to directory
$1
exit
-1
}
function
ensure_directory
{
echo
"Ensuring
$1
exists and is writable"
[[
-d
"
$1
"
]]
||
mkdir
-p
$1
touch
$1
/.write_check
||
io_error
$1
}
function
yes_or_no
{
while
true
;
do
read
-p
"
$*
[y/n]: "
yn
...
...
@@ -63,7 +73,7 @@ do
shift
# past argument
;;
-c
|
--coin
)
DO_COIN
=
"true"
shift
# past argument
;;
*
)
# unknown option
...
...
@@ -97,5 +107,16 @@ fi
# exit
#fi
hcana
-b
-q
\
"SCRIPTS/SHMS/replay_shms.cxx+(
${
run_number
}
,
${
n_events
}
,
${
min_event
}
,
${
DO_COIN
}
,
${
DO_ALL
}
)"
## NOTE: if you change anything here, make sure you make corresponding changes
## in the replay script
REPLAY_ARGS
=
"
${
run_number
}
,
${
n_events
}
,
${
min_event
}
,
${
DO_COIN
}
,
${
DO_ALL
}
"
REPLAY_CMD
=
"SCRIPTS/PRODUCTION/replay_shms.cxx+(
${
REPLAY_ARGS
}
)"
REPORT_DIR
=
"REPORT_OUTPUT/PRODUCTION"
LOGDIR
=
"logs"
ROOTDIR
=
"ROOTfiles"
ensure_directory
${
REPORT_DIR
}
ensure_directory
${
LOGDIR
}
ensure_directory
${
ROOTDIR
}
hcana
-b
-q
"
${
REPLAY_CMD
}
"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment