#include <SmartCollection.h>
Public Member Functions | |
SmartCollection (const char *collectionName) | |
Constructor. | |
~SmartCollection () | |
Destructor. | |
virtual void | AddAction (CollectionAction &action) |
Adds an action to the SmartCollection. | |
CollectionAction * | GetAction (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 |
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.
SmartCollection::SmartCollection | ( | const char * | collectionName | ) | [inline] |
Constructor.
collectionName | The collection's name. |
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.
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.
iAction | The index of the desired CollectionAction, defined as the insertion order (from 0 to #actions-1, see AddAction()). |
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.
events | The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for CollectionAction::Setup(). |
Reimplemented from PamCutCollection.