4.5. The API and the event sink pipeline

The event sink pipeline is a pipeline of processors that receives control when there are unpacked events to process. Unpacked events are the results of execution of the event analysis pipeline. The are represented in SpecTcl by filled CEvent objects. Alternatively, they represent tree parameters and tree parameter arrays that have been set by the stages of the event analysis pipeline.

SpecTcl has two types of built in event sink pipeline elements.

  1. The histogrammer, which checks gates and increments histograms as directed by gate definitions, histogram definitions and gate applications. This object is the core of SpecTcl's built per event analysis.

  2. Filters which can be created dynamically and added to the event processing pipeline. Filters are objects that can output a subset of the parameters of a subset of events to file.

The event sink pipeline is described more completely in The SpecTcl event sink pipeline..

The API provides methods to edit and visit each element ofthe event sink pipeline. The example in this section will be a function that lists the names of event sink pipeline elements. This function could, once you know how, be invoked by a Tcl command extension to SpecTcl.

Example 4-15. Listing the event sink pipeline elements


#include <SpecTcl.h>
#include <EventSinkPipeline.h>
#include <iostream>


void
ListEventSinkPipeline()
{
  SpecTcl& api(*SpecTcl::getInstance());

  for(auto p = api.EventSinkPipelineBegin(); p != api.EventSinkPipelineEnd(); p++) {
    std::cout << p->first << std::endl;
  }
}
            

About the only thing that needs to be said about this rather classic use of iterators is that the event sink pipeline iterator can be treated as a pointer to std::pair<std::string, CEventSink*>. The first element of the pair, the string, is the name given to that pipeline element, either by SpecTcl, if none was provided, or by the code that registered that element.