# Presentation: 199646

## Definition

- The framework is a library that controls the flow of events and data
- through well-defined interface points defined by user-written algorithm
- components.  The user creates algorithm components using framework
- tools. These components can be arranged into an execution or data-flow
- sequence that is managed by the framework library.

## Library Organization

- framework.o
- iframework.o
- cframework.o

- RegEMReco.o
- RegCPSReco.o
- RegCftExamine.o

- libframework.a
- libio_packages.a

- libEMreco.a
- libCPSReco.a
- libCftExamine.a

*<release_dir>/lib/IRIX6_XXX/*

- Main program
- object files.  Batch,
- interactive versions.

- Framework registration
- object files.  One per
- framework package.

- Framework
- related libraries

- Reconstruction/
- Analysis package
- libraries

- Must include one main program object file and a set of Reg
- object files when linking your executable.  One Reg file must
- be linked for each package that you want available in the executable.
- The framework RCP controls which user package objects actually
- get created at run time.

## Example User Package Class Definition

- 	fwk::RunInit
- {
- public:
- 	UserPackage(Context*);
- 	~UserPackage();
- 	fwk::Result processEvent(edm::Event&);
- 	fwk::Result tagEvent(edm::Event&);
- 	fwk::Result runInit(const RunNumber&);
- 	void reinitialize(edm::RCP);
- 	void statusReport();
- 	void flush();
- }

**Example User Package Class Definition**

## Framework provided classes

- Generate:	generateEvent(WorkQueue&)
- Decide:	makeDecision(const edm::Event&, WorkQueue&)
- Filter:	filterEvent(const edm::Event&)
- Process:	processEvent(edm::Event&)
- Analyze:	analyzeEvent(const edm::Event&)
- Dump:	dumpEvent(const edm::Event&)
- Tag:	tagEvent(const edm::Event&)
- Output:	outputEvent(const edm::Event&)
- JobSummary: jobSummary()
- RunInit:	runInit(const RunNumber&)
- RunEnd:	runEnd(const RunNumber&)

**Framework provided classes**

**Interfaces available to user:**

**Framework provided package available for use in RCP files.**

- Groups together interfaces by name.
- Controls event flow through the interface groups.
- Is a package and implements a generic interface.
- Can masquerade as any other available interface.
- Interface name assigned by used in RCP file.
- Can contain Controllers.

## Inside the Framework

**User package code**

**Event loop**

- X: processEvent(),tagEvent()
- Y:processEvent(),tagEvent()
- Z: processEvent(), runInit()
- U: processEvent(), runInit()
- V: generateEvent(),makeDecision()

**InterfaceNames**=“generate decide process tag runInit”
**Packages**=“v1,x1, x2, y1, z1, u1”
**Flow**=“generate decide process tag”

- generate:

- decide:

- process:

- tag:

- runInit:

- (v1) V::generateEvent()

- (v1) V::makeDecision()

- (x1) X::processEvent()
- (x2) X::processEvent()
- (y1) Y::processEvent()
- (z1) Z::processEvent()
- (u1) U::processEvent()

- (x1) X::tagEvent()
- (x2) X::tagEvent()
- (y1) Y::tagEvent()

- (z1) Z::runInit()
- (u1) U::runInit()

## Important Abstract Framework Components

- Package:

- Interface:

- Base class for user created, plug-in components.
- Reconstruction/Analysis algorithms implemented by derived classes
- Instance creation controlled by framework RCP file.
- Instances exist for entire run of program
- Automatically registers all the interfaces it implements

- Base class for framework call-out points.
- Instances identified by string name.
- Implemented by inheritance (similar to Package)
- Specifies when and where data will be passed into a users code.
- Basic component that framework uses to pass event into user packages
- Event data flows through Interfaces.
- A package typically implements several of these interfaces.

## Framework RCP Configuration

- string Interfaces = "generator decide filter analyze process dump tag output
- 	jobSummary runEnd runInit"
- string Flow = "generator decide filter process analyze dump tag output"

**Framework RCP Configuration**

***Defaults.rcp*****:**

***InterfaceName***: We are configuring a controller. This is the interface name that
- the controller will be assigned.  It will appear to the system as an “Process”
- interface.

***Interfaces***: A list of all the interfaces that that will be used in this run.  The
- interface named are assigned dynamically when the program starts.  The user
- can add new interface classes and assign them a name without changing the
- framework library.

***Flow***: An event will be directed through interfaces in the *order* specified by
- the flow.  Any interface not in the flow is considered a free standing interface.
- This flow indicates that events will be passed through all the packages that
- implement processEvent() before being passed through all the packages that
- implement analyzeEvent().

## High-level Framework RCP file example

- RCP FrameworkInfo = <defaults.rcp>
- string Packages = "generate_events first_processor second_processor”

- RCP generate_events = <generate.rcp>
- RCP first_processor = <processor1.rcp>
- RCP second_processor = <processor2.rcp>

**High-level Framework RCP file example**

***Packages***: Specifies the instance names of all the user package instances that
- should be created.  The order is significant; interfaces will be distributed and
- executed in the order they appear in this parameter.  The package type or class
- name is specified in the packages RCP file.

- There must be one RCP line and RCP file present for each of the strings in
- the Packages parameter.  The FrameworkInfo parameter tells where to get the
- framework RCP information from.  The information in defaults.rcp can just
- be included in this RCP.

## Nesting

- Controllers can be placed into controllers

- string InterfaceName = "process"
- string Interfaces = "generator decide process jobSummary runEnd runInit"
- string Flow = "generator decide process"
- string Packages = "gen group1 group2"
- RCP gen = <gen.rcp>
- RCP group1 = <group_even.rcp>
- RCP group2 = <group_odd.rcp>

**User.rcp**

- string PackageName = "Controller"
- string InterfaceName = "process"
- string Interfaces = "filter analyze"
- string Flow = "filter analyze"
- string Packages = "filter"
- RCP filter = <filter_even.rcp>

**group_even.rcp**

- string PackageName = "Controller"
- string InterfaceName = "process"
- string Interfaces = "filter analyze"
- string Flow = "filter analyze"
- string Packages = "filter"
- RCP filter = <filter_odd.rcp>

**group_odd.rcp**

- string PackageName = "Filter"
- string type = "even"

**filter_even.rcp**

- string PackageName = "Filter"
- string type = ”odd"

**filter_odd.rcp**

## Batch Framework

**CPSDigiPkg      $Name: v00-05-03 $**
**CPSReco $Name: v00-05-03 $**
**CalClusterReco  $Name: v00-05-03 $**
**CalWeight       $Name: v00-05-03 $**
**CftClusterPkg   $Name: v00-05-03 $**
**Controller      $Name: v00-05-03 $**
**DropChunks      $Name: v00-12-04 $**
**DumpEvent       $Name: v00-12-04 $**
**EMReco  $Name: v00-05-03 $**
**FPSClusterPackage       $Name: v00-05-03 $**
**FpsDigiPackage  $Name: v00-05-03 $**
**GtrFindPkg      $Name: v00-05-03 $**
**JetReco $Name: v00-05-03 $**
**MissingETReco   $Name: v00-05-03 $**
**MuoHitReco      $Name: v00-05-03 $**
**MuoSegmentReco  $Name: v00-05-03 $**
**ReadEvent       $Name: v00-12-04 $**
**SMT1DPosPack    $Name: v00-05-03 $**
**SMTClusterPack  $Name: v00-05-03 $**
**SMTInterfacePack        $Name: v00-05-03 $**
**SMTLocaltoGlobalTransPack       $Name: v00-05-03 $**
**SmtClusterPkg   $Name: v00-05-03 $**
**TauReco $Name: v00-05-03 $**
**VertexReco      $Name: v00-05-01 $**
**VertexSelect    $Name: v00-05-01 $**
**WriteEvent      $Name: v00-12-04 $**
**geometry_management     $Name: v00-05-03 $**
**<d02ka>**

**Batch Framework**

## Interactive Framework Features

- quit
- start
- help
- pause
- resume
- step
- next
- flush
- show
- config
- time
- ls
- cd
- rcp
- report (status)
- state
- where

**Commands**

- One interface at a time

- One event at a time

- Print all the available packages

- Print the package instance within controller

- Dump the RCP for a package

- Deactivate/Activate a package instance

- Print the current package/interface

- Wait for user input after current interface completes

- Link using iframework.o
- Execute with “-i” option
- Still quite a primitive terminal interface
- Framework internals allow for many different UIs to exist

## Future Plans

- Framework

- Event loop

- Commander

- Messenger

- Controller

- ORB

- Main Thread

- Comm
- Thread

- Network

- Netscape - Java GUI

- Pause Resume Stop Start Step Next

- Output Window

- Error Window

- Packages

- x
- y
- z