| 1 |
/* |
| 2 |
* PktQualCut.h |
| 3 |
* |
| 4 |
* Created on: 10-mar-2009 |
| 5 |
* Author: Nicola Mori |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file PktQualCut.h The PktQualCut class definition file */ |
| 9 |
|
| 10 |
#ifndef PKTQUALCUT_H_ |
| 11 |
#define PKTQUALCUT_H_ |
| 12 |
|
| 13 |
#include "../../PamCutBase/PamCutBase.h" |
| 14 |
|
| 15 |
/*! @enum PKT_Return Return values for rejected events */ |
| 16 |
enum PKT_Return { |
| 17 |
PKT_NEWRUN, ///< Discarded because it is the first event of the run. |
| 18 |
PKT_INVALID |
| 19 |
///< Discarded because the packet number is not valid. |
| 20 |
}; |
| 21 |
|
| 22 |
using std::numeric_limits; |
| 23 |
/*! @brief The packet number quality cut. |
| 24 |
* |
| 25 |
* This cut rejects events whose packet number is less than that of the previous event. |
| 26 |
* When a new run starts, the previous packet number is set to the current one and the |
| 27 |
* current event (ie., the first event of the run) is discarded. |
| 28 |
*/ |
| 29 |
class PktQualCut: public PamCut { |
| 30 |
|
| 31 |
public: |
| 32 |
/*! @brief Constructor. */ |
| 33 |
PktQualCut(const char *cutName) : |
| 34 |
PamCut(cutName), _previousPkt(numeric_limits<UInt_t>::max()), _previousRun(numeric_limits<UInt_t>::max()) { |
| 35 |
} |
| 36 |
/*! @brief Destructor. */ |
| 37 |
~PktQualCut() { |
| 38 |
} |
| 39 |
|
| 40 |
/*! @brief The packet number quality check. |
| 41 |
* |
| 42 |
* @param event The event to analyze. |
| 43 |
* @return #CUTOK if packet number > previous packet number. |
| 44 |
* @return #PKT_NEWRUN if the event has been discarded since it is the first of the run |
| 45 |
* @return #PKT_INVALID if packet number > previous packet number. |
| 46 |
*/ |
| 47 |
int Check(PamLevel2 *event); |
| 48 |
|
| 49 |
private: |
| 50 |
UInt_t _previousPkt; |
| 51 |
UInt_t _previousRun; |
| 52 |
|
| 53 |
}; |
| 54 |
|
| 55 |
#endif /* PKTQUALCUT_H_ */ |