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

In This Package:

RawData.h

Go to the documentation of this file.
00001 /* Raw Data: Classes for representing Raw Event Data.
00002  *
00003  * Created By: dandwyer@caltech.edu 2009/7/10
00004  */
00005 
00006 #ifndef RAWDATA_H
00007 #define RAWDATA_H
00008 
00009 #include "RawData/RawBuffer.h"
00010 #include <iostream>
00011 
00012 namespace DayaBay {
00013 
00014   // Base raw data block
00015   class RawData : public RawBuffer {
00016     public:
00017       RawData(unsigned int* buffer=0, unsigned int majorVersion=0, 
00018               unsigned int minorVersion=0, bool isOwner=false);
00019       ~RawData();
00020       unsigned int type() const;         // Data field type marker
00021       unsigned int majorVersion() const; // Major Data Version
00022       unsigned int minorVersion() const; // Minor Data Version
00023       bool         isEventType() const;  // Is event data block?
00024       bool         isModuleType() const; // Is module data block?
00025       virtual std::ostream& dump(std::ostream& str); // Print string description
00026       // Generate a new data object of the correct type
00027       static DayaBay::RawData* makeNewData(unsigned int* buffer=0,
00028                                            unsigned int majorVersion=0,
00029                                            unsigned int minorVersion=0,
00030                                            bool isOwner=false);
00031     protected:
00032       unsigned int m_majorVersion; // Major version for this data block
00033       unsigned int m_minorVersion; // Minor version for this data block
00034   };
00035 
00036 
00037   // Base type for specific data fragments
00038   class RawFragment: public RawData {
00039     public:
00040       RawFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00041                   unsigned int minorVersion=0, bool isOwner=false);
00042       ~RawFragment();
00043       unsigned int type() const;              // Type of fragment
00044       virtual unsigned int size() const;      // Size of fragment
00045       virtual std::ostream& dump(std::ostream& str); // Print string description
00046   };
00047 
00048   // Head fragment for data block
00049   class HeadFragment: public RawFragment {
00050     public:
00051       HeadFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00052                    unsigned int minorVersion=0, bool isOwner=false);
00053       ~HeadFragment();
00054       virtual unsigned int size() const;      // Size of fragment
00055       unsigned int status() const;
00056       unsigned int triggerNumber() const;
00057       virtual unsigned int headType() const;  // Type of Head fragment
00058       virtual std::ostream& dump(std::ostream& str); // Print string description
00059   };
00060 
00061   // Tail fragment for data block
00062   class TailFragment: public RawFragment {
00063     public:
00064       TailFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00065                    unsigned int minorVersion=0, bool isOwner=false);
00066       ~TailFragment();
00067       virtual unsigned int size() const;      // Size of fragment
00068       unsigned int dataSize() const;          // Size of all data in block
00069       virtual unsigned int tailType() const;  // Type of Tail fragment
00070       virtual std::ostream& dump(std::ostream& str); // Print string description
00071   };
00072 
00073   // Local Trigger Board specific Head fragment
00074   class LtbHeadFragment: public HeadFragment {
00075     public:
00076       LtbHeadFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00077                       unsigned int minorVersion=0, bool isOwner=false);
00078       ~LtbHeadFragment();
00079       virtual unsigned int headType() const;  // Type of Head fragment
00080       unsigned int clockError() const;
00081       unsigned int ltbDataVersion() const;
00082       unsigned int numberInternalLocalTrigger() const;
00083       unsigned int numberSavedInternalLocalTrigger() const;
00084       virtual std::ostream& dump(std::ostream& str); // Print string description
00085   };
00086 
00087   // Local Trigger Board specific Tail fragment
00088   class LtbTailFragment: public TailFragment {
00089     public:
00090       LtbTailFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00091                       unsigned int minorVersion=0, bool isOwner=false);
00092       ~LtbTailFragment();
00093       virtual unsigned int tailType() const;  // Type of Tail fragment
00094       virtual std::ostream& dump(std::ostream& str); // Print string description
00095   };
00096 
00097   // PMT FEE specific Head fragment
00098   class FeeHeadFragment: public HeadFragment {
00099     public:
00100       FeeHeadFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00101                       unsigned int minorVersion=0, bool isOwner=false);
00102       ~FeeHeadFragment();
00103       virtual unsigned int headType() const;  // Type of Head fragment
00104       unsigned int feeDataVersion() const;
00105       virtual std::ostream& dump(std::ostream& str); // Print string description
00106   };
00107 
00108   // PMT FEE specific Tail fragment
00109   class FeeTailFragment: public TailFragment {
00110     public:
00111       FeeTailFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00112                       unsigned int minorVersion=0, bool isOwner=false);
00113       ~FeeTailFragment();
00114       virtual unsigned int tailType() const;  // Type of Tail fragment
00115       virtual std::ostream& dump(std::ostream& str); // Print string description
00116   };
00117 
00118   // Base type for specific data fragments
00119   class DataFragment: public RawFragment {
00120     public:
00121       DataFragment(unsigned int* buffer=0, unsigned int majorVersion=0, 
00122                    unsigned int minorVersion=0, bool isOwner=false);
00123       ~DataFragment();
00124       virtual unsigned int size() const;      // Size of fragment
00125       virtual unsigned int dataType() const;  // Type of Data fragment
00126       bool                 isLocalTriggerData() const; // Is LTB data?
00127       bool                 isFeePeakData() const; // Is FEE Peak data?
00128       virtual std::ostream& dump(std::ostream& str); // Print string description
00129   };
00130 
00131   // Local Trigger Board data block
00132   class LocalTriggerData: public DataFragment {
00133     public:
00134       LocalTriggerData(unsigned int* buffer=0, unsigned int majorVersion=0, 
00135                        unsigned int minorVersion=0, 
00136                        unsigned int ltbDataVersion=0,
00137                        bool isOwner=false);
00138       ~LocalTriggerData();
00139       virtual unsigned int size() const;      // Local Trigger data size
00140       virtual unsigned int dataType() const;  // Type of Data fragment
00141       unsigned int ltbDataVersion() const;
00142       unsigned int sequenceNumber() const;
00143       unsigned int readOutType() const;
00144       unsigned int triggerType() const;
00145       unsigned int hour() const;
00146       unsigned int minute() const;
00147       unsigned int second() const;
00148       unsigned int hsum() const;
00149       unsigned int esumComp() const;
00150       unsigned int esum() const;
00151       unsigned int crossTriggerSource() const;
00152       // Available in LTB Data version == 1
00153       unsigned int year() const;
00154       unsigned int month() const;
00155       unsigned int day() const;
00156       unsigned int clock() const;
00157       // Available in LTB Data version >= 2
00158       unsigned int accumulationStatus() const;
00159       unsigned int gpsValid() const;
00160       unsigned int timestampType() const;
00161       unsigned int clockValid() const;
00162       unsigned int unixtimeHigh() const;
00163       unsigned int unixtimeLow() const;
00164       unsigned int unixtime() const;
00165       unsigned int days() const;
00166       unsigned int accumulationHigh() const;
00167       unsigned int nanosecondHigh() const;
00168       unsigned int accumulationLow() const;
00169       unsigned int nanosecondLow() const;
00170       int          accumulation() const;
00171       unsigned int nanosecond() const;
00172       unsigned int feeBufferStatus() const;
00173       unsigned int ltbBufferStatus() const;
00174       unsigned int blockedTrigger() const;
00175       bool         isUtcTime() const;
00176       bool         isUnixTime() const;
00177       // End version >=2
00178       bool         isManualTrigger() const;  // Is Manual trigger?
00179       bool         isCrossTrigger() const;  // Is Cross trigger?
00180       bool         isPeriodicTrigger() const;  // Is Periodic trigger?
00181       bool         isMultiplicityTrigger() const;  // Is Multiplicity trigger?
00182       bool         isEsumAdcTrigger() const;  // Is Esum ADC trigger?
00183       bool         isEsumCompHighTrigger() const; // Is Esum Comp High trigger?
00184       bool         isEsumCompLowTrigger() const;  // Is Esum Comp Low trigger?
00185       bool         isEsumCompAllTrigger() const;  // Is Esum Comp All trigger?
00186       virtual std::ostream& dump(std::ostream& str); // Print string description
00187     protected:
00188       unsigned int m_ltbDataVersion;
00189   };
00190 
00191   // FEE FPGA Peak-finding data block
00192   class FeePeakData: public DataFragment {
00193     public:
00194       FeePeakData(unsigned int* buffer=0, unsigned int majorVersion=0, 
00195                   unsigned int minorVersion=0, unsigned int feeDataVersion=0, 
00196                   bool isOwner=false);
00197       ~FeePeakData();
00198       virtual unsigned int size() const;      // TDC/ADC Peak data size == 2
00199       virtual unsigned int dataType() const;  // Type of Data fragment
00200       unsigned int feeDataVersion() const;
00201       unsigned int channel() const;      // Channel in module
00202       unsigned int tdcChannel() const;   // Channel from tdc channel line
00203       unsigned int adcChannel() const;   // Channel from adc channel line
00204       unsigned int tdc() const;       
00205       unsigned int tdcHitCount() const;
00206       unsigned int adc() const;
00207       unsigned int peakCycle() const;
00208       unsigned int adcRange() const;
00209       bool         hasAdcPedestal() const;
00210       // Available in FEE Data version >= 2
00211       unsigned int adcPedestal() const;
00212       virtual std::ostream& dump(std::ostream& str); // Print string description
00213     protected:
00214       unsigned int m_feeDataVersion;
00215   };
00216 
00217   // Data from one module
00218   class RawModule: public RawData {
00219     public:
00220       RawModule(unsigned int* buffer=0, unsigned int majorVersion=0, 
00221                 unsigned int minorVersion=0, bool isOwner=false);
00222       ~RawModule();
00223       unsigned int size() const;         // Raw Module total size
00224       unsigned int headerSize() const;   // Raw Module header size
00225       unsigned int siteId() const;
00226       unsigned int detectorId() const;
00227       unsigned int moduleType() const;
00228       unsigned int slot() const;
00229       bool         isLocalTriggerModule() const;  // Is LTB module?
00230       bool         isPmtFeeModule() const;        // Is PMT FEE module?
00231       bool         isFlashAdcModule() const;      // Is Flash ADC module?
00232       bool         isRpcRomModule() const;        // Is RPC ROM module?
00233       bool         isRpcRtmModule() const;        // Is RPC RTM module?
00234       DayaBay::HeadFragment* headFragment();
00235       DayaBay::DataFragment* nextDataFragment();
00236       void resetDataFragment();
00237       virtual std::ostream& dump(std::ostream& str); // Print string description
00238       // Generate a new raw fragment of the correct type
00239       DayaBay::RawFragment* makeNewFragment(unsigned int* buffer=0,
00240                                             unsigned int majorVersion=0,
00241                                             unsigned int minorVersion=0,
00242                                             bool isOwner=false);
00243       // Generate a new head fragment of the correct type
00244       DayaBay::HeadFragment* makeNewHeadFragment(unsigned int* buffer=0,
00245                                                  unsigned int majorVersion=0,
00246                                                  unsigned int minorVersion=0,
00247                                                  bool isOwner=false);
00248       // Generate a new tail fragment of the correct type
00249       DayaBay::TailFragment* makeNewTailFragment(unsigned int* buffer=0,
00250                                                  unsigned int majorVersion=0,
00251                                                  unsigned int minorVersion=0,
00252                                                  bool isOwner=false);
00253       // Generate a new data fragment of the correct type
00254       DayaBay::DataFragment* makeNewDataFragment(unsigned int* buffer=0,
00255                                                  unsigned int majorVersion=0,
00256                                                  unsigned int minorVersion=0,
00257                                                  bool isOwner=false);
00258     private:
00259       unsigned int m_currentFragmentLine; // Line number of current fragment
00260   };
00261 
00262   // Event data block
00263   class RawEvent: public RawData {
00264     public:
00265       RawEvent(unsigned int* buffer=0, unsigned int majorVersion=0, 
00266                unsigned int minorVersion=0, bool isOwner=false);
00267       ~RawEvent();
00268       unsigned int size() const;         // Raw Event total size
00269       unsigned int headerSize() const;   // Raw Event header size
00270       unsigned int eventMajorVersion() const;
00271       unsigned int eventMinorVersion() const;
00272       unsigned int siteId() const;
00273       unsigned int detectorId() const;
00274       unsigned int runNumber() const;
00275       unsigned int eventId() const;
00276       unsigned int eventType() const;
00277       unsigned int eventTypeValue() const;
00278       unsigned int formatFlag() const;
00279       unsigned int statusFlag() const;
00280       DayaBay::RawModule* nextModule();
00281       void resetModule();
00282       DayaBay::RawEvent* clone() const;   // Make a copy of this raw event
00283       virtual std::ostream& dump(std::ostream& str); // Print string description
00284     private:
00285       unsigned int m_currentModuleLine; // Line number for current module
00286   };
00287 
00288 
00289   /*
00290 
00291   // FEE FPGA Waveform data block
00292   class FeeWaveformData: public DataFragment {
00293     public:
00294       FeeWaveformData(unsigned int* buffer=0, unsigned int majorVersion=0, 
00295                       unsigned int minorVersion=0, bool isOwner=false);
00296       ~FeeWaveformData();
00297       // FIXME: Define this data fragment
00298   };
00299 
00300   // FEE FPGA ADC baseline data block
00301   class FeeBaselineData: public DataFragment {
00302     public:
00303       FeeBaselineData(unsigned int* buffer=0, unsigned int majorVersion=0, 
00304                       unsigned int minorVersion=0, bool isOwner=false);
00305       ~FeeBaselineData();
00306       // FIXME: Define this data fragment
00307   };
00308   */
00309 }
00310 
00311 #endif // RAWDATA_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