1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* SmartBlindCollection.h |
3 |
|
|
* |
4 |
|
|
* Created on: 16-mag-2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file SmartBlindCollection.h The SmartBlindCollection class definition file */ |
9 |
|
|
|
10 |
|
|
#ifndef SMARTBLINDCOLLECTION_H_ |
11 |
|
|
#define SMARTBLINDCOLLECTION_H_ |
12 |
|
|
|
13 |
|
|
#include "../BlindCutCollection/BlindCutCollection.h" |
14 |
|
|
#include "../../CollectionActions/CollectionAction/CollectionAction.h" |
15 |
|
|
|
16 |
|
|
/*! @brief A blind collection class designed to use CollectionAction objects. |
17 |
|
|
* |
18 |
|
|
* The SmartBlindCollection class is designed to handle CollectionAction objects. These |
19 |
|
|
* defines the procedures to do when an event is selected or discarded. A SmartBlindCollection |
20 |
|
|
* handles a vector of these objects, calling CollectionAction::OnGood() for each of them |
21 |
|
|
* when a good event is selected and CollectionAction::OnBad() when a bad one is rejected. |
22 |
|
|
* It will also call the CollectionAction::Setup() and CollectionAction::Finalize() methods |
23 |
|
|
* at the beginning and at the end of the analysis, respectively. |
24 |
|
|
* This collection differs from SmartCollection only because it-s blind, ie., it will apply |
25 |
|
|
* all the cuts to each events, even if some of them fail. See #BlindCutCollection to get |
26 |
|
|
* more info about blind collections. |
27 |
|
|
*/ |
28 |
|
|
class SmartBlindCollection: public BlindCutCollection { |
29 |
|
|
|
30 |
|
|
public: |
31 |
|
|
|
32 |
|
|
/*! @brief Constructor. |
33 |
|
|
* |
34 |
|
|
* @param collectionName The collection's name. |
35 |
|
|
*/ |
36 |
|
|
SmartBlindCollection(const char* collectionName) : |
37 |
|
|
BlindCutCollection(collectionName), _actions(0) { |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
/*! @brief Destructor. */ |
41 |
|
|
~SmartBlindCollection(){ |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
/*! @brief Adds an action to the SmartCollection */ |
45 |
|
|
virtual void AddAction(CollectionAction& action); |
46 |
|
|
|
47 |
|
|
/*! @brief Returns the iAction-th action. |
48 |
|
|
* |
49 |
|
|
* @param iAction The index of the desired CollectionAction, defined as the insertion order |
50 |
|
|
* (from 0 to \#actions-1, see AddAction()). |
51 |
|
|
* @return pointer to the iAction-th action; NULL if the specified action cannot be found or if no actions are present. |
52 |
|
|
*/ |
53 |
|
|
CollectionAction *GetAction(unsigned int iAction); |
54 |
|
|
|
55 |
|
|
/*! @brief The pre-analysis task definition. |
56 |
|
|
* |
57 |
|
|
* This override of the Setup() method calls Setup() for the base class BlindCutCollection, and subsequently for each |
58 |
|
|
* action contained in the SmartCollection. |
59 |
|
|
* |
60 |
|
|
* @param events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for |
61 |
|
|
* CollectionAction::Setup(). |
62 |
|
|
*/ |
63 |
|
|
void Setup(PamLevel2 *events); |
64 |
|
|
|
65 |
|
|
/*! @brief The post-analysis task definition. |
66 |
|
|
* |
67 |
|
|
* This override of the Finalize() method calls BlindCutCollection::Finalize() and then the Finalize() method of |
68 |
|
|
* each action contained in the SmartCollection. |
69 |
|
|
*/ |
70 |
|
|
void Finalize(); |
71 |
|
|
|
72 |
|
|
/*! @brief Post-selection tasks. |
73 |
|
|
* |
74 |
|
|
* This routine is automatically called after a good event has been selected by |
75 |
|
|
* ApplyCut(). It will simply call BlindCutCollection::OnGood() and then CollectionAction::OnGood() for each |
76 |
|
|
* action in the SmartCollection. |
77 |
|
|
* @param event The event which satisfy the cut. |
78 |
|
|
*/ |
79 |
|
|
void OnGood(PamLevel2 *event); |
80 |
|
|
|
81 |
|
|
/*! @brief Post-selection tasks. |
82 |
|
|
* |
83 |
|
|
* This routine is automatically called after a bad event has been rejected by |
84 |
|
|
* ApplyCut(). It will simply call BlindCutCollection::OnBad() and then CollectionAction::OnBad() for each |
85 |
|
|
* action in the SmartCollection. |
86 |
|
|
* |
87 |
|
|
* @see OnGood |
88 |
|
|
* @param event The event which don't satisfy the cut. |
89 |
|
|
* @param selectionResult The return value of the Check() routine. |
90 |
|
|
*/ |
91 |
|
|
void OnBad(PamLevel2 *event, int selectionResult); |
92 |
|
|
|
93 |
|
|
private: |
94 |
|
|
|
95 |
|
|
std::vector<CollectionAction*> _actions; |
96 |
|
|
|
97 |
|
|
}; |
98 |
|
|
|
99 |
|
|
#endif /* SMARTBLINDCOLLECTION_H_ */ |