10 |
#ifndef SMARTBLINDCOLLECTION_H_ |
#ifndef SMARTBLINDCOLLECTION_H_ |
11 |
#define SMARTBLINDCOLLECTION_H_ |
#define SMARTBLINDCOLLECTION_H_ |
12 |
|
|
13 |
#include "../BlindCutCollection/BlindCutCollection.h" |
#include "../SmartCollection/SmartCollection.h" |
|
#include "../../CollectionActions/CollectionAction/CollectionAction.h" |
|
14 |
|
|
15 |
/*! @brief A blind collection class designed to use CollectionAction objects. |
/*! @brief A blind collection class designed to use CollectionAction objects. |
16 |
* |
* |
17 |
* The SmartBlindCollection class is designed to handle CollectionAction objects. These |
* The SmartBlindCollection class is designed to handle CollectionAction objects. These |
18 |
* defines the procedures to do when an event is selected or discarded. A SmartBlindCollection |
* defines the procedures to do when an event is selected or discarded. |
19 |
* handles a vector of these objects, calling CollectionAction::OnGood() for each of them |
* This collection differs from SmartCollection only because it is blind, ie., it will apply |
20 |
* when a good event is selected and CollectionAction::OnBad() when a bad one is rejected. |
* all the cuts to each events, even if some of them fail (see #BlindCutCollection to get |
21 |
* It will also call the CollectionAction::Setup() and CollectionAction::Finalize() methods |
* more info about blind collections). In current implementation, after a cut has failed, it |
22 |
* at the beginning and at the end of the analysis, respectively. |
* will call OnBad for all the actions that come after that cut, regardless if, for example, |
23 |
* This collection differs from SmartCollection only because it-s blind, ie., it will apply |
* in a certain subsequent bunch all the cuts are satisfied. |
|
* all the cuts to each events, even if some of them fail. See #BlindCutCollection to get |
|
|
* more info about blind collections. |
|
24 |
*/ |
*/ |
25 |
class SmartBlindCollection: public BlindCutCollection { |
class SmartBlindCollection: public SmartCollection { |
26 |
|
|
27 |
public: |
public: |
28 |
|
|
31 |
* @param collectionName The collection's name. |
* @param collectionName The collection's name. |
32 |
*/ |
*/ |
33 |
SmartBlindCollection(const char* collectionName) : |
SmartBlindCollection(const char* collectionName) : |
34 |
BlindCutCollection(collectionName), _actions(0) { |
SmartCollection(collectionName){ |
35 |
} |
} |
36 |
|
|
37 |
/*! @brief Destructor. */ |
/*! @brief Destructor. */ |
38 |
~SmartBlindCollection(){ |
~SmartBlindCollection() { |
39 |
} |
} |
40 |
|
|
41 |
/*! @brief Adds an action to the SmartCollection */ |
/*! Applies the cuts and executes the actions. |
|
virtual void AddAction(CollectionAction& action); |
|
|
|
|
|
/*! @brief Returns the iAction-th action. |
|
42 |
* |
* |
43 |
* @param iAction The index of the desired CollectionAction, defined as the insertion order |
* When cuts are applied, a SmartBlindCollection will also execute the actions at the end |
44 |
* (from 0 to \#actions-1, see AddAction()). |
* of the bunches of cuts. |
|
* @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. |
|
45 |
* |
* |
46 |
* This override of the Setup() method calls Setup() for the base class BlindCutCollection, and subsequently for each |
* @param event The event to analyze. |
|
* action contained in the SmartCollection. |
|
|
* |
|
|
* @param events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for |
|
|
* CollectionAction::Setup(). |
|
47 |
*/ |
*/ |
48 |
void Setup(PamLevel2 *events); |
int ApplyCut(PamLevel2 *event); |
|
|
|
|
/*! @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<CollectionAction*> _actions; |
|
|
|
|
49 |
}; |
}; |
50 |
|
|
51 |
#endif /* SMARTBLINDCOLLECTION_H_ */ |
#endif /* SMARTBLINDCOLLECTION_H_ */ |