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 
274  void init() {
275 #if (ECAL_MATACQ_DIGI_VERS >= 2)
276  bxId_ = -1;
277  l1a_ = -1;
278  triggerType_ = -1;
279  orbitId_ = -1;
280  trigRec_ = -1;
281  postTrig_ = -1;
282  vernier_ = std::vector<Int_t>(4, -1);
283  delayA_ = -1;
284  emtcDelay_ = -1;
285  emtcPhase_ = -1;
286  attenuation_dB_ = -1;
287  laserPower_ = -1;
288 #endif
289  }
290 
291 #endif
292 
293 private:
296  int chId_;
297 
300  std::vector<Short_t> data_;
301 
304  int freq;
305 
308  double ts_;
309 
312  double tTrigS_;
313 
316  short version_;
317 
318 #if (ECAL_MATACQ_DIGI_VERS >= 2)
319 
323 
328 
331  Short_t bxId_;
332 
335  Int_t l1a_;
336 
337  /* LHC orbit ID
338  */
339  Int_t orbitId_;
340 
343  Short_t trigRec_;
344 
347  Short_t postTrig_;
348 
351  std::vector<Int_t> vernier_;
352 
355  Int_t delayA_;
356 
359  Int_t emtcDelay_;
360 
363  Int_t emtcPhase_;
364 
367  Int_t laserPower_;
368 
373  Long64_t tv_sec_;
374  Long64_t tv_usec_;
375 
376 #endif
377 };
378 
379 std::ostream& operator<<(std::ostream& s, const EcalMatacqDigi& digi);
380 
381 #endif
EcalMatacqDigi::MAXSAMPLES
static const int MAXSAMPLES
Definition: EcalMatacqDigi.h:24
EcalMatacqDigi::emtcDelay
void emtcDelay(int value)
Definition: EcalMatacqDigi.h:238
mps_fire.i
i
Definition: mps_fire.py:428
EcalMatacqDigi::adcCount
float adcCount(const int &i) const
Definition: EcalMatacqDigi.h:53
EcalMatacqDigi::version
short version() const
Definition: EcalMatacqDigi.h:118
EcalMatacqDigi::laserPower
void laserPower(int value)
Definition: EcalMatacqDigi.h:272
EcalMatacqDigi
Definition: EcalMatacqDigi.h:16
EcalMatacqDigi::delayA
int delayA() const
Definition: EcalMatacqDigi.h:223
EcalMatacqDigi::bxId_
Short_t bxId_
Definition: EcalMatacqDigi.h:331
EcalMatacqDigi::EcalMatacqDigi
EcalMatacqDigi()
Definition: EcalMatacqDigi.h:32
EcalMatacqDigi::emtcDelay
int emtcDelay() const
Definition: EcalMatacqDigi.h:233
EcalMatacqDigi::trigRec_
Short_t trigRec_
Definition: EcalMatacqDigi.h:343
EcalMatacqDigi::l1a
int l1a() const
Definition: EcalMatacqDigi.h:141
EcalMatacqDigi::vernier
std::vector< int > vernier() const
Definition: EcalMatacqDigi.h:213
EcalMatacqDigi::chId
int chId() const
Definition: EcalMatacqDigi.h:62
EcalMatacqDigi::l1a_
Int_t l1a_
Definition: EcalMatacqDigi.h:335
EcalMatacqDigi::version_
short version_
Definition: EcalMatacqDigi.h:316
EgammaValidation_cff.samples
samples
Definition: EgammaValidation_cff.py:18
EcalMatacqDigi::delayA
void delayA(int value)
Definition: EcalMatacqDigi.h:228
EcalMatacqDigi::trigRec
int trigRec() const
Definition: EcalMatacqDigi.h:193
EcalMatacqDigi::tv_usec_
Long64_t tv_usec_
Definition: EcalMatacqDigi.h:374
EcalMatacqDigi::triggerType
int triggerType() const
Definition: EcalMatacqDigi.h:151
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EcalMatacqDigi::orbitId_
Int_t orbitId_
Definition: EcalMatacqDigi.h:339
EcalMatacqDigi::emtcPhase
int emtcPhase() const
Definition: EcalMatacqDigi.h:243
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
EcalMatacqDigi::lsb_
static const double lsb_
Definition: EcalMatacqDigi.h:20
EcalMatacqDigi::attenuation_dB_
char attenuation_dB_
Definition: EcalMatacqDigi.h:327
EcalMatacqDigi::postTrig_
Short_t postTrig_
Definition: EcalMatacqDigi.h:347
EcalMatacqDigi::delayA_
Int_t delayA_
Definition: EcalMatacqDigi.h:355
EcalMatacqDigi::chId_
int chId_
Definition: EcalMatacqDigi.h:296
EcalMatacqDigi::bxId
int bxId() const
Definition: EcalMatacqDigi.h:131
EcalMatacqDigi::size
int size() const
Definition: EcalMatacqDigi.h:75
EcalMatacqDigi::vernier_
std::vector< Int_t > vernier_
Definition: EcalMatacqDigi.h:351
EcalMatacqDigi::emtcPhase_
Int_t emtcPhase_
Definition: EcalMatacqDigi.h:363
EcalMatacqDigi::id
int id() const
Definition: EcalMatacqDigi.h:67
EcalMatacqDigi::init
void init()
Definition: EcalMatacqDigi.h:274
a
double a
Definition: hdecay.h:119
EcalMatacqDigi::triggerType_
char triggerType_
Definition: EcalMatacqDigi.h:322
EcalMatacqDigi::vernier
void vernier(const std::vector< int > &value)
Definition: EcalMatacqDigi.h:218
EcalMatacqDigi::ts
float ts() const
Definition: EcalMatacqDigi.h:91
value
Definition: value.py:1
EcalMatacqDigi::bxId
void bxId(int value)
Definition: EcalMatacqDigi.h:136
EcalMatacqDigi::trigRec
void trigRec(int value)
Definition: EcalMatacqDigi.h:198
EcalMatacqDigi::timeStamp
timeval timeStamp() const
Definition: EcalMatacqDigi.h:163
EcalMatacqDigi::postTrig
int postTrig() const
Definition: EcalMatacqDigi.h:203
EcalMatacqDigi::attenuation_dB
int attenuation_dB() const
Definition: EcalMatacqDigi.h:254
EcalMatacqDigi::ts_
double ts_
Definition: EcalMatacqDigi.h:308
EcalMatacqDigi::tTrig
float tTrig() const
Definition: EcalMatacqDigi.h:105
EcalMatacqDigi::l1a
void l1a(int value)
Definition: EcalMatacqDigi.h:146
EcalMatacqDigi::swap
void swap(std::vector< short > &samples)
Definition: EcalMatacqDigi.h:81
EcalMatacqDigi::timeStamp
void timeStamp(timeval value)
Definition: EcalMatacqDigi.h:173
EcalMatacqDigi::tv_sec_
Long64_t tv_sec_
Definition: EcalMatacqDigi.h:373
EcalMatacqDigi::emtcDelay_
Int_t emtcDelay_
Definition: EcalMatacqDigi.h:359
EcalMatacqDigi::orbitId
void orbitId(UInt_t value)
Definition: EcalMatacqDigi.h:187
relativeConstraints.value
value
Definition: relativeConstraints.py:53
EcalMatacqDigi::freq
int freq
Definition: EcalMatacqDigi.h:304
operator<<
std::ostream & operator<<(std::ostream &s, const EcalMatacqDigi &digi)
Definition: EcalMatacqDigi.cc:16
EcalMatacqDigi::amplitudeV
float amplitudeV(const int &i) const
Definition: EcalMatacqDigi.h:58
EcalMatacqDigi::emtcPhase
void emtcPhase(int value)
Definition: EcalMatacqDigi.h:248
EcalMatacqDigi::EcalMatacqDigi
EcalMatacqDigi(const std::vector< Short_t > &samples, const int &chId, const double &ts, const short &version=-1, const double &tTrig=999.)
Definition: EcalMatacqDigi.h:41
EcalMatacqDigi::attenuation_dB
void attenuation_dB(int value)
Definition: EcalMatacqDigi.h:260
EcalMatacqDigi::laserPower
int laserPower() const
Definition: EcalMatacqDigi.h:266
EcalMatacqDigi::postTrig
void postTrig(int value)
Definition: EcalMatacqDigi.h:208
EcalMatacqDigi::tTrigS_
double tTrigS_
Definition: EcalMatacqDigi.h:312
EcalMatacqDigi::laserPower_
Int_t laserPower_
Definition: EcalMatacqDigi.h:367
EcalMatacqDigi::orbitId
UInt_t orbitId() const
Definition: EcalMatacqDigi.h:182
EcalMatacqDigi::data_
std::vector< Short_t > data_
Definition: EcalMatacqDigi.h:300
EcalMatacqDigi::triggerType
void triggerType(int value)
Definition: EcalMatacqDigi.h:156
EcalMatacqDigi::key_type
int key_type
Definition: EcalMatacqDigi.h:27