ROOTANA
TMesytecData.cxx
Go to the documentation of this file.
1 #include "TMesytecData.hxx"
2 
3 // Must be either 11, 12 or 13 bit; default is 11 bit
4 int gBitResolution = 0x7ff;
5 
6 
8 
9 
10 
11 TMesytecData::TMesytecData(int bklen, int bktype, const char* name, void *pdata):
12  TGenericData(bklen, bktype, name, pdata)
13 {
14 
15  /// Save the current header.
16  fGlobalHeader =0;
17 
18  for(int i = 0; i < GetSize(); i++){
19  uint32_t word = GetData32()[i];
20 
21  if( (word & 0xc0000000) == 0x40000000){ // header word
22  fGlobalHeader = word;
23  // Figure out which bit resolution we are using
24  int bitresolution = ((fGlobalHeader & 0x7000) >> 12);
25  if(bitresolution == 1)
26  gBitResolution = 0x7ff;
27  else if(bitresolution == 2)
28  gBitResolution = 0xfff;
29  else if(bitresolution == 4)
30  gBitResolution = 0x1fff;
31 
32  }
33 
34  if( (word & 0xc0000000) == 0x00000000 &&
35  (word & 0x3fe00000) == 0x04000000 ){ // Data word
36  fMeasurements.push_back(ADCMeasMesy(fGlobalHeader,word));
37  }
38 
39  if( (word & 0xc0000000) == 0x00000000 &&
40  (word & 0x3fe00000) == 0x04000000 ){ // Data extended timestamp
41  // Not currently supported!!!
42  }
43 
44  if((word & 0xc0000000) == 0xc0000000){ // trailer word
45  fGlobalTrailer = word;
46  }
47 
48  }
49 
50 }
51 
52 
54 
55  std::cout << "Data for Mesytec module in bank " << GetName() << std::endl;
56  std::cout << "Module ID = " << GetModuleID() << std::endl;
57  std::cout << "Bit resolution : 0x" << std::hex
58  << gBitResolution << std::dec << std::endl;
59 
60  std::cout << "Timestamp = " << GetTimeStamp() << std::endl;
61 
62  std::vector<ADCMeasMesy> measurements = GetMeasurements();
63  std::cout << "Number of measurements: " << measurements.size() << std::endl;
64 
65  for(unsigned int i = 0; i < measurements.size(); i++){
66  ADCMeasMesy adcmeas = measurements[i];
67  std::cout << "meas: " << adcmeas.GetMeasurement()
68  << " [chan="<< adcmeas.GetChannel()
69  <<",OOR=" << adcmeas.IsOutOfRange() << "] ";
70  if(i%2==1) std::cout << std::endl;
71  }
72  std::cout << std::endl;
73 
74 
75 }
int gBitResolution
Definition: TMesytecData.cxx:4
bool IsOutOfRange() const
Is Out Of Range?
uint32_t GetChannel() const
Get the channel number.
uint32_t GetMeasurement() const
Get the ADC measurement.
Definition: TMesytecData.cxx:7
uint32_t adc_measurement_word
int GetSize() const
const uint32_t * GetData32() const
std::string GetName() const
uint32_t fGlobalTrailer
The overall global trailer.
TMesytecData(int bklen, int bktype, const char *name, void *pdata)
Constructor.
uint32_t fGlobalHeader
The overall global header.
uint32_t GetTimeStamp() const
void Print()
Print the bank contents in a structured way.
std::vector< ADCMeasMesy > fMeasurements
Vector of ADC Measurements.
uint32_t GetModuleID() const
Get Module ID.
std::vector< ADCMeasMesy > & GetMeasurements()
Get the Vector of ADC Measurements.