CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCTMBHeader2013.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 = 0x7a76;
12  bits.nTBins = 12;
13  bits.nCFEBs = 5;
14 }
15 
16 
17 CSCTMBHeader2013::CSCTMBHeader2013(const unsigned short * buf)
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> CSCTMBHeader2013::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>
62 CSCTMBHeader2013::CorrelatedLCTDigis(uint32_t idlayer) const
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  bits.bxnCount = (digi.getFullBX() + 167) & 0xFFF;
116 
117 }
118 
119 void
121 {
122  int halfStrip = digi.getKeyStrip();
123  int pattern = digi.getPattern();
124  //int bend = digi.getBend();
125  //hardwareStripNumbering(strip, cfeb, pattern, bend);
126  bits.clct1_valid = digi.isValid();
127  bits.clct1_quality = digi.getQuality();
128  bits.clct1_shape = pattern;
129  // first 7 bits of halfstrip
130  bits.clct1_key_low = halfStrip & (0x7F);
131  // most-significant (8th) bit
132  bits.clct1_key_high = (halfStrip >> 7) & (0x1);
133  // There is just one BX field common for CLCT0 and CLCT1 (since both
134  // are latched at the same BX); set it in addCLCT0().
135  //bits.clct_bxn = digi.getBX();
136  bits.bxnPreTrigger = digi.getFullBX();
137 }
138 
139 void
141 {
142  int halfStrip = digi.getStrip();
143  //hardwareHalfStripNumbering(halfStrip);
144 
145  bits.MPC_Muon0_vpf_ = digi.isValid();
146  bits.MPC_Muon0_wire_ = digi.getKeyWG();
147  bits.MPC_Muon0_clct_pattern_ = digi.getPattern();
148  bits.MPC_Muon0_quality_ = digi.getQuality();
149  bits.MPC_Muon0_halfstrip_clct_pattern = halfStrip;
150  bits.MPC_Muon0_bend_ = digi.getBend();
151  bits.MPC_Muon0_SyncErr_ = digi.getSyncErr();
152  bits.MPC_Muon0_bx_ = digi.getBX();
153  bits.MPC_Muon0_bc0_ = digi.getBX0();
154  bits.MPC_Muon0_cscid_low = digi.getCSCID() & 0x7;
155  bits.MPC_Muon0_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
156 }
157 
158 void
160 {
161  int halfStrip = digi.getStrip();
162  //hardwareHalfStripNumbering(halfStrip);
163 
164  bits.MPC_Muon1_vpf_ = digi.isValid();
165  bits.MPC_Muon1_wire_ = digi.getKeyWG();
166  bits.MPC_Muon1_clct_pattern_ = digi.getPattern();
167  bits.MPC_Muon1_quality_ = digi.getQuality();
168  bits.MPC_Muon1_halfstrip_clct_pattern = halfStrip;
169  bits.MPC_Muon1_bend_ = digi.getBend();
170  bits.MPC_Muon1_SyncErr_ = digi.getSyncErr();
171  bits.MPC_Muon1_bx_ = digi.getBX();
172  bits.MPC_Muon1_bc0_ = digi.getBX0();
173  bits.MPC_Muon1_cscid_low = digi.getCSCID() & 0x7;
174  bits.MPC_Muon1_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
175 }
176 
177 
178 void CSCTMBHeader2013::print(std::ostream & os) const
179 {
180  os << "...............TMB Header.................." << "\n";
181  os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n";
182  os << std::dec << "fifoMode = " << bits.fifoMode
183  << ", nTBins = " << bits.nTBins << "\n";
184 // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = "
185 // << nHeaderFrames << "\n";
186  os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n";
187  os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n";
188 // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " ";
189  os << "trigSourceVect = " << bits.trigSourceVect
190  << ", activeCFEBs = " << (bits.activeCFEBs | (bits.activeCFEBs_2 << 5))
191  << ", readCFEBs = " << (bits.readCFEBs | (bits.readCFEBs_2 << 5)) << "\n";
192  os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n";
193  os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly
194  << " clctOnly = " << bits.clctOnly << "\n";
195 // << " alctMatchTime = " << alctMatchTime << " ";
196 // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh
197 // << " ";
198 // os << "clct0_key = " << bits.clct0_key
199  os << " bits.clct0_shape = " << bits.clct0_shape
200  << " clct0_quality = " << bits.clct0_quality << "\n";
201 // os << "r_buf_nbusy = " << r_buf_nbusy << " ";
202 
203  os << "..................CLCT....................." << "\n";
204 
205 }
206 
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
virtual void print(std::ostream &os) const
unsigned l1a24() const
Definition: CSCDMBHeader.h:51
virtual void setEventInformation(const CSCDMBHeader &dmbHeader)
uint16_t getSyncErr() const
int getQuality() const
return the 4 bit Correlated LCT Quality
virtual void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
int getBend() const
return bend
tuple result
Definition: mps_fire.py:84
virtual void addALCT1(const CSCALCTDigi &digi)
virtual unsigned short * data()
returns the first data word
virtual void addCLCT1(const CSCCLCTDigi &digi)
virtual void addALCT0(const CSCALCTDigi &digi)
virtual void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
int getBX() const
return BX
Definition: CSCCLCTDigi.h:51
uint16_t getCSCID() const
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
virtual std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis
int getBX() const
return BX
uint16_t getBX0() const
struct CSCTMBHeader2013::@315 bits
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:36
virtual std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
bool isValid() const
return valid pattern bit
unsigned dmbID() const
Definition: CSCDMBHeader.h:47
int getPattern() const
return pattern
int getKeyStrip() const
Definition: CSCCLCTDigi.h:65
unsigned short int sizeInWords() const
int getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:74
int getKeyWG() const
return the key wire group
virtual void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)