#include <TV1720RawData.h>
Public Member Functions | |
TV1720RawData (int bklen, int bktype, const char *name, void *pdata) | |
Constructor. | |
uint32_t | GetEventSize () const |
Get the number of 32-bit words in bank. | |
uint32_t | GetChannelMask () const |
bool | IsZLECompressed () const |
Is the V1720 data ZLE compressed? | |
uint32_t | GetEventCounter () const |
Get event counter. | |
uint32_t | GetTriggerTag () const |
Get trigger tag. | |
int | GetNChannels () const |
Get Number of channels in this bank. | |
TV1720RawChannel | GetChannelData (int i) |
Get Channel Data. | |
void | Print () |
Print the bank contents in a structured way. | |
const uint16_t * | GetData16 () const |
const uint32_t * | GetData32 () const |
const uint64_t * | GetData64 () const |
int | GetSize () const |
int | GetType () const |
std::string | GetName () const |
void | Dump () |
Dump the bank contents in an unstructured way. | |
Private Member Functions | |
void | HandlZLECompressedData () |
Helper method to handle ZLE compressed data. | |
void | HandlUncompressedData () |
Helper method to handle uncompressed data. | |
Private Attributes | |
uint32_t | fGlobalHeader0 |
The overall global headers. | |
uint32_t | fGlobalHeader1 |
uint32_t | fGlobalHeader2 |
uint32_t | fGlobalHeader3 |
std::vector< TV1720RawChannel > | fMeasurements |
Vector of V1720 measurements. |
Class to store data from CAEN V1720, 250MHz FADC.
Full info on CAEN V1720 module http://daq-plone.triumf.ca/HR/VME/CAEN/v1720rev9.pdf/view
This class encapsulates the data from a single board (in a single MIDAS bank). This decoder is for the default or ZLE version of the firmware. Not the DPP firmware
Definition at line 135 of file TV1720RawData.h.
TV1720RawData::TV1720RawData | ( | int | bklen, | |
int | bktype, | |||
const char * | name, | |||
void * | pdata | |||
) |
Constructor.
Definition at line 90 of file TV1720RawData.cxx.
References fGlobalHeader0, fGlobalHeader1, fGlobalHeader2, fGlobalHeader3, TGenericData::GetData32(), HandlUncompressedData(), HandlZLECompressedData(), and IsZLECompressed().
00090 : 00091 TGenericData(bklen, bktype, name, pdata) 00092 { 00093 00094 fGlobalHeader0 = GetData32()[0]; 00095 fGlobalHeader1 = GetData32()[1]; 00096 fGlobalHeader2 = GetData32()[2]; 00097 fGlobalHeader3 = GetData32()[3]; 00098 00099 00100 00101 if(IsZLECompressed()){ 00102 HandlZLECompressedData(); 00103 }else{ 00104 HandlUncompressedData(); 00105 } 00106 00107 }
void TGenericData::Dump | ( | ) | [inline, inherited] |
Dump the bank contents in an unstructured way.
Definition at line 39 of file TGenericData.hxx.
References TGenericData::GetData32(), TGenericData::GetName(), and TGenericData::GetSize().
Referenced by TGenericData::Print().
00039 { 00040 00041 std::cout << "Generic decoder for bank named " << GetName().c_str() << std::endl; 00042 for(int i = 0; i < GetSize(); i++){ 00043 std::cout << std::hex << "0x" << GetData32()[i] << std::dec << std::endl; 00044 } 00045 00046 }
TV1720RawChannel TV1720RawData::GetChannelData | ( | int | i | ) | [inline] |
Get Channel Data.
Definition at line 163 of file TV1720RawData.h.
References fMeasurements.
Referenced by Print(), and TV1720Waveform::UpdateHistograms().
00163 { 00164 if(i >= 0 && i < (int)fMeasurements.size()) 00165 return fMeasurements[i]; 00166 00167 return TV1720RawChannel(0,0); 00168 }
uint32_t TV1720RawData::GetChannelMask | ( | ) | const [inline] |
Get the channel mask; ie, the set of channels for which we have data for this event.
Definition at line 147 of file TV1720RawData.h.
References fGlobalHeader1.
Referenced by Print(), and TV1720Waveform::UpdateHistograms().
00147 {return (fGlobalHeader1 & 0xff);};
const uint16_t* TGenericData::GetData16 | ( | ) | const [inline, inherited] |
Definition at line 24 of file TGenericData.hxx.
References TGenericData::fData.
Referenced by TL2249Data::TL2249Data().
00024 { return reinterpret_cast<const uint16_t*>(fData); }
const uint32_t* TGenericData::GetData32 | ( | ) | const [inline, inherited] |
Definition at line 27 of file TGenericData.hxx.
References TGenericData::fData.
Referenced by TGenericData::Dump(), HandlUncompressedData(), HandlZLECompressedData(), TDT724RawData::TDT724RawData(), TMesytecData::TMesytecData(), TV1190Data::TV1190Data(), TV1720RawData(), TV1730DppData::TV1730DppData(), TV1730RawData::TV1730RawData(), and TV792Data::TV792Data().
00027 { return reinterpret_cast<const uint32_t*>(fData); }
const uint64_t* TGenericData::GetData64 | ( | ) | const [inline, inherited] |
Definition at line 30 of file TGenericData.hxx.
References TGenericData::fData.
Referenced by TAgilentHistograms::UpdateHistograms().
00030 { return reinterpret_cast<const uint64_t*>(fData); }
uint32_t TV1720RawData::GetEventCounter | ( | ) | const [inline] |
Get event counter.
Definition at line 153 of file TV1720RawData.h.
References fGlobalHeader2.
Referenced by Print().
00153 {return ((fGlobalHeader2) & 0xffffff);};
uint32_t TV1720RawData::GetEventSize | ( | ) | const [inline] |
Get the number of 32-bit words in bank.
Definition at line 143 of file TV1720RawData.h.
References fGlobalHeader0.
Referenced by HandlUncompressedData(), and Print().
00143 {return (fGlobalHeader0 & 0xffffff);};
std::string TGenericData::GetName | ( | ) | const [inline, inherited] |
Definition at line 36 of file TGenericData.hxx.
References TGenericData::fBankName.
Referenced by TGenericData::Dump(), TV792Data::Print(), TV1730RawData::Print(), TV1730DppData::Print(), Print(), TV1190Data::Print(), TMesytecData::Print(), TL2249Data::Print(), and TDT724RawData::Print().
00036 {return fBankName;}
int TV1720RawData::GetNChannels | ( | ) | const [inline] |
Get Number of channels in this bank.
Definition at line 160 of file TV1720RawData.h.
References fMeasurements.
Referenced by Print().
00160 {return fMeasurements.size();}
int TGenericData::GetSize | ( | ) | const [inline, inherited] |
Definition at line 32 of file TGenericData.hxx.
References TGenericData::fSize.
Referenced by TGenericData::Dump(), TL2249Data::TL2249Data(), TMesytecData::TMesytecData(), TV1190Data::TV1190Data(), and TV792Data::TV792Data().
00032 {return fSize;}
uint32_t TV1720RawData::GetTriggerTag | ( | ) | const [inline] |
Get trigger tag.
Definition at line 156 of file TV1720RawData.h.
References fGlobalHeader3.
Referenced by Print().
00156 {return ((fGlobalHeader3) & 0xffffffff);};
int TGenericData::GetType | ( | ) | const [inline, inherited] |
Definition at line 34 of file TGenericData.hxx.
References TGenericData::fBankType.
00034 {return fBankType;}
void TV1720RawData::HandlUncompressedData | ( | ) | [private] |
Helper method to handle uncompressed data.
Definition at line 47 of file TV1720RawData.cxx.
References TV1720RawChannel::AddADCSample(), fMeasurements, TGenericData::GetData32(), GetEventSize(), and IsZLECompressed().
Referenced by TV1720RawData().
00047 { 00048 00049 // Skip the header. 00050 uint32_t iPtr=4; 00051 uint32_t chMask = GetData32()[1] & 0xFF; 00052 00053 int nActiveChannels=0; 00054 for(int iCh=0; iCh<8; iCh++){ 00055 if(chMask & (1<<iCh)) 00056 nActiveChannels++; 00057 } 00058 // Assume that we have readout the same number of samples for each channel. 00059 // The number of 32 bit double-samples per channel is then 00060 // N32samples = (bank size - 4)/ nActiveChannels 00061 int N32samples = (GetEventSize() - 4)/ nActiveChannels; 00062 00063 // Loop over channels 00064 for(int iCh=0; iCh<8; iCh++){ 00065 00066 if(!(chMask & (1<<iCh))){ 00067 // Add empty channel data objects, to keep vector simple. 00068 TV1720RawChannel channel(iCh, IsZLECompressed()); 00069 fMeasurements.push_back(channel); 00070 continue; 00071 } 00072 00073 TV1720RawChannel channel(iCh, IsZLECompressed()); 00074 00075 for(int j = 0; j < N32samples; j++){ 00076 uint32_t samp1 = (GetData32()[iPtr]&0xFFF); 00077 uint32_t samp2 = ((GetData32()[iPtr]>>16)&0xFFF); 00078 00079 channel.AddADCSample(samp1); 00080 channel.AddADCSample(samp2); 00081 iPtr++; 00082 } 00083 00084 fMeasurements.push_back(channel); 00085 00086 } 00087 }
void TV1720RawData::HandlZLECompressedData | ( | ) | [private] |
Helper method to handle ZLE compressed data.
Definition at line 6 of file TV1720RawData.cxx.
References TV1720RawChannel::AddZlePulse(), fMeasurements, TGenericData::GetData32(), and IsZLECompressed().
Referenced by TV1720RawData().
00006 { 00007 00008 // >>> Loop over ZLE data and fill up 00009 00010 uint32_t chMask = GetData32()[1] & 0xFF; 00011 uint32_t iPtr=4; 00012 for(int iCh=0; iCh<8; iCh++){ 00013 if (chMask & (1<<iCh)){ 00014 uint32_t chSize = GetData32()[iPtr]; 00015 uint32_t iChPtr = 1;// The chSize space is included in chSize 00016 uint32_t iBin=0; 00017 iPtr++; 00018 00019 TV1720RawChannel channel(iCh, IsZLECompressed()); 00020 00021 while(iChPtr<chSize){ 00022 uint32_t goodData = ((GetData32()[iPtr]>>31) & 0x1); 00023 uint32_t nWords = (GetData32()[iPtr] & 0xFFFFF); 00024 if(goodData){ 00025 std::vector<uint32_t> samples; 00026 for(uint32_t iWord=0; iWord<nWords; iWord++){ 00027 iPtr++; 00028 iChPtr++; 00029 samples.push_back((GetData32()[iPtr]&0xFFF)); 00030 samples.push_back(((GetData32()[iPtr]>>16)&0xFFF)); 00031 } 00032 channel.AddZlePulse(TV1720RawZlePulse(iBin, samples)); 00033 } 00034 00035 iBin += (nWords*2); 00036 iChPtr++; 00037 iPtr++; 00038 00039 } 00040 00041 fMeasurements.push_back(channel); 00042 } 00043 } 00044 00045 }
bool TV1720RawData::IsZLECompressed | ( | ) | const [inline] |
Is the V1720 data ZLE compressed?
Definition at line 150 of file TV1720RawData.h.
References fGlobalHeader1.
Referenced by HandlUncompressedData(), HandlZLECompressedData(), Print(), TV1720RawData(), and TV1720Waveform::UpdateHistograms().
00150 {return ((fGlobalHeader1 >> 24) & 0x1);};
void TV1720RawData::Print | ( | ) | [virtual] |
Print the bank contents in a structured way.
Reimplemented from TGenericData.
Definition at line 109 of file TV1720RawData.cxx.
References GetChannelData(), GetChannelMask(), TV1720RawChannel::GetChannelNumber(), GetEventCounter(), GetEventSize(), TV1720RawZlePulse::GetFirstBin(), TGenericData::GetName(), GetNChannels(), TV1720RawZlePulse::GetNSamples(), TV1720RawChannel::GetNZlePulses(), TV1720RawZlePulse::GetSample(), GetTriggerTag(), TV1720RawChannel::GetZlePulse(), and IsZLECompressed().
00109 { 00110 00111 std::cout << "V1720 decoder for bank " << GetName().c_str() << std::endl; 00112 std::cout << "Bank size: " << GetEventSize() << std::endl; 00113 00114 if( IsZLECompressed()) 00115 std::cout << "Data is ZLE compressed." << std::endl; 00116 else 00117 std::cout << "Data is not ZLE compressed." << std::endl; 00118 00119 std::cout << "Channel Mask : " << GetChannelMask() << std::endl; 00120 00121 std::cout << "Event counter : " << GetEventCounter() << std::endl; 00122 std::cout << "Trigger tag: " << GetTriggerTag() << std::endl; 00123 00124 00125 std::cout << "Number of channels with data: " << GetNChannels() << std::endl; 00126 for(int i = 0 ; i < GetNChannels(); i++){ 00127 00128 TV1720RawChannel channelData = GetChannelData(i); 00129 00130 std::cout << "Channel: " << channelData.GetChannelNumber() << std::endl; 00131 00132 if(IsZLECompressed()){ 00133 std::cout << "Number of ZLE pulses: " << channelData.GetNZlePulses() << std::endl; 00134 for(int j = 0; j < channelData.GetNZlePulses(); j++){ 00135 std::cout << "Pulse: " << j << std::endl; 00136 TV1720RawZlePulse pulse = channelData.GetZlePulse(j); 00137 std::cout << "first sample bin: " << pulse.GetFirstBin() << std::endl; 00138 std::cout << "Samples ("<< pulse.GetNSamples()<< " total): " <<std::endl; 00139 for(int k = 0; k < pulse.GetNSamples(); k++){ 00140 std::cout << pulse.GetSample(k) << ", "; 00141 if(k%12 == 11) std::cout << std::endl; 00142 } 00143 std::cout << std::endl; 00144 00145 } 00146 } 00147 00148 } 00149 00150 }
uint32_t TV1720RawData::fGlobalHeader0 [private] |
The overall global headers.
Definition at line 183 of file TV1720RawData.h.
Referenced by GetEventSize(), and TV1720RawData().
uint32_t TV1720RawData::fGlobalHeader1 [private] |
Definition at line 184 of file TV1720RawData.h.
Referenced by GetChannelMask(), IsZLECompressed(), and TV1720RawData().
uint32_t TV1720RawData::fGlobalHeader2 [private] |
Definition at line 185 of file TV1720RawData.h.
Referenced by GetEventCounter(), and TV1720RawData().
uint32_t TV1720RawData::fGlobalHeader3 [private] |
Definition at line 186 of file TV1720RawData.h.
Referenced by GetTriggerTag(), and TV1720RawData().
std::vector<TV1720RawChannel> TV1720RawData::fMeasurements [private] |
Vector of V1720 measurements.
Definition at line 190 of file TV1720RawData.h.
Referenced by GetChannelData(), GetNChannels(), HandlUncompressedData(), and HandlZLECompressedData().