76
76
\param -v [LEVEL] Explicitly set the verbosity level:
77
77
<= 0 = only output errors;
78
78
1 = only output errors and warnings;
79
- 2 = output minimal informative messages, errors and warnings;
80
- >= 3 = output all messages (default) .
79
+ 2 = output minimal informative messages, errors and warnings (default) ;
80
+ >= 3 = output all messages.
81
81
\return hadd returns a status code: 0 if OK, 1 otherwise
82
82
83
83
For example assume 3 files f1, f2, f3 containing histograms hn and Trees Tn
168
168
169
169
// //////////////////////////////////////////////////////////////////////////////
170
170
171
- // NOTE: TFileMerger will use PrintLevel = gVerbosity - 1. If PrintLevel is < 1, it will print nothing, otherwise
171
+ // NOTE: TFileMerger will use PrintLevel = gHaddVerbosity - 1. If PrintLevel is < 1, it will print nothing, otherwise
172
172
// it will print everything. To give some granularity to hadd, we do the following:
173
- // gVerbosity = 0: only print hadd errors
174
- // gVerbosity = 1: only print hadd errors + warnings
175
- // gVerbosity = 2: print hadd errors + warnings and TFileMerger messages
176
- // gVerbosity > 2: print all hadd and TFileMerger messages.
177
- static int gVerbosity = 99 ;
173
+ // gHaddVerbosity = 0: only print hadd errors
174
+ // gHaddVerbosity = 1: only print hadd errors + warnings
175
+ // gHaddVerbosity = 2: print hadd errors + warnings and TFileMerger messages
176
+ // gHaddVerbosity > 2: print all hadd and TFileMerger messages.
177
+ static int gHaddVerbosity = 2 ;
178
178
179
179
namespace {
180
180
@@ -206,14 +206,14 @@ static inline std::ostream &Err()
206
206
207
207
static inline std::ostream &Warn ()
208
208
{
209
- std::ostream &s = gVerbosity < 1 ? GetNullStream () : std::cerr;
209
+ std::ostream &s = gHaddVerbosity < 1 ? GetNullStream () : std::cerr;
210
210
s << " Warning in <hadd>: " ;
211
211
return s;
212
212
}
213
213
214
- static inline std::ostream &Info ()
214
+ static inline std::ostream &Info (int minLevel )
215
215
{
216
- std::ostream &s = gVerbosity < 3 ? GetNullStream () : std::cerr;
216
+ std::ostream &s = gHaddVerbosity < minLevel ? GetNullStream () : std::cerr;
217
217
s << " Info in <hadd>: " ;
218
218
return s;
219
219
}
@@ -636,7 +636,7 @@ static Int_t ParseFilterFile(const std::optional<std::string> &filterFileName,
636
636
}
637
637
638
638
if (nObjects) {
639
- Info () << " added " << nObjects << " object from filter file '" << *filterFileName << " '\n " ;
639
+ Info (2 ) << " added " << nObjects << " object from filter file '" << *filterFileName << " '\n " ;
640
640
fileMerger.AddObjectNames (filteredObjects);
641
641
} else {
642
642
Warn () << " no objects were added from filter file '" << *filterFileName << " '\n " ;
@@ -664,7 +664,7 @@ int main(int argc, char **argv)
664
664
665
665
ROOT::TIOFeatures features = args.fFeatures .value_or (ROOT::TIOFeatures{});
666
666
Int_t maxopenedfiles = args.fMaxOpenedFiles .value_or (0 );
667
- gVerbosity = args.fVerbosity .value_or (99 );
667
+ gHaddVerbosity = args.fVerbosity .value_or (99 );
668
668
Int_t newcomp = args.fCompressionSettings .value_or (-1 );
669
669
TString cacheSize = args.fCacheSize .value_or (" " );
670
670
@@ -682,7 +682,7 @@ int main(int argc, char **argv)
682
682
nProcesses = s.fCpus ;
683
683
}
684
684
if (multiproc)
685
- Info () << " parallelizing with " << nProcesses << " processes.\n " ;
685
+ Info (3 ) << " parallelizing with " << nProcesses << " processes.\n " ;
686
686
687
687
// If the user specified a workingDir, use that. Otherwise, default to the system temp dir.
688
688
std::string workingDir;
@@ -712,18 +712,18 @@ int main(int argc, char **argv)
712
712
}
713
713
targetname = argv[args.fOutputArgIdx ];
714
714
715
- Info () << " target file: " << targetname << " \n " ;
715
+ Info (2 ) << " target file: " << targetname << " \n " ;
716
716
717
717
if (args.fCacheSize )
718
- Info () << " Using " << cacheSize << " \n " ;
718
+ Info (3 ) << " Using " << cacheSize << " \n " ;
719
719
720
720
// //////////////////////////// end flags processing /////////////////////////////////
721
721
722
722
gSystem ->Load (" libTreePlayer" );
723
723
724
724
TFileMerger fileMerger (kFALSE , kFALSE );
725
725
fileMerger.SetMsgPrefix (" hadd" );
726
- fileMerger.SetPrintLevel (gVerbosity - 1 );
726
+ fileMerger.SetPrintLevel (gHaddVerbosity - 1 );
727
727
if (maxopenedfiles > 0 ) {
728
728
fileMerger.SetMaxOpenedFiles (maxopenedfiles);
729
729
}
@@ -796,9 +796,9 @@ int main(int argc, char **argv)
796
796
}
797
797
}
798
798
if (args.fKeepCompressionAsIs && !args.fReoptimize )
799
- Info () << " compression setting for meta data: " << newcomp << ' \n ' ;
799
+ Info (2 ) << " compression setting for meta data: " << newcomp << ' \n ' ;
800
800
else
801
- Info () << " compression setting for all output: " << newcomp << ' \n ' ;
801
+ Info (2 ) << " compression setting for all output: " << newcomp << ' \n ' ;
802
802
803
803
if (args.fAppend ) {
804
804
if (!fileMerger.OutputFile (targetname, " UPDATE" , newcomp)) {
@@ -819,9 +819,9 @@ int main(int argc, char **argv)
819
819
// At least 3 files per process
820
820
step = 3 ;
821
821
nProcesses = (allSubfiles.size () + step - 1 ) / step;
822
- Info () << " each process should handle at least 3 files for efficiency."
823
- " Setting the number of processes to: "
824
- << nProcesses << std::endl;
822
+ Info (2 ) << " each process should handle at least 3 files for efficiency."
823
+ " Setting the number of processes to: "
824
+ << nProcesses << std::endl;
825
825
}
826
826
if (nProcesses == 1 )
827
827
multiproc = kFALSE ;
@@ -888,7 +888,7 @@ int main(int argc, char **argv)
888
888
auto parallelMerge = [&](int start) {
889
889
TFileMerger mergerP (kFALSE , kFALSE );
890
890
mergerP.SetMsgPrefix (" hadd" );
891
- mergerP.SetPrintLevel (gVerbosity - 1 );
891
+ mergerP.SetPrintLevel (gHaddVerbosity - 1 );
892
892
if (maxopenedfiles > 0 ) {
893
893
mergerP.SetMaxOpenedFiles (maxopenedfiles / nProcesses);
894
894
}
@@ -931,8 +931,8 @@ int main(int argc, char **argv)
931
931
#endif
932
932
933
933
if (status) {
934
- Info () << " merged " << allSubfiles.size () << " (" << fileMerger.GetMergeList ()->GetEntries ()
935
- << " ) input (partial) files into " << targetname << " \n " ;
934
+ Info (3 ) << " merged " << allSubfiles.size () << " (" << fileMerger.GetMergeList ()->GetEntries ()
935
+ << " ) input (partial) files into " << targetname << " \n " ;
936
936
return 0 ;
937
937
} else {
938
938
Err () << " failure during the merge of " << allSubfiles.size () << " (" << fileMerger.GetMergeList ()->GetEntries ()
0 commit comments