ROOTANA
Loading...
Searching...
No Matches
TV1190Data.hxx
Go to the documentation of this file.
1#ifndef TV1190Data_hxx_seen
2#define TV1190Data_hxx_seen
3
4#include <vector>
5
6#include "TGenericData.hxx"
7
8/// Class for each TDC measurement
9/// For the definition of obscure variables see the CAEN V1190 manual.
11
12 friend class TV1190Data;
13
14public:
15
16 /// Is this the leading edge measurement?
17 bool IsLeading() const {return ((tdc_measurement_word & 0x4000000) == 0x0000000);}
18 /// Is this the trailing edge measurement?
19 bool IsTrailing() const {return ((tdc_measurement_word & 0x4000000) == 0x4000000);}
20 /// Get the TDC measurement
21 uint32_t GetMeasurement() const {return (tdc_measurement_word & 0x7ffff);}
22
23/// Get the TDC number
24 uint32_t GetTDCNumber() const;
25 /// Get the channel number
26 uint32_t GetChannel() const {return ((tdc_measurement_word & 0x3f80000) >> 19 );}
27
28 /// Get Event ID; this is event number defined by V1190 module
29 uint32_t GetEventID() const;
30
31 /// Get Bunch ID
32 uint32_t GetBunchID() const;
33
34 /// Get Event Index; this is which event number within the bank.
35 uint32_t GetEventIndex() const{return event_index;};
36
37 /// Check if measurement has a TDC header
38 bool HasTDCHeader() const {return (tdc_header_word != 0);}
39 /// Check if measurement has a TDC trailer
40 bool HasTDCTrailer() const {return (tdc_trailer_word != 0);}
41 /// Check if measurement has a TDC error word
42 bool HasTDCErrorWord() const {return (tdc_error_error != 0);}
43
44 /// Get Errors
45 uint32_t GetErrors() const;
46
47private:
48
49 /// Found fields to hold the header, measurement, trailer and error words.
55
56 /// Constructor; need to pass in header and measurement.
57 TDCMeasurement(uint32_t header, uint32_t measurement, int index):
58 tdc_header_word(header),
59 tdc_measurement_word(measurement),
61
62 /// Set the trailer word.
63 void SetTrailer(uint32_t trailer);
64
65 /// Set the error word.
66 void SetErrors(uint32_t error){tdc_error_error = error;}
67
68
70};
71
72
73/// Class to store data from CAEN V1190.
74/// We store the information as a vector of TDCMeasurement's
75/// Question: do we need a way of retrieving information about TDCs that
76/// have no measurements? Currently this information is not exposed.
77/// For the definition of obscure variables see the CAEN V1190 manual.
78class TV1190Data: public TGenericData {
79
80public:
81
82 /// Constructor
83 TV1190Data(int bklen, int bktype, const char* name, void *pdata);
84
85
86 /// Get Event Counter
87 uint32_t GetEventCounter(int index = 0) const {return (fGlobalHeader[index] & 0x07ffffe0) >> 5;};
88
89 /// Get Geographical Address
90 uint32_t GetGeoAddress(int index = 0) const {return (fGlobalHeader[index] & 0x1f) ;};
91
92 /// Get the extended trigger time tag
93 int GetExtendedTriggerTimeTag(int index = 0) const {return fExtendedTriggerTimeTag[index];};
94
95 /// Get the word count
96 int GetWordCount() const {return fWordCountTotal;};
97
98 // Methods to check the status flags in trailer.
99 bool IsTriggerLost(int index = 0) const {
100 if(fStatus[index] & 0x4)
101 return true;
102 else
103 return false;
104 }
105 bool HasBufferOverflow(int index = 0) const {
106 if(fStatus[index] & 0x2)
107 return true;
108 else
109 return false;
110 }
111 bool HasTDCError(int index = 0) const {
112 if(fStatus[index] & 0x1)
113 return true;
114 else
115 return false;
116 }
117
118 /// Get the number of events in this bank
119 int GetEventsInBank(){return fGlobalHeader.size();};
120
121 void Print();
122
123 /// Get the Vector of TDC Measurements.
124 std::vector<TDCMeasurement>& GetMeasurements() {return fMeasurements;}
125
126
127private:
128
129 // We have vectors of the headers/trailers/etc, since there can be
130 // multiple events in a bank.
131
132 /// The overall global header
133 std::vector<uint32_t> fGlobalHeader;
134
135
136 std::vector<int> fExtendedTriggerTimeTag; // Extended trigger time
137 int fWordCountTotal; // Word count
138
139 std::vector<uint32_t> fStatus;
140
141
142 /// Vector of TDC Measurements.
143 std::vector<TDCMeasurement> fMeasurements;
144
145};
146
147#endif
uint32_t GetMeasurement() const
Get the TDC measurement.
bool IsLeading() const
Is this the leading edge measurement?
TDCMeasurement(uint32_t header, uint32_t measurement, int index)
Constructor; need to pass in header and measurement.
void SetTrailer(uint32_t trailer)
Set the trailer word.
Definition TV1190Data.cxx:6
bool IsTrailing() const
Is this the trailing edge measurement?
uint32_t GetEventIndex() const
Get Event Index; this is which event number within the bank.
uint32_t GetTDCNumber() const
Get the TDC number.
bool HasTDCHeader() const
Check if measurement has a TDC header.
uint32_t tdc_measurement_word
void SetErrors(uint32_t error)
Set the error word.
uint32_t GetErrors() const
Get Errors.
uint32_t tdc_trailer_word
uint32_t GetChannel() const
Get the channel number.
bool HasTDCTrailer() const
Check if measurement has a TDC trailer.
uint32_t tdc_header_word
Found fields to hold the header, measurement, trailer and error words.
uint32_t tdc_error_error
bool HasTDCErrorWord() const
Check if measurement has a TDC error word.
uint32_t GetBunchID() const
Get Bunch ID.
uint32_t GetEventID() const
Get Event ID; this is event number defined by V1190 module.
int GetEventsInBank()
Get the number of events in this bank.
bool IsTriggerLost(int index=0) const
std::vector< int > fExtendedTriggerTimeTag
void Print()
Print the bank contents in a structured way.
int GetWordCount() const
Get the word count.
std::vector< uint32_t > fGlobalHeader
The overall global header.
std::vector< uint32_t > fStatus
int fWordCountTotal
bool HasTDCError(int index=0) const
std::vector< TDCMeasurement > & GetMeasurements()
Get the Vector of TDC Measurements.
int GetExtendedTriggerTimeTag(int index=0) const
Get the extended trigger time tag.
std::vector< TDCMeasurement > fMeasurements
Vector of TDC Measurements.
bool HasBufferOverflow(int index=0) const
uint32_t GetEventCounter(int index=0) const
Get Event Counter.
uint32_t GetGeoAddress(int index=0) const
Get Geographical Address.