| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

RawRecord.h

Go to the documentation of this file.
00001 /* Raw Record: Classes for working with DAQ data records
00002  *
00003  * Created By: dandwyer@caltech.edu 2009/7/10
00004  */
00005 
00006 #ifndef RAWRECORD_H
00007 #define RAWRECORD_H
00008 
00009 #include "RawData/RawBuffer.h"
00010 
00011 #include <iostream>
00012 
00013 namespace DayaBay {
00014   class RawData;
00015 }
00016 
00017 namespace DayaBay {
00018 
00019   // Record as defined in DAQ raw data format
00020   class RawRecord : public RawBuffer {
00021     public:
00022       RawRecord(unsigned int* buffer=0, unsigned int version=0,
00023                 bool isOwner=false);
00024       RawRecord(DayaBay::RawRecord& record, bool adopt=false);
00025       virtual ~RawRecord();
00026       unsigned int type() const;       // Data field type marker
00027       unsigned int size() const;       // Size of the record, in integer segments
00028       unsigned int version() const;    // Data Version
00029       static unsigned int minimumSize(); // Minimum size of all records
00030       bool         isFileStart() const; // Is this a file start record?
00031       bool         isFileName() const; // Is this a file name record?
00032       bool         isMetadata() const; // Is this a metadata record?
00033       bool         isRunParameters() const; // Is this a run parameters record?
00034       bool         isCalibrationParameters() const; // Is this a calib record?
00035       bool         isDataSeparator() const; // Is this a data separator record?
00036       bool         isFileEnd() const; // Is this a file end record?
00037       DayaBay::RawRecord* clone() const; // Copy this data record
00038       virtual std::ostream& dump(std::ostream& str); // Print string description
00039       // Generate a new record of the correct type
00040       static DayaBay::RawRecord* makeNewRecord(unsigned int* buffer=0,
00041                                                unsigned int version=0,
00042                                                bool isOwner=false);
00043     private:
00044       unsigned int m_version; // Maintain version for this record
00045   };
00046 
00047   // File-related data blocks
00048   class RawFileStart: public RawRecord {
00049     public:
00050       RawFileStart(unsigned int* buffer=0, unsigned int version=0,
00051                    bool isOwner=false);
00052       RawFileStart(DayaBay::RawRecord& record, bool adopt=false);
00053       virtual ~RawFileStart();
00054       unsigned int fileVersion() const;
00055       unsigned int fileNumber() const;
00056       unsigned int date() const;
00057       unsigned int time() const;
00058       unsigned int sizeLimitDataBlocks() const;
00059       unsigned int sizeLimitMB() const;
00060       virtual std::ostream& dump(std::ostream& str); // Print string description
00061   };
00062 
00063   class RawFileName: public RawRecord {
00064     public:
00065       RawFileName(unsigned int* buffer=0, unsigned int version=0,
00066                   bool isOwner=false);
00067       RawFileName(DayaBay::RawRecord& record, bool adopt=false);
00068       virtual ~RawFileName();
00069       char*        appName() const;
00070       unsigned int appNameLength() const;
00071       char*        fileName() const;
00072       unsigned int fileNameLength() const;
00073       virtual std::ostream& dump(std::ostream& str); // Print string description
00074   };
00075 
00076   class RawMetadata: public RawRecord {
00077     public:
00078       RawMetadata(unsigned int* buffer=0, unsigned int version=0,
00079                   bool isOwner=false);
00080       RawMetadata(DayaBay::RawRecord& record, bool adopt=false);
00081       virtual ~RawMetadata();
00082       unsigned int entries() const;
00083       char*        string(unsigned int index) const;
00084       unsigned int stringLength(unsigned int index) const;
00085       virtual std::ostream& dump(std::ostream& str); // Print string description
00086   };
00087 
00088   class RawRunParameters: public RawRecord {
00089     public:
00090       RawRunParameters(unsigned int* buffer=0, unsigned int version=0,
00091                        bool isOwner=false);
00092       RawRunParameters(DayaBay::RawRecord& record, bool adopt=false);
00093       virtual ~RawRunParameters();
00094       unsigned int runNumber() const;
00095       unsigned int reconstructionEnabled() const;
00096       unsigned int triggerType() const;
00097       unsigned int detectorMask() const;
00098       virtual std::ostream& dump(std::ostream& str); // Print string description
00099   };
00100 
00101   class RawCalibrationParameters: public RawRecord {
00102     public:
00103       RawCalibrationParameters(unsigned int* buffer=0, unsigned int version=0,
00104                                bool isOwner=false);
00105       RawCalibrationParameters(DayaBay::RawRecord& record, bool adopt=false);
00106       virtual ~RawCalibrationParameters();
00107       unsigned int detectorId() const;
00108       unsigned int axis() const;
00109       unsigned int sourceId() const;
00110       unsigned int zPosition() const;
00111       unsigned int duration() const;
00112       unsigned int ledFrequency() const;
00113       unsigned int ltbMode() const;
00114       virtual std::ostream& dump(std::ostream& str); // Print string description
00115   };
00116 
00117   class RawDataSeparator: public RawRecord {
00118     public:
00119       RawDataSeparator(unsigned int* buffer=0, unsigned int version=0,
00120                        bool isOwner=false);
00121       RawDataSeparator(DayaBay::RawRecord& record, bool adopt=false);
00122       virtual ~RawDataSeparator();
00123       unsigned int blockNumber() const;
00124       unsigned int blockSize() const;
00125       DayaBay::RawData* data() const;
00126       virtual std::ostream& dump(std::ostream& str); // Print string description
00127   };
00128 
00129   class RawFileEnd: public RawRecord {
00130     public:
00131       RawFileEnd(unsigned int* buffer=0, unsigned int version=0,
00132                  bool isOwner=false);
00133       RawFileEnd(DayaBay::RawRecord& record, bool adopt=false);
00134       virtual ~RawFileEnd();
00135       unsigned int date() const;
00136       unsigned int time() const;
00137       unsigned int eventsInFile() const;
00138       unsigned int dataInFile() const;
00139       unsigned int eventsInRun() const;
00140       unsigned int dataInRun() const;
00141       unsigned int status() const;
00142       unsigned int end() const;
00143       virtual std::ostream& dump(std::ostream& str); // Print string description
00144   };
00145 
00146 }
00147 
00148 #endif // RAWRECORD_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:07:27 2011 for RawData by doxygen 1.4.7