ROOTANA
Loading...
Searching...
No Matches
TV1730RawData.cxx
Go to the documentation of this file.
1#include "TV1730RawData.hxx"
2
3#include <iostream>
4
5
6
7TV1730RawData::TV1730RawData(int bklen, int bktype, const char* name, void *pdata):
8 TGenericData(bklen, bktype, name, pdata)
9{
10
11 // Do some sanity checking.
12 // Make sure first word has right identifier
13 if( (GetData32()[0] & 0xf0000000) != 0xa0000000){
14 std::cerr << "First word has wrong identifier; first word = 0x"
15 << std::hex << GetData32()[0] << std::dec << std::endl;
16 return;
17 }
18
19 fGlobalHeader.push_back(GetData32()[0]);
20 fGlobalHeader.push_back(GetData32()[1]);
21 fGlobalHeader.push_back(GetData32()[2]);
22 fGlobalHeader.push_back(GetData32()[3]);
23
24
25
26 int counter = 4;
27
28 int number_available_channels = 0;
29 for(int ch = 0; ch < 16; ch++){
30 if((1<<ch) & GetChMask()){
31 number_available_channels++;
32 }
33 }
34
35 int nwords_per_channel = (GetEventSize() - 4)/number_available_channels;
36 // std::cout << "Number of channels " << nwords_per_channel << std::endl;
37
38 // Loop over channel data
39 for(int ch = 0; ch < 16; ch++){
40
41 if((1<<ch) & GetChMask()){
42
43 std::vector<uint32_t> Samples;
44 for(int i = 0; i < nwords_per_channel; i++){
45 uint32_t sample = (GetData32()[counter] & 0x3fff);
46 Samples.push_back(sample);
47 sample = (GetData32()[counter] & 0x3fff0000) >> 16;
48 Samples.push_back(sample);
49 counter++;
50 }
52 meas.AddSamples(Samples);
53
54 fMeasurements.push_back(meas);
55
56 }
57 }
58
59}
60
62
63 std::cout << "V1730 decoder for bank " << GetName().c_str() << std::endl;
64
65
66}
void AddSamples(std::vector< uint32_t > Samples)
std::string GetName() const
const uint32_t * GetData32() const
TV1730RawData(int bklen, int bktype, const char *name, void *pdata)
Constructor.
std::vector< RawChannelMeasurement > fMeasurements
Vector of V1730 Measurements.
std::vector< uint32_t > fGlobalHeader
The overall global header.
void Print()
Print the bank contents in a structured way.
uint32_t GetEventSize() const
Get Event Counter.
uint32_t GetChMask()
Get channel mask.