/* * EffCollection.h * * Created on: 10/ago/2009 * Author: Nicola Mori */ /*! @file EffCollection.h The EffCollection class definition file. */ #ifndef EFFCOLLECTION_H_ #define EFFCOLLECTION_H_ #include "../VerboseCollection/VerboseCollection.h" /*! @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 * cuts; detector cuts are evaluated after selection cuts. The collection will compute the * efficiency of the whole detector cuts set evaluated using an efficiency sample selected * by the selection cuts. Actions will be divided in selection and detector actions as well: * adding a selection action, it will be placed after all the selection cuts inserted since * the action insertion, and before all detector cuts. Detector actions are placed after all * 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. * */ class EffCollection: public VerboseCollection { public: /*! @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. * */ EffCollection(const char *collectionName, TString rigBinsFile, TString &outFileBase = "", bool absRig = false); /*! @brief Destructor. */ ~EffCollection() { } /*! @brief Adds a detector cut to the collection. * * For EffCollection, cuts added wit #AddCut will be treated as detector cuts. * * @param cut The PamCut-derived object to add to the collection. */ void AddCut(PamCut &cut) { AddDetectorCut(cut); } /*! @brief Adds a detector cut to the collection. * * Adds a detector cut. Calling #AddCut will add a detector cut as well, and not a * selection cut. * @param cut The PamCut-derived object to add to the collection. */ void AddDetectorCut(PamCut &cut); /*! @brief Adds a selection cut to the collection. * * Adds a selection cut. Notice that calling #AddCut will add a detector cut , and not a * selection cut. * @param cut The PamCut-derived object to add to the collection. */ void AddSelectionCut(PamCut &cut); /*! @brief Adds an action to the detector cuts queue. * * For EffCollection, actions added wit #AddAction will be inserted in the detector cuts queue. * * @param action The CollectionAction-derived object to add to the collection. */ void AddAction(CollectionAction &action) { AddDetectorAction(action); } /*! @brief Adds an action to the detector cuts queue. * * Adds a detector action, ie., an action placed in the detector cuts queue. Calling #AddAction will * add a detector action as well, and not a selection action. * * @param action The CollectionAction-derived object to add to the collection. */ void AddDetectorAction(CollectionAction &action); /*! @brief Adds an action to the selection cuts queue. * * Adds a selection action, ie., an action placed in the selection cuts queue. Notice that calling * #AddAction will add a detector action, and not a selection action. * * @param action The CollectionAction-derived object to add to the collection. */ void AddSelectionAction(CollectionAction &action); /*! @brief Applies the selection and detector cuts to the current event. * * @param event The event to analyze. * @return CUTOK if the event survives all the selection and detector cuts. */ int ApplyCut(PamLevel2 *event); /*TODO: redefine GetCut and the other methods to comply with the new selection/detector cuts structure. */ /*! @brief The post analysis task. * */ void Finalize(); private: SmartCollection _selCollection; SmartCollection _detCollection; TString _outFileBase; bool _absRig; vector _bins; vector _sel; vector _det; unsigned int _outUp, _outDown; }; #endif /* EFFCOLLECTION_H_ */