ROOTANA
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 
14 public:
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 
47 private:
48 
49  /// Found fields to hold the header, measurement, trailer and error words.
50  uint32_t tdc_header_word;
52  uint32_t tdc_trailer_word;
53  uint32_t tdc_error_error;
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.
78 class TV1190Data: public TGenericData {
79 
80 public:
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 
127 private:
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.
Definition: TV1190Data.hxx:21
bool IsLeading() const
Is this the leading edge measurement?
Definition: TV1190Data.hxx:17
TDCMeasurement(uint32_t header, uint32_t measurement, int index)
Constructor; need to pass in header and measurement.
Definition: TV1190Data.hxx:57
void SetTrailer(uint32_t trailer)
Set the trailer word.
Definition: TV1190Data.cxx:6
bool IsTrailing() const
Is this the trailing edge measurement?
Definition: TV1190Data.hxx:19
uint32_t GetEventIndex() const
Get Event Index; this is which event number within the bank.
Definition: TV1190Data.hxx:35
uint32_t GetTDCNumber() const
Get the TDC number.
Definition: TV1190Data.cxx:12
bool HasTDCHeader() const
Check if measurement has a TDC header.
Definition: TV1190Data.hxx:38
uint32_t tdc_measurement_word
Definition: TV1190Data.hxx:51
void SetErrors(uint32_t error)
Set the error word.
Definition: TV1190Data.hxx:66
uint32_t GetErrors() const
Get Errors.
Definition: TV1190Data.cxx:37
uint32_t tdc_trailer_word
Definition: TV1190Data.hxx:52
uint32_t GetChannel() const
Get the channel number.
Definition: TV1190Data.hxx:26
bool HasTDCTrailer() const
Check if measurement has a TDC trailer.
Definition: TV1190Data.hxx:40
uint32_t tdc_header_word
Found fields to hold the header, measurement, trailer and error words.
Definition: TV1190Data.hxx:50
uint32_t tdc_error_error
Definition: TV1190Data.hxx:53
bool HasTDCErrorWord() const
Check if measurement has a TDC error word.
Definition: TV1190Data.hxx:42
uint32_t GetBunchID() const
Get Bunch ID.
Definition: TV1190Data.cxx:30
uint32_t GetEventID() const
Get Event ID; this is event number defined by V1190 module.
Definition: TV1190Data.cxx:21
int GetEventsInBank()
Get the number of events in this bank.
Definition: TV1190Data.hxx:119
bool IsTriggerLost(int index=0) const
Definition: TV1190Data.hxx:99
std::vector< int > fExtendedTriggerTimeTag
Definition: TV1190Data.hxx:136
TV1190Data(int bklen, int bktype, const char *name, void *pdata)
Constructor.
Definition: TV1190Data.cxx:46
std::vector< TDCMeasurement > & GetMeasurements()
Get the Vector of TDC Measurements.
Definition: TV1190Data.hxx:124
void Print()
Print the bank contents in a structured way.
Definition: TV1190Data.cxx:148
int GetWordCount() const
Get the word count.
Definition: TV1190Data.hxx:96
std::vector< uint32_t > fGlobalHeader
The overall global header.
Definition: TV1190Data.hxx:133
std::vector< uint32_t > fStatus
Definition: TV1190Data.hxx:139
int fWordCountTotal
Definition: TV1190Data.hxx:137
bool HasTDCError(int index=0) const
Definition: TV1190Data.hxx:111
int GetExtendedTriggerTimeTag(int index=0) const
Get the extended trigger time tag.
Definition: TV1190Data.hxx:93
std::vector< TDCMeasurement > fMeasurements
Vector of TDC Measurements.
Definition: TV1190Data.hxx:143
bool HasBufferOverflow(int index=0) const
Definition: TV1190Data.hxx:105
uint32_t GetEventCounter(int index=0) const
Get Event Counter.
Definition: TV1190Data.hxx:87
uint32_t GetGeoAddress(int index=0) const
Get Geographical Address.
Definition: TV1190Data.hxx:90