--- PamCut/Collections/SmartBlindCollection/SmartBlindCollection.h 2009/05/29 10:08:46 1.1 +++ PamCut/Collections/SmartBlindCollection/SmartBlindCollection.h 2009/06/05 13:14:34 1.2 @@ -10,22 +10,19 @@ #ifndef SMARTBLINDCOLLECTION_H_ #define SMARTBLINDCOLLECTION_H_ -#include "../BlindCutCollection/BlindCutCollection.h" -#include "../../CollectionActions/CollectionAction/CollectionAction.h" +#include "../SmartCollection/SmartCollection.h" /*! @brief A blind collection class designed to use CollectionAction objects. * * The SmartBlindCollection class is designed to handle CollectionAction objects. These - * defines the procedures to do when an event is selected or discarded. A SmartBlindCollection - * handles a vector of these objects, calling CollectionAction::OnGood() for each of them - * when a good event is selected and CollectionAction::OnBad() when a bad one is rejected. - * It will also call the CollectionAction::Setup() and CollectionAction::Finalize() methods - * at the beginning and at the end of the analysis, respectively. - * This collection differs from SmartCollection only because it-s blind, ie., it will apply - * all the cuts to each events, even if some of them fail. See #BlindCutCollection to get - * more info about blind collections. + * defines the procedures to do when an event is selected or discarded. + * This collection differs from SmartCollection only because it is blind, ie., it will apply + * all the cuts to each events, even if some of them fail (see #BlindCutCollection to get + * more info about blind collections). In current implementation, after a cut has failed, it + * will call OnBad for all the actions that come after that cut, regardless if, for example, + * in a certain subsequent bunch all the cuts are satisfied. */ -class SmartBlindCollection: public BlindCutCollection { +class SmartBlindCollection: public SmartCollection { public: @@ -34,66 +31,21 @@ * @param collectionName The collection's name. */ SmartBlindCollection(const char* collectionName) : - BlindCutCollection(collectionName), _actions(0) { + SmartCollection(collectionName){ } /*! @brief Destructor. */ - ~SmartBlindCollection(){ + ~SmartBlindCollection() { } - /*! @brief Adds an action to the SmartCollection */ - virtual void AddAction(CollectionAction& action); - - /*! @brief Returns the iAction-th action. + /*! Applies the cuts and executes the actions. * - * @param iAction The index of the desired CollectionAction, defined as the insertion order - * (from 0 to \#actions-1, see AddAction()). - * @return pointer to the iAction-th action; NULL if the specified action cannot be found or if no actions are present. - */ - CollectionAction *GetAction(unsigned int iAction); - - /*! @brief The pre-analysis task definition. + * When cuts are applied, a SmartBlindCollection will also execute the actions at the end + * of the bunches of cuts. * - * This override of the Setup() method calls Setup() for the base class BlindCutCollection, and subsequently for each - * action contained in the SmartCollection. - * - * @param events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for - * CollectionAction::Setup(). + * @param event The event to analyze. */ - void Setup(PamLevel2 *events); - - /*! @brief The post-analysis task definition. - * - * This override of the Finalize() method calls BlindCutCollection::Finalize() and then the Finalize() method of - * each action contained in the SmartCollection. - */ - void Finalize(); - - /*! @brief Post-selection tasks. - * - * This routine is automatically called after a good event has been selected by - * ApplyCut(). It will simply call BlindCutCollection::OnGood() and then CollectionAction::OnGood() for each - * action in the SmartCollection. - * @param event The event which satisfy the cut. - */ - void OnGood(PamLevel2 *event); - - /*! @brief Post-selection tasks. - * - * This routine is automatically called after a bad event has been rejected by - * ApplyCut(). It will simply call BlindCutCollection::OnBad() and then CollectionAction::OnBad() for each - * action in the SmartCollection. - * - * @see OnGood - * @param event The event which don't satisfy the cut. - * @param selectionResult The return value of the Check() routine. - */ - void OnBad(PamLevel2 *event, int selectionResult); - -private: - - std::vector _actions; - + int ApplyCut(PamLevel2 *event); }; #endif /* SMARTBLINDCOLLECTION_H_ */