SmartCollection Class Reference

A collection class designed to use CollectionAction objects. More...

#include <SmartCollection.h>

Inheritance diagram for SmartCollection:

PamCutCollection PamCut SmartBlindCollection VerboseCollection VerboseBlindCollection

List of all members.

Public Member Functions

 SmartCollection (const char *collectionName)
 Constructor.
 ~SmartCollection ()
 Destructor.
virtual void AddAction (CollectionAction &action)
 Adds an action to the SmartCollection.
CollectionActionGetAction (unsigned int iAction)
 Returns the iAction-th action.
void Setup (PamLevel2 *events)
 The pre-analysis task definition.
void Finalize ()
 The post-analysis task definition.
int ApplyCut (PamLevel2 *event)

Protected Attributes

std::vector< CollectionAction * > _actions
std::vector< unsigned int > _actionsPositions


Detailed Description

A collection class designed to use CollectionAction objects.

The SmartCollection class is designed to handle CollectionAction objects. It holds a vector of these objects and takes care of calling Setup and Finalize for each of them at the beginning and at the end of the analysis, respectively. Actions can be added to the SmartCollection by means of the AddAction() method. If a bunch of cuts have been already added to the collection, the action will be logically placed after the cuts. The SmartCollection will call CollectionAction::OnGood() if the cuts preceding the actions are satisfied, and CollectionAction::OnBad() if at least one of them fails. An action will not be sensitive to cuts added to the collection after the action itself. The resulting structure is composed by bunches of cuts intertwined by actions, which are "executed" depending on the result of the bunch of cuts that precedes the action. Note that CollectionAction::OnBad() is called only for those actions at the end of the bunch where the first failed cut is: if after these actions there are other bunches of cuts and actions, they will be ignored. For example, in the sequence below:

| cut1 | cut2 | action1 | action2 | cut3 | cut4 | action3 | ...

action1 and action2 are executed (eg., OnGood is called for them) if cut1 and cut2 are both satisfied, then cut3 and cut4 are evaluated and if both of them are satisfied then action3 is executed. If, for example, cut 1 or cut2 fail, then OnBad is called for action1 and action2; however, cut3, cut4, action3 and all that follows are ignored. The analysis goes on with the next event.


Constructor & Destructor Documentation

SmartCollection::SmartCollection ( const char *  collectionName  )  [inline]

Constructor.

Parameters:
collectionName The collection's name.


Member Function Documentation

int SmartCollection::ApplyCut ( PamLevel2 *  event  )  [virtual]

Applies the cuts and executes the actions.

When cuts are applied, a SmartCollection will also execute the actions at the end of the bunches of cuts.

Parameters:
event The event to analyze.

Reimplemented from PamCutCollection.

Reimplemented in SmartBlindCollection.

void SmartCollection::Finalize (  )  [virtual]

The post-analysis task definition.

This override of the Finalize() method calls PamCutCollection::Finalize() and then the Finalize() method of each action contained in the SmartCollection.

Reimplemented from PamCutCollection.

Reimplemented in VerboseBlindCollection, and VerboseCollection.

CollectionAction * SmartCollection::GetAction ( unsigned int  iAction  ) 

Returns the iAction-th action.

Parameters:
iAction The index of the desired CollectionAction, defined as the insertion order (from 0 to #actions-1, see AddAction()).
Returns:
pointer to the iAction-th action; NULL if the specified action cannot be found or if no actions are present.

void SmartCollection::Setup ( PamLevel2 *  events  )  [virtual]

The pre-analysis task definition.

This override of the Setup() method calls Setup() for the base class PamCutCollection, and subsequently for each action contained in the SmartCollection.

Parameters:
events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for CollectionAction::Setup().

Reimplemented from PamCutCollection.


The documentation for this class was generated from the following files:

Generated on Fri Jun 5 15:09:04 2009 for PamCut by  doxygen 1.5.9