Problem 1579 - If Ntuple name is empty AIDA/XML output file is corrupted
Summary: If Ntuple name is empty AIDA/XML output file is corrupted
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: analysis (show other problems)
Version: 10.0
Hardware: All All
: P5 minor
Assignee: Ivana.Hrivnacova
URL:
Depends on:
Blocks:
 
Reported: 2014-02-28 19:28 CET by Andrea Dotti
Modified: 2014-04-16 16:12 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Andrea Dotti 2014-02-28 19:28:40 CET
Hello,
this is a minor issue, actually caused by a mis-use of an API. However a protection could be added to analysis module to prevent this. 

The problem is that if user uses an empty string "" for n-tuple name and selects XML format, the output file is corrupted (truncated).
I think that an exception could be thrown just to inform user in such a case.

Here is a way to reproduce the problem:

#include "g4xml.hh"

{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName("BlaBla");
analysisManager->CreateNtuple("", "Hits"); //<<<<<<<<<< Bug!
[...]
}
Comment 1 Ivana.Hrivnacova 2014-03-15 21:30:22 CET
n co
Comment 2 Ivana.Hrivnacova 2014-03-15 21:32:22 CET
Hello,

Thank you for reporting this problem.
We will add a protection against such situation and make it available with the next patch.

Best regards,
Comment 3 Ivana.Hrivnacova 2014-04-16 16:11:49 CEST
The problem is now fixed in the development version and the fix is also provided for the next patch release. Creating objects (h1d, h2d  or ntuple) with empty names is not allowed, a warning will be issued and the object is not created in such case.

Best regards,