SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Computing Search
Who's who?
Meetings
FAQ Homepage
Archive
Environment
Online SW
Offline
Workbook
Simulation
Reconstruction
Data Distribution
Beta
Beta Tools
Event display
Code releases
Databases:
Hot Items!
About Us
Meetings
General DB info
Conditions DB
Event Store
Online DB
Links
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

The BABAR Event Query Tag User's Guide

David Quarrie

BABAR Database Group
BABAR Computing

 

Version Information

Draft: 15th June 1998

This document is still under development. If you have any questions or comments, please address them to the author.

Table of Contents


Introduction

The BABAR Event Query Tag is a mechanism for rapid selection of events having desirable characteristics from an input event collection. It allows an output collection to be created that contains just those events of interest from an input collection.

Note that the event selection tag is likely to be redesigned following Mock Data Challenge II (MDC-II) and this document describes only the tag and acess for the tag for MDC-II.


AbsEventTag - The Abstract Transient Event Query Tag

Description

The AbsEventTag class is the abstract transient event query tag.

Inheritance Tree

AbsEventTag

Interface

#include "AbsEventTag/AbsEventTag.hh"

Constructors

None.

Selectors

bool getBool ( bool&  value, const char* const key ) = 0
bool getInt  ( int&   value, const char* const key ) = 0
bool getFloat( float& value, const char* const key ) = 0

Get an attribute of the specified type and having the specified name. The function value indicates whether an attribute exists of the specified type and with the specified name. These functions are abstract.

Modifiers

bool putBool ( bool  value, const char* const key ) = 0
bool putInt  ( int   value, const char* const key ) = 0
bool putFloat( float value, const char* const key ) = 0

Insert an attribute of the specified type and having the specified name into the transient event query tag, replacing any previous value that might have already have been inserted within this type and name. The function value indicates whether the insertion was successful. These functions are abstract.

Operations

None.

Return to Table of Contents


TagTransient - The Transient Event Query Tag

Description

The TagTransient class is the transient event query tag. It inherits from the AbsEventTag abstract parent class.

Inheritance Tree

TagTransient > AbsEventTag

Interface

#include "TagData/TagTransient.hh"

Constructors

TagTransient( )

Create a transient event query tag.

Selectors

bool getBool ( bool&  value, const char* const key )
bool getInt  ( int&   value, const char* const key )
bool getFloat( float& value, const char* const key )

Get an attribute of the specified type and having the specified name. The function value indicates whether an attribute exists of the specified type and with the specified name.

Modifiers

bool putBool ( bool  value, const char* const key )
bool putInt  ( int   value, const char* const key )
bool putFloat( float value, const char* const key )

Insert an attribute of the specified type and having the specified name into the transient event query tag, replacing any previous value that might have already have been inserted within this type and name. The function value indicates whether the insertion was successful. A failure indicates that an attribute already exists with the specified name but which has a different type.

Operations

None.

Return to Table of Contents


BdbEventTag - The Persistent Event Query Tag

Description

The BdbEventTag class is the persistent event query tag. The user interface to this class is provided by the TagAttribute<T> templated tag attribute class. The BdbEventTag class itself is described in the BABAR Event Store Reference Manual.

Return to Table of Contents.


TagAttribute<T> - The templated Tag Attribute

Description

The templated TagAttribute<T> class provides the primary user interface to the persistent event query tag. Instances of such templated attributes may be created and bound via a TagAttributeManager object. Thereafter they may be treated as variables of conventional basic data types. A suitable TagAttributeManager object is provided by the TagFastFilterModule framework module.

Inheritance Tree

TagAttribute<T> > TagAttributeBase

Interface

#include "TagDataP/TagAttribute.hh"

Constructors

TagAttribute( const char* const theName, TagAttributeManager& theManager )

Create a templated.

Selectors

None.

Modifiers

None.

Operations

None.

Operators

const TagAttribute<T>& operator = ( T value )
const TagAttribute<T>& operator = ( const TagAttribute<T>& theOther )

Assign a value to the tag attribute.

operator T( ) const

Return tag attribute value.

Return to Table of Contents.


Event Query Tag Packages and Framework Modules

The following BABAR software packages contain classes that manage the event query tag.

  • BdbEvent. This package contains the persistent event query tag class.
  • TagData. This package contains the transient event query class.
  • TagDataP. This package contains the tag attribute classes and converters classes etc.
  • TagModules. This package contains framework modules that create, fill or perform event selections based on the event query tag.

