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

Annotation of /PamCut/Collections/EffCollection/EffCollection.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Wed Jan 27 15:59:11 2010 UTC (14 years, 10 months ago) by pam-fi
Branch: MAIN
Changes since 1.7: +10 -0 lines
File MIME type: text/plain
Bug in actions handling fixed.

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 pam-fi 1.7 /*! @enum EffCollection_ErrMethod to select the method of error computation */
16 pam-fi 1.6 enum EffCollection_ErrMethod {
17     EFFERR_SERGIO, ///< Flag for Sergio Ricciarini's Fortran routine
18     EFFERR_ROOT
19 pam-fi 1.5 ///< Flag for ROOT TGraphAsymErrors::BayesDivide()
20     };
21    
22 pam-fi 1.1 /*! @brief A verbose collection which computes the efficiency of a set of cuts.
23     *
24     * This class subdivides the cuts it contains into two classes: selection and detector
25     * cuts; detector cuts are evaluated after selection cuts. The collection will compute the
26     * efficiency of the whole detector cuts set evaluated using an efficiency sample selected
27     * by the selection cuts. Actions will be divided in selection and detector actions as well:
28     * adding a selection action, it will be placed after all the selection cuts inserted since
29     * the action insertion, and before all detector cuts. Detector actions are placed after all
30     * the cuts.
31     * This class implements specific methods to add selection and detector cuts; cuts added
32     * with the standard #AddCut method will be treated as detector cuts. The same for actions.
33 pam-fi 1.5 * Error computation is done either using Sergio Ricciarini's Fortran routine or ROOT's
34     * TGraphAsimmErrors::BayesDivide(). For both methods, the efficiency is arbitrarily set to
35     * 1.1 when less than 8 events survive the selection cuts. This is needed to avoid convergence
36     * problems in Sergio's routine, and the ROOT output has been consequently adapted to this
37     * convention.
38 pam-fi 1.2 *
39 pam-fi 1.1 */
40     class EffCollection: public VerboseCollection {
41    
42     public:
43    
44     /*! @brief Constructor.
45     *
46     * @param collectionName The collection's name.
47 pam-fi 1.2 * @param outFileBase The output file base name. If "", no file output will be produced; otherwise,
48 pam-fi 1.6 * a file named outFilebase + collection's name + ".txt" will be produced, containing
49     * the number of events surviving the detector cuts (1st column), the selection cuts (2nd column),
50 pam-fi 1.4 * the efficiency (3rd column), the lower (4th column) and upper (5th column) length
51     * of the efficiency's error bar.
52 pam-fi 1.7 * @param errMethod The method to use for error computation. Possible values are defined in #EffCollection_ErrMethod.
53     * @param owns If true, the collection will own the cuts and the actions, ie., it will
54     * destroy them in its destructor.
55 pam-fi 1.1 */
56 pam-fi 1.7 EffCollection(const char *collectionName, TString outFileBase = "", int errMethod = EFFERR_ROOT, bool owns = true);
57 pam-fi 1.1
58     /*! @brief Destructor. */
59     ~EffCollection() {
60    
61     }
62    
63     /*! @brief Adds a detector cut to the collection.
64     *
65     * For EffCollection, cuts added wit #AddCut will be treated as detector cuts.
66     *
67     * @param cut The PamCut-derived object to add to the collection.
68     */
69 pam-fi 1.7 void AddCut(PamCut *cut) {
70 pam-fi 1.1 AddDetectorCut(cut);
71     }
72    
73     /*! @brief Adds a detector cut to the collection.
74     *
75     * Adds a detector cut. Calling #AddCut will add a detector cut as well, and not a
76     * selection cut.
77     * @param cut The PamCut-derived object to add to the collection.
78     */
79 pam-fi 1.7 void AddDetectorCut(PamCut *cut);
80 pam-fi 1.1
81     /*! @brief Adds a selection cut to the collection.
82     *
83     * Adds a selection cut. Notice that calling #AddCut will add a detector cut , and not a
84     * selection cut.
85     * @param cut The PamCut-derived object to add to the collection.
86     */
87 pam-fi 1.7 void AddSelectionCut(PamCut *cut);
88 pam-fi 1.1
89     /*! @brief Adds an action to the detector cuts queue.
90     *
91     * For EffCollection, actions added wit #AddAction will be inserted in the detector cuts queue.
92     *
93     * @param action The CollectionAction-derived object to add to the collection.
94     */
95 pam-fi 1.7 void AddAction(CollectionAction *action) {
96 pam-fi 1.1 AddDetectorAction(action);
97     }
98    
99     /*! @brief Adds an action to the detector cuts queue.
100     *
101     * Adds a detector action, ie., an action placed in the detector cuts queue. Calling #AddAction will
102     * add a detector action as well, and not a selection action.
103     *
104     * @param action The CollectionAction-derived object to add to the collection.
105     */
106 pam-fi 1.7 void AddDetectorAction(CollectionAction *action);
107 pam-fi 1.1
108     /*! @brief Adds an action to the selection cuts queue.
109     *
110     * Adds a selection action, ie., an action placed in the selection cuts queue. Notice that calling
111     * #AddAction will add a detector action, and not a selection action.
112     *
113     * @param action The CollectionAction-derived object to add to the collection.
114     */
115 pam-fi 1.7 void AddSelectionAction(CollectionAction *action);
116 pam-fi 1.1
117     /*! @brief Applies the selection and detector cuts to the current event.
118     *
119     * @param event The event to analyze.
120     * @return CUTOK if the event survives all the selection and detector cuts.
121     */
122 pam-fi 1.8
123     /*! @brief The pre-analysis task definition.
124     *
125     * This override of the Setup() method sets up the selection and detector cuts and actions
126     *
127     * @param events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for
128     * VerboseCollection::Setup().
129     */
130     void Setup(PamLevel2 *events);
131    
132 pam-fi 1.1 int ApplyCut(PamLevel2 *event);
133    
134     /*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */
135    
136     /*! @brief The post analysis task.
137     *
138     */
139     void Finalize();
140    
141 pam-fi 1.2 protected:
142 pam-fi 1.1
143 pam-fi 1.3 /*! This collection contains the selection cuts. */
144 pam-fi 1.1 SmartCollection _selCollection;
145 pam-fi 1.3
146     /*! This collection contains the detector cuts. */
147 pam-fi 1.1 SmartCollection _detCollection;
148 pam-fi 1.3
149     /*! The base name of the output file. */
150 pam-fi 1.1 TString _outFileBase;
151 pam-fi 1.3
152 pam-fi 1.5 /*! The method used for error computation. */
153     int _errMethod;
154    
155 pam-fi 1.3 /*! The number of events surviving the detector cuts. */
156     unsigned int _det;
157    
158     /*! The number of events surviving the selection cuts. */
159     unsigned int _sel;
160 pam-fi 1.1
161     };
162    
163     #endif /* EFFCOLLECTION_H_ */

  ViewVC Help
Powered by ViewVC 1.1.23