diff --git a/build/misc/argparse2help.py b/build/misc/argparse2help.py index fd7cf4a5772af648d7ddb83998e9d34ee82f7483..67dbc796ae01a6f1305da6ad7de34e8262dfe6de 100644 --- a/build/misc/argparse2help.py +++ b/build/misc/argparse2help.py @@ -64,12 +64,11 @@ def write_man(parser, fileName): if __name__ == "__main__": path = os.path.expanduser(sys.argv[1]) - splitPath = path.split("/") - sys.path.insert(0, "/".join(splitPath[:len(splitPath)-1])) - i = importlib.import_module(splitPath[len(splitPath)-1].partition(".")[0]) + sys.path.insert(0, os.path.abspath(os.path.dirname(path))) + i = importlib.import_module(os.path.splitext(os.path.basename(path))[0]) parser = i.get_argparse() listArgs = parser._actions if (sys.argv[2].partition(".")[2] == "h"): write_header(parser, sys.argv[2]) elif (sys.argv[2].partition(".")[2] == "1"): - write_man(parser, sys.argv[2]) \ No newline at end of file + write_man(parser, sys.argv[2]) diff --git a/cmake/modules/RootNewMacros.cmake b/cmake/modules/RootNewMacros.cmake index 8e1c264aa0ab0f916e0bec4114b53a4d3c65b656..a8d734b10afd4ad413855eed500238b9c4443b92 100644 --- a/cmake/modules/RootNewMacros.cmake +++ b/cmake/modules/RootNewMacros.cmake @@ -1454,4 +1454,34 @@ function(find_python_module module) set(PY_${module_upper}_FOUND ${PY_${module_upper}_FOUND} PARENT_SCOPE) endfunction() +#---------------------------------------------------------------------------- +# Generate headers files containing the command line options help +# The first argument pythonInput is the path of the python argparse file for this command +# The second argument output is the of path/name of the output file +# The third argument is the name of the target that should be linked to the generated +# library( the executable that includes it or the library that uses it) +#---------------------------------------------------------------------------- +function(generateHeaders pythonInput output target) + add_custom_command(OUTPUT ${output} + DEPENDS ${pythonInput} ${CMAKE_SOURCE_DIR}/build/misc/argparse2help.py + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/misc/argparse2help.py + ${pythonInput} + ${output} + ) + target_sources(${target} PRIVATE ${output}) +endfunction() +#---------------------------------------------------------------------------- +# Generate man page through argparse method +# The first argument pythonInput is the path of the python argparse file for this command +# The second argument output is the of path/name of the output file +#---------------------------------------------------------------------------- +function(generateManual name pythonInput output) + add_custom_target(${name} ALL + DEPENDS ${pythonInput} ${CMAKE_SOURCE_DIR}/build/misc/argparse2help.py + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/misc/argparse2help.py + ${pythonInput} + ${output} + ) + install(FILES ${output} DESTINATION ${CMAKE_INSTALL_MANDIR}) +endfunction() diff --git a/core/base/CMakeLists.txt b/core/base/CMakeLists.txt index 77d7e4b955809df9d1731f6d73b863fb9a57bdee..c89673198328b2f1b89e5b3714bae81f6ec2025c 100644 --- a/core/base/CMakeLists.txt +++ b/core/base/CMakeLists.txt @@ -76,6 +76,9 @@ set_property(TARGET G__Core PROPERTY INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}) list(REMOVE_ITEM sources TROOT.cxx roota.cxx) ROOT_OBJECT_LIBRARY(Base G__Core.cxx ${sources} BUILTINS PCRE) +#---CreateTApplicationCommandLineOptions------------------------------------------------------------------ +generateHeaders(${CMAKE_CURRENT_SOURCE_DIR}/src/root-argparse.py ${CMAKE_BINARY_DIR}/include/TApplicationCommandLineOptionsHelp.h Base) + ROOT_INSTALL_HEADERS(${install_dirs}) #---Extra options----------------------------------------------------------------------- @@ -85,3 +88,24 @@ if(GCC_MAJOR EQUAL 4 AND GCC_MINOR EQUAL 1) COMPILE_FLAGS -Wno-strict-aliasing ) endif() +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/man) + +if(NOT MSVC) +#---addRootC++CmdMan------------------------------------------------------------------------- +generateManual(rootMan ${CMAKE_CURRENT_SOURCE_DIR}/src/root-argparse.py ${CMAKE_BINARY_DIR}/man/root.1) +generateManual(haddMan ${CMAKE_SOURCE_DIR}/main/src/hadd-argparse.py ${CMAKE_BINARY_DIR}/man/hadd.1) +generateManual(hist2workspaceMan ${CMAKE_SOURCE_DIR}/roofit/histfactory/src/hist2workspace-argparse.py ${CMAKE_BINARY_DIR}/man/hist2workspace.1) +generateManual(rootclingMan ${CMAKE_SOURCE_DIR}/core/dictgen/src/rootcling-argparse.py ${CMAKE_BINARY_DIR}/man/rootcling.1) + +#---addRootPyCmdMan--------------------------------------------------------------------------- +#generateManual(rootbrowseMan ${CMAKE_SOURCE_DIR}/main/python/rootbrowse.py ${CMAKE_BINARY_DIR}/man/rootbrowse.1) +#generateManual(rootcpMan ${CMAKE_SOURCE_DIR}/main/python/rootcp.py ${CMAKE_BINARY_DIR}/man/rootcp.1) +#generateManual(rootdrawtreeMan ${CMAKE_SOURCE_DIR}/main/python/rootdrawtree.py ${CMAKE_BINARY_DIR}/man/rootdrawtree.1) +#generateManual(rooteventselectorMan ${CMAKE_SOURCE_DIR}/main/python/rooteventselector.py ${CMAKE_BINARY_DIR}/man/rooteventselector.1) +#generateManual(rootlsMan ${CMAKE_SOURCE_DIR}/main/python/rootls.py ${CMAKE_BINARY_DIR}/man/rootls.1) +#generateManual(rootmkdirMan ${CMAKE_SOURCE_DIR}/main/python/rootmkdir.py ${CMAKE_BINARY_DIR}/man/rootmkdir.1) +#generateManual(rootmvMan ${CMAKE_SOURCE_DIR}/main/python/rootmv.py ${CMAKE_BINARY_DIR}/man/rootmv.1) +#generateManual(rootprintMan ${CMAKE_SOURCE_DIR}/main/python/rootprint.py ${CMAKE_BINARY_DIR}/man/rootprint.1) +#generateManual(rootrmMan ${CMAKE_SOURCE_DIR}/main/python/rootrm.py ${CMAKE_BINARY_DIR}/man/rootrm.1) +#generateManual(rootslimtreeMan ${CMAKE_SOURCE_DIR}/main/python/rootslimtree.py ${CMAKE_BINARY_DIR}/man/rootslimtree.1) +endif() diff --git a/core/base/inc/CommandLineOptionsHelp.h b/core/base/inc/CommandLineOptionsHelp.h deleted file mode 100644 index b7d903878e86a147995cfcce198368a7dd0050b2..0000000000000000000000000000000000000000 --- a/core/base/inc/CommandLineOptionsHelp.h +++ /dev/null @@ -1,82 +0,0 @@ -/* @(#)root/base:$Id$ */ - -/************************************************************************* - * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. * - * All rights reserved. * - * * - * For the licensing terms see $ROOTSYS/LICENSE. * - * For the list of contributors see $ROOTSYS/README/CREDITS. * - *************************************************************************/ - -#ifndef ROOT_CommandLineOptionsHelp -#define ROOT_CommandLineOptionsHelp - - -////////////////////////////////////////////////////////////////////////// -// // -// CommandLineOptionsHelp // -// // -// Help text displayed by TApplication and rootx.cxx. // -// // -////////////////////////////////////////////////////////////////////////// - -/// Help for command line options. -/// -/// - b : run in batch mode without graphics -/// - x : exit on exception -/// - e expression: request execution of the given C++ expression. -/// - n : do not execute logon and logoff macros as specified in .rootrc -/// - q : exit after processing command line macro files -/// - l : do not show splash screen -/// -/// The last three options are only relevant in conjunction with TRint. -/// The following help and info arguments are supported: -/// -/// - ? : print usage -/// - h : print usage -/// - -help : print usage -/// - config : print ./configure options -/// - memstat : run with memory usage monitoring -/// -/// In addition to the above options the arguments that are not options, -/// i.e. they don't start with - or + are treated as follows (and also removed -/// from the argument array): -/// -/// - `<dir>` is considered the desired working directory and available -/// via WorkingDirectory(), if more than one dir is specified the -/// first one will prevail -/// - `<file>` if the file exists its added to the InputFiles() list -/// - `<file>.root` are considered ROOT files and added to the InputFiles() list, -/// the file may be a remote file url -/// - `<macro>.C` are considered ROOT macros and also added to the InputFiles() list -/// -/// In TRint we set the working directory to the `<dir>`, the ROOT files are -/// connected, and the macros are executed. If your main TApplication is not -/// TRint you have to decide yourself what to do with these options. -/// All specified arguments (also the ones removed) can always be retrieved -/// via the TApplication::Argv() method. - -constexpr static const char kCommandLineOptionsHelp[] = R"RAW( -Usage: %s [-l] [-b] [-n] [-q] [dir] [[file:]data.root] [file1.C ... fileN.C] -Options: - -b : run in batch mode without graphics - -x : exit on exception - -e expression: request execution of the given C++ expression - -n : do not execute logon and logoff macros as specified in .rootrc - -q : exit after processing command line macro files - -l : do not show splash screen - -t : enable thread-safety and implicit multi-threading (IMT) - --web: display graphics in a default web browser - --web=<browser>: display graphics in specified web browser - --notebook : execute ROOT notebook - dir : if dir is a valid directory cd to it before executing - - -? : print usage - -h : print usage - --help : print usage - -config : print ./configure options - -memstat : run with memory usage monitoring - -)RAW"; - -#endif diff --git a/core/base/src/TApplication.cxx b/core/base/src/TApplication.cxx index fe125c55ca510dc4780ccdb1b8fbdd2188a1f979..64868fa9138b77a21bb77e6e6b75448064770255 100644 --- a/core/base/src/TApplication.cxx +++ b/core/base/src/TApplication.cxx @@ -44,7 +44,7 @@ TApplication (see TRint). #include "TUrl.h" #include "TVirtualMutex.h" -#include "CommandLineOptionsHelp.h" +#include "TApplicationCommandLineOptionsHelp.h" #include <stdlib.h> @@ -382,7 +382,7 @@ void TApplication::GetOptions(Int_t *argc, char **argv) for (i = 1; i < *argc; i++) { if (!strcmp(argv[i], "-?") || !strncmp(argv[i], "-h", 2) || !strncmp(argv[i], "--help", 6)) { - fprintf(stderr, kCommandLineOptionsHelp, argv[0]); + fprintf(stderr, kCommandLineOptionsHelp); Terminate(0); } else if (!strncmp(argv[i], "--version", 9)) { fprintf(stderr, "ROOT Version: %s\n", gROOT->GetVersion()); diff --git a/core/base/src/root-argparse.py b/core/base/src/root-argparse.py index 3ae35f6a7f5904dd0739d13f4b7cc194d2dc761d..8ec1dda0688f85a79538d3c6643da06a14c48a1d 100644 --- a/core/base/src/root-argparse.py +++ b/core/base/src/root-argparse.py @@ -1,5 +1,4 @@ import argparse -import sys def get_argparse(): parser = argparse.ArgumentParser(add_help=False, prog='root', @@ -17,7 +16,11 @@ An extensive Users Guide is available from that site (see below). parser.add_argument('-config', help='print ./configure options') parser.add_argument('-memstat', help='run with memory usage monitoring') parser.add_argument('-h','-?', '--help', help='Show summary of options') + parser.add_argument('--version', help='Show the ROOT version') parser.add_argument('--notebook', help='Execute ROOT notebook') - parser.add_argument('--web', help='Display graphics in a web browser') - parser.add_argument('dir', help='if dir is a valid directory cd to it before executing') + parser.add_argument('--web', help='Display graphics in a default web browser') + parser.add_argument('--web=<browser>', help='Display graphics in specified web browser') + parser.add_argument('[dir]', help='if dir is a valid directory cd to it before executing') + parser.add_argument('[file:data.root]', help='Open the ROOT file data.root') + parser.add_argument('[file1.C...fileN.C]', help='Execute the the ROOT macro file1.C ... fileN.C') return parser diff --git a/core/dictgen/CMakeLists.txt b/core/dictgen/CMakeLists.txt index 51643712494900736aafb903e3413195aa5e76aa..c327f2236dcea2d460f8f4718ba58374c3c0de0e 100644 --- a/core/dictgen/CMakeLists.txt +++ b/core/dictgen/CMakeLists.txt @@ -34,3 +34,6 @@ if(CXX_HAS_fno_rtti) set_source_files_properties(src/LinkdefReader.cxx PROPERTIES COMPILE_FLAGS "-fno-rtti") set_source_files_properties(src/TModuleGenerator.cxx PROPERTIES COMPILE_FLAGS "-fno-rtti") endif() + +#---CreateRootClingCommandLineOptions------------------------------------------------------------------ +generateHeaders(${CMAKE_SOURCE_DIR}/core/dictgen/src/rootcling-argparse.py ${CMAKE_BINARY_DIR}/include/rootclingCommandLineOptionsHelp.h Dictgen) diff --git a/core/dictgen/src/rootcling-argparse.py b/core/dictgen/src/rootcling-argparse.py new file mode 100644 index 0000000000000000000000000000000000000000..198849ce10be19cbb9ca1fafd54bcd176ea31f97 --- /dev/null +++ b/core/dictgen/src/rootcling-argparse.py @@ -0,0 +1,151 @@ +import argparse +import sys + +EPILOG = """ +The options -p, -c, -l, -cint, -reflex and -gccxml are deprecated and +currently ignored. + + + +IMPORTANT: +1) LinkDef.h must be the last argument on the rootcling command line. +2) Note that the LinkDef file name must contain the string: + LinkDef.h, Linkdef.h or linkdef.h, i.e. NA49_LinkDef.h. + +Before specifying the first header file one can also add include +file directories to be searched and preprocessor defines, like: + -I$MYPROJECT/include -DDebug=1 + +NOTA BENE: the dictionaries that will be used within the same project must +have unique names + + + +The (optional) file LinkDef.h looks like: + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class TAxis; +#pragma link C++ class TAttAxis-; +#pragma link C++ class TArrayC-!; +#pragma link C++ class AliEvent+; + +#pragma link C++ function StrDup; +#pragma link C++ function operator+(const TString&,const TString&); + +#pragma link C++ global gROOT; +#pragma link C++ global gEnv; + +#pragma link C++ enum EMessageTypes; + +#endif + +This file tells rootcling which classes will be persisted on disk and what +entities will trigger automatic load of the shared library which contains +it. A trailing - in the class name tells rootcling to not generate the +Streamer() method. This is necessary for those classes that need a +customized Streamer() method. A trailing ! in the class name tells rootcling +to not generate the operator>>(TBuffer &b, MyClass *&obj) function. This is +necessary to be able to write pointers to objects of classes not inheriting +from TObject. See for an example the source of the TArrayF class. +If the class contains a ClassDef macro, a trailing + in the class +name tells rootcling to generate an automatic Streamer(), i.e. a +streamer that let ROOT do automatic schema evolution. Otherwise, a +trailing + in the class name tells rootcling to generate a ShowMember +function and a Shadow Class. The + option is mutually exclusive with +the - option. For legacy reasons it is not yet the default. +When the linkdef file is not specified a default version exporting +the classes with the names equal to the include files minus the .h +is generated. + +The default constructor used by the ROOT I/O can be customized by +using the rootcling pragma: + #pragma link C++ ioctortype UserClass; +For example, with this pragma and a class named MyClass, +this method will called the first of the following 3 +constructors which exists and is public: + MyClass(UserClass*); + MyClass(TRootIOCtor*); + MyClass(); // Or a constructor with all its arguments defaulted. + +When more than one pragma ioctortype is used, the first seen has +priority. For example with: + #pragma link C++ ioctortype UserClass1; + #pragma link C++ ioctortype UserClass2; + +ROOT considers the constructors in this order: + MyClass(UserClass1*); + MyClass(UserClass2*); + MyClass(TRootIOCtor*); + MyClass(); // Or a constructor with all its arguments defaulted. +""" +def get_argparse(): + parser = argparse.ArgumentParser(add_help=False, prog='rootcling', + description = 'This program generates the dictionaries needed for performing I/O of classes.', + epilog = EPILOG +) + parser.add_argument('-f', help='Overwrite an existing output file\nThe output file must have the .cxx, .C, .cpp, .cc or .cp extension.\n') + parser.add_argument('-v', help='Display all messages') + parser.add_argument('-v0', help='Display no messages at all') + parser.add_argument('-v1', help='Display only error messages') + parser.add_argument('-v2', help='Display error and warning messages (default).') + parser.add_argument('-v3', help='Display error, warning and note messages') + parser.add_argument('-v4', help='Display all messages\n') + parser.add_argument('-m', help="""Specify absolute or relative path Clang pcm file to be loaded +The pcm file (module) produced by this invocation of rootcling +will not include any of the declarations already included in the +pcm files loaded via -m. There can be more than one -m +""") + parser.add_argument('-rmf', help="""Rootmap file name +Name of the rootmap file. In order to be picked up by ROOT it must +have .rootmap extension +""") + parser.add_argument('-rml', help="""Rootmap library name +Specify the name of the library which contains the autoload keys. This +switch can be specified multiple times to autoload several libraries in +presence of a particular key +""") + parser.add_argument('-split', help="""Split the dictionary +Split the dictionary in two, putting the ClassDef functions in a separate +file +""") + parser.add_argument('-s', help="""Target library name +The flag -s must be followed by the name of the library that will +contain the object file corresponding to the dictionary produced by +this invocation of rootcling. +The name takes priority over the one specified for the rootmapfile. +The name influences the name of the created pcm: + 1) If it is not specified, the pcm is called libINPUTHEADER_rdict.pcm + 2) If it is specified, the pcm is called libTARGETLIBRARY_rdict.pcm + Any "liblib" occurence is transformed in the expected "lib" + 3) If this is specified in conjunction with --multiDict, the output is + libTARGETLIBRARY_DICTIONARY_rdict.pcm +""") + parser.add_argument('-multiDict', help="""Enable support for multiple pcms in one library +Needs the -s flag. See its documentation. +""") + parser.add_argument('-inlineInputHeader', help="""Add the argument header to the code of the dictionary +This allows the header to be inlined within the dictionary +""") + parser.add_argument('-interpreteronly', help='No IO information in the dictionary\n') + parser.add_argument('-noIncludePaths', help="""Do not store the headers' directories in the dictionary +Instead, rely on the environment variable $ROOT_INCLUDE_PATH at runtime +""") + parser.add_argument('-excludePath', help="""Specify a path to be excluded from the include paths +specified for building this dictionary +""") + parser.add_argument('--lib-list-prefix', help="""Specify libraries needed by the header files parsed +This feature is used by ACliC (the automatic library generator). +Rootcling will read the content of xxx.in for a list of rootmap files (see +rlibmap). Rootcling will read these files and use them to deduce a list of +libraries that are needed to properly link and load this dictionary. This +list of libraries is saved in the first line of the file xxx.out; the +remaining lines contains the list of classes for which this run of +rootcling produced a dictionary +""") + return parser + diff --git a/core/dictgen/src/rootcling_impl.cxx b/core/dictgen/src/rootcling_impl.cxx index d9ee007f6b6f28d5b00992d922f36d679a531871..5cfb34bb2006334226d71d1d07857ceb122c924c 100644 --- a/core/dictgen/src/rootcling_impl.cxx +++ b/core/dictgen/src/rootcling_impl.cxx @@ -12,159 +12,10 @@ const char *shortHelp = "Usage: rootcling [-v][-v0-4] [-f] [out.cxx] [opts] " "file1.h[+][-][!] file2.h[+][-][!] ...[LinkDef.h]\n"; -// Write the help as a big string to have only one version of the documentation -const char *rootClingHelp = - "This program generates the dictionaries needed for performing I/O of \n" - "classes. Rootcling can be used with an invocation like this one: \n" - " \n" - " rootcling [-v][-v0-4] [-f] [out.cxx] [opts] " - "file1.h[+][-][!] file2.h[+][-][!] ...[LinkDef.h]\n" - " \n" - "IMPORTANT: \n" - "1) LinkDef.h must be the last argument on the rootcling command line. \n" - "2) Note that the LinkDef file name must contain the string: \n" - " LinkDef.h, Linkdef.h or linkdef.h, i.e. NA49_LinkDef.h. \n" - " \n" - "Before specifying the first header file one can also add include \n" - "file directories to be searched and preprocessor defines, like: \n" - " -I$MYPROJECT/include -DDebug=1 \n" - " \n" - "NOTA BENE: the dictionaries that will be used within the same project must \n" - "have unique names. \n" - " \n" - "Options: \n" - " \n" - " -f\tOverwrite an existing output file. \n" - " The output file must have the .cxx, .C, .cpp, .cc or .cp extension. \n" - " \n" - " -v\tThe verbose flags have the following meaning: \n" - " -v Display all messages \n" - " -v0 Display no messages at all. \n" - " -v1 Display only error messages. \n" - " -v2 Display error and warning messages (default). \n" - " -v3 Display error, warning and note messages. \n" - " -v4 Display all messages \n" - " \n" - " -m\tSpecify absolute or relative path Clang pcm file to be loaded. \n" - " The pcm file (module) produced by this invocation of rootcling will \n" - " not include any of the declarations already included in the pcm \n" - " files loaded via -m. There can be more than one -m. \n" - " \n" - " -rmf\tRootmap file name. \n" - " Name of the rootmap file. In order to be picked up by ROOT it must have \n" - " .rootmap extension. \n" - " \n" - " -rml\tRootmap library name. \n" - " Specify the name of the library which contains the autoload keys. This \n" - " switch can be specified multiple times to autoload several libraries in \n" - " presence of a particular key. \n" - " \n" - " -split\tSplit the dictionary. \n" - " Split the dictionary in two, putting the ClassDef functions in a separate \n" - " file. \n" - " \n" - " -s\tTarget library name. \n" - " The flag -s must be followed by the name of the library that will \n" - " contain the object file corresponding to the dictionary produced by \n" - " this invocation of rootcling. \n" - " The name takes priority over the one specified for the rootmapfile. \n" - " The name influences the name of the created pcm: \n" - " 1) If it is not specified, the pcm is called libINPUTHEADER_rdict.pcm \n" - " 2) If it is specified, the pcm is called libTARGETLIBRARY_rdict.pcm \n" - " Any \"liblib\" occurence is transformed in the expected \"lib\". \n" - " 3) If this is specified in conjunction with --multiDict, the output is \n" - " libTARGETLIBRARY_DICTIONARY_rdict.pcm \n" - " \n" - " -multiDict\tEnable support for multiple pcms in one library. \n" - " Needs the -s flag. See its documentation. \n" - " \n" - " -inlineInputHeader\tAdd the argument header to the code of the dictionary. \n" - " This allows the header to be inlined within the dictionary. \n" - " \n" - " -interpreteronly\tNo IO information in the dictionary. \n" - " \n" - " -noIncludePaths\tDo not store the headers' directories in the dictionary. \n" - " Instead, rely on the environment variable $ROOT_INCLUDE_PATH at runtime. \n" - " \n" - " -excludePath\tSpecify a path to be excluded from the include paths \n" - " specified for building this dictionary. \n" - " \n" - " --lib-list-prefix\t Specify libraries needed by the header files parsed. \n" - " This feature is used by ACliC (the automatic library generator). \n" - " Rootcling will read the content of xxx.in for a list of rootmap files (see\n" - " rlibmap). Rootcling will read these files and use them to deduce a list of\n" - " libraries that are needed to properly link and load this dictionary. This \n" - " list of libraries is saved in the first line of the file xxx.out; the \n" - " remaining lines contains the list of classes for which this run of \n" - " rootcling produced a dictionary. \n" - " \n" - "The options -p, -c, -l, -cint, -reflex and -gccxml are deprecated and \n" - "currently ignored. \n" - " \n" - "The (optional) file LinkDef.h looks like: \n" - " \n" - "#ifdef __CLING__ \n" - " \n" - "#pragma link off all globals; \n" - "#pragma link off all classes; \n" - "#pragma link off all functions; \n" - " \n" - "#pragma link C++ class TAxis; \n" - "#pragma link C++ class TAttAxis-; \n" - "#pragma link C++ class TArrayC-!; \n" - "#pragma link C++ class AliEvent+; \n" - " \n" - "#pragma link C++ function StrDup; \n" - "#pragma link C++ function operator+(const TString&,const TString&); \n" - " \n" - "#pragma link C++ global gROOT; \n" - "#pragma link C++ global gEnv; \n" - " \n" - "#pragma link C++ enum EMessageTypes; \n" - " \n" - "#endif \n" - " \n" - "This file tells rootcling which classes will be persisted on disk and what \n" - "entities will trigger automatic load of the shared library which contains \n" - "it. A trailing - in the class name tells rootcling to not generate the \n" - "Streamer() method. This is necessary for those classes that need a \n" - "customized Streamer() method. A trailing ! in the class name tells rootcling\n" - "to not generate the operator>>(TBuffer &b, MyClass *&obj) function. This is \n" - "necessary to be able to write pointers to objects of classes not inheriting \n" - "from TObject. See for an example the source of the TArrayF class. \n" - "If the class contains a ClassDef macro, a trailing + in the class \n" - "name tells rootcling to generate an automatic Streamer(), i.e. a \n" - "streamer that let ROOT do automatic schema evolution. Otherwise, a \n" - "trailing + in the class name tells rootcling to generate a ShowMember \n" - "function and a Shadow Class. The + option is mutually exclusive with \n" - "the - option. For legacy reasons it is not yet the default. \n" - "When the linkdef file is not specified a default version exporting \n" - "the classes with the names equal to the include files minus the .h \n" - "is generated. \n" - " \n" - "The default constructor used by the ROOT I/O can be customized by \n" - "using the rootcling pragma: \n" - " #pragma link C++ ioctortype UserClass; \n" - "For example, with this pragma and a class named MyClass, \n" - "this method will called the first of the following 3 \n" - "constructors which exists and is public: \n" - " MyClass(UserClass*); \n" - " MyClass(TRootIOCtor*); \n" - " MyClass(); // Or a constructor with all its arguments defaulted. \n" - " \n" - "When more than one pragma ioctortype is used, the first seen has \n" - "priority. For example with: \n" - " #pragma link C++ ioctortype UserClass1; \n" - " #pragma link C++ ioctortype UserClass2; \n" - " \n" - "ROOT considers the constructors in this order: \n" - " MyClass(UserClass1*); \n" - " MyClass(UserClass2*); \n" - " MyClass(TRootIOCtor*); \n" - " MyClass(); // Or a constructor with all its arguments defaulted. \n"; #include "rootcling_impl.h" +#include "rootclingCommandLineOptionsHelp.h" #include "RConfigure.h" #include <ROOT/RConfig.h> @@ -4072,7 +3923,7 @@ int RootClingMain(int argc, ignoreExistingDict = true; ic++; } else if (argc > 1 && (!strcmp(argv[1], "-?") || !strcmp(argv[1], "-h"))) { - fprintf(stderr, "%s\n", rootClingHelp); + fprintf(stderr, kCommandLineOptionsHelp); return 1; } else if (ic < argc && !strncmp(argv[ic], "-", 1)) { fprintf(stderr, shortHelp, @@ -4131,7 +3982,7 @@ int RootClingMain(int argc, ic++; } else if (!strcmp(argv[1], "-?") || !strcmp(argv[1], "-h")) { - fprintf(stderr, "%s\n", rootClingHelp); + fprintf(stderr, kCommandLineOptionsHelp); return 1; } else { ic = 1; diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 32094d55bde0320614bd57210050571efa54908a..f52437f971026e348f9aaeaddb02105497c0e626 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -27,6 +27,9 @@ else() endif() ROOT_EXECUTABLE(rootnb.exe nbmain.cxx LIBRARIES Core) +#---CreateHaddCommandLineOptions------------------------------------------------------------------ +generateHeaders(${CMAKE_SOURCE_DIR}/main/src/hadd-argparse.py ${CMAKE_BINARY_DIR}/include/haddCommandLineOptionsHelp.h hadd) + if(fortran AND CMAKE_Fortran_COMPILER) ROOT_EXECUTABLE(g2root g2root.f LIBRARIES minicern) set_target_properties(g2root PROPERTIES COMPILE_FLAGS "-w") diff --git a/main/src/hadd-argparse.py b/main/src/hadd-argparse.py new file mode 100644 index 0000000000000000000000000000000000000000..f1e1be74ac3e21924265204acd22f63c32f0663e --- /dev/null +++ b/main/src/hadd-argparse.py @@ -0,0 +1,37 @@ +import argparse +import sys + +def get_argparse(): + DESCRIPTION = """This program will add histograms from a list of root files and write them to a target root file.\n +The target file is newly created and must not exist, or if -f (\"force\") is given, must not be one of the source files.\n +Supply at least two source files for this to make sense... ;-) +""" + EPILOGUE = """ +If Target and source files have different compression settings a slower method is used. +For options that takes a size as argument, a decimal number of bytes is expected. +If the number ends with a ``k'', ``m'', ``g'', etc., the number is multiplied by 1000 (1K), 1000000 (1MB), 1000000000 (1G), etc. +If this prefix is followed by i, the number is multipled by the traditional 1024 (1KiB), 1048576 (1MiB), 1073741824 (1GiB), etc. +The prefix can be optionally followed by B whose casing is ignored, eg. 1k, 1K, 1Kb and 1KB are the same. +""" + parser = argparse.ArgumentParser(add_help=False, prog='hadd', + description = DESCRIPTION, epilog = EPILOGUE) + parser.add_argument("-a", help="Append to the output") + parser.add_argument("-k", help="Skip corrupt or non-existant files, do not exit") + parser.add_argument("-T", help="Do not merge Trees") + parser.add_argument("-O", help="Re-optimize basket size when mergin TTree") + parser.add_argument("-v", help="Explicitly set the verbosity level: 0 request no output, 99 is the default") + parser.add_argument("-j", help="Parallelize the execution in multiple processes") + parser.add_argument("-dbg", help="Parallelize the execution in multiple processes in debug mode (Does not delete partial files stored inside working directory)") + parser.add_argument("-d", help="Carry out the partial multiprocess execution in the specified directory") + parser.add_argument("-n", help="Open at most 'maxopenedfiles' at once (use 0 to request to use the system maximum)") + parser.add_argument("-cachesize", help="Resize the prefetching cache use to speed up I/O operations(use 0 to disable)") + parser.add_argument("-experimental-io-features", help="Used with an argument provided, enables the corresponding experimental feature for output trees") + parser.add_argument("-f", help="Gives the ability to specify the compression level of the target file(by default 4) ") + parser.add_argument("-fk", help="""Sets the target file to contain the baskets with the same compression +as the input files (unless -O is specified). Compresses the meta data +using the compression level specified in the first input or the +compression setting after fk (for example 206 when using -fk206)""") + parser.add_argument("-ff", help="The compression level use is the one specified in the first input") + parser.add_argument("-f0", help="Do not compress the target file") + parser.add_argument("-f6", help="Use compression level 6. (See TFile::SetCompressionSettings for the support range of value.)") + return parser \ No newline at end of file diff --git a/main/src/hadd.cxx b/main/src/hadd.cxx index d94874d4685e3a3310feb47cc3c1a225db487c49..4aa5374237e738f463363b521a70a8aa8ec3cd1d 100644 --- a/main/src/hadd.cxx +++ b/main/src/hadd.cxx @@ -85,6 +85,7 @@ #include <stdlib.h> #include <climits> #include <sstream> +#include "haddCommandLineOptionsHelp.h" #include "TFileMerger.h" #ifndef R__WIN32 @@ -96,56 +97,8 @@ int main( int argc, char **argv ) { if ( argc < 3 || "-h" == std::string(argv[1]) || "--help" == std::string(argv[1]) ) { - std::cout << "Usage: " << argv[0] << " [-f[fk][0-9]] [-k] [-T] [-O] [-a] \n" - " [-n maxopenedfiles] [-cachesize size] [-j ncpus] [-v [verbosity]] \n" - " targetfile source1 [source2 source3 ...]\n" << std::endl; - std::cout << "This program will add histograms from a list of root files and write them" << std::endl; - std::cout << " to a target root file. The target file is newly created and must not" << std::endl; - std::cout << " exist, or if -f (\"force\") is given, must not be one of the source files." << std::endl; - std::cout << " Supply at least two source files for this to make sense... ;-)" << std::endl; - std::cout << "If the option -a is used, hadd will append to the output." << std::endl; - std::cout << "If the option -k is used, hadd will not exit on corrupt or non-existant input\n" - " files but skip the offending files instead." << std::endl; - std::cout << "If the option -T is used, Trees are not merged" <<std::endl; - std::cout << "If the option -O is used, when merging TTree, the basket size is re-optimized" <<std::endl; - std::cout << "If the option -v is used, explicitly set the verbosity level;\n"\ - " 0 request no output, 99 is the default" <<std::endl; - std::cout << "If the option -j is used, the execution will be parallelized in multiple processes\n" << std::endl; - std::cout << "If the option -dbg is used, the execution will be parallelized in multiple processes in debug mode." - " This will not delete the partial files stored in the working directory\n" - << std::endl; - std::cout << "If the option -d is used, the partial multiprocess execution will be carried out in the specified " - "directory\n" - << std::endl; - std::cout << "If the option -n is used, hadd will open at most 'maxopenedfiles' at once, use 0\n" - " to request to use the system maximum." << std::endl; - std::cout << "If the option -cachesize is used, hadd will resize (or disable if 0) the\n" - " prefetching cache use to speed up I/O operations." << std::endl; - std::cout << "If the option -experimental-io-features is used (and an argument provided), then\n" - " the corresponding experimental feature will be enabled for output trees." << std::endl; - std::cout << "When -the -f option is specified, one can also specify the compression level of\n" - " the target file. By default the compression level is kDefaultZLIB." - << std::endl; - std::cout << "If \"-fk\" is specified, the target file contain the baskets with the same\n" - " compression as in the input files unless -O is specified. The meta data will\n" - " be compressed using the compression level specified in the first input or the\n" - " compression setting specified follow fk (206 when using -fk206 for example)" <<std::endl; - std::cout << "If \"-ff\" is specified, the compression level use is the one specified in the\n" - " first input." <<std::endl; - std::cout << "If \"-f0\" is specified, the target file will not be compressed." <<std::endl; - std::cout << "If \"-f6\" is specified, the compression level 6 will be used. \n" - " See TFile::SetCompressionSettings for the support range of value." <<std::endl; - std::cout << "If Target and source files have different compression settings a slower method\n" - " is used.\n"<<std::endl; - std::cout << "For options that takes a size as argument, a decimal number of bytes is expected.\n" - "If the number ends with a ``k'', ``m'', ``g'', etc., the number is multiplied\n" - " by 1000 (1K), 1000000 (1MB), 1000000000 (1G), etc. \n" - "If this prefix is followed by i, the number is multipled by the traditional\n" - " 1024 (1KiB), 1048576 (1MiB), 1073741824 (1GiB), etc. \n" - "The prefix can be optionally followed by B whose casing is ignored,\n" - " eg. 1k, 1K, 1Kb and 1KB are the same."<<std::endl; - - return 1; + fprintf(stderr, kCommandLineOptionsHelp); + return 1; } ROOT::TIOFeatures features; diff --git a/man/man1/hadd.1 b/man/man1/hadd.1 deleted file mode 100644 index ccc0ae4fcf79f8a46627530eb40e1c001100040b..0000000000000000000000000000000000000000 --- a/man/man1/hadd.1 +++ /dev/null @@ -1,78 +0,0 @@ -.\" -.\" $Id: hadd.1,v 1.1 2002/07/31 20:44:26 rdm Exp $ -.\" -.TH HADD 1 "Version 3" "ROOT" -.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection -.\" other parms are allowed: see man(7), man(1) -.SH NAME -hadd \- Merge ROOT histogram files into one file -.SH SYNOPSIS -.B hadd -.I "outputfile inputfiles ..." -.SH "DESCRIPTION" -This program will add histograms from a list of -.B ROOT -files and write them to a target -.B ROOT -file. The target file is newly created and must not be identical to -one of the source files. -.SH "SEE ALSO" -.SB -\fIroot\fR(1) -.PP -.\" .SE -For extensive documentation on the \fBROOT\fR system, see -.UR http://root.cern.ch -\fIhttp://root.cern.ch\fR -.UE -.PP -A \fBUsers Guide\fR is available from -.UR https://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html -here. -.UE -.PP -The classes of ROOT are all documented by the automatic documentation -system, and is available -.UR https://root.cern/doc/master/annotated.html -online. -.UE -.SH "ORIGINAL AUTHORS" - Sven A. Schmidt -.UR sven.schmidt@cern.ch -\fIsven.schmidt@cern.ch\fR, Dirk Geppert, and Rene Brun -.UR Rene.Brun@cern.ch -\fIRene.Brun@cern.ch\fR -.SH "COPYRIGHT" -This library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 of the -License, or (at your option) any later version. -.P -This library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. -.P -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -.SH AUTHOR -This manual page was written by Christian Holm Christensen -<cholm@nbi.dk>, for the Debian GNU/Linux system (but may be used by -others). -.\" -.\" $Log: hadd.1,v $ -.\" Revision 1.1 2002/07/31 20:44:26 rdm -.\" new Debian and RedHat package scripts. By Christian Holm. -.\" -.\" Revision 1.1 2001/08/15 13:30:48 rdm -.\" move man files to new subdir man1. This makes it possible to add -.\" $ROOTSYS/man to MANPATH and have "man root" work. -.\" -.\" Revision 1.2 2001/04/23 09:10:12 rdm -.\" updates by Christian Holm for making debian and RedHat packages. -.\" -.\" Revision 1.1 2000/12/08 17:41:01 rdm -.\" man pages of all ROOT executables provided by Christian Holm. -.\" -.\" diff --git a/man/man1/hist2workspace.1 b/man/man1/hist2workspace.1 deleted file mode 100644 index f4733eeb9d8af9542517dd094d294bf5e0ed7dde..0000000000000000000000000000000000000000 --- a/man/man1/hist2workspace.1 +++ /dev/null @@ -1,108 +0,0 @@ -.\" Hey, EMACS: -*- nroff -*- -.\" First parameter, NAME, should be all caps -.\" Second parameter, 1, should be 1-8, maybe w/ subsection -.\" other parameters are allowed: see man(7), man(1) -.TH HISTTOWORKSPACE 1 "DEC. 2010" -.\" Please adjust this date whenever revising the manpage. -.\" -.\" Some roff macros, for reference: -.\" .nh disable hyphenation -.\" .hy enable hyphenation -.\" .ad l left justify -.\" .ad b justify to both left and right margins -.\" .nf disable filling -.\" .fi enable filling -.\" .br insert line break -.\" .sp <n> insert n+1 empty lines -.\" for manpage-specific macros, see man(7) -.SH NAME -hist2workspace \- utility to create RooFit/RooStats workspace from histograms -.SH SYNOPSIS -.B hist2workspace [option] input.xml -.SH DESCRIPTION -.B hist2workspace -is a utility to create RooFit/RooStats workspace from histograms -.SH OPTIONS -.B -standard_form -default model, which creates an extended PDF that interpolates between RooHistFuncs. This is much faster for models with many bins and uses significantly less memory. -.br -.B -number_counting_form -this was the original model in 5.28 (without patches). It uses a Poisson for each bin of the histogram. This can become slow and memory intensive when there are many bins. -.br -.br -.SH Prepare working area -The ROOT release ships with a script -.B prepareHistFactory -in the $ROOTSYS/bin directory that prepares a working area. -It creates a results/, data/, and config/ directory. -It also copies the HistFactorySchema.dtd and example XML files into -the config/ directory. Additionally, it copies a root file into the data/ -directory for use with the examples. -.br -.SH HistFactorySchema.dtd -This file is located in $ROOTSYS/etc/ specifies the XML schema. -It is typically placed in the config/ directory of a working area -together with the top-level XML file and the individual channel XML files. -The user should not modify this file. -.br -The HistFactorySchema.dtd is commented to specify exactly the meaning of -the various options. - - -.SH Top-Level XML File -(see for example $ROOTSYS/tutorials/histfactory/example.xml) -This file is edited by the user. It specifies - - A top level 'Combination' that is composed of: - - several 'Channels', which are described in separate XML files. - - several 'Measurements' (corresponding to a full fit of the model) each of which specifies - - a name for this measurement to be used in tables and files - - what is the luminosity associated to the measurement in picobarns - - which bins of the histogram should be used - - what is the relative uncertainty on the luminosity - - what is (are) the parameter(s) of interest that will be measured - - which parameters should be fixed/floating (eg. nuisance parameters) - - which type of constraints are desired - - Gaussian by default - - Gamma, LogNormal, and Uniform are also supported - - if the tool should export the model only and skip the default fit - -.br -.SH Channel XML Files -(see for example $ROOTSYS/tutorials/histfactory/example_channel.xml) -This file is edited by the user. It specifies for each channel - - observed data - - if absent the tool will use the expectation, which is useful for expected sensitivity - - several 'Samples' (eg. signal, bkg1, bkg2, ...), each of which has: - - a name - - if the sample is normalized by theory (eg N = L*sigma) or not (eg. data driven) - - a nominal expectation histogram - - a named 'Normalization Factor' (which can be fixed or allowed to float in a fit) - - several 'Overall Systematics' in normalization with: - - a name - - +/- 1 sigma variations (eg. 1.05 and 0.95 for a 5% uncertainty) - - several 'Histogram Systematics' in shape with: - - a name (which can be shared with the OverallSyst if correlated) - - +/- 1 sigma variational histograms -.SH "ORIGINAL AUTHORS" -.RS -.B Kyle Cranmer -, -.B Akira Shibata -, and -.B Dominique Tardif -.RE -.SH "COPYRIGHT" -This library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 of the -License, or (at your option) any later version. -.P -This library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. -.P -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - diff --git a/man/man1/root.1 b/man/man1/root.1 deleted file mode 100644 index c5d6938a3d07a698a363c6ec62309dade3ae453a..0000000000000000000000000000000000000000 --- a/man/man1/root.1 +++ /dev/null @@ -1,163 +0,0 @@ -.\" -.\" $Id: root.1,v 1.1 2001/08/15 13:30:48 rdm Exp $ -.\" -.TH ROOT 1 "Version 6" "ROOT" -.\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection -.\" other parms are allowed: see man(7), man(1) -.SH NAME -root \- Interpreter of C++ for the ROOT framework -.SH SYNOPSIS -.SY root -.OP options -.OP -e 'expression' -.RI [ datafile\~ .\|.\|.] -.RI [ macrofile\~ .\|.\|.] -.SY root -.RI macrofile.C -.SY root -.RI macrofile.C(arguments\~.\|.\|.) -.SY root -.RI macrofile.C(\\\(dqstring\~arguments\\\(dq) -.SY root -.RI macrofile.C+ -.SY root -.RI macrofile.C++ -.SY root -.RI macrofile.C+g -.SY root -.RI macrofile.C+O -.YS -.SH "DESCRIPTION" -\fBR\fROOTs \fBO\fRbject-\fBO\fRriented \fBT\fRechnologies. -.PP -.B root -is an interactive interpreter of C++ code. It uses the -.B ROOT -framework. For more information on -.BR ROOT , -please refer to -.UR http://root.cern.ch -.UE . -.PP -An extensive \fIUsers Guide\fR is available from that site (see below). -.SH OPTIONS -.B \-?, -h, --help -Show summary of options. -.TP -.B -b -Run in batch mode without graphics -.TP -.B -e -Execute the command passed between single quotes -.TP -.B -n -Do not execute logon and logoff macros as specified in -.B .rootrc -.TP -.B --notebook -execute ROOT notebook -.TP -.B -t -enable thread-safety and implicit multi-threading (IMT) -.TP -.B -q -Exit after processing command line macro files -.TP -.B -l -Do not show splash screen -.PP -\fIData files\fR are opened and accessible in root as \fI_file0\fR, \fI_file1\fR ... -.PP -\fIMacro files\fR are either intrepreted (filename provided alone) or compiled (with + added to the filename). -Afterwards the function with the same name as the filename (without extension) in the macro file is executed (eg. \fIvoid macro()\fR in a file \fImacro.C\fR). -.PP -Compilation is done on-demand if the macro is newer than a previously generated shared library. Two plus signs (macro.C++) force a recompilation. Adding \fIO\fR after a plus results in an optimised build, adding \fIg\fR adds debug symbols (eg. \fImacro.C+Og\fR). -.PP -Macro files, data files and \fI-e\fR expressions are processed in the order in which they are provided. If a macro relies on the presence of \fI_file0\fR, then root should be called with \fIroot data.root macro.C\fR. -.SH "SEE ALSO" -.SB -\fIrootcling\fR(1), \fIcling\fR(1), \fIroot-config\fR(1), -\fIrootd\fR(1), \fIh2root\fR(1), \fIg2root\fR(1) -.PP -For extensive documentation on the \fBROOT\fR system, see -.UR http://root.cern.ch -.UE . -.PP -A \fBUsers Guide\fR is available at -.UR http://root.cern.ch/root/htmldoc/guides/users-guide/ROOTUsersGuide.html -.UE . -.PP -The classes of ROOT are all documented by the automatic documentation -system, and is available at -.UR https://root.cern/doc/master/annotated.html -.UE . -.PP -Questions and support are provided in -.UR https://root-forum.cern.ch/ -the root forum -.UE , -bugs can be reported -.UR https://sft.its.cern.ch/jira/projects/ROOT/issues -on jira -.UE -and pull requests can be submitted -.UR https://github.com/root-project/root -on github -.UE . -.SH FILES -.TP -<\fIetcdir\fR>/\fBsystem.rootrc\fR -System-wide configuration file. <\fIetcdir\fR> either $ROOTSYS, or -something like \fB/etc/root\fR -.TP -<\fIlibdir\fR>/*\fR -.B ROOT -C++ class libraries. <\fIlibdir\fR> is either $ROOTSYS/lib or something -like \fB/usr/lib/root\fR. -.TP -<\fIincdir\fR>/*\fR -The header files for the -.B ROOT -C++ class libraries. <\fIincdir\fR> is either $ROOTSYS/include or -something like \fB/usr/include/root\fR. -.TP -\fB~/.rootrc\fR, \fB./.rootrc\fR -User configuration file -.SH "ORIGINAL AUTHORS" -The ROOT team (see web page above): -.RS -.B Rene Brun -and -.B Fons Rademakers -.RE -.SH "COPYRIGHT" -This library is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 of the -License, or (at your option) any later version. -.P -This library is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. -.P -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -.SH AUTHOR -This manual page was written by Christian Holm Christensen -<cholm@nbi.dk>, for the Debian GNU/Linux system (but may be used by -others). -.\" -.\" $Log: root.1,v $ -.\" Revision 1.1 2001/08/15 13:30:48 rdm -.\" move man files to new subdir man1. This makes it possible to add -.\" $ROOTSYS/man to MANPATH and have "man root" work. -.\" -.\" Revision 1.2 2001/04/23 09:10:12 rdm -.\" updates by Christian Holm for making debian and RedHat packages. -.\" -.\" Revision 1.1 2000/12/08 17:41:01 rdm -.\" man pages of all ROOT executables provided by Christian Holm. -.\" -.\" diff --git a/roofit/histfactory/CMakeLists.txt b/roofit/histfactory/CMakeLists.txt index 4c30179016978b0712bb2ee0fde6b1cb0ec5facc..232463525fcb9c074261e03c05b855f57a216a7a 100644 --- a/roofit/histfactory/CMakeLists.txt +++ b/roofit/histfactory/CMakeLists.txt @@ -82,6 +82,9 @@ ROOT_EXECUTABLE(hist2workspace MakeModelAndMeasurements.cxx hist2workspace.cxx Minuit Foam RooStats XMLParser BUILTINS GSL) +#---Createhist2workspaceCommandLineOptions------------------------------------------------------------------ +generateHeaders(${CMAKE_CURRENT_SOURCE_DIR}/src/hist2workspace-argparse.py ${CMAKE_BINARY_DIR}/include/hist2workspaceCommandLineOptionsHelp.h hist2workspace) + file(COPY config/prepareHistFactory DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/prepareHistFactory PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ diff --git a/roofit/histfactory/src/hist2workspace-argparse.py b/roofit/histfactory/src/hist2workspace-argparse.py new file mode 100644 index 0000000000000000000000000000000000000000..6f4a77d0130b1c55977e826a7d33b279c24918e9 --- /dev/null +++ b/roofit/histfactory/src/hist2workspace-argparse.py @@ -0,0 +1,14 @@ +import argparse + +def get_argparse(): + DESCRIPTION = """hist2workspace is a utility to create RooFit/RooStats workspace from histograms +""" + parser = argparse.ArgumentParser(prog='hist2workspace', + description = DESCRIPTION) + parser.add_argument("-standard_form", help="""default model, which creates an extended PDF that interpolates between RooHistFuncs +This is much faster for models with many bins and uses significantly less memory""") + parser.add_argument("-number_counting_form", help="""This was the original model in 5.28 (without patches). It uses a Poisson for each +bin of the his togram. This can become slow and memory intensive when there are many bins. +""") + return parser + \ No newline at end of file diff --git a/roofit/histfactory/src/hist2workspace.cxx b/roofit/histfactory/src/hist2workspace.cxx index 4ea8dbbab77802a7f9d7c9b773b5df9fce932d85..b4e5146eaef04e943917706df6bfbbe69d8ed637 100644 --- a/roofit/histfactory/src/hist2workspace.cxx +++ b/roofit/histfactory/src/hist2workspace.cxx @@ -22,6 +22,7 @@ //#include "RooStats/HistFactory/MakeModelAndMeasurements.h" #include "RooStats/HistFactory/ConfigParser.h" #include "RooStats/HistFactory/MakeModelAndMeasurementsFast.h" +#include "hist2workspaceCommandLineOptionsHelp.h" //_____________________________batch only_____________________ #ifndef __CINT__ @@ -67,19 +68,25 @@ int main(int argc, char** argv) { if(argc==2){ std::string input(argv[1]); - try { - RooStats::HistFactory::fastDriver(input); - } - catch(const std::string &str) { - std::cerr << "hist2workspace - Caught exception: " << str << std::endl ; - exit(1); - } - catch( const std::exception& e ) { - std::cerr << "hist2workspace - Caught Exception: " << e.what() << std::endl; - exit(1); - } - catch(...) { - exit(1); + if ( input == "-h" || input == "--help"){ + fprintf(stderr, kCommandLineOptionsHelp); + return 0; + } + else{ + try { + RooStats::HistFactory::fastDriver(input); + } + catch(const std::string &str) { + std::cerr << "hist2workspace - Caught exception: " << str << std::endl ; + exit(1); + } + catch( const std::exception& e ) { + std::cerr << "hist2workspace - Caught Exception: " << e.what() << std::endl; + exit(1); + } + catch(...) { + exit(1); + } } } diff --git a/rootx/CMakeLists.txt b/rootx/CMakeLists.txt index e71058655ee5de05eaf071939e1c04aab9aa4a03..3469d8812921d2dff6b74568c3ee576b93bd94bb 100644 --- a/rootx/CMakeLists.txt +++ b/rootx/CMakeLists.txt @@ -8,6 +8,10 @@ if(x11) # FIXME: Why are we adding the x11 independent rootx.cxx file? ROOT_EXECUTABLE(root *.cxx ${CMAKE_SOURCE_DIR}/core/clib/src/strlcpy.c LIBRARIES ${X11_LIBRARIES} ${X11_Xpm_LIB} ${X11_Xft_LIB} ${X11_Xext_LIB}) + + #---CreateRootCommandLineOptions------------------------------------------------------------------ + generateHeaders(${CMAKE_SOURCE_DIR}/core/base/src/root-argparse.py + ${CMAKE_BINARY_DIR}/include/rootCommandLineOptionsHelp.h root) elseif(cocoa) if (cxxmodules) @@ -27,5 +31,8 @@ elseif(cocoa) # that the compiler will recognise the extension mm and switch to the correct # language mode. ROOT_EXECUTABLE(root rootx.cxx rootxx-cocoa.mm LIBRARIES "-framework Cocoa") + #---CreateRootCommandLineOptions------------------------------------------------------------------ + generateHeaders(${CMAKE_SOURCE_DIR}/core/base/src/root-argparse.py + ${CMAKE_BINARY_DIR}/include/rootCommandLineOptionsHelp.h root) endif() diff --git a/rootx/src/rootx.cxx b/rootx/src/rootx.cxx index 889f78cb19e7572047263bc988e4814b37a58094..c4787557ac8aee66b1db1dc8117e199dc42c67c0 100644 --- a/rootx/src/rootx.cxx +++ b/rootx/src/rootx.cxx @@ -18,7 +18,7 @@ #include "RConfigure.h" #include "Rtypes.h" -#include "CommandLineOptionsHelp.h" +#include "rootCommandLineOptionsHelp.h" #include <stdio.h> #include <stdlib.h> @@ -436,9 +436,9 @@ static void WaitChild() #endif -static void PrintUsage(char *pname) +static void PrintUsage() { - fprintf(stderr, kCommandLineOptionsHelp, pname); + fprintf(stderr, kCommandLineOptionsHelp); } int main(int argc, char **argv) @@ -469,7 +469,7 @@ int main(int argc, char **argv) for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-?") || !strncmp(argv[i], "-h", 2) || !strncmp(argv[i], "--help", 6)) { - PrintUsage(argv[0]); + PrintUsage(); return 1; } if (!strcmp(argv[i], "-b")) batch = true;