--- PamCut/Collections/EffCollection/EffCollection.h 2009/08/11 08:37:18 1.1 +++ PamCut/Collections/EffCollection/EffCollection.h 2009/10/01 10:34:34 1.6 @@ -12,6 +12,13 @@ #include "../VerboseCollection/VerboseCollection.h" +/*! @enum Flags to select the method of error computation */ +enum EffCollection_ErrMethod { + EFFERR_SERGIO, ///< Flag for Sergio Ricciarini's Fortran routine + EFFERR_ROOT +///< Flag for ROOT TGraphAsymErrors::BayesDivide() +}; + /*! @brief A verbose collection which computes the efficiency of a set of cuts. * * This class subdivides the cuts it contains into two classes: selection and detector @@ -23,6 +30,11 @@ * the cuts. * This class implements specific methods to add selection and detector cuts; cuts added * with the standard #AddCut method will be treated as detector cuts. The same for actions. + * Error computation is done either using Sergio Ricciarini's Fortran routine or ROOT's + * TGraphAsimmErrors::BayesDivide(). For both methods, the efficiency is arbitrarily set to + * 1.1 when less than 8 events survive the selection cuts. This is needed to avoid convergence + * problems in Sergio's routine, and the ROOT output has been consequently adapted to this + * convention. * */ class EffCollection: public VerboseCollection { @@ -32,15 +44,14 @@ /*! @brief Constructor. * * @param collectionName The collection's name. - * @param rigBinsFile The file with the rigidity bins. - * @param outFileBase The output file base name. If != "", 3 text files will be produced: - * - outFileBase + "-sel.txt": events surviving the selection cuts for each bin; - * - outFileBase + "-det.txt": events surviving the detector cuts for each bin; - * - outFileBase + "-eff.txt": efficiency for each bin (will be 0 if no event survives selection cuts). - * @param absRig If true, the absolute rigidity of the selected events will be considered. - * + * @param outFileBase The output file base name. If "", no file output will be produced; otherwise, + * a file named outFilebase + collection's name + ".txt" will be produced, containing + * the number of events surviving the detector cuts (1st column), the selection cuts (2nd column), + * the efficiency (3rd column), the lower (4th column) and upper (5th column) length + * of the efficiency's error bar. + * @param errMethod The method to use for error computation. Possible values are defined in #EffRigCollection_ErrMethod. */ - EffCollection(const char *collectionName, TString rigBinsFile, TString &outFileBase = "", bool absRig = false); + EffCollection(const char *collectionName, TString outFileBase = "", int errMethod = EFFERR_ROOT); /*! @brief Destructor. */ ~EffCollection() { @@ -115,17 +126,26 @@ */ void Finalize(); -private: +protected: + /*! This collection contains the selection cuts. */ SmartCollection _selCollection; + + /*! This collection contains the detector cuts. */ SmartCollection _detCollection; + + /*! The base name of the output file. */ TString _outFileBase; - bool _absRig; - vector _bins; - vector _sel; - vector _det; - unsigned int _outUp, _outDown; + /*! The method used for error computation. */ + int _errMethod; + + /*! The number of events surviving the detector cuts. */ + unsigned int _det; + + /*! The number of events surviving the selection cuts. */ + unsigned int _sel; + }; #endif /* EFFCOLLECTION_H_ */