1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#ifndef DIGIECAL_ECALDATAFRAME_H
#define DIGIECAL_ECALDATAFRAME_H
#include "DataFormats/EcalDigi/interface/EcalMGPASample.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/Common/interface/DataFrame.h"
#define EcalMgpaBitwiseGain12 1
#define EcalMgpaBitwiseGain6 2
#define EcalMgpaBitwiseGain1 3
#define EcalMgpaBitwiseGain0 0
/** \class EcalDataFrame
*/
class EcalDataFrame {
public:
EcalDataFrame() {}
// EcalDataFrame(DetId i) : m_data(i) {}
EcalDataFrame(edm::DataFrame const& iframe) : m_data(iframe) {}
virtual ~EcalDataFrame() {}
DetId id() const { return m_data.id(); }
int size() const { return m_data.size(); }
EcalMGPASample operator[](int i) const { return m_data[i]; }
EcalMGPASample sample(int i) const { return m_data[i]; }
// get the leading sample (the first non saturated sample)
// starting from the fourth sample
// (it relies on the fact that the unpaker will discard fixed gain0 DataFrame)
// .. sample numbering: [0, 9]
// .. return -1 in case of no saturation
int lastUnsaturatedSample() const;
// just the boolean method
bool isSaturated() const { return (lastUnsaturatedSample() != -1); }
// FIXME (shall we throw??)
void setSize(int) {}
// void setPresamples(int ps);
void setSample(int i, EcalMGPASample sam) { m_data[i] = sam; }
bool hasSwitchToGain6() const;
bool hasSwitchToGain1() const;
static constexpr int MAXSAMPLES = 10;
edm::DataFrame const& frame() const { return m_data; }
edm::DataFrame& frame() { return m_data; }
private:
edm::DataFrame m_data;
};
#endif
|