// // File : VTltProcessor.hh // // Purpose: Declaration of the class VTltProcessor // // $Id: VTltProcessor.hh 9725 2010-09-28 07:31:17Z mathes $ // /** @file VTltProcessor.hh * Declaration of the class VTltProcessor. * @author H.-J. Mathes, FzK */ #ifndef _VTltProcessor_hh_ #define _VTltProcessor_hh_ #include #include #include #include #include // --- forward declaration(s) class VirtualReadout; class FEPageDesc; class VMirrorEvent; /** Abstract base class for all type of TLT processors. */ class VTltProcessor { public: /** */ typedef enum { kUnknown, kPrototype, kMultiplicity, kMStc } ETltType; /** Constructor for the class VTltProcessor. */ VTltProcessor(const char *name); /** Destructor of the class VTltProcessor. */ virtual ~VTltProcessor() { } /** Clear internal data structures to be prepared for the next Event. */ virtual void Clear() = 0; /** Perform the TLT decision. */ virtual void Decide(VMirrorEvent*) = 0; /** Finsih internal data structures etc. (optional) */ virtual void Finish() { } /** Return the EMiEventLabel which has been assigned to the current event. * * As long as the two steps decision is not finished, the label * '???' is returned. */ virtual TMirrorEventHeader::EMiEventLabel GetEventLabel() { return fEventLabel; } /** Return the name assigned (during construction) to the TLT processor. */ virtual const std::string GetName() { return fName; } /** Set the level of verbosity for all instances of this class. */ static int GetPrintLevel() { return fgPrintLevel; } /** Get the type of the TLT (enum ETltType). */ virtual ETltType GetTltType() { return fTltType; } /** Get the 'verbose' menaing of the ETltType. */ static std::string GetVerboseTltType(ETltType); /** Initialize internal data structures etc. (optional) */ virtual void Init() { } /** Return 'true' if the event has been accepted. */ virtual bool IsEventAccepted() { return fEventAccepted; } /** Print the actual settings of this instance of VTltProcessor. */ virtual void PrintSettings(std::ostream& ostr=FD_ERRLOGSTREAM(FdUtil::ErrorLogger::eWarning)) { ostr << "VTltProcessor::PrintSettings('" << fName << "') is not implemented !" << std::endl; } /** Set a handle for the log file into which the TLT information is * written to. */ virtual void SetLogfile(std::FILE* file) { fTltLogfile = file; } /** Set the level of verbosity for all instances of this class. */ static void SetPrintLevel(int level) { fgPrintLevel = level; } /** Set the type (ETltType) of this VTltProcessor. */ virtual void SetTltType(ETltType tlt_type) { fTltType = tlt_type; } protected: /** Set a flag that the event is accepted. */ void SetEventAccepted(bool acc=true) { fEventAccepted = acc; } /** Set a classification 'label' for the event. */ void SetEventLabel(TMirrorEventHeader::EMiEventLabel label) { fEventLabel = label; } /** The print level (= level of verbosity) for all (derived) instances * of this class. */ static int fgPrintLevel; std::FILE *fTltLogfile; //<<< a log file for TLT actions private: // these ones don't exist VTltProcessor(); VTltProcessor(const VTltProcessor&); bool fEventAccepted; TMirrorEventHeader::EMiEventLabel fEventLabel; ETltType fTltType; std::string fName; }; /** This class implements a dummy TLT processor (with the interface * VTltProcessor). * * For the member function documentation @see VTltProcessor. */ class DummyTltProcessor : public VTltProcessor { public: /** */ DummyTltProcessor() : VTltProcessor("DummyTltProcessor") { } /** */ void Clear() { } /** */ void Decide(VMirrorEvent*) { } /** */ TMirrorEventHeader::EMiEventLabel GetEventLabel() { return TMirrorEventHeader::kAcceptedEvent; } /** */ bool IsEventAccepted() { return true; } }; #if 0 #include // Version_t namespace MiReadout { /** This structure describes the parameters which ... */ typedef struct _VTltParametersRec { /** Version of this struct. */ Version_t fVersion; /** Type of the TLT in use. */ VTltProcessor::ETltType fTltType; } VTltParametersRec, *VTltParameters; } // namespace MiReadout #endif #endif // _VTltProcessor_hh_