Skip to content

Commit

Permalink
Splitting FCCAnalysisRun (#335)
Browse files Browse the repository at this point in the history
* Splitting FCCAnalysisRun

* Check for HTCondor commands

* Improved batch submition

* Using with context for ROOT files

* Adding type hints

* Updated man pages
  • Loading branch information
kjvbrt authored Jan 25, 2024
1 parent 032874f commit d924653
Show file tree
Hide file tree
Showing 25 changed files with 3,072 additions and 2,477 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/man2html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
mkdir -p ./man/html
cd ./man/man1
for MANFILE in *; do
mandoc -Thtml -Ostyle=/css/mandoc.css "${MANFILE}" > "../html/${MANFILE::-1}html"
mandoc -Thtml -Ostyle=../../css/mandoc.css "${MANFILE}" > "../html/${MANFILE::-1}html"
done
cd ../man7
for MANFILE in *; do
mandoc -Thtml -Ostyle=/css/mandoc.css "${MANFILE}" > "../html/${MANFILE::-1}html"
mandoc -Thtml -Ostyle=../../css/mandoc.css "${MANFILE}" > "../html/${MANFILE::-1}html"
done
74 changes: 31 additions & 43 deletions bin/fccanalysis
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#!/usr/bin/env python3
'''
Starting point (executable) for fccanalysis command
'''

import argparse
import logging

from parsers import setup_subparsers
from init_analysis import init_analysis
from build_analysis import build_analysis
from test_fccanalyses import test_fccanalyses
from pin_analysis import PinAnalysis
from run_analysis import run
from run_final_analysis import run_final
from do_plots import do_plots


class MultiLineFormatter(logging.Formatter):
'''
Expand Down Expand Up @@ -30,9 +42,12 @@ class MultiLineFormatter(logging.Formatter):


def main():
'''
Starting point for fccanalysis command
'''
parser = argparse.ArgumentParser(description='FCCAnalyses v0.8.0')

# Verbosity settings
# Verbosity arguments
verbosity_argument_group = parser.add_mutually_exclusive_group()
verbosity_argument_group.add_argument('-v', '--verbose',
action='store_true',
Expand All @@ -42,42 +57,16 @@ def main():
help='make output more verbose')
verbosity_argument_group.add_argument('-vvv', '--most-verbose',
action='store_true',
help='make output most verbose')

# Create sub-parsers
subparsers = parser.add_subparsers(help='types of running modes',
dest='command')
parser_init = subparsers.add_parser(
'init',
help="generate a RDataFrame based FCC analysis")
parser_build = subparsers.add_parser(
'build',
help='build and install local analysis')
parser_test = subparsers.add_parser(
'test',
help='test whole or a part of the analysis framework')
parser_pin = subparsers.add_parser(
'pin',
help='pin fccanalyses to the current version of Key4hep stack')
parser_run = subparsers.add_parser(
'run',
help="run a RDataFrame based FCC analysis")
parser_run_final = subparsers.add_parser(
'final',
help="run a RDataFrame based FCC analysis final configuration")
parser_run_plots = subparsers.add_parser(
'plots',
help="run a RDataFrame based FCC analysis plot configuration")

# Setup sub-parsers
import Parsers as fccpars
fccpars.setup_init_parser(parser_init)
fccpars.setup_build_parser(parser_build)
fccpars.setup_test_parser(parser_test)
fccpars.setup_pin_parser(parser_pin)
fccpars.setup_run_parser(parser_run)
fccpars.setup_run_parser_final(parser_run_final)
fccpars.setup_run_parser_plots(parser_run_plots)
help='make output even more verbose')

# Sub-parsers
subparsers = parser.add_subparsers(
title='sub-commands',
metavar='sub-command',
dest='command',
help='one of the available sub-commands')

setup_subparsers(subparsers)

args = parser.parse_args()

Expand All @@ -94,19 +83,18 @@ def main():
logger.addHandler(stream_handler)

if args.command == 'init':
from FCCAnalysisSetup import setup
setup(parser)
init_analysis(parser)
elif args.command == 'build':
from build_analysis import build_analysis
build_analysis(parser)
elif args.command == 'test':
from test import test_fccanalyses
test_fccanalyses(parser)
elif args.command == 'pin':
from pin_analysis import PinAnalysis
PinAnalysis(parser)
elif args.command == 'final':
run_final(parser)
elif args.command == 'plots':
do_plots(parser)
else:
from FCCAnalysisRun import run
run(parser)


Expand Down
2 changes: 2 additions & 0 deletions examples/FCCee/higgs/mH-recoil/mumu/analysis_final.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#produces ROOT TTrees, default is False
doTree = False

saveTabular = True

###Dictionnay of the list of cuts. The key is the name of the selection that will be added to the output file
cutList = {"sel0":"Zcand_q == 0",
"sel1":"Zcand_q == -1 || Zcand_q == 1",
Expand Down
60 changes: 60 additions & 0 deletions man/man1/fccanalysis-build.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.\" Manpage for fccanalysis-build
.\" Contact [email protected] to correct errors or typos.
.TH FCCANALYSIS\-BUILD 1 "17 Jan 2024" "0.8.0" "fccanalysis-build man page"
.SH NAME
\fBfccanalysis\-build\fR \(en helper to build FCCAnalyses framework locally
.SH SYNOPSIS
.B fccanalysis build
[\fB\-h\fR | \fB\-\-help\fR]
[\fB\-c\fR]
[\fB\-j\fR \fIBUILD_THREADS\fR]
.SH DESCRIPTION
.B fccanalysis\-build
will build the whole FCCAnalyses framework\&.

This sub-command is not intended as a replacement for the CMake build procedure,
it just makes this task a little easier\&. The helper will build the framework in
the directory: build and install it into the directory: install\&.
.SH OPTIONS
.TP
.BR \-h ", " \-\-help
Prints short help message and exits\&.
.TP
.BR \-c ", " \-\-clean\-build
Completely clean build directory before compilation\&.
.TP
\fB\-j\fR \fIBUILD_THREADS\fR, \fB\-\-build\-threads\fR \fIBUILD_THREADS\fR
Specify number of threads used when compiling (equivalent to `make -j`)
.SH SEE ALSO
fccanalysis(1), fccanalysis\-test(7), cmake(1)
.SH BUGS
Many
.SH AUTHORS
There are many contributors to the FCCAnalyses framework, but the principal
authors are:
.in +4
Clement Helsens
.br
Valentin Volk
.br
Gerardo Ganis
.SH FCCANALYSES
Part of the FCCAnalyses framework\&.
.SH LINKS
.PP
.UR https://hep-fcc\&.github\&.io/FCCAnalyses/
FCCAnalyses webpage
.UE
.PP
.UR https://github\&.com/HEP\-FCC/FCCAnalyses/
FCCAnalysises GitHub repository
.UE
.PP
.UR https://fccsw\-forum\&.web\&.cern\&.ch/
FCCSW Forum
.UE
.SH CONTACT
.pp
.MT [email protected]
FCC-PED-SoftwareAndComputing-Analysis
.ME
150 changes: 57 additions & 93 deletions man/man1/fccanalysis-run.1
Original file line number Diff line number Diff line change
@@ -1,125 +1,89 @@
.\" Manpage for fccanalysis
.\" Contact fcc-experiments-sw-dev@cern.ch to correct errors or typos.
.TH FCCANALYSIS\-RUN 1 "24 May 2023" "0.8.0" "fccanalysis-run man page"
.\" Manpage for fccanalysis-run
.\" Contact FCC-PED-SoftwareAndComputing-Analysis@cern.ch to correct errors or typos.
.TH FCCANALYSIS\-RUN 1 "17 Jan 2024" "0.8.0" "fccanalysis-run man page"
.SH NAME
fccanalysis\-run \- run FCC analysis
\fBfccanalysis\-run\fR \- run FCC analysis
.SH SYNOPSIS
.sp
.nf
\fIfccanalysis run\fR [\-h | \-\-help] [\-\-files\-list FILES_LIST [FILES_LIST ...]]
[\-\-output OUTPUT] [\-\-nevents NEVENTS] [\-\-test] [\-\-bench]
[\-\-ncpus NCPUS] [\-\-preprocess] [\-\-validate] [\-\-rerunfailed]
[\-\-jobdir JOBDIR] <analysis-file>
.fi
.sp
.B fccanalysis run
[\fB\-h\fR | \fB\-\-help\fR]
[\fB\-\-files\-list\fR \fIFILES_LIST\fR [\fIFILES_LIST\fR ...]]
[\fB\-\-output\fR \fIOUTPUT\fR]
[\fB\-\-nevents\fR \fINEVENTS\fR]
[\fB\-\-test\fR]
[\fB\-\-bench\fR]
[\fB\-\-ncpus\fR \fINCPUS\fR]
.I analysis-script
.SH DESCRIPTION
\fIfccanalysis-run\fR will run analysis provided in the analysis file\&. The
.B fccanalysis-run
will run analysis provided in the analysis file\&. The
analysis itself can be divided into several stages if desired\&. For all those
stages \fIfccanalysis-run\fR is used\&.
.sp
When using \fIfccanalysis-run\fR the analysis is running in the managed mode,
where the RDataFrame provided is steered by the framework and users can control
some aspects of the running with additional global attributes, see
\fBfccanalysis-file\fR(8).

When using \fBfccanalysis-run\fR the analysis is running in the managed mode,
where the RDataFrame is steered by the framework and users can control some
aspects of the running with additional global attributes, see
\fIfccanalysis-script\fR(8).
.SH OPTIONS
.PP
<analysis-file>
.RS 4
Path to analysis file\&.
.RE
.PP
\-\-help
.RS 4
.TP
.I analysis-script
Path to analysis script\&.
.TP
.BR \-h ", " \-\-help
Prints short help message and exits\&.
.RE
.PP
\-\-files\-list FILES_LIST [FILES_LIST ...]
.RS 4
.TP
\fB\-\-files\-list\fR \fIFILES_LIST\fR [\fIFILES_LIST\fR ...]
Specify input file to bypass the processList\&.
.RE
.PP
\-\-output OUTPUT
.RS 4
.TP
\fB\-\-output\fR \fIOUTPUT\fR
Specify output file name to bypass the processList and or outputList, default
\fIoutput.root\fR\&.
.RE
.PP
\-\-nevents NEVENTS
.RS 4
.TP
\fB\-\-nevents\fR \fINEVENTS\fR
Specify max number of events to process\&.
.RE
.PP
\-\-test
.RS 4
.TP
.B \-\-test
Run over the test file\&.
.RE
.PP
\-\-bench
.RS 4
.TP
.B \-\-bench
Output benchmark results to a JSON file\&.
.RE
.PP
\-\-ncpus NCPUS
.RS 4
.TP
\-\-ncpus \fINCPUS\fR
Set number of threads\&.
.RE
.PP
\-\-preprocess
.RS 4
Run preprocessing\&.
.RE
.PP
\-\-validate
.RS 4
Validate a given production\&.
.RE
.PP
\-\-rerunfailed
.RS 4
Rerun failed jobs\&.
.RE
.PP
\-\-jobdir JOBDIR
.RS 4
Specify the batch job directory\&.
.RE
.SH ENVIRONMENT VARIABLES
.PP
\fBFCCDICTSDIR\fR
.RS 4
.TP
.B FCCDICTSDIR
Controls search path for the process dictionaries. The default value is
\fI/cvmfs/fcc.cern.ch/FCCDicts/\fR\&.
.RE
.SH SEE ALSO
fccanalysis(1), fccanalysis-file(7)
fccanalysis(1), fccanalysis-script(7)
.SH BUGS
Many
.SH AUTHORS
There are many contributors to the FCCAnalyses framework, but the principal
authors are:
.br
.RS 4
.in +4
Clement Helsens
.br
Valentin Volk
.br
Gerardo Ganis
.RE
.SH FCCANALYSES
Part of the FCCAnalyses framework\&.
.SH LINKS
.PP
1\&. FCCAnalyses webpage
.RS 4
https://hep-fcc\&.github\&.io/FCCAnalyses/
.RE
.PP
2\&. FCCAnalysises GitHub repository
.RS
https://github\&.com/HEP\-FCC/FCCAnalyses/
.RE
.PP
3\&. FCCSW Forum
.RS
https://fccsw\-forum\&.web\&.cern\&.ch/
.RE
.UR https://hep-fcc\&.github\&.io/FCCAnalyses/
FCCAnalyses webpage
.UE
.PP
.UR https://github\&.com/HEP\-FCC/FCCAnalyses/
FCCAnalysises GitHub repository
.UE
.PP
.UR https://fccsw\-forum\&.web\&.cern\&.ch/
FCCSW Forum
.UE
.SH CONTACT
.pp
.MT [email protected]
FCC-PED-SoftwareAndComputing-Analysis
.ME
Loading

0 comments on commit d924653

Please sign in to comment.