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){
33  init();
34  }
35 
43  EcalMatacqDigi(const std::vector<Short_t>& samples, const int& chId, const double& ts,
44  const short& version=-1, const double& tTrig=999.)
45  : chId_(chId), data_(samples), ts_(ts), tTrigS_(tTrig),
47  init();
48  };
49 
50 
54  const float adcCount(const int& i) const { return data_[i]; }
55 
59  const float amplitudeV(const int& i) const { return data_[i]*lsb_;}
60 
63  int chId() const{ return chId_;}
64 
68  int id() const { return chId_;}
69 
70 // /** Sets Matacq electronics channel id
71 // */
72 // void chId(int newChId){ chId_ = newChId;}
73 
76  int size() const { return data_.size();}
77 
82  void swap(std::vector<short>& samples){ std::swap(data_, samples);}
83 
84  void swap(EcalMatacqDigi& a);
85 
86 // /** Gets time of sample i. i between 0 and size()-1.
87 // */
88 // float t(int i) const { return ts()*i;}
89 
92  float ts() const { return ts_;}
93 
94 // /** Sets sampling time period
95 // * @param ts sampling time period in seconds
96 // */
97 // void ts(double newTs){
98 // ts_ = newTs;
99 // }
100 
106  float tTrig() const { return tTrigS_;}
107 
108 // /** Sets trigger time position
109 // * @param tTrigS (t_trig-t_0) in seconds, with t_trig the time of MATACQ
110 // * trigger and t_0 the time of the first sample of each MATACQ channel.
111 // */
112 // void tTrig(double tTrigS){
113 // tTrigS_ = tTrigS;
114 // }
115 
119  short version() const {return version_;}
120 
121 // /** Sets the raw data format, the digi is issued from.
122 // * @param version internal matacq raw data format version
123 // */
124 // void version(short version){
125 // version_ = version;
126 // }
127 
128 #if (ECAL_MATACQ_DIGI_VERS>=2)
129 
132  int bxId() const { return bxId_; }
133 
137  void bxId(int value) { bxId_ = value; }
138 
142  int l1a() const { return l1a_; }
143 
147  void l1a(int value) { l1a_ = value; }
148 
152  int triggerType() const { return triggerType_; }
153 
158 
164  timeval timeStamp() const { timeval value; value.tv_sec = tv_sec_; value.tv_usec = tv_usec_; return value; }
165 
169  void timeStamp(timeval value) { tv_sec_ = value.tv_sec; tv_usec_ = value.tv_usec; }
170 
175  UInt_t orbitId() const { return orbitId_; }
176 
180  void orbitId(UInt_t value) { orbitId_ = value; }
181 
186  int trigRec() const { return trigRec_; }
187 
191  void trigRec(int value) { trigRec_ = value; }
192 
196  int postTrig() const { return postTrig_; }
197 
201  void postTrig(int value) { postTrig_ = value; }
202 
206  std::vector<int> vernier() const { return vernier_; }
207 
211  void vernier(const std::vector<int>& value) { vernier_ = value; }
212 
213 
217  int delayA() const { return delayA_; }
218 
222  void delayA(int value) { delayA_ = value; }
223 
227  int emtcDelay() const { return emtcDelay_; }
228 
232  void emtcDelay(int value) { emtcDelay_ = value; }
233 
237  int emtcPhase() const { return emtcPhase_; }
238 
242  void emtcPhase(int value) { emtcPhase_ = value; }
243 
248  int attenuation_dB() const { return attenuation_dB_; }
249 
255 
260  int laserPower() const { return laserPower_; }
261 
267 
268  void init(){
269 #if (ECAL_MATACQ_DIGI_VERS>=2)
270  bxId_ = -1;
271  l1a_ = -1;
272  triggerType_ = -1;
273  orbitId_ = -1;
274  trigRec_ = -1;
275  postTrig_ = -1;
276  vernier_ = std::vector<Int_t>(4,-1);
277  delayA_ = -1;
278  emtcDelay_ = -1;
279  emtcPhase_ = -1;
280  attenuation_dB_ = -1;
281  laserPower_ = -1;
282 #endif
283  }
284 
285 #endif
286 
287 private:
290  int chId_;
291 
294  std::vector<Short_t> data_;
295 
298  int freq;
299 
302  double ts_;
303 
306  double tTrigS_;
307 
310  short version_;
311 
312 #if (ECAL_MATACQ_DIGI_VERS>=2)
313 
317 
322 
325  Short_t bxId_;
326 
329  Int_t l1a_;
330 
331  /* LHC orbit ID
332  */
333  Int_t orbitId_;
334 
337  Short_t trigRec_;
338 
341  Short_t postTrig_;
342 
345  std::vector<Int_t> vernier_;
346 
349  Int_t delayA_;
350 
353  Int_t emtcDelay_;
354 
357  Int_t emtcPhase_;
358 
361  Int_t laserPower_;
362 
367  Long64_t tv_sec_;
368  Long64_t tv_usec_;
369 
370 #endif
371 
372 };
373 
374 
375 std::ostream& operator<<(std::ostream& s, const EcalMatacqDigi& digi);
376 
377 #endif
float ts() const
timeval timeStamp() const
int emtcDelay() const
static const double lsb_
void postTrig(int value)
void triggerType(int value)
float tTrig() const
std::vector< int > vernier() const
int delayA() const
int attenuation_dB() const
int emtcPhase() const
void laserPower(int value)
const float adcCount(const int &i) const
std::vector< Int_t > vernier_
void timeStamp(timeval value)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
UInt_t orbitId() 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
short version() const
int chId() const
int id() const
int triggerType() const
void bxId(int value)
int l1a() const
std::ostream & operator<<(std::ostream &s, const EcalMatacqDigi &digi)
void swap(std::vector< short > &samples)
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)
int size() const
const float amplitudeV(const int &i) const
std::vector< Short_t > data_
double a
Definition: hdecay.h:121
void orbitId(UInt_t value)
int postTrig() const
int trigRec() const
void attenuation_dB(int value)
int laserPower() const
int bxId() const