Chapter 8. Analyzing filter files

Using event filters described filters, how to create them, and manipulate them to produce filtered data sets. This chapter will describe how to analyze filtered data sets. The scope of this chapter is limited to analyzing XDR formatted filters in SpecTcl.

Filter data files are self-describing, but require a special buffer decoder and event processor to unpack them into parameters. This chapter desribes:

8.1. Preparing SpecTcl to analyze filtered event files.

The steps required to prepare SpecTcl to read filtered event files are:

In our sample code, our event processors created tree parameters. We still need those parameters to provide slots for the filtered event data to put the unpacked data. The simplest way to do this is to instantiate our event processors but just to not register them with the event analysis pipeline. See the sample CreateAnalysisPipeline below:

Example 8-1. Removing our event processors from the analysis pipeline


void 
CMySpecTclApp::CreateAnalysisPipeline(CAnalyzer& rAnalyzer)  
{
  CEventProcessor* simple = new SimpleEventProcessor;  (1)

  // Note calibration is static.                       (2)

#ifdef ANALYZE_FILTERS                                 (3)

#else
  
  RegisterEventProcessor(*simple "Test");
  RegsisterEventProcessor(calibration, "Calibrator");
#endif
  
}  
                    
                
(1)
Rather than instantiating the event processor as we register it, instantiating it separately allows us to make the instance, which defines tree parameters, but to leave it out of the analysis pipeline.
(2)
It's been a few pages ago but recall that the calbration computing event processor was defined statically. This will cause it to make the tree parameters it needs.
(3)
What we do here is use conditional compilation so that we can compile SpecTcl to either register the filter event processor (next step) or our event processors depending on the preprocessor definition (or lack thereof) of ANALYZE_FILTERS.

To add in the filter event processor we have to include its header and register an instance of it at the front of the event analysis pipeline:

Example 8-2. Registering the filter event processor


                    ...
#include "CmdCalibration.h"
#include "SetCalibCommand.h"
#include <FilterEventProcessor.h>
...

#ifdef ANALYZE_FILTERS
  RegisterEventProcessor(*(new CFilterEventProcessor), "FilterUnpacker");
#else
  ...
                

Now to analyze filter files we just need to modify the Makefile definition of USERCXXFLAGS:

Example 8-3. Defining ANALYZE_FILTERS


...
#  If you have any switches you need to add to the default c++ compilation rules,
#  add them to the defintion below:

USERCXXFLAGS=-DANALYZE_FILTERS
...
                

Doing a make clean SpecTcl will now build SpecTcl to analyze filters. commenting out that definition and again doing make clean SpecTcl will build a SpecTcl capable of reading raw event files again.