| 1 |
/* |
| 2 |
* AbsTimeCut.h |
| 3 |
* |
| 4 |
* Created on: 22-mag-2009 |
| 5 |
* Author: Nicola Mori |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file AbsTimeCut.h The AbsTimeCut class declaration file */ |
| 9 |
|
| 10 |
#ifndef ABSTIMECUT_H_ |
| 11 |
#define ABSTIMECUT_H_ |
| 12 |
|
| 13 |
#include "../../PamCutBase/PamCutBase.h" |
| 14 |
#include <TTimeStamp.h> |
| 15 |
|
| 16 |
/*! @enum AbsTimeCut_Return Return values for events discarded by AbsTimeCut. */ |
| 17 |
enum AbsTimeCut_Return { |
| 18 |
ABSTIMECUT_TOOEARLY, ///< The event happened before the time interval. |
| 19 |
ABSTIMECUT_TOOLATE |
| 20 |
///< The event happened after the time interval. |
| 21 |
}; |
| 22 |
|
| 23 |
/*! @brief A cut on absolute time. |
| 24 |
* |
| 25 |
* This selection rejects all events recorded outside a certain time interval. |
| 26 |
*/ |
| 27 |
class AbsTimeCut: public PamCut { |
| 28 |
|
| 29 |
public: |
| 30 |
|
| 31 |
/*! @brief Constructor. |
| 32 |
* |
| 33 |
* The parameters define the time interval. They have to be encoded as 6-digits numbers, |
| 34 |
* eg.: 18 March 2008 15:30:00 will be encoded as 080318 for the date and as 153000 for the time. |
| 35 |
* |
| 36 |
* @param cutName The cut's name |
| 37 |
* @param initDate The initial date (format: YYMMDD). |
| 38 |
* @param initTime The initial time (format: hhmmss). |
| 39 |
* @param endDate The final date (format: YYMMDD);. |
| 40 |
* @param endTime The final time (format: hhmmss). |
| 41 |
*/ |
| 42 |
AbsTimeCut(const char *cutName, const char *initDate, const char * initTime, const char * endDate, |
| 43 |
const char * endTime) : |
| 44 |
PamCut(cutName), _initDate(atoi(initDate)), _initTime(atoi(initTime)), _endDate(atoi(endDate)), _endTime(atoi( |
| 45 |
endTime)), _time() { |
| 46 |
} |
| 47 |
|
| 48 |
/*! @brief Destructor. */ |
| 49 |
~AbsTimeCut() { |
| 50 |
} |
| 51 |
|
| 52 |
/*! @brief The absolute time check. |
| 53 |
* |
| 54 |
* @param event The event to analyze. |
| 55 |
* @return #CUTOK if the event happened inside the time interval |
| 56 |
* @return #ABSTIMECUT_TOOEARLY if the event happened before the begin of the time interval. |
| 57 |
* @return #ABSTIMECUT_TOOLATE if the event happened after the end of the time interval. |
| 58 |
*/ |
| 59 |
int Check(PamLevel2 *event); |
| 60 |
|
| 61 |
private: |
| 62 |
|
| 63 |
unsigned int _initDate, _initTime, _endDate, _endTime; |
| 64 |
TTimeStamp _time; |
| 65 |
}; |
| 66 |
#endif /* ABSTIMECUT_H_ */ |