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, unsigned int board, unsigned int lv1id, unsigned int orbit, unsigned int bx, const std::vector<uint64_t>& load, unsigned int user=0);
77  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);
78  bool write(const edm::Event& ev, unsigned char * ptr, unsigned int skip, unsigned int size) const;
79 
80  inline std::vector<amc::Packet> payload() const { return payload_; };
81 
82  private:
83  Header header_;
84  std::vector<amc::Packet> payload_;
85  };
86 }
87 
88 #endif
size
Write out results.
Definition: start.py:1
std::vector< amc::Packet > payload() const
Definition: AMC13Spec.h:80
Header(const uint64_t *data)
Definition: AMC13Spec.h:18
uint64_t raw() const
Definition: AMC13Spec.h:52
unsigned int getCRC() const
Definition: AMC13Spec.h:47
bool ev
uint64_t data_
Definition: AMC13Spec.h:39
Trailer(const uint64_t *data)
Definition: AMC13Spec.h:44
std::vector< amc::Packet > payload_
Definition: AMC13Spec.h:84
unsigned int getBX() const
Definition: AMC13Spec.h:50
unsigned int getBlock() const
Definition: AMC13Spec.h:48
uint64_t data_
Definition: AMC13Spec.h:66
#define end
Definition: vmac.h:39
unsigned int getLV1ID() const
Definition: AMC13Spec.h:49
uint64_t raw() const
Definition: AMC13Spec.h:21
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
unsigned int getOrbitNumber() const
Definition: AMC13Spec.h:26
def parse(path, config)
Definition: dumpparser.py:13
unsigned long long uint64_t
Definition: Time.h:15
def load(fileName)
Definition: svgfig.py:547
unsigned int getNumberOfAMCs() const
Definition: AMC13Spec.h:25
unsigned int getFormatVersion() const
Definition: AMC13Spec.h:24
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
def write(self, setup)
static void check(T const &p, std::string const &id, SelectedProducts const &iProducts)