Project

General

Profile

Creating one output file per input file

It is sometimes desired that the output files produced by art have a one-to-one correspondence with the input files. This can be achieved by using the "no-merge" scheduling option. Consider the following sample configuration:

process_name : mergerTest

services: {
   scheduler: {
      fileMode: NOMERGE
   }
}

source : { 
   maxEvents : 10
   module_type : RootInput
   fileNames : [ "ToyProductProducer_t_01.root",
                 "ToyProductProducer_t_02.root" ]
}

physics : {

   stream1  : [ out1 ]
   end_paths : [ stream1 ]

}

outputs : { 

   out1 : { 
      fileName: "ToyProductMerger_%#.root" 
      module_type : RootOutput
   } 

} 

For this particular example, '%#' will increment the file number written to the out1 stream. Two output files are thus produced:
  • ToyProductMerger_1.root
  • ToyProductMerger_2.root

which correspond, respectively, to the first and second input files.

Summary: The important ingredients here are the NOMERGE file mode specification, and the output file renaming specifiers (see here). Without the specifiers, the same output file will be overwritten with the events corresponding to the current input file.