| 1 | /* | 
| 2 | * LTQualCut.h | 
| 3 | * | 
| 4 | *  Created on: 10-mar-2009 | 
| 5 | *      Author: Nicola Mori, S. Ricciarini | 
| 6 | */ | 
| 7 |  | 
| 8 | /*! @file LTQualCut.h The LTQualCut class definition file */ | 
| 9 |  | 
| 10 | #ifndef LTQUALCUT_H_ | 
| 11 | #define LTQUALCUT_H_ | 
| 12 |  | 
| 13 | #include "../../PamCutBase/PamCutBase.h" | 
| 14 |  | 
| 15 | /*! @enum LT_Return Return values for rejected events */ | 
| 16 | enum LT_Return { | 
| 17 | //LT_NEWRUN, ///< Discarded because it is the first event of the run. | 
| 18 | LT_INVALID | 
| 19 | ///< Discarded because the LT is greater than timeout. | 
| 20 | }; | 
| 21 |  | 
| 22 | /*! @brief The live-time data quality cut: rejects events with LT greater | 
| 23 | *         than an upper threshold (or with LT smaller than 0). | 
| 24 | */ | 
| 25 | class LTQualCut: public PamCut { | 
| 26 |  | 
| 27 | public: | 
| 28 | /*! @brief Constructor. | 
| 29 | * | 
| 30 | * @param cutName The cut's name. | 
| 31 | * @param threshold The live time maximum accepted value in ms. It is the value above which a live time is | 
| 32 | *        considered invalid. It must be less than the trigger timeout on IDAQ board, which | 
| 33 | *        is ~ 4600 ms. Default is 4500 (use of different values must be justified). | 
| 34 | */ | 
| 35 | LTQualCut(const char* cutName, float threshold = 4500) : | 
| 36 | PamCut(cutName), _previousRun(numeric_limits<UInt_t>::max()), _LT(-1.), _timeout(threshold) { | 
| 37 | } | 
| 38 | /*! @brief Destructor. */ | 
| 39 | ~LTQualCut() { | 
| 40 | } | 
| 41 |  | 
| 42 | /*! @brief The live time quality check. | 
| 43 | * | 
| 44 | * @param event The event to analyze. | 
| 45 | * @return #CUTOK if LT < timeout. | 
| 46 | * @return #LT_INVALID if LT > timeout. | 
| 47 | */ | 
| 48 | int Check(PamLevel2 *event); | 
| 49 |  | 
| 50 | /*! @brief Returns the live time of the last examined event. | 
| 51 | * | 
| 52 | * @return The live time of the last examined event in ms (-1 -> first event of the run). | 
| 53 | */ | 
| 54 | float GetLT() { | 
| 55 | return _LT; | 
| 56 | } | 
| 57 |  | 
| 58 | private: | 
| 59 | unsigned int _previousRun; | 
| 60 | float _LT; | 
| 61 | float _timeout; | 
| 62 | }; | 
| 63 |  | 
| 64 | #endif /* LTQUALCUT_H_ */ |