CMS 3D CMS Logo

EcalMatacqDigi.h
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
2 
3 #ifndef ECALMATACQDIGI_H
4 #define ECALMATACQDIGI_H 1
5 
6 #include <ostream>
7 #include <vector>
8 #include <algorithm>
9 #include "Rtypes.h"
10 
11 #define ECAL_MATACQ_DIGI_VERS 2
12 
17 public:
20  static const double lsb_;
21 
24  static const int MAXSAMPLES = 2560;
25 
26 public:
27  typedef int key_type; //matacq channel id used as key for edm::SortedCollection
28 
29 public:
32  EcalMatacqDigi() : chId_(-1), ts_(0.), tTrigS_(999.), version_(-1) { init(); }
33 
41  EcalMatacqDigi(const std::vector<Short_t>& samples,
42  const int& chId,
43  const double& ts,
44  const short& version = -1,
45  const double& tTrig = 999.)
47  init();
48  };
49 
53  float adcCount(const int& i) const { return data_[i]; }
54 
58  float amplitudeV(const int& i) const { return data_[i] * lsb_; }
59 
62  int chId() const { return chId_; }
63 
67  int id() const { return chId_; }
68 
69  // /** Sets Matacq electronics channel id
70  // */
71  // void chId(int newChId){ chId_ = newChId;}
72 
75  int size() const { return data_.size(); }
76 
81  void swap(std::vector<short>& samples) { std::swap(data_, samples); }
82 
83  void swap(EcalMatacqDigi& a);
84 
85  // /** Gets time of sample i. i between 0 and size()-1.
86  // */
87  // float t(int i) const { return ts()*i;}
88 
91  float ts() const { return ts_; }
92 
93  // /** Sets sampling time period
94  // * @param ts sampling time period in seconds
95  // */
96  // void ts(double newTs){
97  // ts_ = newTs;
98  // }
99 
105  float tTrig() const { return tTrigS_; }
106 
107  // /** Sets trigger time position
108  // * @param tTrigS (t_trig-t_0) in seconds, with t_trig the time of MATACQ
109  // * trigger and t_0 the time of the first sample of each MATACQ channel.
110  // */
111  // void tTrig(double tTrigS){
112  // tTrigS_ = tTrigS;
113  // }
114 
118  short version() const { return version_; }
119 
120  // /** Sets the raw data format, the digi is issued from.
121  // * @param version internal matacq raw data format version
122  // */
123  // void version(short version){
124  // version_ = version;
125  // }
126 
127 #if (ECAL_MATACQ_DIGI_VERS >= 2)
128 
131  int bxId() const { return bxId_; }
132 
136  void bxId(int value) { bxId_ = value; }
137 
141  int l1a() const { return l1a_; }
142 
146  void l1a(int value) { l1a_ = value; }
147 
151  int triggerType() const { return triggerType_; }
152 
157 
163  timeval timeStamp() const {
164  timeval value;
165  value.tv_sec = tv_sec_;
166  value.tv_usec = tv_usec_;
167  return value;
168  }
169 
173  void timeStamp(timeval value) {
174  tv_sec_ = value.tv_sec;
175  tv_usec_ = value.tv_usec;
176  }
177 
182  UInt_t orbitId() const { return orbitId_; }
183 
187  void orbitId(UInt_t value) { orbitId_ = value; }
188 
193  int trigRec() const { return trigRec_; }
194 
198  void trigRec(int value) { trigRec_ = value; }
199 
203  int postTrig() const { return postTrig_; }
204 
208  void postTrig(int value) { postTrig_ = value; }
209 
213  std::vector<int> vernier() const { return vernier_; }
214 
218  void vernier(const std::vector<int>& value) { vernier_ = value; }
219 
223  int delayA() const { return delayA_; }
224 
228  void delayA(int value) { delayA_ = value; }
229 
233  int emtcDelay() const { return emtcDelay_; }
234 
238  void emtcDelay(int value) { emtcDelay_ = value; }
239 
243  int emtcPhase() const { return emtcPhase_; }
244 
248  void emtcPhase(int value) { emtcPhase_ = value; }
249 
254  int attenuation_dB() const { return attenuation_dB_; }
255 
261 
266  int laserPower() const { return laserPower_; }
267 
273 #endif
274 
275  void init() {
276 #if (ECAL_MATACQ_DIGI_VERS >= 2)
277  bxId_ = -1;
278  l1a_ = -1;
279  triggerType_ = -1;
280  orbitId_ = -1;
281  trigRec_ = -1;
282  postTrig_ = -1;
283  vernier_ = std::vector<Int_t>(4, -1);
284  delayA_ = -1;
285  emtcDelay_ = -1;
286  emtcPhase_ = -1;
287  attenuation_dB_ = -1;
288  laserPower_ = -1;
289  tv_sec_ = 0;
290  tv_usec_ = 0;
291 #endif
292  }
293 
294 private:
297  int chId_;
298 
301  std::vector<Short_t> data_;
302 
305  double ts_;
306 
309  double tTrigS_;
310 
313  short version_;
314 
315 #if (ECAL_MATACQ_DIGI_VERS >= 2)
316 
320 
325 
328  Short_t bxId_;
329 
332  Int_t l1a_;
333 
334  /* LHC orbit ID
335  */
336  Int_t orbitId_;
337 
340  Short_t trigRec_;
341 
344  Short_t postTrig_;
345 
348  std::vector<Int_t> vernier_;
349 
352  Int_t delayA_;
353 
356  Int_t emtcDelay_;
357 
360  Int_t emtcPhase_;
361 
364  Int_t laserPower_;
365 
370  Long64_t tv_sec_;
371  Long64_t tv_usec_;
372 
373 #endif
374 };
375 
376 std::ostream& operator<<(std::ostream& s, const EcalMatacqDigi& digi);
377 
378 #endif
int delayA() const
static const double lsb_
UInt_t orbitId() const
void postTrig(int value)
void triggerType(int value)
int emtcDelay() const
int trigRec() const
float adcCount(const int &i) const
void laserPower(int value)
int id() const
std::vector< Int_t > vernier_
void timeStamp(timeval value)
std::vector< int > vernier() const
int postTrig() const
int chId() const
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
int l1a() const
int emtcPhase() const
int bxId() const
EcalMatacqDigi(const std::vector< Short_t > &samples, const int &chId, const double &ts, const short &version=-1, const double &tTrig=999.)
void delayA(int value)
Definition: value.py:1
int laserPower() const
float tTrig() const
void bxId(int value)
std::ostream & operator<<(std::ostream &s, const EcalMatacqDigi &digi)
timeval timeStamp() const
void swap(std::vector< short > &samples)
float amplitudeV(const int &i) const
void emtcPhase(int value)
void vernier(const std::vector< int > &value)
void l1a(int value)
void trigRec(int value)
static const int MAXSAMPLES
void emtcDelay(int value)
std::vector< Short_t > data_
double a
Definition: hdecay.h:121
int size() const
void orbitId(UInt_t value)
int attenuation_dB() const
float ts() const
void attenuation_dB(int value)
int triggerType() const
short version() const