The following modules deal with the event query tag within the BABAR Framework.

  • TagBdbLoad. This module performs reading and writing to the event store. In the case of reading, it creates the transient event query tag from the persistent one, and in the case of writing it creates the persistent event query tag from the transient one.
  • TagCreateModule. This module creates an empty transient event query tag object and associates it with the transient event.
  • TagFillExample. This is an example of a module that locates the transient event query tag within the transient event and fills entries into it.
  • TagFilterModule. This is a Framework filter module that is designed to act as a base class for user-level event query tag filter modules. Such modules access the transient tag within the transient event and perform filtering based on the transient attributes. The FagFilterExample module is an example of such a filter module.
  • TagFilterExample. This is an example of a module that locates the transient event query tag within the transient event and filters events having particular characteristics.
  • TagFastFilterModule. This is a Framework filter module that is designed to act as a base class for user-level fast filter modules. Such modules declare templated tag attributes that bind to the underlying persistent event query tag and perform filtering based on these attribute objects. They therefore have smaller overhead than modules based on the TagFilterModule module. The TagFastFilterExample module is an example of such a filter module.
  • TagFastFilerExample. This is an example of a module that declares several templated tag attributes and filters events having particular characteristics.

Return to Table of Contents


Filling the Transient Event Query Tag

A framework application wishing to create and fill the transient tag, adding this to the information output to the event store after all event processing is completed, must setup a processing path that includes the following modules:

path create TagPath BdbCreateCM TagBdbLoad TagCreateModule <theTagFillModule>

Although other modules may appear in the processing path, those that that must appear in the specified relative sequence are:

  • BdbCreateCM. This module creates the Converter Managers for the event and associates them with the transient event. It is required by all paths that access the event store either for input or output.
  • TagBdbLoad. This module controls whether the event query tag will be read from the event store or written to it. In this case it must appear in order to cause the the tag information to be written to the event store.
  • TagCreateModule. This module creates an empty transient event query tag object and associates it with the transient event so that it is available for downstream modules.
  • <theTagFillModule>. This is the module that fills the transient tag. An example of such a module is the TagFillExample module which is used for the remainder of this example. It should be replaced by the actual desired module.

In order that these modules be linked into the application, the AppUserBuild.cc file should include the following code fragments:

