00001 #ifndef __PXXDomHitEngineeringFormatRecord__H__ 00002 #define __PXXDomHitEngineeringFormatRecord__H__ 00003 00011 00012 #include "payloads-unpacker/payloads/PXXVRecord.h" 00013 #include "payloads-unpacker/payloads/PXXIHitDataRecord.h" 00014 #include <vector> 00015 using namespace std; 00016 00017 class PXXDomHitEngineeringFormatRecord : public PXXVRecord, public PXXIHitDataRecord 00018 { 00019 public: 00020 00021 SET_LOGGER("PXXDomHitEngineeringFormatRecord"); 00022 00026 PXXDomHitEngineeringFormatRecord(); 00027 //------------------------------------------------------------------------------ 00028 00032 virtual ~PXXDomHitEngineeringFormatRecord(); 00033 //------------------------------------------------------------------------------ 00034 00040 virtual Int32b_t GetVersion() const; 00041 //------------------------------------------------------------------------------ 00042 00046 virtual const PXXVRecordPtr GetRecordPtr(); 00047 //------------------------------------------------------------------------------ 00048 00053 virtual Int32b_t GetRecordLength() const; 00054 //--------------------------------------------------------- 00055 00059 virtual Int32b_t GetATWDChipID() const; 00060 //------------------------------------------------------------------------------ 00061 00065 virtual Int32b_t GetNumberOfFADCSamples() const; 00066 //------------------------------------------------------------------------------ 00067 00076 virtual Int32b_t GetTriggerMode() const; 00077 //------------------------------------------------------------------------------ 00078 00082 virtual Long64b_t GetDOMClockAsLong64b() const; 00083 //------------------------------------------------------------------------------ 00084 00088 virtual const vector<Int32b_t> &GetFADCData() const { return fIFADCData_; } 00089 //------------------------------------------------------------------------------ 00090 00095 virtual const vector<Int32b_t> &GetATWDData(Int32b_t i) const; 00096 //------------------------------------------------------------------------------ 00097 00101 virtual void WriteProperties(); 00102 //------------------------------------------------------------------------------ 00103 00104 private: 00105 00109 class ATWDFormat 00110 { 00111 public: 00112 00113 ATWDFormat() : fIsShortWord_(false), fINumberOfSamples_(0){} 00114 void Initialize(Int32b_t nybble) 00115 { 00116 fIsShortWord_ = false; 00117 fINumberOfSamples_ = 0; 00118 if ((nybble & 1) == 0) return; // bit 0 is 0, ATWD not present 00119 if ((nybble & 2) != 0) fIsShortWord_ = true; // Bit 1 is 1 : short data 00120 switch (nybble >> 2) { 00121 case 0 : 00122 fINumberOfSamples_ = 32; // See DOMdatafmtbinary_1_4_0.pdf 00123 break; 00124 case 1 : 00125 fINumberOfSamples_ = 64; 00126 break; 00127 case 2 : 00128 fINumberOfSamples_ = 16; 00129 break; 00130 case 3 : 00131 fINumberOfSamples_ = 128; 00132 break; 00133 } 00134 } 00135 00136 Bool8b_t IsShortWord() const { return fIsShortWord_; } 00137 Int32b_t GetNumberOfSamples() const { return fINumberOfSamples_; } 00138 00139 private: 00140 Bool8b_t fIsShortWord_; 00141 Int32b_t fINumberOfSamples_; 00142 00143 }; 00144 //------------------------------------------------------------------------------ 00145 00166 virtual Int32b_t ReadData(); 00167 //------------------------------------------------------------------------------ 00168 00169 private: 00170 00171 static const Int32b_t kNATWDChannels_; // number of ATWD channels : 4 00172 static const Int32b_t kMAXFADCSamples_; // max num of FADC samples : 255 00173 00174 Short16b_t fSRecordLen_; // RecordLength 00175 Short16b_t fSFormatID_; // Format ID 00176 Int32b_t fIATWDChipID_; // id of ATWD Chip, 0 or 1 00177 Int32b_t fINumFADCSamples_; // number of FADC samples 00178 Int32b_t fITrigMode_; // id of trig mode, 0 to 3 00179 Int32b_t fIStatus_; // status flag (not used now?) 00180 Long64b_t fLDOMClock_; // time stamp (read in 6byts) 00181 vector<Int32b_t> fIFADCData_; // FADC data 00182 vector<Int32b_t> fIATWDDataArray_[4]; // ATWD data array: array size must be same as kNATWDChannels_ 00183 00184 ClassDef(PXXDomHitEngineeringFormatRecord, 0) // interface of payloads 00185 00186 }; 00187 00188 #ifdef __USEROOT__ // compile with ROOT 00189 typedef PXXDomHitEngineeringFormatRecord* PXXDomHitEngineeringFormatRecordPtr; 00190 #else // compile with IceTray 00191 typedef shared_ptr<PXXDomHitEngineeringFormatRecord> PXXDomHitEngineeringFormatRecordPtr; 00192 #endif 00193 00194 #endif // __PXXDomHitEngineeringFormatRecord__H__