1 |
pam-fi |
1.1 |
/* |
2 |
|
|
* EffCollection.h |
3 |
|
|
* |
4 |
|
|
* Created on: 10/ago/2009 |
5 |
|
|
* Author: Nicola Mori |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
/*! @file EffCollection.h The EffCollection class definition file. */ |
9 |
|
|
|
10 |
|
|
#ifndef EFFCOLLECTION_H_ |
11 |
|
|
#define EFFCOLLECTION_H_ |
12 |
|
|
|
13 |
|
|
#include "../VerboseCollection/VerboseCollection.h" |
14 |
|
|
|
15 |
|
|
/*! @brief A verbose collection which computes the efficiency of a set of cuts. |
16 |
|
|
* |
17 |
|
|
* This class subdivides the cuts it contains into two classes: selection and detector |
18 |
|
|
* cuts; detector cuts are evaluated after selection cuts. The collection will compute the |
19 |
|
|
* efficiency of the whole detector cuts set evaluated using an efficiency sample selected |
20 |
|
|
* by the selection cuts. Actions will be divided in selection and detector actions as well: |
21 |
|
|
* adding a selection action, it will be placed after all the selection cuts inserted since |
22 |
|
|
* the action insertion, and before all detector cuts. Detector actions are placed after all |
23 |
|
|
* the cuts. |
24 |
|
|
* This class implements specific methods to add selection and detector cuts; cuts added |
25 |
|
|
* with the standard #AddCut method will be treated as detector cuts. The same for actions. |
26 |
|
|
* |
27 |
pam-fi |
1.2 |
* |
28 |
pam-fi |
1.1 |
*/ |
29 |
|
|
class EffCollection: public VerboseCollection { |
30 |
|
|
|
31 |
|
|
public: |
32 |
|
|
|
33 |
|
|
/*! @brief Constructor. |
34 |
|
|
* |
35 |
|
|
* @param collectionName The collection's name. |
36 |
pam-fi |
1.2 |
* @param outFileBase The output file base name. If "", no file output will be produced; otherwise, |
37 |
|
|
* a file named outFilebase + "-eff.txt" will be produced, containing the number of |
38 |
pam-fi |
1.4 |
* events surviving the detector cuts (1st column), the selection cuts (2nd column), |
39 |
|
|
* the efficiency (3rd column), the lower (4th column) and upper (5th column) length |
40 |
|
|
* of the efficiency's error bar. |
41 |
pam-fi |
1.1 |
*/ |
42 |
pam-fi |
1.2 |
EffCollection(const char *collectionName, TString outFileBase = ""); |
43 |
pam-fi |
1.1 |
|
44 |
|
|
/*! @brief Destructor. */ |
45 |
|
|
~EffCollection() { |
46 |
|
|
|
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
/*! @brief Adds a detector cut to the collection. |
50 |
|
|
* |
51 |
|
|
* For EffCollection, cuts added wit #AddCut will be treated as detector cuts. |
52 |
|
|
* |
53 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
54 |
|
|
*/ |
55 |
|
|
void AddCut(PamCut &cut) { |
56 |
|
|
AddDetectorCut(cut); |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
/*! @brief Adds a detector cut to the collection. |
60 |
|
|
* |
61 |
|
|
* Adds a detector cut. Calling #AddCut will add a detector cut as well, and not a |
62 |
|
|
* selection cut. |
63 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
64 |
|
|
*/ |
65 |
|
|
void AddDetectorCut(PamCut &cut); |
66 |
|
|
|
67 |
|
|
/*! @brief Adds a selection cut to the collection. |
68 |
|
|
* |
69 |
|
|
* Adds a selection cut. Notice that calling #AddCut will add a detector cut , and not a |
70 |
|
|
* selection cut. |
71 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
72 |
|
|
*/ |
73 |
|
|
void AddSelectionCut(PamCut &cut); |
74 |
|
|
|
75 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
76 |
|
|
* |
77 |
|
|
* For EffCollection, actions added wit #AddAction will be inserted in the detector cuts queue. |
78 |
|
|
* |
79 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
80 |
|
|
*/ |
81 |
|
|
void AddAction(CollectionAction &action) { |
82 |
|
|
AddDetectorAction(action); |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
86 |
|
|
* |
87 |
|
|
* Adds a detector action, ie., an action placed in the detector cuts queue. Calling #AddAction will |
88 |
|
|
* add a detector action as well, and not a selection action. |
89 |
|
|
* |
90 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
91 |
|
|
*/ |
92 |
|
|
void AddDetectorAction(CollectionAction &action); |
93 |
|
|
|
94 |
|
|
/*! @brief Adds an action to the selection cuts queue. |
95 |
|
|
* |
96 |
|
|
* Adds a selection action, ie., an action placed in the selection cuts queue. Notice that calling |
97 |
|
|
* #AddAction will add a detector action, and not a selection action. |
98 |
|
|
* |
99 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
100 |
|
|
*/ |
101 |
|
|
void AddSelectionAction(CollectionAction &action); |
102 |
|
|
|
103 |
|
|
/*! @brief Applies the selection and detector cuts to the current event. |
104 |
|
|
* |
105 |
|
|
* @param event The event to analyze. |
106 |
|
|
* @return CUTOK if the event survives all the selection and detector cuts. |
107 |
|
|
*/ |
108 |
|
|
int ApplyCut(PamLevel2 *event); |
109 |
|
|
|
110 |
|
|
/*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */ |
111 |
|
|
|
112 |
|
|
/*! @brief The post analysis task. |
113 |
|
|
* |
114 |
|
|
*/ |
115 |
|
|
void Finalize(); |
116 |
|
|
|
117 |
pam-fi |
1.2 |
protected: |
118 |
pam-fi |
1.1 |
|
119 |
pam-fi |
1.3 |
/*! This collection contains the selection cuts. */ |
120 |
pam-fi |
1.1 |
SmartCollection _selCollection; |
121 |
pam-fi |
1.3 |
|
122 |
|
|
/*! This collection contains the detector cuts. */ |
123 |
pam-fi |
1.1 |
SmartCollection _detCollection; |
124 |
pam-fi |
1.3 |
|
125 |
|
|
/*! The base name of the output file. */ |
126 |
pam-fi |
1.1 |
TString _outFileBase; |
127 |
pam-fi |
1.3 |
|
128 |
|
|
/*! The number of events surviving the detector cuts. */ |
129 |
|
|
unsigned int _det; |
130 |
|
|
|
131 |
|
|
/*! The number of events surviving the selection cuts. */ |
132 |
|
|
unsigned int _sel; |
133 |
pam-fi |
1.1 |
|
134 |
|
|
}; |
135 |
|
|
|
136 |
|
|
#endif /* EFFCOLLECTION_H_ */ |