Project

General

Profile

Removing Objects from Art Files

It is possible to delete already existing objects from a root file. As seen above in the eventdump output, every object has four specifiers: object_type, instance_name, module_name and process_name. Objects can be deleted by specifying a combination of these specifiers. This can be done by including the following code in the outputs section of the job.fcl file:

outputs:
{
  # Don't specify a fileName. Require user to specify output file explicitly
  out:
  {
    module_type:    RootOutput
    filename:       trimmed_file.root
    outputCommands: [ "keep *",
                      "drop ObjectType_ModuleLabel_InstanceName_ProcessName"]
  }
}

keep * means keep all objects in the file. drop specifies which objects should be deleted from the file. Wildcards may also be used to delete a set of objects having a common type, or module_name or process_name. For example, including "drop *_KalmanTrack" deletes all objects created by KalmanTrack.

Note that these objects do leave a footprint. When eventdump.fcl job is run over a trimmed file, the size of the deleted object shows up as a "?". For the above example, where KalmanTrack objects have been removed, eventdump output looks like follows:

KalmanTrack........ | kalmantrackmerge | ..................... | std::vector<rb::Track>.......................... | ...?