CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCTMBHeader2020_Run2.cc
Go to the documentation of this file.
4 
6  bzero(data(), sizeInWords() * 2);
7  bits.nHeaderFrames = 42;
8  bits.e0bline = 0x6E0B;
9  bits.b0cline = 0xDB0C;
10  bits.firmRevCode = firmware_revision;
11  bits.nTBins = 12;
12  bits.nCFEBs = 5;
13 }
14 
15 CSCTMBHeader2020_Run2::CSCTMBHeader2020_Run2(const unsigned short* buf) { memcpy(data(), buf, sizeInWords() * 2); }
16 
18  bits.cscID = dmbHeader.dmbID();
19  bits.l1aNumber = dmbHeader.l1a();
20  bits.bxnCount = dmbHeader.bxn();
21 }
22 
24 std::vector<CSCCLCTDigi> CSCTMBHeader2020_Run2::CLCTDigis(uint32_t idlayer) {
25  std::vector<CSCCLCTDigi> result;
26  unsigned halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7);
27  unsigned strip = halfstrip % 32;
28  unsigned cfeb = halfstrip / 32;
29  unsigned pattern = bits.clct0_shape;
30  unsigned bend = pattern & 0x1;
31 
32  CSCCLCTDigi digi0(
33  bits.clct0_valid, bits.clct0_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger);
34 
35  halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7);
36  strip = halfstrip % 32;
37  cfeb = halfstrip / 32;
38  pattern = bits.clct1_shape;
39  bend = pattern & 0x1;
40 
41  CSCCLCTDigi digi1(
42  bits.clct1_valid, bits.clct1_quality, pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger);
43  result.push_back(digi0);
44  result.push_back(digi1);
45  return result;
46 }
47 
49 std::vector<CSCCorrelatedLCTDigi> CSCTMBHeader2020_Run2::CorrelatedLCTDigis(uint32_t idlayer) const {
50  std::vector<CSCCorrelatedLCTDigi> result;
52  unsigned strip = bits.MPC_Muon0_halfstrip_clct_pattern; //this goes from 0-159
53  CSCCorrelatedLCTDigi digi(1,
54  bits.MPC_Muon0_vpf_,
55  bits.MPC_Muon0_quality_,
56  bits.MPC_Muon0_wire_,
57  strip,
58  bits.MPC_Muon0_clct_pattern_,
59  bits.MPC_Muon0_bend_,
60  bits.MPC_Muon0_bx_,
61  0,
62  bits.MPC_Muon0_bc0_,
63  bits.MPC_Muon0_SyncErr_,
64  bits.MPC_Muon0_cscid_low | (bits.MPC_Muon0_cscid_bit4 << 3));
65  result.push_back(digi);
67  strip = bits.MPC_Muon1_halfstrip_clct_pattern; //this goes from 0-159
68  digi = CSCCorrelatedLCTDigi(2,
69  bits.MPC_Muon1_vpf_,
70  bits.MPC_Muon1_quality_,
71  bits.MPC_Muon1_wire_,
72  strip,
73  bits.MPC_Muon1_clct_pattern_,
74  bits.MPC_Muon1_bend_,
75  bits.MPC_Muon1_bx_,
76  0,
77  bits.MPC_Muon1_bc0_,
78  bits.MPC_Muon1_SyncErr_,
79  bits.MPC_Muon1_cscid_low | (bits.MPC_Muon1_cscid_bit4 << 3));
80  result.push_back(digi);
81  return result;
82 }
83 
85  throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header");
86 }
87 
89  throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header");
90 }
91 
93  unsigned halfStrip = digi.getKeyStrip();
94  unsigned pattern = digi.getPattern();
95  bits.clct0_valid = digi.isValid();
96  bits.clct0_quality = digi.getQuality();
97  bits.clct0_shape = pattern;
98  // first 7 bits of halfstrip
99  bits.clct0_key_low = halfStrip & (0x7F);
100  // most-significant (8th) bit
101  bits.clct0_key_high = (halfStrip >> 7) & (0x1);
102  bits.clct_bxn = digi.getBX();
103  bits.bxnPreTrigger = digi.getFullBX();
104 }
105 
107  unsigned halfStrip = digi.getKeyStrip();
108  unsigned pattern = digi.getPattern();
109  bits.clct1_valid = digi.isValid();
110  bits.clct1_quality = digi.getQuality();
111  bits.clct1_shape = pattern;
112  // first 7 bits of halfstrip
113  bits.clct1_key_low = halfStrip & (0x7F);
114  // most-significant (8th) bit
115  bits.clct1_key_high = (halfStrip >> 7) & (0x1);
116  // There is just one BX field common for CLCT0 and CLCT1 (since both
117  // are latched at the same BX); set it in addCLCT0().
118  bits.bxnPreTrigger = digi.getFullBX();
119 }
120 
122  unsigned halfStrip = digi.getStrip();
123  bits.MPC_Muon0_vpf_ = digi.isValid();
124  bits.MPC_Muon0_wire_ = digi.getKeyWG();
125  bits.MPC_Muon0_clct_pattern_ = digi.getPattern();
126  bits.MPC_Muon0_quality_ = digi.getQuality();
127  bits.MPC_Muon0_halfstrip_clct_pattern = halfStrip;
128  bits.MPC_Muon0_bend_ = digi.getBend();
129  bits.MPC_Muon0_SyncErr_ = digi.getSyncErr();
130  bits.MPC_Muon0_bx_ = digi.getBX();
131  bits.MPC_Muon0_bc0_ = digi.getBX0();
132  bits.MPC_Muon0_cscid_low = digi.getCSCID() & 0x7;
133  bits.MPC_Muon0_cscid_bit4 = (digi.getCSCID() >> 3) & 0x1;
134 }
135 
137  unsigned halfStrip = digi.getStrip();
138  bits.MPC_Muon1_vpf_ = digi.isValid();
139  bits.MPC_Muon1_wire_ = digi.getKeyWG();
140  bits.MPC_Muon1_clct_pattern_ = digi.getPattern();
141  bits.MPC_Muon1_quality_ = digi.getQuality();
142  bits.MPC_Muon1_halfstrip_clct_pattern = halfStrip;
143  bits.MPC_Muon1_bend_ = digi.getBend();
144  bits.MPC_Muon1_SyncErr_ = digi.getSyncErr();
145  bits.MPC_Muon1_bx_ = digi.getBX();
146  bits.MPC_Muon1_bc0_ = digi.getBX0();
147  bits.MPC_Muon1_cscid_low = digi.getCSCID() & 0x7;
148  bits.MPC_Muon1_cscid_bit4 = (digi.getCSCID() >> 3) & 0x1;
149 }
150 
151 void CSCTMBHeader2020_Run2::print(std::ostream& os) const {
152  os << "...............(O)TMB2020 legacy Run2 Header.................."
153  << "\n";
154  os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n";
155  os << std::hex << "FW revision: 0x" << bits.firmRevCode << "\n";
156  os << std::dec << "fifoMode = " << bits.fifoMode << ", nTBins = " << bits.nTBins << "\n";
157  os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n";
158  os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n";
159  os << "trigSourceVect = " << bits.trigSourceVect << ", activeCFEBs = 0x" << std::hex
160  << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5)) << ", readCFEBs = 0x" << std::hex
161  << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << std::dec << "\n";
162  os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n";
163  os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly << " clctOnly = " << bits.clctOnly << "\n";
164 
165  os << "CLCT Words:\n"
166  << " bits.clct0_valid = " << bits.clct0_valid << " bits.clct0_shape = " << bits.clct0_shape
167  << " bits.clct0_quality = " << bits.clct0_quality
168  << " halfstrip = " << (bits.clct0_key_low + (bits.clct0_key_high << 7)) << "\n";
169 
170  os << " bits.clct1_valid = " << bits.clct1_valid << " bits.clct1_shape = " << bits.clct1_shape
171  << " bits.clct1_quality = " << bits.clct1_quality
172  << " halfstrip = " << (bits.clct1_key_low + (bits.clct1_key_high << 7)) << "\n";
173 
174  os << "MPC Words:\n"
175  << " LCT0 valid = " << bits.MPC_Muon0_vpf_ << " key WG = " << bits.MPC_Muon0_wire_
176  << " key halfstrip = " << bits.MPC_Muon0_halfstrip_clct_pattern << " pattern = " << bits.MPC_Muon0_clct_pattern_
177  << " quality = " << bits.MPC_Muon0_quality_ << "\n";
178 
179  os << " LCT1 valid = " << bits.MPC_Muon1_vpf_ << " key WG = " << bits.MPC_Muon1_wire_
180  << " key halfstrip = " << bits.MPC_Muon1_halfstrip_clct_pattern << " pattern = " << bits.MPC_Muon1_clct_pattern_
181  << " quality = " << bits.MPC_Muon1_quality_ << "\n";
182 }
uint16_t getBend() const
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:165
unsigned l1a() const
Definition: CSCDMBHeader.h:39
uint16_t getSyncErr() const
uint16_t getBX() const
return BX
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
uint16_t getPattern() const
return the Run-2 pattern ID
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const override
returns CorrelatedLCT digis
unsigned short int sizeInWords() const override
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer) override
returns CLCT digis
void addALCT1(const CSCALCTDigi &digi) override
tuple result
Definition: mps_fire.py:311
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
struct CSCTMBHeader2020_Run2::@489 bits
uint16_t getKeyWG() const
return the key wire group. counts from 0.
unsigned short * data() override
returns the first data word
void addCLCT1(const CSCCLCTDigi &digi) override
uint16_t getCSCID() const
void addALCT0(const CSCALCTDigi &digi) override
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi) override
uint16_t getBX0() const
uint16_t getStrip(uint16_t n=2) const
return the key halfstrip from 0,159
unsigned bxn() const
Definition: CSCDMBHeader.h:37
CSCTMBHeader2020_Run2(int firmware_revision=0x421)
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
uint16_t getQuality() const
return the Quality
bool isValid() const
return valid pattern bit
unsigned dmbID() const
Definition: CSCDMBHeader.h:36
void setEventInformation(const CSCDMBHeader &dmbHeader) override
void print(std::ostream &os) const override
void addCLCT0(const CSCCLCTDigi &digi) override
for data packing
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi) override