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 |
|
|
* events surviving the detector cuts (1st column), the selection cuts (2nd column) |
39 |
|
|
* and the efficiency (3rd column). |
40 |
pam-fi |
1.1 |
*/ |
41 |
pam-fi |
1.2 |
EffCollection(const char *collectionName, TString outFileBase = ""); |
42 |
pam-fi |
1.1 |
|
43 |
|
|
/*! @brief Destructor. */ |
44 |
|
|
~EffCollection() { |
45 |
|
|
|
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
/*! @brief Adds a detector cut to the collection. |
49 |
|
|
* |
50 |
|
|
* For EffCollection, cuts added wit #AddCut will be treated as detector cuts. |
51 |
|
|
* |
52 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
53 |
|
|
*/ |
54 |
|
|
void AddCut(PamCut &cut) { |
55 |
|
|
AddDetectorCut(cut); |
56 |
|
|
} |
57 |
|
|
|
58 |
|
|
/*! @brief Adds a detector cut to the collection. |
59 |
|
|
* |
60 |
|
|
* Adds a detector cut. Calling #AddCut will add a detector cut as well, and not a |
61 |
|
|
* selection cut. |
62 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
63 |
|
|
*/ |
64 |
|
|
void AddDetectorCut(PamCut &cut); |
65 |
|
|
|
66 |
|
|
/*! @brief Adds a selection cut to the collection. |
67 |
|
|
* |
68 |
|
|
* Adds a selection cut. Notice that calling #AddCut will add a detector cut , and not a |
69 |
|
|
* selection cut. |
70 |
|
|
* @param cut The PamCut-derived object to add to the collection. |
71 |
|
|
*/ |
72 |
|
|
void AddSelectionCut(PamCut &cut); |
73 |
|
|
|
74 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
75 |
|
|
* |
76 |
|
|
* For EffCollection, actions added wit #AddAction will be inserted in the detector cuts queue. |
77 |
|
|
* |
78 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
79 |
|
|
*/ |
80 |
|
|
void AddAction(CollectionAction &action) { |
81 |
|
|
AddDetectorAction(action); |
82 |
|
|
} |
83 |
|
|
|
84 |
|
|
/*! @brief Adds an action to the detector cuts queue. |
85 |
|
|
* |
86 |
|
|
* Adds a detector action, ie., an action placed in the detector cuts queue. Calling #AddAction will |
87 |
|
|
* add a detector action as well, and not a selection action. |
88 |
|
|
* |
89 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
90 |
|
|
*/ |
91 |
|
|
void AddDetectorAction(CollectionAction &action); |
92 |
|
|
|
93 |
|
|
/*! @brief Adds an action to the selection cuts queue. |
94 |
|
|
* |
95 |
|
|
* Adds a selection action, ie., an action placed in the selection cuts queue. Notice that calling |
96 |
|
|
* #AddAction will add a detector action, and not a selection action. |
97 |
|
|
* |
98 |
|
|
* @param action The CollectionAction-derived object to add to the collection. |
99 |
|
|
*/ |
100 |
|
|
void AddSelectionAction(CollectionAction &action); |
101 |
|
|
|
102 |
|
|
/*! @brief Applies the selection and detector cuts to the current event. |
103 |
|
|
* |
104 |
|
|
* @param event The event to analyze. |
105 |
|
|
* @return CUTOK if the event survives all the selection and detector cuts. |
106 |
|
|
*/ |
107 |
|
|
int ApplyCut(PamLevel2 *event); |
108 |
|
|
|
109 |
|
|
/*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */ |
110 |
|
|
|
111 |
|
|
/*! @brief The post analysis task. |
112 |
|
|
* |
113 |
|
|
*/ |
114 |
|
|
void Finalize(); |
115 |
|
|
|
116 |
pam-fi |
1.2 |
protected: |
117 |
pam-fi |
1.1 |
|
118 |
pam-fi |
1.3 |
/*! This collection contains the selection cuts. */ |
119 |
pam-fi |
1.1 |
SmartCollection _selCollection; |
120 |
pam-fi |
1.3 |
|
121 |
|
|
/*! This collection contains the detector cuts. */ |
122 |
pam-fi |
1.1 |
SmartCollection _detCollection; |
123 |
pam-fi |
1.3 |
|
124 |
|
|
/*! The base name of the output file. */ |
125 |
pam-fi |
1.1 |
TString _outFileBase; |
126 |
pam-fi |
1.3 |
|
127 |
|
|
/*! The number of events surviving the detector cuts. */ |
128 |
|
|
unsigned int _det; |
129 |
|
|
|
130 |
|
|
/*! The number of events surviving the selection cuts. */ |
131 |
|
|
unsigned int _sel; |
132 |
pam-fi |
1.1 |
|
133 |
|
|
}; |
134 |
|
|
|
135 |
|
|
#endif /* EFFCOLLECTION_H_ */ |