CMS 3D CMS Logo

CSCTMBHeader2007_rev0x50c3.cc
Go to the documentation of this file.
4 
6 {
7  bzero(data(), sizeInWords()*2);
8  bits.nHeaderFrames = 42;
9  bits.e0bline = 0x6E0B;
10  bits.b0cline = 0xDB0C;
11  bits.firmRevCode = 0x50c3;
12  bits.nTBins = 12;
13  bits.nCFEBs = 5;
14 }
15 
16 
18 {
19  memcpy(data(), buf, sizeInWords()*2);
20 }
21 
22 
24 {
25  bits.cscID = dmbHeader.dmbID();
26  bits.l1aNumber = dmbHeader.l1a24() & 0xFFF;
27 // bits.bxnCount = dmbHeader.bxn12();
28 }
29 
31 std::vector<CSCCLCTDigi> CSCTMBHeader2007_rev0x50c3::CLCTDigis(uint32_t idlayer)
32 {
33  std::vector<CSCCLCTDigi> result;
34  int halfstrip = bits.clct0_key_low + (bits.clct0_key_high << 7);
35  int strip = halfstrip%32;
36  int cfeb = halfstrip/32;
37  int pattern = bits.clct0_shape;
38  int bend = pattern &0x1;
39 
40  //offlineStripNumbering(strip, cfeb, pattern, bend);
41  CSCCLCTDigi digi0(bits.clct0_valid, bits.clct0_quality,
42  pattern, 1, bend, strip, cfeb, bits.clct_bxn, 1, bits.bxnPreTrigger);
43  //digi0.setFullBX(bits.bxnPreTrigger);
44 
45  halfstrip = bits.clct1_key_low + (bits.clct1_key_high << 7);
46  strip = halfstrip%32;
47  cfeb = halfstrip/32;
48  pattern = bits.clct1_shape;
49  bend = pattern &0x1;
50 
51  //offlineStripNumbering(strip, cfeb, pattern, bend);
52  CSCCLCTDigi digi1(bits.clct1_valid, bits.clct1_quality,
53  pattern, 1, bend, strip, cfeb, bits.clct_bxn, 2, bits.bxnPreTrigger);
54  //digi1.setFullBX(bits.bxnPreTrigger);
55  result.push_back(digi0);
56  result.push_back(digi1);
57  return result;
58 }
59 
61 std::vector<CSCCorrelatedLCTDigi>
63 {
64  std::vector<CSCCorrelatedLCTDigi> result;
66  int strip = bits.MPC_Muon0_halfstrip_clct_pattern;//this goes from 0-159
67  //offlineHalfStripNumbering(strip);
68  CSCCorrelatedLCTDigi digi(1, bits.MPC_Muon0_vpf_, bits.MPC_Muon0_quality_,
69  bits.MPC_Muon0_wire_, strip, bits.MPC_Muon0_clct_pattern_,
70  bits.MPC_Muon0_bend_, bits.MPC_Muon0_bx_, 0,
71  bits.MPC_Muon0_bc0_, bits.MPC_Muon0_SyncErr_,
72  bits.MPC_Muon0_cscid_low | (bits.MPC_Muon0_cscid_bit4<<3));
73  result.push_back(digi);
75  strip = bits.MPC_Muon1_halfstrip_clct_pattern;//this goes from 0-159
76  //offlineHalfStripNumbering(strip);
77  digi = CSCCorrelatedLCTDigi(2, bits.MPC_Muon1_vpf_, bits.MPC_Muon1_quality_,
78  bits.MPC_Muon1_wire_, strip, bits.MPC_Muon1_clct_pattern_,
79  bits.MPC_Muon1_bend_, bits.MPC_Muon1_bx_, 0,
80  bits.MPC_Muon1_bc0_, bits.MPC_Muon1_SyncErr_,
81  bits.MPC_Muon1_cscid_low | (bits.MPC_Muon1_cscid_bit4<<3));
82  result.push_back(digi);
83  return result;
84 }
85 
86 void
88 {
89  throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header");
90 }
91 
92 
93 void
95 {
96  throw cms::Exception("In CSC TMBHeaderFormat 2007, ALCTs belong in ALCT header");
97 }
98 
99 void
101 {
102  int halfStrip = digi.getKeyStrip();
103  int pattern = digi.getPattern();
104  //int bend = digi.getBend();
105  //hardwareStripNumbering(strip, cfeb, pattern, bend);
106  bits.clct0_valid = digi.isValid();
107  bits.clct0_quality = digi.getQuality();
108  bits.clct0_shape = pattern;
109  // first 7 bits of halfstrip
110  bits.clct0_key_low = halfStrip & (0x7F);
111  // most-significant (8th) bit
112  bits.clct0_key_high = (halfStrip >> 7) & (0x1);
113  bits.clct_bxn = digi.getBX();
114  bits.bxnPreTrigger = digi.getFullBX();
115 }
116 
117 void
119 {
120  int halfStrip = digi.getKeyStrip();
121  int pattern = digi.getPattern();
122  //int bend = digi.getBend();
123  //hardwareStripNumbering(strip, cfeb, pattern, bend);
124  bits.clct1_valid = digi.isValid();
125  bits.clct1_quality = digi.getQuality();
126  bits.clct1_shape = pattern;
127  // first 7 bits of halfstrip
128  bits.clct1_key_low = halfStrip & (0x7F);
129  // most-significant (8th) bit
130  bits.clct1_key_high = (halfStrip >> 7) & (0x1);
131  // There is just one BX field common for CLCT0 and CLCT1 (since both
132  // are latched at the same BX); set it in addCLCT0().
133  //bits.clct_bxn = digi.getBX();
134  bits.bxnPreTrigger = digi.getFullBX();
135  bits.bxnCount = (digi.getFullBX() + 167) & 0xFFF;
136 }
137 
138 void
140 {
141  int halfStrip = digi.getStrip();
142  //hardwareHalfStripNumbering(halfStrip);
143 
144  bits.MPC_Muon0_vpf_ = digi.isValid();
145  bits.MPC_Muon0_wire_ = digi.getKeyWG();
146  bits.MPC_Muon0_clct_pattern_ = digi.getPattern();
147  bits.MPC_Muon0_quality_ = digi.getQuality();
148  bits.MPC_Muon0_halfstrip_clct_pattern = halfStrip;
149  bits.MPC_Muon0_bend_ = digi.getBend();
150  bits.MPC_Muon0_SyncErr_ = digi.getSyncErr();
151  bits.MPC_Muon0_bx_ = digi.getBX();
152  bits.MPC_Muon0_bc0_ = digi.getBX0();
153  bits.MPC_Muon0_cscid_low = digi.getCSCID() & 0x7;
154  bits.MPC_Muon0_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
155 }
156 
157 void
159 {
160  int halfStrip = digi.getStrip();
161  //hardwareHalfStripNumbering(halfStrip);
162 
163  bits.MPC_Muon1_vpf_ = digi.isValid();
164  bits.MPC_Muon1_wire_ = digi.getKeyWG();
165  bits.MPC_Muon1_clct_pattern_ = digi.getPattern();
166  bits.MPC_Muon1_quality_ = digi.getQuality();
167  bits.MPC_Muon1_halfstrip_clct_pattern = halfStrip;
168  bits.MPC_Muon1_bend_ = digi.getBend();
169  bits.MPC_Muon1_SyncErr_ = digi.getSyncErr();
170  bits.MPC_Muon1_bx_ = digi.getBX();
171  bits.MPC_Muon1_bc0_ = digi.getBX0();
172  bits.MPC_Muon1_cscid_low = digi.getCSCID() & 0x7;
173  bits.MPC_Muon1_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
174 }
175 
176 
177 void CSCTMBHeader2007_rev0x50c3::print(std::ostream & os) const
178 {
179  os << "...............TMB Header.................." << "\n";
180  os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n";
181  os << std::dec << "fifoMode = " << bits.fifoMode
182  << ", nTBins = " << bits.nTBins << "\n";
183 // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = "
184 // << nHeaderFrames << "\n";
185  os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n";
186  os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n";
187 // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " ";
188  os << "trigSourceVect = " << bits.trigSourceVect
189  << ", activeCFEBs = " << bits.activeCFEBs <<"\n";
190  os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n";
191  os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly
192  << " clctOnly = " << bits.clctOnly << "\n";
193 // << " alctMatchTime = " << alctMatchTime << " ";
194 // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh
195 // << " ";
196 // os << "clct0_key = " << bits.clct0_key
197  os << " bits.clct0_shape = " << bits.clct0_shape
198  << " clct0_quality = " << bits.clct0_quality << "\n";
199 // os << "r_buf_nbusy = " << r_buf_nbusy << " ";
200 
201  os << "..................CLCT....................." << "\n";
202 
203 }
204 
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:33
int getStrip() const
return the key halfstrip from 0,159
unsigned l1a24() const
Definition: CSCDMBHeader.h:50
uint16_t getSyncErr() const
int getQuality() const
return the 4 bit Correlated LCT Quality
int getBend() const
return bend
void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi) override
struct CSCTMBHeader2007_rev0x50c3::@380 bits
void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi) override
void addALCT0(const CSCALCTDigi &digi) override
void addCLCT1(const CSCCLCTDigi &digi) override
int getBX() const
return BX
Definition: CSCCLCTDigi.h:51
void addCLCT0(const CSCCLCTDigi &digi) override
Needed before data packing.
uint16_t getCSCID() const
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
unsigned short int sizeInWords() const override
int getBX() const
return BX
uint16_t getBX0() const
unsigned short * data() override
returns the first data word
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:36
void setEventInformation(const CSCDMBHeader &dmbHeader) override
bool isValid() const
return valid pattern bit
unsigned dmbID() const
Definition: CSCDMBHeader.h:46
std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const override
returns CorrelatedLCT digis
int getPattern() const
return pattern
std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer) override
returns CLCT digis
void addALCT1(const CSCALCTDigi &digi) override
int getKeyStrip() const
Definition: CSCCLCTDigi.h:65
int getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:74
int getKeyWG() const
return the key wire group. counts from 0.
void print(std::ostream &os) const override