next up previous contents
Next: AC++ Reference Manuals Up: A USERS GUIDE Previous: Running an Executable

Reusing A_C modules as AC++ modules

There are a number of things you must know about the old module before you will be able to fit it into the new framework. Here is the list:

  1. You must be able to specify the named ybos banks uses as input for the module.
  2. You must be able to specify the named ybos banks produced as output for the module. Usually these will be the same banks that the original author would have written to the ybos ``A'' list. The banks specified here do not have to be produced for every event. For example if your output bank is ELES then it is quite possible that there will not be an electron in every event. The framework utilities look to see if any of the specified banks were produced before it tries to output them.
  3. All block-data common blocks that are used by the Fortran module must be specified and added to the F77InterfaceModule.
  4. Some services that used to be provided by A_C will be provided by the F77InterfaceModule. Fortran specific services such as filling of the JOBSTA common or fortran bindings to any ANG* routines will be implemented on an as needed basis. Because of this, you must identify things in this category.
  5. The talk-to will have to be reworked, since UIPACK is no longer supported. CDF will have to take a look at the requirements for a talk-to. If setting of parameters is all that is needed then the mechanisms of the previous sections will do, however if this is not sufficient then a re-design will be needed. This issue will be discussed in the beginning of June 1997.
As a demonstration that this can all work, the Fortran module stpana has been converted. Here is the code for the C++ StpanaModule:
...
//----------------
// Constructors --
//----------------
StpanaModule::StpanaModule(
    const char* const theName,
    const char* const theDescription )
  : AppModule( theName, theDescription ),  // Pass args. to parent class
    _CES_control("CES_region_enable", this, true ), // CES clustering on
    _PES_control("PES_region_enable", this, false ) // PES clustering off
//
// The above will default regional central strip clustering on and
// full plug strip clustering off.
{
  // Add talk-to parameters created above to list of command handlers
  commands( )->append( &_CES_control );
  commands( )->append( &_PES_control );
}
//--------------
// Destructor --
//--------------
StpanaModule::~StpanaModule( )
{
}
//--------------
// Operations --
//--------------
void
StpanaModule::begin( AppJob* )
{
    cout << name( ) << " begin Job call spinit_" << endl;
    spinit_();
}
AbsEvent*
StpanaModule::event( AbsEvent* anEvent, int )
{

   // Update IW need banks from input argument anEvent
 
   F77_readIntoIW( anEvent, "PESETOWE" );

   // now call the event entry for stpana

   spevnt_();

   // this will write the output banks back to Trybos

   F77_writeFromIW( anEvent, "CESSCASS" );
   
   return (AbsEvent*)anEvent;
}
This is an abbreviated version of this code. The full file may be found in the cdfsoft2 distribution as $PROJECT_DIR/cas/StpanaModule.cc It is important that any job which uses an A_C module also include in its definition (the equivalent of a build_job file) the F77InterfaceModule. This is done for the stpana test with this file:
...
AppUserBuild::AppUserBuild( AppFramework* theFramework )
    : AppBuild( theFramework )
{
    AppModule* aModule;
    
    aModule = new F77InterfaceModule( "F77DefModule", "Default Fortran Interface" );
    add( aModule );

    aModule = new StpanaModule( "StpanaDefModule", "Default Instance of Stpana" );
    add( aModule );

    aModule = new UserExample( "DefUserExample", "Default Instance of UserExample" );
    add( aModule );
}
...
Again the full file can be found in $PROJECT_DIR/cas/test/Stpana_test.cc

next up previous contents
Next: AC++ Reference Manuals Up: A USERS GUIDE Previous: Running an Executable



Liz Sexton
Fri May 16 16:37:56 CDT 1997