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