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/TagCreateModule.cc

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: TagCreateModule.cc,v 1.9 2000/11/02 13:47:59 elmer Exp $
00004 //
00005 // Description:
00006 //      Class TagCreateModule. This module creates the transient event tag if
00007 //  it doesn't already exist.
00008 //
00009 // Environment:
00010 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00011 //
00012 // Author List:
00013 //      David R. Quarrie        Originator
00014 //
00015 // Copyright Information:
00016 //      Copyright (C) 1998      Lawrence Berkeley National Laboratory
00017 //
00018 //------------------------------------------------------------------------
00019 //-----------------
00020 // BaBar Headers --
00021 //-----------------
00022 #include "BaBar/BaBar.hh"
00023 
00024 //-----------------------
00025 // This Class's Header --
00026 //-----------------------
00027 #include "TagModules/TagCreateModule.hh"
00028 
00029 //-------------------------------
00030 // Collaborating Class Headers --
00031 //-------------------------------
00032 #include "AbsEvent/AbsEvent.hh"
00033 #include "TagDataP/BdbTagTransient.hh"
00034 #include "TagData/TagDescriptor.hh"
00035 #include "Framework/AbsParmBool.hh"
00036 #include "ProxyDict/Ifd.hh"
00037 #include <rw/cstring.h>
00038 
00039 #include "ErrLogger/ErrLog.hh"
00040 
00041 //-----------------------------------------------------------------------
00042 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00043 //-----------------------------------------------------------------------
00044 
00045 //              ----------------------------------------
00046 //              -- Public Function Member Definitions --
00047 //              ----------------------------------------
00048 
00049 //----------------
00050 // Constructors --
00051 //----------------
00052 TagCreateModule::TagCreateModule( const char* const theName, 
00053                                   const char* const theDescription )
00054   : AppModule( theName, theDescription )
00055 {
00056 }
00057                 
00058 
00059 //--------------
00060 // Destructor --
00061 //--------------
00062 TagCreateModule::~TagCreateModule()
00063 {
00064 }
00065 
00066 //--------------
00067 // Operations --
00068 //--------------
00069 AppResult
00070 TagCreateModule::beginJob( AbsEvent* anEvent )
00071 {
00072     if ( _verbose.value() ) cout << name() << ": Begin Job." << endl;
00073     return AppResult::OK;
00074 }
00075 
00076 AppResult
00077 TagCreateModule::beginRun( AbsEvent* anEvent )
00078 {
00079     if ( _verbose.value() ) cout << name() << ": Begin Run." << endl;
00080     return AppResult::OK;
00081 }
00082 
00083 AppResult
00084 TagCreateModule::event( AbsEvent* ev )
00085 {
00086     TagDescriptor* descriptor = TagDescriptor::instance();
00087 
00088     // book tags
00089     if ( !descriptor->processProxies(ev) ) {
00090       ErrMsg(error) << "Failed to declare all deferred tags" << endmsg;
00091     }
00092     descriptor->lock();
00093     AbsEventTag* theTag = Ifd<AbsEventTag>::get( ev );
00094     if ( 0 == theTag ) {
00095       theTag = new BdbTagTransient(*descriptor );
00096       bool status = Ifd<AbsEventTag>::put( ev, theTag );
00097       assert( status );
00098     } else {
00099       // merge the contents of the tags, preserving the contents 
00100       // of the existing one
00101       theTag->merge(descriptor, true);
00102     }
00103 
00104     return AppResult::OK;
00105 }
00106 
00107  void
00108 TagCreateModule::help( int argc, char** argv )
00109 {
00110     cout << "This module creates the transient event tag if it doesn't "
00111          << endl
00112          << "already exist."
00113          << endl
00114          << endl << endl;
00115 
00116   AppModule::help( argc, argv );
00117 }

 


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

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