Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/TagModules/TagFillExample.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: TagFillExample.cc,v 1.7 2000/11/02 13:48:00 elmer Exp $
00004 //
00005 // Description:
00006 //      Class TagFillExample. An example framework to fill the transient tag.
00007 //
00008 // Environment:
00009 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00010 //
00011 // Author List:
00012 //      David R. Quarrie        Originator
00013 //
00014 // Copyright Information:
00015 //      Copyright (C) 1998      Lawrence Berkeley National Laboratory
00016 //
00017 //------------------------------------------------------------------------
00018 //-----------------
00019 // BaBar Headers --
00020 //-----------------
00021 #include "BaBar/BaBar.hh"
00022 
00023 //-----------------------
00024 // This Class's Header --
00025 //-----------------------
00026 #include "TagModules/TagFillExample.hh"
00027 
00028 //-------------------------------
00029 // Collaborating Class Headers --
00030 //-------------------------------
00031 #include "AbsEvent/AbsEvent.hh"
00032 #include "TagData/TagTransient.hh"
00033 #include "Framework/AbsParmBool.hh"
00034 #include "ErrLogger/ErrLog.hh"
00035 #include "ProxyDict/Ifd.hh"
00036 #include <rw/cstring.h>
00037 
00038 //-----------------------------------------------------------------------
00039 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00040 //-----------------------------------------------------------------------
00041 
00042 //              ----------------------------------------
00043 //              -- Public Function Member Definitions --
00044 //              ----------------------------------------
00045 
00046 //----------------
00047 // Constructors --
00048 //----------------
00049 TagFillExample::TagFillExample( const char* const theName, 
00050                         const char* const theDescription )
00051   : AppModule( theName ,
00052                theDescription ) ,
00053     _initialCount( "initialCount" ,
00054                    this ,
00055                    1 )
00056 {
00057    commands()->append( &_initialCount ) ;
00058 }
00059                 
00060 
00061 //--------------
00062 // Destructor --
00063 //--------------
00064 TagFillExample::~TagFillExample()
00065 {
00066 }
00067 
00068 //--------------
00069 // Operations --
00070 //--------------
00071 AppResult
00072 TagFillExample::beginJob( AbsEvent* anEvent )
00073 {
00074     if ( _verbose.value() ) {
00075        ErrMsg( routine ) << name() << ": Begin Job." << endmsg;
00076     }
00077     return AppResult::OK;
00078 }
00079 
00080 AppResult
00081 TagFillExample::beginRun( AbsEvent* anEvent )
00082 {
00083     if ( _verbose.value() ) {
00084        ErrMsg( routine ) << name() << ": Begin Run." << endmsg;
00085     }
00086     return AppResult::OK;
00087 }
00088 
00089 AppResult
00090 TagFillExample::event( AbsEvent* ev )
00091 {
00092    static int count( _initialCount.value() ) ;
00093 
00094     AbsEventTag* theTag = Ifd<AbsEventTag>::get( ev );
00095     if ( 0 == theTag ) {
00096        ErrMsg( warning ) << "No Tag found in the primary event"
00097                          << endmsg ;
00098        return AppResult::OK ;
00099     }
00100     theTag->putBool( ( count == (( count / 2 ) * 2 ) ) ,
00101                      "EvenCount" ) ;
00102     theTag->putBool( ( ( count + 1 ) == (( ( count + 1 ) / 2 ) * 2 ) ) ,
00103                      "OddCount" ) ;
00104     theTag->putInt  ( count ,
00105                       "Count" );
00106     theTag->putInt  ( count * 10 ,
00107                       "CountX10" ) ;
00108     theTag->putInt  ( count * 100  ,
00109                       "CountX100" ) ;
00110     theTag->putFloat( count * 1.0 ,
00111                       "FloatCount" );
00112     theTag->putFloat( count / 2.0 ,
00113                       "HalfCount" );
00114     theTag->putFloat( 1.0 / count ,
00115                       "OneOverCount" );
00116 
00117    // Increase count (skipping zero to avoid "divide by zero" errors)
00118    ++count ;
00119    if( 0 == count ) {
00120       ++count ;
00121    }
00122 
00123     return AppResult::OK ;
00124 }
00125 
00126 void
00127 TagFillExample::help( int argc, char** argv )
00128 {
00129     ErrMsg( routine ) << "This module is an example of filling the"
00130                       << "transient event tag."
00131          << endmsg
00132          << endmsg << endmsg ;
00133 
00134   AppModule::help( argc, argv );
00135 }

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002