Skip to content

How can I filter input hipo files for events that pass my final state cuts ?

dglazier edited this page Aug 27, 2020 · 2 revisions

Currently an output hipo file is created for any events in the input file that pass all the cuts (i.e. get to the point of writing events to the final output tree (or hipo ntuple) ), in the case of many FinalState objects registered the filtered file will include events that pass the cuts for any of these objects. If you are running in via a ROOT script e.g. Run_MyFS.C then you can activate the filtering telling the HipoData to write a copy.

   HipoData hdata;
   hdata.SetFile("myinput.hipo");
   hdata.SetWriteToFile("myoutput.hipo");
   ...

If you are running via chanser_proof and HipoProcessor then you can set an output file by adding an option,

  chanser::HipoProcessor processor(&chain,"finalstates.txt","/work/output/dir");
  processor.AddOption("HIPOPROCESSOR_FILTERHIPO","filtered.hipo");

In this case you will get 1 filtered.hipo file for each worker used. The worker number is appended, i.e. /work/output/dir/worker_0.0filtered.hipo. In any case multiple processors may not be helpful as this is likely to be a read/write bound process.

Note you may want to consider if you need to write a ROOT tree at the same time, or just filter events. If you do not want to make a ROOT tree (it is expensive CPU wise) then you must only add FinalState Objects that have not got the line FS->UseOutputRootTree(); included in their creation.