I have a question: How can I add an array to an element of a tuple column in Geant4.
I have several value, and I want to put them into a array.
total[0]=fEnergyAbs;
total[1]=fEnergyGap;
analysisManager->FillNtupleDColumn(4, total);
But I meet a error:
B4a/src/B4aEventAction.cc:92:46: error: no matching function for call to ‘G4RootAnalysisManager :: FillNtupleDColumn(int, double [2]).
analysisManager->FillNtupleDColumn(4, total);
The array can’t be stored in a tuple?
Can you tell me ?
Thanks.
Hello,
Yes, the array can’t be stored in a ntuple. But you can use std::vector instead which is supported.
Please, look at the relevant section in the Application Developer Guide.
Best regards,
I saw the relevant sections given in the reply and was able to create a column of type std::vector. But I still can’t fill them and I can’t find any reference regarding it in the Application Developer Guide. Can you please also point out on how to fill an std::vector type ntuple using G4root?
An example of an ntuple with std::vector ntuple columns types is provided at the basic B5 example.
See: http://geant4-userdoc.web.cern.ch/geant4-userdoc/Doxygen/examples_doc/html/ExampleB5.html
and the ANALYSIS section.
There is indeed missing mentioning this example in the Application Developers Guide.
As the ntuple column takes the std::vector reference, there is no need to call an extra Fill method to fill a column, and the vector content is automatically saved in the ntuple when calling AddNtupleRow.