CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalMatacqDigi.h
Go to the documentation of this file.
1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 8; -*-
2 //$Id: EcalMatacqDigi.h,v 1.6 2011/08/30 18:42:57 wmtan Exp $
3 
4 #ifndef ECALMATACQDIGI_H
5 #define ECALMATACQDIGI_H 1
6 
7 #include <ostream>
8 #include <vector>
9 #include <algorithm>
10 #include "Rtypes.h"
11 
12 #define ECAL_MATACQ_DIGI_VERS 2
13 
18 public:
21  static const double lsb_;
22 
25  static const int MAXSAMPLES = 2560;
26 
27 public:
28  typedef int key_type; //matacq channel id used as key for edm::SortedCollection
29 
30 public:
33  EcalMatacqDigi(): chId_(-1), ts_(0.), tTrigS_(999.), version_(-1){
34  init();
35  }
36 
44  EcalMatacqDigi(const std::vector<Short_t>& samples, const int& chId, const double& ts,
45  const short& version=-1, const double& tTrig=999.)
46  : chId_(chId), data_(samples), ts_(ts), tTrigS_(tTrig),
48  init();
49  };
50 
51 
55  const float adcCount(const int& i) const { return data_[i]; }
56 
60  const float amplitudeV(const int& i) const { return data_[i]*lsb_;}
61 
64  int chId() const{ return chId_;}
65 
69  int id() const { return chId_;}
70 
71 // /** Sets Matacq electronics channel id
72 // */
73 // void chId(int newChId){ chId_ = newChId;}
74 
77  int size() const { return data_.size();}
78 
83  void swap(std::vector<short>& samples){ std::swap(data_, samples);}
84 
85  void swap(EcalMatacqDigi& a);
86 
87 // /** Gets time of sample i. i between 0 and size()-1.
88 // */
89 // float t(int i) const { return ts()*i;}
90 
93  float ts() const { return ts_;}
94 
95 // /** Sets sampling time period
96 // * @param ts sampling time period in seconds
97 // */
98 // void ts(double newTs){
99 // ts_ = newTs;
100 // }
101 
107  float tTrig() const { return tTrigS_;}
108 
109 // /** Sets trigger time position
110 // * @param tTrigS (t_trig-t_0) in seconds, with t_trig the time of MATACQ
111 // * trigger and t_0 the time of the first sample of each MATACQ channel.
112 // */
113 // void tTrig(double tTrigS){
114 // tTrigS_ = tTrigS;
115 // }
116 
120  short version() const {return version_;}
121 
122 // /** Sets the raw data format, the digi is issued from.
123 // * @param version internal matacq raw data format version
124 // */
125 // void version(short version){
126 // version_ = version;
127 // }
128 
129 #if (ECAL_MATACQ_DIGI_VERS>=2)
130 
133  int bxId() const { return bxId_; }
134 
138  void bxId(int value) { bxId_ = value; }
139 
143  int l1a() const { return l1a_; }
144 
148  void l1a(int value) { l1a_ = value; }
149 
153  int triggerType() const { return triggerType_; }
154 
159 
165  timeval timeStamp() const { timeval value; value.tv_sec = tv_sec_; value.tv_usec = tv_usec_; return value; }
166 
170  void timeStamp(timeval value) { tv_sec_ = value.tv_sec; tv_usec_ = value.tv_usec; }
171 
176  UInt_t orbitId() const { return orbitId_; }
177 
182 
187  int trigRec() const { return trigRec_; }
188 
192  void trigRec(int value) { trigRec_ = value; }
193 
197  int postTrig() const { return postTrig_; }
198 
202  void postTrig(int value) { postTrig_ = value; }
203 
207  std::vector<int> vernier() const { return vernier_; }
208 
212  void vernier(const std::vector<int>& value) { vernier_ = value; }
213 
214 
218  int delayA() const { return delayA_; }
219 
223  void delayA(int value) { delayA_ = value; }
224 
228  int emtcDelay() const { return emtcDelay_; }
229 
233  void emtcDelay(int value) { emtcDelay_ = value; }
234 
238  int emtcPhase() const { return emtcPhase_; }
239 
243  void emtcPhase(int value) { emtcPhase_ = value; }
244 
249  int attenuation_dB() const { return attenuation_dB_; }
250 
256 
261  int laserPower() const { return laserPower_; }
262 
268 
269  void init(){
270 #if (ECAL_MATACQ_DIGI_VERS>=2)
271  bxId_ = -1;
272  l1a_ = -1;
273  triggerType_ = -1;
274  orbitId_ = -1;
275  trigRec_ = -1;
276  postTrig_ = -1;
277  vernier_ = std::vector<Int_t>(4,-1);
278  delayA_ = -1;
279  emtcDelay_ = -1;
280  emtcPhase_ = -1;
281  attenuation_dB_ = -1;
282  laserPower_ = -1;
283 #endif
284  }
285 
286 #endif
287 
288 private:
291  int chId_;
292 
295  std::vector<Short_t> data_;
296 
299  int freq;
300 
303  double ts_;
304 
307  double tTrigS_;
308 
311  short version_;
312 
313 #if (ECAL_MATACQ_DIGI_VERS>=2)
314 
318 
323 
326  Short_t bxId_;
327 
330  Int_t l1a_;
331 
332  /* LHC orbit ID
333  */
334  Int_t orbitId_;
335 
338  Short_t trigRec_;
339 
342  Short_t postTrig_;
343 
346  std::vector<Int_t> vernier_;
347 
350  Int_t delayA_;
351 
354  Int_t emtcDelay_;
355 
358  Int_t emtcPhase_;
359 
362  Int_t laserPower_;
363 
368  Long64_t tv_sec_;
369  Long64_t tv_usec_;
370 
371 #endif
372 
373 };
374 
375 
376 std::ostream& operator<<(std::ostream& s, const EcalMatacqDigi& digi);
377 
378 #endif
int i
Definition: DBlmapReader.cc:9
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
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
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)
short version() const
int chId() const
int id() const
int triggerType() const
void bxId(int value)
int l1a() const
unsigned int UInt_t
Definition: FUTypes.h:12
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