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

Diff of /PamCut/Collections/EffCollection/EffCollection.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by pam-fi, Tue Aug 11 08:37:18 2009 UTC revision 1.9 by pam-fi, Tue Mar 23 17:27:40 2010 UTC
# Line 12  Line 12 
12    
13  #include "../VerboseCollection/VerboseCollection.h"  #include "../VerboseCollection/VerboseCollection.h"
14    
15    /*! @enum EffCollection_ErrMethod to select the method of error computation */
16    enum EffCollection_ErrMethod {
17      EFFERR_SERGIO, ///< Flag for Sergio Ricciarini's Fortran routine
18      EFFERR_ROOT
19    ///< Flag for ROOT TGraphAsymErrors::BayesDivide()
20    };
21    
22  /*! @brief A verbose collection which computes the efficiency of a set of cuts.  /*! @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   * This class subdivides the cuts it contains into two classes: selection and detector
# Line 23  Line 30 
30   * the cuts.   * the cuts.
31   * This class implements specific methods to add selection and detector cuts; cuts added   * 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.   * with the standard #AddCut method will be treated as detector cuts. The same for actions.
33     * 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   *   *
39   */   */
40  class EffCollection: public VerboseCollection {  class EffCollection: public VerboseCollection {
# Line 32  public: Line 44  public:
44    /*! @brief Constructor.    /*! @brief Constructor.
45     *     *
46     * @param collectionName The collection's name.     * @param collectionName The collection's name.
47     * @param rigBinsFile The file with the rigidity bins.     * @param outFileBase The output file base name. If "", no file output will be produced; otherwise,
48     * @param outFileBase The output file base name. If != "", 3 text files will be produced:     *                    a file named outFilebase + collection's name + ".txt" will be produced, containing
49     *                    - outFileBase + "-sel.txt": events surviving the selection cuts for each bin;     *                    the number of events surviving the detector cuts (1st column), the selection cuts (2nd column),
50     *                    - outFileBase + "-det.txt": events surviving the detector cuts for each bin;     *                    the efficiency (3rd column), the lower (4th column) and upper (5th column) length
51     *                    - outFileBase + "-eff.txt": efficiency for each bin (will be 0 if no event survives selection cuts).     *                    of the efficiency's error bar.
52     * @param absRig If true, the absolute rigidity of the selected events will be considered.     * @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     */     */
56    EffCollection(const char *collectionName, TString rigBinsFile, TString &outFileBase = "", bool absRig = false);    EffCollection(const char *collectionName, TString outFileBase = "", int errMethod = EFFERR_ROOT, bool owns = true);
57    
58    /*! @brief Destructor. */    /*! @brief Destructor. */
59    ~EffCollection() {    ~EffCollection() {
# Line 53  public: Line 66  public:
66     *     *
67     * @param cut The PamCut-derived object to add to the collection.     * @param cut The PamCut-derived object to add to the collection.
68     */     */
69    void AddCut(PamCut &cut) {    void AddCut(PamCut *cut) {
70      AddDetectorCut(cut);      AddDetectorCut(cut);
71    }    }
72    
# Line 63  public: Line 76  public:
76     * selection cut.     * selection cut.
77     * @param cut The PamCut-derived object to add to the collection.     * @param cut The PamCut-derived object to add to the collection.
78     */     */
79    void AddDetectorCut(PamCut &cut);    void AddDetectorCut(PamCut *cut);
80    
81    /*! @brief Adds a selection cut to the collection.    /*! @brief Adds a selection cut to the collection.
82     *     *
# Line 71  public: Line 84  public:
84     * selection cut.     * selection cut.
85     * @param cut The PamCut-derived object to add to the collection.     * @param cut The PamCut-derived object to add to the collection.
86     */     */
87    void AddSelectionCut(PamCut &cut);    void AddSelectionCut(PamCut *cut);
88    
89    /*! @brief Adds an action to the detector cuts queue.    /*! @brief Adds an action to the detector cuts queue.
90     *     *
# Line 79  public: Line 92  public:
92     *     *
93     * @param action The CollectionAction-derived object to add to the collection.     * @param action The CollectionAction-derived object to add to the collection.
94     */     */
95    void AddAction(CollectionAction &action) {    void AddAction(CollectionAction *action) {
96      AddDetectorAction(action);      AddDetectorAction(action);
97    }    }
98    
# Line 90  public: Line 103  public:
103     *     *
104     * @param action The CollectionAction-derived object to add to the collection.     * @param action The CollectionAction-derived object to add to the collection.
105     */     */
106    void AddDetectorAction(CollectionAction &action);    void AddDetectorAction(CollectionAction *action);
107    
108    /*! @brief Adds an action to the selection cuts queue.    /*! @brief Adds an action to the selection cuts queue.
109     *     *
# Line 99  public: Line 112  public:
112     *     *
113     * @param action The CollectionAction-derived object to add to the collection.     * @param action The CollectionAction-derived object to add to the collection.
114     */     */
115    void AddSelectionAction(CollectionAction &action);    void AddSelectionAction(CollectionAction *action);
116    
117    /*! @brief Applies the selection and detector cuts to the current event.  
118      /*! @brief The pre-analysis task definition.
119       *
120       * This override of the Setup() method sets up the selection and detector cuts and actions
121     *     *
122     * @param event The event to analyze.     * @param events The PamLevel2 pointer to the events that will be analyzed. Used only as parameter for
123     * @return CUTOK if the event survives all the selection and detector cuts.     *          VerboseCollection::Setup().
124     */     */
125      void Setup(PamLevel2 *events);
126    
127      /*! @brief Applies the selection and detector cuts to the current event.
128        *
129        * @param event The event to analyze.
130        * @return CUTOK if the event survives all the selection and detector cuts.
131        */
132    
133    int ApplyCut(PamLevel2 *event);    int ApplyCut(PamLevel2 *event);
134    
135    /*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */    /*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */
# Line 115  public: Line 139  public:
139     */     */
140    void Finalize();    void Finalize();
141    
142  private:  protected:
143    
144      /*! This collection contains the selection cuts. */
145    SmartCollection _selCollection;    SmartCollection _selCollection;
146    
147      /*! This collection contains the detector cuts. */
148    SmartCollection _detCollection;    SmartCollection _detCollection;
149    
150      /*! The base name of the output file. */
151    TString _outFileBase;    TString _outFileBase;
   bool _absRig;  
   vector<float> _bins;  
   vector<unsigned int> _sel;  
   vector<unsigned int> _det;  
152    
153    unsigned int _outUp, _outDown;    /*! The method used for error computation. */
154      int _errMethod;
155    
156      /*! The number of events surviving the detector cuts. */
157      unsigned int _det;
158    
159      /*! The number of events surviving the selection cuts. */
160      unsigned int _sel;
161    
162  };  };
163    
164  #endif /* EFFCOLLECTION_H_ */  #endif /* EFFCOLLECTION_H_ */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.23