CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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.l1a();
27  bits.bxnCount = dmbHeader.bxn();
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 }
136 
137 void
139 {
140  int halfStrip = digi.getStrip();
141  //hardwareHalfStripNumbering(halfStrip);
142 
143  bits.MPC_Muon0_vpf_ = digi.isValid();
144  bits.MPC_Muon0_wire_ = digi.getKeyWG();
145  bits.MPC_Muon0_clct_pattern_ = digi.getPattern();
146  bits.MPC_Muon0_quality_ = digi.getQuality();
147  bits.MPC_Muon0_halfstrip_clct_pattern = halfStrip;
148  bits.MPC_Muon0_bend_ = digi.getBend();
149  bits.MPC_Muon0_SyncErr_ = digi.getSyncErr();
150  bits.MPC_Muon0_bx_ = digi.getBX();
151  bits.MPC_Muon0_bc0_ = digi.getBX0();
152  bits.MPC_Muon0_cscid_low = digi.getCSCID() & 0x7;
153  bits.MPC_Muon0_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
154 }
155 
156 void
158 {
159  int halfStrip = digi.getStrip();
160  //hardwareHalfStripNumbering(halfStrip);
161 
162  bits.MPC_Muon1_vpf_ = digi.isValid();
163  bits.MPC_Muon1_wire_ = digi.getKeyWG();
164  bits.MPC_Muon1_clct_pattern_ = digi.getPattern();
165  bits.MPC_Muon1_quality_ = digi.getQuality();
166  bits.MPC_Muon1_halfstrip_clct_pattern = halfStrip;
167  bits.MPC_Muon1_bend_ = digi.getBend();
168  bits.MPC_Muon1_SyncErr_ = digi.getSyncErr();
169  bits.MPC_Muon1_bx_ = digi.getBX();
170  bits.MPC_Muon1_bc0_ = digi.getBX0();
171  bits.MPC_Muon1_cscid_low = digi.getCSCID() & 0x7;
172  bits.MPC_Muon1_cscid_bit4 = (digi.getCSCID()>>3) & 0x1;
173 }
174 
175 
176 void CSCTMBHeader2007_rev0x50c3::print(std::ostream & os) const
177 {
178  os << "...............TMB Header.................." << "\n";
179  os << std::hex << "BOC LINE " << bits.b0cline << " EOB " << bits.e0bline << "\n";
180  os << std::dec << "fifoMode = " << bits.fifoMode
181  << ", nTBins = " << bits.nTBins << "\n";
182 // os << "dumpCFEBs = " << dumpCFEBs << ", nHeaderFrames = "
183 // << nHeaderFrames << "\n";
184  os << "boardID = " << bits.boardID << ", cscID = " << bits.cscID << "\n";
185  os << "l1aNumber = " << bits.l1aNumber << ", bxnCount = " << bits.bxnCount << "\n";
186 // os << "preTrigTBins = " << preTrigTBins << ", nCFEBs = "<< nCFEBs<< " ";
187  os << "trigSourceVect = " << bits.trigSourceVect
188  << ", activeCFEBs = " << bits.activeCFEBs <<"\n";
189  os << "bxnPreTrigger = " << bits.bxnPreTrigger << "\n";
190  os << "tmbMatch = " << bits.tmbMatch << " alctOnly = " << bits.alctOnly
191  << " clctOnly = " << bits.clctOnly << "\n";
192 // << " alctMatchTime = " << alctMatchTime << " ";
193 // os << "hs_thresh = " << hs_thresh << ", ds_thresh = " << ds_thresh
194 // << " ";
195 // os << "clct0_key = " << bits.clct0_key
196  os << " bits.clct0_shape = " << bits.clct0_shape
197  << " clct0_quality = " << bits.clct0_quality << "\n";
198 // os << "r_buf_nbusy = " << r_buf_nbusy << " ";
199 
200  os << "..................CLCT....................." << "\n";
201 
202 }
203 
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:35
int getStrip() const
return the key halfstrip from 0,159
unsigned l1a() const
Definition: CSCDMBHeader.cc:74
unsigned short int sizeInWords() const
uint16_t getSyncErr() const
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
struct CSCTMBHeader2007_rev0x50c3::@215 bits
int getQuality() const
return the 4 bit Correlated LCT Quality
int getBend() const
return bend
virtual void addCorrelatedLCT0(const CSCCorrelatedLCTDigi &digi)
virtual void addCorrelatedLCT1(const CSCCorrelatedLCTDigi &digi)
tuple result
Definition: query.py:137
int getBX() const
return BX
Definition: CSCCLCTDigi.h:53
uint16_t getCSCID() const
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:32
int getBX() const
return BX
uint16_t getBX0() const
virtual void setEventInformation(const CSCDMBHeader &dmbHeader)
unsigned bxn() const
Definition: CSCDMBHeader.cc:61
virtual std::vector< CSCCLCTDigi > CLCTDigis(uint32_t idlayer)
returns CLCT digis
virtual void print(std::ostream &os) const
int getPattern() const
return pattern
Definition: CSCCLCTDigi.h:38
virtual void addALCT0(const CSCALCTDigi &digi)
bool isValid() const
return valid pattern bit
unsigned dmbID() const
Definition: CSCDMBHeader.cc:56
virtual void addCLCT1(const CSCCLCTDigi &digi)
int getPattern() const
return pattern
virtual unsigned short * data()
returns the first data word
int getKeyStrip() const
Definition: CSCCLCTDigi.h:67
virtual void addALCT1(const CSCALCTDigi &digi)
int getFullBX() const
return 12-bit full BX.
Definition: CSCCLCTDigi.h:76
int getKeyWG() const
return the key wire group
virtual void addCLCT0(const CSCCLCTDigi &digi)
Needed before data packing.
virtual std::vector< CSCCorrelatedLCTDigi > CorrelatedLCTDigis(uint32_t idlayer) const
returns CorrelatedLCT digis