/[PAMELA software]/PamCut/Collections/SmartCollection/SmartCollection.h
ViewVC logotype

Contents of /PamCut/Collections/SmartCollection/SmartCollection.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed May 27 13:30:09 2009 UTC (15 years, 6 months ago) by pam-fi
Branch: DEV
CVS Tags: v0r00
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
First import

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

  ViewVC Help
Powered by ViewVC 1.1.23