#ifndef _sevt_StationTriggerData_h_ #define _sevt_StationTriggerData_h_ #include #include static const char CvsId_sevt_StationTriggerData[] = "$Id: StationTriggerData.h 21977 2012-10-03 21:46:02Z maris $"; namespace sevt { /*! \class StationTriggerData StationTriggerData.h "sevt/StationTriggerData.h" \brief %Station Trigger Data description \author Stefano Argiro, Darko Veberic \date 27 january 2003 \version $Id: StationTriggerData.h 21977 2012-10-03 21:46:02Z maris $ \ingroup sevt */ class StationTriggerData { public: enum Algorithm { // force explicit mapping for string array index, see StationTrigger.cc eNone = 0, eT1Threshold = 1, eT2Threshold = 2, eTimeOverThreshold = 3, eTimeOverThresholdDeconvoluted = 4, eMultiplicityOfPositiveSteps = 5, eRandom = 6, eMuon = 7, // muons are here just for backward compatibility eSilent = 8 }; enum PLDTrigger { ePLDNone = 0x00000000, // Latch triggers ePLDLatchThreshold = 0x00000001, ePLDLatchTOTA = 0x00000002, ePLDLatchTOTB = 0x00000004, ePLDLatchTOTC = 0x00000008, // now used by MOPS ePLDLatchRandom = 0x00000010, // Post-lach triggers ePLDThreshold = 0x00000100, ePLDTOTA = 0x00000200, ePLDTOTB = 0x00000400, ePLDTOTC = 0x00000800, // now used by MOPS ePLDRandom = 0x00001000, // (DV) Muon: this is not a PLD bit. It is set only explicitly via // SetAlgorithm(). This feature is maintained on behalf of some // modules (TankSimulator). ePLDMuon = 0x80000000 }; enum ErrorCode { eNoError = 0, eT3Lost, eT3NotFound, eT3TooYoung, eT3Already, eT1Stopped, eBadCompress, eDataLost }; int GetOffset() const { return fOffset; } int GetWindowSize() const { return fWindowSize; } int GetErrorCode() const { return fErrorCode; } int GetPLDTrigger() const { return fPLDTrigger; } // Threshold can be T1 or T2 /*bool IsThreshold() const { return fPLDTrigger & ePLDTotalThreshold; }*/ /// T1 TOT is always promoted to T2 TOT bool IsTimeOverThreshold() const { return fPLDTrigger & ePLDTotalTOT; } /// Time Over Threshold deconvoluted bool IsTimeOverThresholdDeconvoluted() const { return fPLDTrigger & ePLDTotalTOTD; } // Multiplicity of positive steps bool IsMultiplicityOfPositiveSteps() const { return fPLDTrigger & ePLDTotalMOPS; } /// Any of the PLD triggers (threshold or TOT) bool IsThresholdOrTimeOverThreshold() const { return fPLDTrigger & ePLDTotalThresholdOrTOT; } /// T1 events have non-zero window size bool IsT1() const { return fWindowSize && (IsThresholdOrTimeOverThreshold() || IsTimeOverThresholdDeconvoluted() || IsMultiplicityOfPositiveSteps()); } /// T2 events have zero window size bool IsT2() const { return IsT2Threshold() || IsTimeOverThreshold() || IsTimeOverThresholdDeconvoluted() || IsMultiplicityOfPositiveSteps(); } /// T1 threshold bool IsT1Threshold() const { return fWindowSize && (fPLDTrigger & ePLDTotalThreshold); } /// T2 threshold bool IsT2Threshold() const { return !fWindowSize && (fPLDTrigger & ePLDTotalThreshold); } bool IsRandom() const { return fPLDTrigger & ePLDTotalRandom; } bool IsMuon() const { return fWindowSize && (fPLDTrigger & ePLDMuon); } bool IsSilent() const { return fWindowSize && fErrorCode == eT3NotFound; } Algorithm GetAlgorithm() const; const std::string& GetAlgorithmName() const { return fgAlgorithmLookup[GetAlgorithm()]; } int GetPLDTimeOffset() const { return fPLDTimeOffset; } std::string GetPLDVersion() const { return fPLDVersion; } void SetOffset(const int offset) { fOffset = offset; } void SetWindowSize(const int windowSize) { fWindowSize = windowSize; } void SetErrorCode(const int errorCode) { fErrorCode = errorCode; } void SetPLDTrigger(const int trigger) { fPLDTrigger = trigger; } void SetAlgorithm(const Algorithm algo); void SetPLDTimeOffset(const int offset) { fPLDTimeOffset = offset; } void SetPLDVersion(const std::string version) { fPLDVersion = version; } private: StationTriggerData() : fOffset(-1), fWindowSize(-1), fErrorCode(-1), fPLDTrigger(ePLDNone), fPLDTimeOffset(0), fPLDVersion("Unknown") { } ~StationTriggerData() { } enum PLDTotalTrigger { // combined (see SD Calibration report by X. Bertou and PLD trigger guide) ePLDTotalThreshold = (ePLDLatchThreshold | ePLDThreshold), ePLDTotalTOT = (ePLDLatchTOTA | ePLDTOTA), // according to IoSdData ePLDTotalTOTD = (ePLDLatchTOTB | ePLDTOTB), ePLDTotalMOPS = (ePLDLatchTOTC | ePLDTOTC), ePLDTotalThresholdOrTOT = (ePLDTotalThreshold | ePLDTotalTOT), ePLDTotalRandom = (ePLDLatchRandom | ePLDRandom) }; int fOffset; int fWindowSize; int fErrorCode; int fPLDTrigger; int fPLDTimeOffset; std::string fPLDVersion; static const std::string fgAlgorithmLookup[]; friend class Station; friend class StationSimData; friend class utl::ShadowPtr; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: