1 |
pam-fi |
1.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 the first event of each run and events with LT greater than an upper threshold (or with LT smaller than 0). |
23 |
|
|
*/ |
24 |
|
|
class LTQualCut: public PamCut { |
25 |
|
|
|
26 |
|
|
public: |
27 |
|
|
/*! @brief Constructor. |
28 |
|
|
* |
29 |
|
|
* @param cutName The cut's name. |
30 |
|
|
* @param threshold The live time maximum accepted value in ms. It is the value above which a live time is |
31 |
|
|
* considered invalid. It must be less than the trigger timeout on IDAQ board, which |
32 |
|
|
* is ~ 4600 ms. Default is 4500 (use of different values must be justified). |
33 |
|
|
*/ |
34 |
|
|
LTQualCut(const char* cutName, float threshold=4500) : |
35 |
|
|
PamCut(cutName), _previousRun(numeric_limits<UInt_t>::max()), _LT(-1.), _timeout(threshold) { |
36 |
|
|
} |
37 |
|
|
/*! @brief Destructor. */ |
38 |
|
|
~LTQualCut() { |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
/*! @brief The live time quality check. |
42 |
|
|
* |
43 |
|
|
* @param event The event to analyze. |
44 |
|
|
* @return #CUTOK if LT < timeout. |
45 |
|
|
* @return #LT_INVALID if LT > timeout. |
46 |
|
|
* @return #LT_NEWRUN if the event is at the beginning of the run. |
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() { return _LT; } |
55 |
|
|
|
56 |
|
|
private: |
57 |
|
|
unsigned int _previousRun; |
58 |
|
|
float _LT; |
59 |
|
|
float _timeout; |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
#endif /* LTQUALCUT_H_ */ |