Fermilab


Go to top,

FrameWork: IoModules

Purpose

The input and output job modules are used to manage the flow of of data to and from file.

Input Module Description

In addition to the input module configuration parameters listed in the report above, there are several commands that can be used to control the input module. These are:
j.Input.Next(n) // Advance n records in the stream (default is 1). 
j.Input.Prev(n) // Go back n records in the stream (default is 1). 
j.Input.GoTo(run,event) // Go to specified run event number. 
j.Input.List() // List all files atteched to the input module 
j.Input.AddFile("filename") // Add a file to the list 
j.Input.RemoveFile("filename") // Remove a file from the list 
j.Input.NextFile(n) // Advance n files in the list (default is 1) 
j.Input.PrevFile(n) // Go back n files in list (default is 1) 
j.Input.GoToFile(n) // Go to the ith file in the list 
j.Input.GoToFile("file") // Go to the file ``file'' in the list 
j.Input.Select("stream","cut") // Set a selection cut on a stream 
Input files may also be specified on the command line as shown in the example below.

Input Module Example of Use:

////////////////////////////////////////////////////////////////////////
// A job to demonstrate how to use the input module
//
// usage: loon -bq demo.C fullfilepathname 
{////////////////////////////////////////////////////////////////////////

  JobC j;

  j.Input.Set("Format=input"); // input(default), reroot, dds
  j.Input.Set("Streams=DaqSnarl,Cand"); // one or more input streams
  // Selection cut can be used to filter events. In this 
  // example, cut is used to select every 5th snarl from DaqSnarl stream
  j.Input.Select("DaqSnarl","((RawDaqSnarlHeader*)fHeader)->GetSnarl()%5==0");
  
  j.Path.Create("Demo","EventDump::Ana");
  j.Path("Demo").Mod("EventDump").Cmd("Dump Fragments");
  j.Path("Demo").Run(100);  // process first 100 events
  
}///////////////////////////////////////////////////////////////////////

Output Module Description:

In addition to the default set of defined output streams, the user may define their own with with the output module command:
j.Path(pathname).Mod("Output").DefineStream(streamname,classname,
                   username(optional),inputstreamname(optional));

Output Module Example of Use:

{
  JobC j;
  j.Path.Create("Demo",
                "DigitListModule::Get "  // creates and adds CandRecord to Mom
                "DigitListModule::Reco "
                "MyJobModule::Reco "   // creates and adds MyRecord to Mom
                "Output::Put");

  j.Path("Demo").Mod("Output").Set("FileName=testout.root");
  // Define stream My to persist records of class MyRecord
  j.Path("Demo").Mod("Output").Cmd("DefineStream My MyRecord");
  // Activate output stream Cand & My
  j.Path("Demo").Mod("Output").Set("Streams=Cand,My");
  j.Path("Demo").Run();
}

Notes and Further References

None so far.

Contact: Nick West <n.west1@physics.ox.ac.uk>
Fermilab
Security, Privacy, Legal Fermi National Accelerator Laboratory