36 {
37
38
40
41
42 if( ( argc < 3 ) ||
43 ( ! strcmp( argv[ 1 ], "-h" ) ) ||
44 ( ! strcmp( argv[ 1 ], "--help" ) ) ) {
46 ::Info(
APP_NAME,
"Usage: %s [options] outputFile inputFile1 "
47 "[inputFile2 ...]",
51 ::Info(
APP_NAME,
" -s Use slow xAOD tree merging" );
52 ::Info(
APP_NAME,
" -b Use branch-access for slow and metadata "
53 "merging" );
54 ::Info(
APP_NAME,
" -v NUMBER Use a specific verbosity setting" );
55 ::Info(
APP_NAME,
" -m Metadata tool type to use during the merge" );
56 ::Info(
APP_NAME,
" -e NUMBER Number of events to merge in slow "
57 "merging mode" );
59 return 1;
60 }
61
62
64
65
66 bool useSlowMerge = false;
69 std::vector< const char* > inputNames;
71 std::vector< const char* > metaDataTools;
73 for(
int i = 1;
i <
argc; ++
i ) {
74 if( ! strcmp( argv[ i ], "-s" ) ) {
75 useSlowMerge = true;
76 } else if( ! strcmp( argv[ i ], "-b" ) ) {
78 } else if( ! strcmp( argv[ i ], "-v" ) ) {
79 if( i + 1 >= argc ) {
80 ::Error(
APP_NAME,
"No verbosity level was provided after -v" );
81 } else {
82 const long request = strtol( argv[ i + 1 ], 0, 10 );
83 if( ( request < kMaxLong ) && ( request >= 0 ) ) {
84 verbosity =
static_cast< int >( request );
86 } else {
87 ::Error(
APP_NAME,
"Could not parse the verbosity level passed "
88 "after -v: %s", argv[ i + 1 ] );
89 ::Error(
APP_NAME,
"Will use the default value (0)" );
90 }
91 }
92 } else if( ! strcmp( argv[ i ], "-m" ) ) {
93 if( i + 1 >= argc ) {
94 ::Error(
APP_NAME,
"No tool type name provided after -m" );
95 } else {
96 metaDataTools.push_back( argv[ i + 1 ] );
98 }
99 } else if( ! strcmp( argv[ i ], "-e" ) ) {
100 if( i + 1 >= argc ) {
101 ::Error(
APP_NAME,
"No verbosity level was provided after -e" );
102 } else {
103 const long request = strtol( argv[ i + 1 ], 0, 10 );
104 if( ( request < kMaxLong ) && ( request >= 0 ) ) {
105 entries =
static_cast< ::Long64_t
>( request );
107 } else {
108 ::Error(
APP_NAME,
"Could not parse the number of entries "
109 "passed after -e: %s", argv[ i + 1 ] );
110 ::Error(
APP_NAME,
"Will use the default value (%i)",
112 }
113 }
114 } else if( ! outputName ) {
116 } else {
117 inputNames.push_back( argv[ i ] );
118 }
119 }
120
121 if( ! outputName ) {
122 ::Error(
APP_NAME,
"No output name provided." );
123 return 1;
124 }
125
126
131 for( auto name : inputNames ) {
133 }
134 for( auto typeName : metaDataTools ) {
136 }
137
138
141
142 return 0;
143}
EAuxMode
Auxiliary store "mode".
@ kClassAccess
Access auxiliary data using the aux containers.
@ kBranchAccess
Access auxiliary data branch-by-branch.
Helper class for merging xAOD files.
StatusCode merge(EMergeMode mode=kFastMerge, ::Long64_t entries=kBigNumber)
Execute the file merge itself.
void setAccessMode(TEvent::EAuxMode mode)
Set the access mode used for slow and metadata merging.
StatusCode setOutputFileName(const std::string &name, const std::string &mode="RECREATE")
Set the name of the output file that should be created.
StatusCode addMetaDataTool(const std::string &typeName)
Add a metadata tool to be used during the merging.
static const ::Long64_t kBigNumber
Number of entries that are assumed to be never exceeded in a file.
void setVerbosity(int value)
Set verbosity level (meant for debugging mainly)
@ kSlowMerge
Merging is done using TEvent.
@ kFastMerge
Merging is done using fast TTree merge.
StatusCode addFile(const std::string &name, bool copyLocally=false)
Add a file to the list to be merged, by name.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
#define R_CHECK(EXP)
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.