#include "BdbConverters/BdbCreateCM.hh"
#include "TagModules/TagBdbLoad.hh"
#include "TagModules/TagCreateModule.hh"
// Replace the following by the actual module. This is just an example
#include "TagModules/TagFillExample.hh"
    [....]
    add( new BdbCreateCM    ( "BdbCreateCM"     , "Create Converter Manager Module" );
    add( new TagBdbLoad     ( "TagBdbLoad"      , "Tag Loader Module" );
    add( new TagCreateModule( "TagCreateModule", "Tag Creator Module" );
    // Replace the following by the actual tag filling module.
    add( new TagFillExample ( "TagFillExample" , "Tag Fill Example Module" );

In order for the tag information to be written to the event store along with any other event-related information, the TagBdbLoad module must be setup to output the information by using the following Tcl fragment:

module talk TagBdbLoad
    writeTag set true
exit

The relevant code fragments from the TagFillExample module code that locates the transient tag within the transient event, and creates some transient attributes is:

TagFillExample.cc

#include "AbsEventTag/AbsEventTag.hh"
[....]
AbsEvent*
TagFillExample::event( AbsEvent* ev, int mode )
{
    bool status;
    AbsEventTag* theTag = Ifd<AbsEventTag>::get( ev );
    if ( 0 != theTag ) {
        status = theTag->putBool ( true, "aBoolValue" );
        assert( status );
        thetag->putInt  (    10, "anIntValue" );
        theTag->putFloat( 100.0, "aFloatValue" );
        [....]
    }
    return ev;
}

Note that the transient event tag is declared to be of type AbsEventTag, the abstract parent class, rather than of type TagTransient.

Return to Table of Contents.


Event Selection using the Transient Event Query Tag

A framework application wishing to input the tag information from the event store and filter based on tag attribute values, must setup a processing path that includes the following modules:

path create TagPath BdbCreateCM TagBdbLoad BdbEventUpdate <theTagFilterModule>

Although other modules may appear in the processing path, those that that must appear in the specified relative sequence are:

  • BdbCreateCM. This module creates the Converter Managers for the event and associates them with the transient event. It is required by all paths that access the event store either for input or output.
  • TagBdbLoad. This module controls whether the event query tag will be read from the event store or written to it. In this case it must appear in order to cause the the tag information to be written to the event store.
  • BdbEventUpdate. This module actually performs the input of information from the event store based on prior setting of the various loader modules (in this case just TagBdbLoad) that appear upstream in the path..
  • <theTagFilterExample>. This is the module that locates the transient tag and filters using it. It must inherit from the TagFilterModule class. An example of such a module is the TagFilterExample module which is used for the remainder of this example. It should be replaced by the actual desired module.

In order that these modules be linked into the application, the AppUserBuild.cc file should include the following code fragments:

#include "BdbConverters/BdbCreateCM.hh"
#include "TagConverters/BdbEventUpdate.hh"
#include "TagModules/TagBdbLoad.hh"
// Replace the following by the actual module. This is just an example
#include "TagModules/TagFilterExample.hh"
    [....]
    add( new BdbCreateCM     ( "BdbCreateCM"      , "Create Converter Manager Module" );
    add( new BdbEventUpdate  ( "BdbEventUpdate"  , "Event Store Update Module" );
    add( new TagBdbLoad      ( "TagBdbLoad"      , "Tag Loader Module" );
    // Replace the following by the actual tag filtering module.
    add( new TagFilterExample( "TagFilterExample", "Tag Filter Example Module" );

In order for the tag information to be read to the event store along with any other event-related information, the TagBdbLoad module must be setup to input the information by using the following Tcl fragment:

module talk TagBdbLoad
    readTag set true
exit

The relevant code fragments from the TagFilterExample module code that locates the transient tag within the transient event, and creates some transient attributes is:

TagFilterExample.hh

#include "TagModules/TagFilterModule.hh"
[....]
class TagFilterExample : public TagFilterModule {
    [....]
};

TagFilterExample.cc

#include "TagModules/TagFilterExample.hh"
#include "AbsEventTag/AbsEventTag.hh"
[....]
AbsEvent*
TagFilterExample::event( AnsEvent* ev, int mode )
{
    bool  aBool;
    float aFloat;
    int   anInt;
    bool  status;
    bool  passed = false;

    TagFilterModule::event( ev, mode );
    if ( 0 != tag( ) ) {
        status = tag( )->getBool (  aBool, "aBoolValue" );
        status = tag( )->getInt  (  anInt, "anIntValue" );
        status = tag( )->getFloat( aFloat, "aFloatValue" );
        [....]
        // Decide whether this event passes the event selection criteria
        passed = true;
    }
    [....]
    // Mark the event for further processing depending on the "passed" flag
    setPassed( passed );
    return ev;
}

Note that the transient event tag is declared to be of type AbsEventTag, the abstract parent class, rather than of type TagTransient.

Return to Table of Contents.


Event Selection using the Persistent Event Query Tag

A framework application wishing to input the tag information from the event store and perform fast filtering filter based on templated tag attribute values, must setup a processing path that includes the following modules:

path create TagPath <theTagFastFilterModule>

Although other modules may appear in the processing path, those that that must appear in the specified relative sequence are:

  • <theTagFastFilterExample>. This is the module that declares templated tag attributes and binds them using a TagAttributeManager object. It must inherit from the TagFastFilterModule class. An example of such a module is the TagFastFilterExample module which is used for the remainder of this example. It should be replaced by the actual desired module.

In order that these modules be linked into the application, the AppUserBuild.cc file should include the following code fragments:

// Replace the following by the actual module. This is just an example
#include "TagModules/TagFastFilterExample.hh"
    [....]
    // Replace the following by the actual tag fast filtering module.
    add( new TagFastFilterExample( "TagFast FilterExample", "Tag Fast Filter Example Module" );

The relevant code fragments from the TagFastFilterExample module code that declares templated tag attributes and binds them using a TagAttributeManager object is:

TagFastFilterExample.hh

#include "TagModules/TagFastFilterModule.hh"
[....]
class TagFastFilterExample : public TagFastFilterModule {
    [....]
private:

    // Declare several templated tag attributes
    TagAttribute<bool>  _aBool;
    TagAttribute<float> _aFloat;
    TagAttribute<int>   _anInt;
};

TagFastFilterExample.cc

#include "TagModules/TagFastFilterExample.hh"
[....]
// Constructor
TagFastFilterExample::TagFastFilterExample( const char* const theName,
                                            const char* const theDescription )
: TagFastFilterModule( theName, the Description ),

// Name and bind the tag attributes to the tag manager
  _aBool ( "aBoolValue" , _tagManager ),
  _aFloat( "aFloatValue", _tagManager ),
  _anInt ( "anIntValue" , _tagManager )
{
}
    [....]
AbsEvent*
TagFastFilterExample::event( AnsEvent* ev, int mode )
{
    bool  aBool;
    float aFloat;
    int   anInt;
    bool  status;
    bool  passed = false;

    // Setup for this event
    if ( setup( ev ) ) {
       
        // Access tag information
        if ( _aBool ) {
            [....]
        }
        float myData = 10.0 * _aFloat;
        [....]
        // Decide whether this event passes the event selection criteria
        passed = true;
    }
    [....]
    // Mark the event for further processing depending on the "passed" flag
    setPassed( passed );
    return ev;
}

Note that the transient event tag is declared to be of type AbsEventTag, the abstract parent class, rather than of type TagTransient.

Return to Table of Contents.


References

None.

 

DB Home | BaBar Home | Computing | Reconstruction | Simulation | Search

e-mail DRQuarrie@LBL.Gov