// // File : FEFileReadout.hh // // Purpose: Declaration of the class FEFileReadout // // $Id: FEFileReadout.hh 11934 2011-01-25 08:55:29Z mathes $ // /** @file FEFileReadout.hh * Declaration of the class FEFileReadout. * @author H.-J. Mathes, FzK */ #ifndef _FEFileReadout_hh_ #define _FEFileReadout_hh_ #include #include #include // --- forward declaration(s) class FEPageDesc; class TMirrorEventFile; /** This class implements the interface given by the class FEReadout for a * TMirrorEventFile based data file. * * The original methods of the class FEReadout are overwritten by file * specific methods or left empty. The name of the data file in the directory * where this process is started, is 'data.root'. * * The behaviour of this class can be partly controlled by a corresponding * section in an ini-file. Thsi sections looks like: * \code [FEFileReadout] ; section to steer class FEFileReadout behaviour name= data.root ; name of the input file format= mirror ; file format is TMirrorEvent (=mirror) or TEyeEvent (=eye) loop=0 ; loop over the file (=1) or not (=0) random=0 ; read events in random order (=1) or not (=0) * \endcode * * @todo * @li complete the readout of the monitoring data */ class FEFileReadout : public VirtualReadout { public: /** Constructor for the class FEFileReadout. * * Initialize the following things: * @li set fColumnList * @li set fEndOfFile to false */ FEFileReadout(const char* ini_file="readout.ini",FILE* log_file=NULL); /** Constructor for the class FEFileReadout. * * This constructor gets a pointer to a TMirrorEvent passed from which * then the data are read. * * It is used only to test the TLT in a separate test frame ... */ FEFileReadout(TMirrorEvent**, const char* ini_file="readout.ini",FILE* log_file=NULL); /** Destructor of the class FEFileReadout. */ ~FEFileReadout(); /** Do the initialisation of the acquisition. * * Read parameters from ini-file. */ int AcquisitionInit(); /** Do the shutdown of the acquisition (no action !). */ int AcquisitionShutdown() { return 0; } /** Perform the start of the acquisition. * * @li init status/counting/flag variables * @li try to open the file data.root */ int AcquisitionStart(); /** Perform the stop of the acquisition. * * @li the data file is closed, the handle to it is deleted */ int AcquisitionStop(); /** Re-implementation of the corresponding method of the class * FEReadout. * * Some flags are resetted in order to make this implementation ready * to get/process for a new event. */ void DeleteEvent(FEPageDesc*); /** Fill the run header with some information got from the hardware. * * Actions: * @li read the run header from the file * @li copy data fields aka. FEReadout::FillRunHeader() */ void FillRunHeader(TMirrorRunHeader*); /** Fill the run trailer with some information got from the hardware. * * Actions:
* -- None -- */ void FillRunTrailer(TMirrorRunTrailer*); /** Do the readout of the TMirrorEventHeader object. * * Storage will be allocated if not provided by the caller. */ TMirrorEventHeader * GetEventHeader(FEPageDesc*,TMirrorEventHeader *header=NULL); /** Read the FADCData of the specified pixel. * * @see VirtualReadout for more details ! */ TFADCData *GetFADCData(FEPageDesc*,TFADCData*); /** Read the FADC data of the specified pixel. * * @see VirtualReadout for more details ! */ TFADCData* GetFADCData(FEPageDesc*, FdUtil::Fd::PixelNumber,TFADCData* data=NULL); /** Read the FADC data of the specified pixel. * * @see VirtualReadout for more details ! */ TFADCData* GetFADCData(FEPageDesc*,FdUtil::Fd::PixelNumber, TFADCData::FADCTraceInfo,TFADCData *data=NULL); /** Get the pixels monitoring data for the specified pixel. */ TFADCData::PixelMonitorData GetMonitorData(FEPageDesc*, FdUtil::Fd::PixelNumber,TFADCData::PixelMonitorData data=NULL); /** Get the pixels SLT data (TMirrorPixelData). */ TMirrorPixelData *GetPixelData(FEPageDesc*,TMirrorPixelData *data=NULL); /** Return the print level (verbosity level) for this class instance. */ static int GetPrintLevel() { return fgPrintLevel; } /** Wait for the occurence of a NxPage signal. * * As long as there are events in the file not read, this method will * return a new FEPageDesc, otherwise NULL. */ FEPageDesc* WaitForNextPage(); /** Set the print (verbosity) level for this class instance. */ static void SetPrintLevel(int level = 1) { fgPrintLevel = level; } /** Print the current parameters settings for this class to the passed * ostream. */ void PrintSettings(std::ostream& ostr=std::cout); protected: /** Init the parameters for the algorithms used by this class by reading * from ini-file. */ virtual void Init(); private: enum { kFromFile, kFromEvent }; // for fMode enum { kMirrorEvent, kEyeEvent }; // for fFileFormat static int fgPrintLevel; // verbose print level bool fEndOfFile; // flag that file end has been reached TMirrorEvent *fEvent; // buffer for a single event TMirrorEventFile *fEventFile; // handle to the file bool fEventLoaded; // indicates event in memory TMirrorEvent **fEventPtr; // pointer to single event buffer FILE *fLogfile; // sink for the logging stuff // run info TMirrorRunHeader *fRunHeader; TMirrorRunTrailer *fRunTrailer; int fMode; // operating mode of this class std::string fDataFilename; // name of the data file bool fDoLoop; // loop over the file int fFileFormat; // read events in TMirrorFormat (default) unsigned int fReadDelay; // delay between subsequent events in msec bool fReadRandom; // read events in random order }; #endif // _FEFileReadout_hh_