@@ -120,18 +120,23 @@ const std::shared_ptr<IAlgorithm> FileLoaderRegistryImpl::chooseLoader(const std
120
120
IAlgorithm_sptr bestLoader;
121
121
122
122
if (H5::H5File::isHdf5 (filename)) {
123
- std::pair<IAlgorithm_sptr, int > HDF5result =
123
+ std::pair<IAlgorithm_sptr, int > NexusResult =
124
124
searchForLoader<NexusDescriptor, IFileLoader<NexusDescriptor>>(filename, m_names[Nexus], m_log);
125
125
126
- // must also try NexusDescriptor algorithms because LoadMuonNexus can load both HDF4 and HDF5 files
127
- std::pair<IAlgorithm_sptr, int > HDF4result =
128
- searchForLoader<LegacyNexusDescriptor, IFileLoader<LegacyNexusDescriptor>>(filename, m_names[LegacyNexus],
129
- m_log);
130
-
131
- if (HDF5result.second > HDF4result.second )
132
- bestLoader = HDF5result.first ;
133
- else
134
- bestLoader = HDF4result.first ;
126
+ if (NexusResult.second < 80 ) {
127
+ // must also try LegacyNexusDescriptor algorithms because LoadMuonNexus can load both HDF4 and HDF5 files
128
+ // but only need to do this if confidence is less than 80, i.e. not loaded by LoadEventNexus, LoadNexusProcessed,
129
+ // LoadMuonNexusV2 or LoadMD
130
+ std::pair<IAlgorithm_sptr, int > LegacyNexusResult =
131
+ searchForLoader<LegacyNexusDescriptor, IFileLoader<LegacyNexusDescriptor>>(filename, m_names[LegacyNexus],
132
+ m_log);
133
+
134
+ if (NexusResult.second > LegacyNexusResult.second )
135
+ bestLoader = NexusResult.first ;
136
+ else
137
+ bestLoader = LegacyNexusResult.first ;
138
+ } else
139
+ bestLoader = NexusResult.first ;
135
140
} else {
136
141
try {
137
142
bestLoader = searchForLoader<LegacyNexusDescriptor, IFileLoader<LegacyNexusDescriptor>>(
0 commit comments