ROOTANA
TV1730DppData.cxx
Go to the documentation of this file.
1 #include "TV1730DppData.hxx"
2 
3 #include <iostream>
4 
5 
6 
7 TV1730DppData::TV1730DppData(int bklen, int bktype, const char* name, void *pdata):
8  TGenericData(bklen, bktype, name, pdata)
9 {
10 
11  // Do decoding. Decoding is complicated by the fact that there can be
12  // multiple events in the same bank. So need to find and save multiple
13  // event headers, trailers.
14 
15  fGlobalHeader.push_back(GetData32()[0]);
16  fGlobalHeader.push_back(GetData32()[1]);
17  fGlobalHeader.push_back(GetData32()[2]);
18  fGlobalHeader.push_back(GetData32()[3]);
19 
20  // Do some sanity checking.
21  // Make sure first word has right identifier
22  if( (GetData32()[0] & 0xf0000000) != 0xa0000000)
23  std::cerr << "First word has wrong identifier; first word = 0x"
24  << std::hex << GetData32()[0] << std::dec << std::endl;
25 
26  int counter = 4;
27 
28  // Loop over channel data
29  for(int ch = 0; ch < 16; ch++){
30 
31  if((1<<ch) & GetChMask()){
32 
33 
34  uint32_t header0 = GetData32()[counter];
35  counter++;
36  uint32_t header1 = GetData32()[counter];
37  counter++;
38  uint32_t size = header0 & 0x7fff;
39  ChannelMeasurement meas = ChannelMeasurement(ch,header0,header1);
40 
41  int nsamples = size - 2; // calculate number of samples.
42 
43  std::vector<uint32_t> Samples;
44  //std::cout << "nsamples " << nsamples << std::endl;
45  for(int i = 0; i < nsamples; i++){
46  uint32_t sample = (GetData32()[counter] & 0x3fff);
47  Samples.push_back(sample);
48  sample = (GetData32()[counter] & 0x3fff0000) >> 16;
49  Samples.push_back(sample);
50  counter++;
51  }
52  meas.AddSamples(Samples);
53 
54  fMeasurements.push_back(meas);
55 
56  }
57  }
58 
59 
60 
61 }
62 
64 
65  std::cout << "V1730Dpp decoder for bank " << GetName().c_str() << std::endl;
66 
67 
68 }
void AddSamples(std::vector< uint32_t > Samples)
const uint32_t * GetData32() const
std::string GetName() const
std::vector< uint32_t > fGlobalHeader
The overall global header.
TV1730DppData(int bklen, int bktype, const char *name, void *pdata)
Constructor.
void Print()
Print the bank contents in a structured way.
uint32_t GetChMask()
Get channel mask.
std::vector< ChannelMeasurement > fMeasurements
Vector of V1730 Measurements.