CMS 3D CMS Logo

AMC13Spec.h
Go to the documentation of this file.
1 #ifndef EventFilter_L1TRawToDigi_AMC13_SPEC__h
2 #define EventFilter_L1TRawToDigi_AMC13_SPEC__h
3 
4 #include <memory>
5 #include <vector>
6 #include <cstdint>
7 
8 #include "AMCSpec.h"
9 
10 namespace edm {
11  class Event;
12 }
13 
14 namespace amc13 {
15  class Header {
16  public:
17  Header() : data_(0){};
18  Header(const uint64_t *data) : data_(data[0]){};
19  Header(unsigned int namc, unsigned int orbit);
20 
21  inline uint64_t raw() const { return data_; };
22  bool check() const;
23 
24  inline unsigned int getFormatVersion() const { return (data_ >> uFOV_shift) & uFOV_mask; };
25  inline unsigned int getNumberOfAMCs() const { return (data_ >> nAMC_shift) & nAMC_mask; };
26  inline unsigned int getOrbitNumber() const { return (data_ >> OrN_shift) & OrN_mask; };
27 
28  private:
29  static const unsigned int uFOV_shift = 60;
30  static const unsigned int uFOV_mask = 0xf;
31  static const unsigned int nAMC_shift = 52;
32  static const unsigned int nAMC_mask = 0xf;
33  static const unsigned int OrN_shift = 4;
34  static const unsigned int OrN_mask = 0xffffffff;
35 
36  static const unsigned int fov = 1;
37  static const unsigned int max_amc = 12;
38 
40  };
41 
42  class Trailer {
43  public:
44  Trailer(const uint64_t *data) : data_(data[0]){};
45  Trailer(unsigned int blk, unsigned int lv1, unsigned int bx);
46 
47  inline unsigned int getCRC() const { return (data_ >> CRC_shift) & CRC_mask; };
48  inline unsigned int getBlock() const { return (data_ >> BlkNo_shift) & BlkNo_mask; };
49  inline unsigned int getLV1ID() const { return (data_ >> LV1_shift) & LV1_mask; };
50  inline unsigned int getBX() const { return (data_ >> BX_shift) & BX_mask; };
51 
52  uint64_t raw() const { return data_; };
53  bool check(unsigned int crc, unsigned int block, unsigned int lv1_id, unsigned int bx) const;
54  static void writeCRC(const uint64_t *start, uint64_t *end);
55 
56  private:
57  static const unsigned int CRC_shift = 32;
58  static const unsigned int CRC_mask = 0xffffffff;
59  static const unsigned int BlkNo_shift = 20;
60  static const unsigned int BlkNo_mask = 0xff;
61  static const unsigned int LV1_shift = 12;
62  static const unsigned int LV1_mask = 0xff;
63  static const unsigned int BX_shift = 0;
64  static const unsigned int BX_mask = 0xfff;
65 
67  };
68 
69  class Packet {
70  public:
71  Packet(){};
72 
73  unsigned int blocks() const;
74  unsigned int size() const;
75 
76  void add(unsigned int amc_no,
77  unsigned int board,
78  unsigned int lv1id,
79  unsigned int orbit,
80  unsigned int bx,
81  const std::vector<uint64_t> &load,
82  unsigned int user = 0);
83  bool parse(const uint64_t *start,
84  const uint64_t *data,
85  unsigned int size,
86  unsigned int lv1,
87  unsigned int bx,
88  bool legacy_mc = false,
89  bool mtf7_mode = false);
90  bool write(const edm::Event &ev, unsigned char *ptr, unsigned int skip, unsigned int size) const;
91 
92  inline std::vector<amc::Packet> payload() const { return payload_; };
93 
94  private:
96  std::vector<amc::Packet> payload_;
97  };
98 } // namespace amc13
99 
100 #endif
amc13::Trailer::BX_shift
static const unsigned int BX_shift
Definition: AMC13Spec.h:63
amc13::Packet::blocks
unsigned int blocks() const
Definition: AMC13Spec.cc:177
start
Definition: start.py:1
amc13::Header
Definition: AMC13Spec.h:15
amc13::Packet::parse
bool parse(const uint64_t *start, const uint64_t *data, unsigned int size, unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
Definition: AMC13Spec.cc:60
amc13::Trailer::check
bool check(unsigned int crc, unsigned int block, unsigned int lv1_id, unsigned int bx) const
Definition: AMC13Spec.cc:26
amc13::Trailer::getBlock
unsigned int getBlock() const
Definition: AMC13Spec.h:48
amc13::Trailer::raw
uint64_t raw() const
Definition: AMC13Spec.h:52
edm
HLT enums.
Definition: AlignableModifier.h:19
amc13::Header::check
bool check() const
Definition: AMC13Spec.cc:19
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
amc13::Trailer::LV1_shift
static const unsigned int LV1_shift
Definition: AMC13Spec.h:61
amc13
Definition: AMC13Spec.h:14
amc13::Header::getNumberOfAMCs
unsigned int getNumberOfAMCs() const
Definition: AMC13Spec.h:25
amc13::Trailer
Definition: AMC13Spec.h:42
amc13::Packet::payload
std::vector< amc::Packet > payload() const
Definition: AMC13Spec.h:92
amc13::Trailer::BlkNo_shift
static const unsigned int BlkNo_shift
Definition: AMC13Spec.h:59
amc13::Header::uFOV_shift
static const unsigned int uFOV_shift
Definition: AMC13Spec.h:29
amc13::Header::OrN_shift
static const unsigned int OrN_shift
Definition: AMC13Spec.h:33
amc13::Header::raw
uint64_t raw() const
Definition: AMC13Spec.h:21
optionsL1T.skip
skip
Definition: optionsL1T.py:30
amc13::Trailer::CRC_shift
static const unsigned int CRC_shift
Definition: AMC13Spec.h:57
amc13::Packet::header_
Header header_
Definition: AMC13Spec.h:92
amc13::Packet
Definition: AMC13Spec.h:69
amc13::Packet::size
unsigned int size() const
Definition: AMC13Spec.cc:186
mps_fire.end
end
Definition: mps_fire.py:242
Event
svgfig.load
def load(fileName)
Definition: svgfig.py:547
amc13::Packet::payload_
std::vector< amc::Packet > payload_
Definition: AMC13Spec.h:96
amc13::Header::nAMC_shift
static const unsigned int nAMC_shift
Definition: AMC13Spec.h:31
amc13::Trailer::getCRC
unsigned int getCRC() const
Definition: AMC13Spec.h:47
amc13::Header::OrN_mask
static const unsigned int OrN_mask
Definition: AMC13Spec.h:34
amc13::Header::nAMC_mask
static const unsigned int nAMC_mask
Definition: AMC13Spec.h:32
amc13::Header::fov
static const unsigned int fov
Definition: AMC13Spec.h:36
amc13::Header::max_amc
static const unsigned int max_amc
Definition: AMC13Spec.h:37
amc13::Trailer::LV1_mask
static const unsigned int LV1_mask
Definition: AMC13Spec.h:62
amc13::Trailer::writeCRC
static void writeCRC(const uint64_t *start, uint64_t *end)
Definition: AMC13Spec.cc:40
amc13::Packet::Packet
Packet()
Definition: AMC13Spec.h:71
groupFilesInBlocks.block
block
Definition: groupFilesInBlocks.py:150
amc13::Trailer::BlkNo_mask
static const unsigned int BlkNo_mask
Definition: AMC13Spec.h:60
amc13::Header::getOrbitNumber
unsigned int getOrbitNumber() const
Definition: AMC13Spec.h:26
amc13::Trailer::BX_mask
static const unsigned int BX_mask
Definition: AMC13Spec.h:64
amc13::Trailer::getLV1ID
unsigned int getLV1ID() const
Definition: AMC13Spec.h:49
amc13::Trailer::getBX
unsigned int getBX() const
Definition: AMC13Spec.h:50
EnviromentSettings.user
user
Definition: EnviromentSettings.py:30
amc13::Header::data_
uint64_t data_
Definition: AMC13Spec.h:39
amc13::Header::getFormatVersion
unsigned int getFormatVersion() const
Definition: AMC13Spec.h:24
amc13::Trailer::CRC_mask
static const unsigned int CRC_mask
Definition: AMC13Spec.h:58
amc13::Header::uFOV_mask
static const unsigned int uFOV_mask
Definition: AMC13Spec.h:30
amc13::Header::Header
Header()
Definition: AMC13Spec.h:17
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
amc13::Packet::write
bool write(const edm::Event &ev, unsigned char *ptr, unsigned int skip, unsigned int size) const
Definition: AMC13Spec.cc:202
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
amc13::Trailer::Trailer
Trailer(const uint64_t *data)
Definition: AMC13Spec.h:44
AMCSpec.h
amc13::Packet::add
void add(unsigned int amc_no, unsigned int board, unsigned int lv1id, unsigned int orbit, unsigned int bx, const std::vector< uint64_t > &load, unsigned int user=0)
Definition: AMC13Spec.cc:47
edm::Event
Definition: Event.h:73
amc13::Header::Header
Header(const uint64_t *data)
Definition: AMC13Spec.h:18
amc13::Trailer::data_
uint64_t data_
Definition: AMC13Spec.h:66