ROOTANA
TV1730DppData.hxx
Go to the documentation of this file.
1 #ifndef TV1730DppData_hxx_seen
2 #define TV1730DppData_hxx_seen
3 
4 #include <vector>
5 
6 #include "TGenericData.hxx"
7 
8 /// Class for each channel measurement
9 /// For the definition of obscure variables see the CAEN V1730 manual (for DPP readout).
11 
12  friend class TV1730DppData;
13 
14 public:
15 
16  /// See CAEN DPP manual for definition of all these variables
17  bool GetDualTraceEnabled(){return (header1 & 0x80000000) >> 31;}
18  bool GetChargeEnabled(){return (header1 & 0x40000000) >> 30;}
19  bool GetTimeEnabled(){return (header1 & 0x20000000) >> 29;}
20  bool GetBaselineEnabled(){return (header1 & 0x10000000) >> 28;}
21  bool GetSamplesEnabled(){return (header1 & 0x08000000) >> 27;}
22  int GetNSamples(){
23  int header_size = (header1 & 0xfff)*8;
24  if(header_size != (int)fSamples.size())
25  std::cerr << "v17390::ChannelMeasurement N samples doesn't match!!"
26  << header_size << " " << fSamples.size() <<std::endl;
27  return header_size;
28  }
29 
30  int GetChannel(){ return fChan;}
31 
32  /// Get Errors
33  uint32_t GetSample(int i){
34  if(i >= 0 && i < (int)fSamples.size())
35  return fSamples[i];
36  return 9999999;
37  }
38 
39  void AddSamples(std::vector<uint32_t> Samples){
40  fSamples = Samples;
41  }
42 
43 private:
44 
45  int fChan; // channel number
46  uint32_t header0;
47  uint32_t header1;
48 
49  /// Constructor; need to pass in header and measurement.
50  ChannelMeasurement(int chan, uint32_t iheader0, uint32_t iheader1){
51  fChan = chan;
52  header0 = iheader0;
53  header1 = iheader1;
54  }
55 
56  std::vector<uint32_t> fSamples;
57 
58 
59 };
60 
61 
62 /// Class to store DPP data from CAEN V1730.
63 class TV1730DppData: public TGenericData {
64 
65 public:
66 
67  /// Constructor
68  TV1730DppData(int bklen, int bktype, const char* name, void *pdata);
69 
70 
71  /// Get Event Counter
72  uint32_t GetEventCounter() const {return (fGlobalHeader[2]);};
73 
74  /// Get Geographical Address
75  uint32_t GetGeoAddress() const {return (fGlobalHeader[1] & 0xf8000000) >> 27 ;};
76 
77  /// Get the extended trigger time tag
78  uint32_t GetTriggerTimeTag() const {return fGlobalHeader[3];};
79 
80  /// Get channel mask
81  uint32_t GetChMask(){return (fGlobalHeader[1] & 0xff);};
82 
83  void Print();
84 
85  /// Get the Vector of TDC Measurements.
86  std::vector<ChannelMeasurement>& GetMeasurements() {return fMeasurements;}
87 
88 
89 
90 private:
91 
92  // We have vectors of the headers/trailers/etc, since there can be
93  // multiple events in a bank.
94 
95  /// The overall global header
96  std::vector<uint32_t> fGlobalHeader;
97 
98  /// Vector of V1730 Measurements.
99  std::vector<ChannelMeasurement> fMeasurements;
100 
101 };
102 
103 #endif
uint32_t GetSample(int i)
Get Errors.
std::vector< uint32_t > fSamples
ChannelMeasurement(int chan, uint32_t iheader0, uint32_t iheader1)
Constructor; need to pass in header and measurement.
void AddSamples(std::vector< uint32_t > Samples)
bool GetDualTraceEnabled()
See CAEN DPP manual for definition of all these variables.
Class to store DPP data from CAEN V1730.
uint32_t GetTriggerTimeTag() const
Get the extended trigger time tag.
std::vector< uint32_t > fGlobalHeader
The overall global header.
uint32_t GetGeoAddress() const
Get Geographical Address.
TV1730DppData(int bklen, int bktype, const char *name, void *pdata)
Constructor.
void Print()
Print the bank contents in a structured way.
uint32_t GetEventCounter() const
Get Event Counter.
uint32_t GetChMask()
Get channel mask.
std::vector< ChannelMeasurement > fMeasurements
Vector of V1730 Measurements.
std::vector< ChannelMeasurement > & GetMeasurements()
Get the Vector of TDC Measurements.