RootWriterSvc supplement

The package ntupleWriterSvc, defines a Service interface INtupleWriterSvc. This interface is implemented by two concrete services:

A new function was added to the interface when RootTupleSvc was added:

 virtual StatusCode addItem(const std::string & tupleName, const std::string& itemName, const double* pval);

This overloads a function with the same name, but with the important difference that the last argument is a pointer  to a double, and is expected to be called only once, during initialization. This simplifies usage, especially since it is not required that every event is added to the tuple. Note that RootTupleSvc does not implement the old style, returning ERROR in that case.

The RootTupleSvc implementation has some important features:

  1. The default for adding a row to the tuple is that it must be requested.
  2. The first argument in addItem is interpreted as the name of a TTree, which will be created if the TTree does not exist. Thus, the ROOT file can have any number of TTree's.
  3. There is access to the ROOT AutoSave  functionality.
  4. It is possible to selectively add rows, with a new interface function
     
    virtual bool storeRowFlag(const std::string& tupleName, bool flag);

The properties are listed in the following table:

Name Description Default
filename  The ROOT filename "RootTupleSvc.root"
treename  Default tree name to use if the "tupleName" argument is empty "1"
title  Title for all TTree's "Glast tuple"
defaultStoreFlag Store the row at the end of an event loop cycle. If false, client must execute storeRowFlag(true) to save all trres in  the current event. Or, the client can execute storeRowFlag(treename, true) to save the specific tree. false
AutoSave Number of bytes to save at a time (ROOT default is 10000000) 100000

Note that compared with nTupleWriterSvc, there is one drawback: since entries are not processed when a row is saved, there is no check for NAN values.