CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
L1RCTJetSummaryCard Class Reference

#include <L1RCTJetSummaryCard.h>

Public Member Functions

int crateNumber ()
 
void fillHFRegionSums (const std::vector< unsigned short > &hfRegionSums)
 
void fillIsolatedEGObjects (const std::vector< unsigned short > &isoElectrons)
 
void fillJetRegions ()
 
void fillMIPBits (const std::vector< unsigned short > &mip)
 
void fillNonIsolatedEGObjects (const std::vector< unsigned short > &nonIsoElectrons)
 
void fillOverFlowBits (const std::vector< unsigned short > &overflow)
 
void fillQuietBits ()
 
void fillRegionSums (const std::vector< unsigned short > &regSums)
 
void fillTauBits (const std::vector< unsigned short > &tau)
 
std::vector< unsigned short > getBarrelRegions ()
 
std::vector< unsigned short > getHFFineGrainBits ()
 
std::vector< unsigned short > getHFRegions ()
 
std::vector< unsigned short > getIsolatedEGObjects ()
 
std::vector< unsigned short > getJetRegions ()
 
unsigned short getMIPBits ()
 
std::vector< unsigned short > getNonisolatedEGObjects ()
 
unsigned short getOverFlowBits ()
 
unsigned short getQuietBits ()
 
unsigned short getTauBits ()
 
 L1RCTJetSummaryCard (int crtNo, const L1RCTLookupTables *rctLookupTables)
 
void print ()
 

Private Member Functions

void asicCompare (std::vector< unsigned short > &array)
 
void asicSort (std::vector< unsigned short > &electrons)
 
 L1RCTJetSummaryCard ()=delete
 

Private Attributes

std::vector< unsigned short > barrelRegions
 
int crtNo
 
std::vector< unsigned short > hfFineGrainBits
 
std::vector< unsigned short > HFRegions
 
std::vector< unsigned short > isolatedEGObjects
 
std::vector< unsigned short > jetRegions
 
unsigned short mipBits
 
std::vector< unsigned short > nonisolatedEGObjects
 
unsigned short overFlowBits
 
unsigned short quietBits
 
unsigned quietThresholdBarrel
 
unsigned quietThresholdEndcap
 
const L1RCTLookupTablesrctLookupTables_
 
unsigned short tauBits
 

Detailed Description

Definition at line 8 of file L1RCTJetSummaryCard.h.

Constructor & Destructor Documentation

L1RCTJetSummaryCard::L1RCTJetSummaryCard ( int  crtNo,
const L1RCTLookupTables rctLookupTables 
)

Definition at line 13 of file L1RCTJetSummaryCard.cc.

14  : crtNo(crtNo),
15  rctLookupTables_(rctLookupTables),
18  jetRegions(22),
19  HFRegions(8),
20  barrelRegions(14),
21  mipBits(0),
22  quietBits(0),
23  tauBits(0),
24  overFlowBits(0),
26 // quietThreshold(3)
27 {}
unsigned short overFlowBits
std::vector< unsigned short > nonisolatedEGObjects
std::vector< unsigned short > isolatedEGObjects
std::vector< unsigned short > HFRegions
std::vector< unsigned short > jetRegions
std::vector< unsigned short > barrelRegions
std::vector< unsigned short > hfFineGrainBits
const L1RCTLookupTables * rctLookupTables_
L1RCTJetSummaryCard::L1RCTJetSummaryCard ( )
privatedelete

Member Function Documentation

void L1RCTJetSummaryCard::asicCompare ( std::vector< unsigned short > &  array)
private

Definition at line 257 of file L1RCTJetSummaryCard.cc.

References L1RCTLookupTables::emRank(), mps_fire::i, rctLookupTables_, and groupFilesInBlocks::temp.

Referenced by asicSort().

257  {
258  int i;
259  unsigned short temp;
260  for (i = 0; i < 4; i++) {
261  unsigned short rank1 = rctLookupTables_->emRank(array.at(2 * i) >> 4);
262  unsigned short rank2 = rctLookupTables_->emRank(array.at(2 * i + 1) >> 4);
263 
264  if (rank1 < rank2) // currently bottom 3 bits are rgn,crd
265  {
266  temp = array.at(2 * i);
267  array.at(2 * i) = array.at((2 * i) + 1);
268  array.at((2 * i) + 1) = temp;
269  }
270  }
271 }
unsigned int emRank(unsigned short energy) const
const L1RCTLookupTables * rctLookupTables_
void L1RCTJetSummaryCard::asicSort ( std::vector< unsigned short > &  electrons)
private

Definition at line 213 of file L1RCTJetSummaryCard.cc.

References asicCompare(), and groupFilesInBlocks::temp.

Referenced by fillIsolatedEGObjects(), and fillNonIsolatedEGObjects().

213  {
214  unsigned short temp, temp2;
215 
217 
218  // Rotate items prior to next compare
219 
220  temp = electrons.at(7);
221  electrons.at(7) = electrons.at(5);
222  electrons.at(5) = electrons.at(3);
223  electrons.at(3) = electrons.at(1);
224  electrons.at(1) = temp;
225 
226  // Second compare
227 
229 
230  // Second rotate, different order this time
231 
232  temp = electrons.at(7);
233  temp2 = electrons.at(5);
234  electrons.at(7) = electrons.at(3);
235  electrons.at(5) = electrons.at(1);
236  electrons.at(3) = temp;
237  electrons.at(1) = temp2;
238 
239  // Third compare
240 
242 
243  // Third rotate, different again
244 
245  temp = electrons.at(1);
246  electrons.at(1) = electrons.at(3);
247  electrons.at(3) = electrons.at(5);
248  electrons.at(5) = electrons.at(7);
249  electrons.at(7) = temp;
250 
251  // Fourth compare
252 
254 }
void asicCompare(std::vector< unsigned short > &array)
int L1RCTJetSummaryCard::crateNumber ( )
inline

Definition at line 15 of file L1RCTJetSummaryCard.h.

References crtNo.

15 { return crtNo; }
void L1RCTJetSummaryCard::fillHFRegionSums ( const std::vector< unsigned short > &  hfRegionSums)

Definition at line 29 of file L1RCTJetSummaryCard.cc.

References crtNo, hfFineGrainBits, HFRegions, mps_fire::i, L1RCTLookupTables::lookup(), and rctLookupTables_.

Referenced by getHFFineGrainBits(), and L1RCTCrate::input().

29  {
30  // std::cout << "JSC.fillHFRegionSums() entered" << std::endl;
31  for (int i = 0; i < 8; i++) {
32  // std::cout << "filling hf region at " << i << std::endl;
33  HFRegions.at(i) = rctLookupTables_->lookup((hfRegionSums.at(i) / 2), crtNo, 999, i);
34  // std::cout << "hf region " << i << " et filled" << std::endl;
35  hfFineGrainBits.at(i) = (hfRegionSums.at(i) & 1);
36  // std::cout << "hf region " << i << " fine grain bit filled" << std::endl;
37  }
38 }
std::vector< unsigned short > HFRegions
std::vector< unsigned short > hfFineGrainBits
const L1RCTLookupTables * rctLookupTables_
unsigned int lookup(unsigned short ecalInput, unsigned short hcalInput, unsigned short fgbit, unsigned short crtNo, unsigned short crdNo, unsigned short twrNo) const
void L1RCTJetSummaryCard::fillIsolatedEGObjects ( const std::vector< unsigned short > &  isoElectrons)

Definition at line 85 of file L1RCTJetSummaryCard.cc.

References asicSort(), mps_fire::i, and isolatedEGObjects.

Referenced by L1RCTCrate::fillJetSummaryCard(), and fillRegionSums().

85  {
86  // sort(isoElectrons.begin(),isoElectrons.end());
87  // reverse(isoElectrons.begin(),isoElectrons.end());
88 
89  std::vector<unsigned short> isoCards03(8);
90  std::vector<unsigned short> isoCards46(8);
91  std::vector<unsigned short> sortIso(8);
92 
93  for (int i = 0; i < 8; i++) {
94  isoCards03.at(i) = isoElectrons.at(i);
95  }
96  for (int i = 0; i < 6; i++) {
97  isoCards46.at(i) = isoElectrons.at(i + 8);
98  }
99  isoCards46.at(6) = 0;
100  isoCards46.at(7) = 0;
101 
102  asicSort(isoCards03);
103  asicSort(isoCards46);
104 
105  sortIso.at(0) = isoCards03.at(0);
106  sortIso.at(2) = isoCards03.at(2);
107  sortIso.at(4) = isoCards03.at(4);
108  sortIso.at(6) = isoCards03.at(6);
109  sortIso.at(1) = isoCards46.at(0);
110  sortIso.at(3) = isoCards46.at(2);
111  sortIso.at(5) = isoCards46.at(4);
112  sortIso.at(7) = isoCards46.at(6);
113 
114  asicSort(sortIso);
115 
116  // for(int i = 0; i<4; i++){
117  // isolatedEGObjects.at(i) = isoElectrons.at(i);
118  // isolatedEGObjects.at(i) = sortIso.at(2*i);
119  //}
120  isolatedEGObjects.at(0) = sortIso.at(4);
121  isolatedEGObjects.at(1) = sortIso.at(6);
122  isolatedEGObjects.at(2) = sortIso.at(0);
123  isolatedEGObjects.at(3) = sortIso.at(2);
124 }
std::vector< unsigned short > isolatedEGObjects
void asicSort(std::vector< unsigned short > &electrons)
void L1RCTJetSummaryCard::fillJetRegions ( )

Definition at line 40 of file L1RCTJetSummaryCard.cc.

References barrelRegions, crtNo, HFRegions, mps_fire::i, and jetRegions.

Referenced by fillRegionSums(), and L1RCTCrate::processJetSummaryCard().

40  {
41  if (crtNo < 9) {
42  for (int i = 0; i < 4; i++) {
43  jetRegions.at(i) = HFRegions.at(i);
44  jetRegions.at(i + 11) = HFRegions.at(i + 4);
45  }
46  jetRegions.at(4) = barrelRegions.at(12);
47  jetRegions.at(5) = barrelRegions.at(9);
48  jetRegions.at(6) = barrelRegions.at(8);
49  jetRegions.at(7) = barrelRegions.at(5);
50  jetRegions.at(8) = barrelRegions.at(4);
51  jetRegions.at(9) = barrelRegions.at(1);
52  jetRegions.at(10) = barrelRegions.at(0);
53 
54  jetRegions.at(15) = barrelRegions.at(13);
55  jetRegions.at(16) = barrelRegions.at(11);
56  jetRegions.at(17) = barrelRegions.at(10);
57  jetRegions.at(18) = barrelRegions.at(7);
58  jetRegions.at(19) = barrelRegions.at(6);
59  jetRegions.at(20) = barrelRegions.at(3);
60  jetRegions.at(21) = barrelRegions.at(2);
61  }
62  if (crtNo >= 9) {
63  jetRegions.at(0) = barrelRegions.at(0);
64  jetRegions.at(1) = barrelRegions.at(1);
65  jetRegions.at(2) = barrelRegions.at(4);
66  jetRegions.at(3) = barrelRegions.at(5);
67  jetRegions.at(4) = barrelRegions.at(8);
68  jetRegions.at(5) = barrelRegions.at(9);
69  jetRegions.at(6) = barrelRegions.at(12);
70 
71  jetRegions.at(11) = barrelRegions.at(2);
72  jetRegions.at(12) = barrelRegions.at(3);
73  jetRegions.at(13) = barrelRegions.at(6);
74  jetRegions.at(14) = barrelRegions.at(7);
75  jetRegions.at(15) = barrelRegions.at(10);
76  jetRegions.at(16) = barrelRegions.at(11);
77  jetRegions.at(17) = barrelRegions.at(13);
78  for (int i = 0; i < 4; i++) {
79  jetRegions.at(i + 7) = HFRegions.at(i);
80  jetRegions.at(i + 18) = HFRegions.at(i + 4);
81  }
82  }
83 }
std::vector< unsigned short > HFRegions
std::vector< unsigned short > jetRegions
std::vector< unsigned short > barrelRegions
void L1RCTJetSummaryCard::fillMIPBits ( const std::vector< unsigned short > &  mip)

Definition at line 167 of file L1RCTJetSummaryCard.cc.

References mps_fire::i, and mipBits.

Referenced by L1RCTCrate::fillJetSummaryCard(), and fillRegionSums().

167  {
168  bitset<14> mips;
169  for (int i = 0; i < 14; i++)
170  mips[i] = mip.at(i);
171  mipBits = mips.to_ulong();
172 }
void L1RCTJetSummaryCard::fillNonIsolatedEGObjects ( const std::vector< unsigned short > &  nonIsoElectrons)

Definition at line 126 of file L1RCTJetSummaryCard.cc.

References asicSort(), mps_fire::i, and nonisolatedEGObjects.

Referenced by L1RCTCrate::fillJetSummaryCard(), and fillRegionSums().

126  {
127  // sort(nonIsoElectrons.begin(),nonIsoElectrons.end());
128  // reverse(nonIsoElectrons.begin(),nonIsoElectrons.end());
129 
130  std::vector<unsigned short> nonIsoCards03(8);
131  std::vector<unsigned short> nonIsoCards46(8);
132  std::vector<unsigned short> sortNonIso(8);
133 
134  for (int i = 0; i < 8; i++) {
135  nonIsoCards03.at(i) = nonIsoElectrons.at(i);
136  }
137  for (int i = 0; i < 6; i++) {
138  nonIsoCards46.at(i) = nonIsoElectrons.at(i + 8);
139  }
140  nonIsoCards46.at(6) = 0;
141  nonIsoCards46.at(7) = 0;
142 
143  asicSort(nonIsoCards03);
144  asicSort(nonIsoCards46);
145 
146  sortNonIso.at(0) = nonIsoCards03.at(0);
147  sortNonIso.at(2) = nonIsoCards03.at(2);
148  sortNonIso.at(4) = nonIsoCards03.at(4);
149  sortNonIso.at(6) = nonIsoCards03.at(6);
150  sortNonIso.at(1) = nonIsoCards46.at(0);
151  sortNonIso.at(3) = nonIsoCards46.at(2);
152  sortNonIso.at(5) = nonIsoCards46.at(4);
153  sortNonIso.at(7) = nonIsoCards46.at(6);
154 
155  asicSort(sortNonIso);
156 
157  // for(int i = 0; i<4; i++){
158  // nonisolatedEGObjects.at(i) = nonIsoElectrons.at(i);
159  // nonisolatedEGObjects.at(i) = sortNonIso.at(2*i);
160  //}
161  nonisolatedEGObjects.at(0) = sortNonIso.at(4);
162  nonisolatedEGObjects.at(1) = sortNonIso.at(6);
163  nonisolatedEGObjects.at(2) = sortNonIso.at(0);
164  nonisolatedEGObjects.at(3) = sortNonIso.at(2);
165 }
std::vector< unsigned short > nonisolatedEGObjects
void asicSort(std::vector< unsigned short > &electrons)
void L1RCTJetSummaryCard::fillOverFlowBits ( const std::vector< unsigned short > &  overflow)

Definition at line 181 of file L1RCTJetSummaryCard.cc.

References mps_fire::i, and overFlowBits.

Referenced by L1RCTCrate::fillJetSummaryCard(), and fillRegionSums().

181  {
182  bitset<14> overflows;
183  for (int i = 0; i < 14; i++)
184  overflows[i] = overflow.at(i);
185  overFlowBits = overflows.to_ulong();
186 }
unsigned short overFlowBits
void L1RCTJetSummaryCard::fillQuietBits ( )

Definition at line 188 of file L1RCTJetSummaryCard.cc.

References barrelRegions, mps_fire::i, L1RCTParameters::jscQuietThresholdBarrel(), L1RCTParameters::jscQuietThresholdEndcap(), quietBits, quietThresholdBarrel, quietThresholdEndcap, rctLookupTables_, and L1RCTLookupTables::rctParameters().

Referenced by fillRegionSums(), and L1RCTCrate::processJetSummaryCard().

188  {
189  bitset<14> quiet;
190 
193 
194  // use one threshold for barrel regions (first 8 in list, cards 0-3)
195  for (int i = 0; i < 8; i++) {
197  quiet[i] = false; // switched 0 and 1
198  else
199  quiet[i] = true;
200  }
201  // use second for endcap regions (last 6 in list, cards 4-6)
202  for (int i = 8; i < 14; i++) {
204  quiet[i] = false; // switched 0 and 1
205  else
206  quiet[i] = true;
207  }
208 
209  quietBits = quiet.to_ulong();
210 }
unsigned jscQuietThresholdEndcap() const
std::vector< unsigned short > barrelRegions
const L1RCTParameters * rctParameters() const
const L1RCTLookupTables * rctLookupTables_
unsigned jscQuietThresholdBarrel() const
void L1RCTJetSummaryCard::fillRegionSums ( const std::vector< unsigned short > &  regSums)
inline
void L1RCTJetSummaryCard::fillTauBits ( const std::vector< unsigned short > &  tau)

Definition at line 174 of file L1RCTJetSummaryCard.cc.

References mps_fire::i, tauBits, and Tau3MuMonitor_cff::taus.

Referenced by L1RCTCrate::fillJetSummaryCard(), and fillRegionSums().

174  {
175  bitset<14> taus;
176  for (int i = 0; i < 14; i++)
177  taus[i] = tau.at(i);
178  tauBits = taus.to_ulong();
179 }
std::vector<unsigned short> L1RCTJetSummaryCard::getBarrelRegions ( )
inline

Definition at line 52 of file L1RCTJetSummaryCard.h.

References barrelRegions.

Referenced by L1RCTCrate::getBarrelRegions().

52 { return barrelRegions; }
std::vector< unsigned short > barrelRegions
std::vector<unsigned short> L1RCTJetSummaryCard::getHFFineGrainBits ( )
inline

Definition at line 70 of file L1RCTJetSummaryCard.h.

References fillHFRegionSums(), and hfFineGrainBits.

Referenced by L1RCTCrate::getHFFineGrainBits().

70 { return hfFineGrainBits; }
std::vector< unsigned short > hfFineGrainBits
std::vector<unsigned short> L1RCTJetSummaryCard::getHFRegions ( )
inline

Definition at line 53 of file L1RCTJetSummaryCard.h.

References HFRegions.

Referenced by L1RCTCrate::getHFRegions().

53 { return HFRegions; }
std::vector< unsigned short > HFRegions
std::vector<unsigned short> L1RCTJetSummaryCard::getIsolatedEGObjects ( )
inline

Definition at line 25 of file L1RCTJetSummaryCard.h.

References isolatedEGObjects.

Referenced by L1RCTCrate::getIsolatedEGObjects().

25 { return isolatedEGObjects; }
std::vector< unsigned short > isolatedEGObjects
std::vector<unsigned short> L1RCTJetSummaryCard::getJetRegions ( )
inline

Definition at line 51 of file L1RCTJetSummaryCard.h.

References jetRegions.

Referenced by L1RCTCrate::getJetRegions().

51 { return jetRegions; }
std::vector< unsigned short > jetRegions
unsigned short L1RCTJetSummaryCard::getMIPBits ( )
inline

Definition at line 64 of file L1RCTJetSummaryCard.h.

References mipBits.

Referenced by L1RCTCrate::getMIPBits().

64 { return mipBits; }
std::vector<unsigned short> L1RCTJetSummaryCard::getNonisolatedEGObjects ( )
inline

Definition at line 26 of file L1RCTJetSummaryCard.h.

References nonisolatedEGObjects.

Referenced by L1RCTCrate::getNonisolatedEGObjects().

26 { return nonisolatedEGObjects; }
std::vector< unsigned short > nonisolatedEGObjects
unsigned short L1RCTJetSummaryCard::getOverFlowBits ( )
inline

Definition at line 68 of file L1RCTJetSummaryCard.h.

References overFlowBits.

Referenced by L1RCTCrate::getOverFlowBits().

68 { return overFlowBits; }
unsigned short overFlowBits
unsigned short L1RCTJetSummaryCard::getQuietBits ( )
inline

Definition at line 65 of file L1RCTJetSummaryCard.h.

References quietBits.

Referenced by L1RCTCrate::getQuietBits().

65 { return quietBits; }
unsigned short L1RCTJetSummaryCard::getTauBits ( )
inline

Definition at line 67 of file L1RCTJetSummaryCard.h.

References tauBits.

Referenced by L1RCTCrate::getTauBits().

67 { return tauBits; }
void L1RCTJetSummaryCard::print ( void  )

Definition at line 273 of file L1RCTJetSummaryCard.cc.

References gather_cfg::cout, mps_fire::i, isolatedEGObjects, jetRegions, mipBits, nonisolatedEGObjects, quietBits, and tauBits.

Referenced by fillRegionSums(), L1RCTCrate::print(), and L1RCTCrate::printJSC().

273  {
274  std::cout << "tauBits " << tauBits << std::endl;
275  std::cout << "MIPBits " << mipBits << std::endl;
276  std::cout << "QuietBits " << quietBits << std::endl;
277  for (int i = 0; i < 4; i++) {
278  std::cout << "isoElectron " << i << " " << isolatedEGObjects.at(i) << std::endl;
279  ;
280  std::cout << "nonIsoElectron " << i << " " << nonisolatedEGObjects.at(i) << std::endl;
281  }
282  std::cout << "Jets ";
283  for (int i = 0; i < 22; i++)
284  std::cout << jetRegions.at(i) << " ";
285  std::cout << std::endl;
286 }
std::vector< unsigned short > nonisolatedEGObjects
std::vector< unsigned short > isolatedEGObjects
std::vector< unsigned short > jetRegions

Member Data Documentation

std::vector<unsigned short> L1RCTJetSummaryCard::barrelRegions
private
int L1RCTJetSummaryCard::crtNo
private

Definition at line 87 of file L1RCTJetSummaryCard.h.

Referenced by crateNumber(), fillHFRegionSums(), and fillJetRegions().

std::vector<unsigned short> L1RCTJetSummaryCard::hfFineGrainBits
private

Definition at line 104 of file L1RCTJetSummaryCard.h.

Referenced by fillHFRegionSums(), and getHFFineGrainBits().

std::vector<unsigned short> L1RCTJetSummaryCard::HFRegions
private

Definition at line 95 of file L1RCTJetSummaryCard.h.

Referenced by fillHFRegionSums(), fillJetRegions(), and getHFRegions().

std::vector<unsigned short> L1RCTJetSummaryCard::isolatedEGObjects
private

Definition at line 91 of file L1RCTJetSummaryCard.h.

Referenced by fillIsolatedEGObjects(), getIsolatedEGObjects(), and print().

std::vector<unsigned short> L1RCTJetSummaryCard::jetRegions
private

Definition at line 93 of file L1RCTJetSummaryCard.h.

Referenced by fillJetRegions(), getJetRegions(), and print().

unsigned short L1RCTJetSummaryCard::mipBits
private

Definition at line 99 of file L1RCTJetSummaryCard.h.

Referenced by fillMIPBits(), getMIPBits(), and print().

std::vector<unsigned short> L1RCTJetSummaryCard::nonisolatedEGObjects
private

Definition at line 92 of file L1RCTJetSummaryCard.h.

Referenced by fillNonIsolatedEGObjects(), getNonisolatedEGObjects(), and print().

unsigned short L1RCTJetSummaryCard::overFlowBits
private

Definition at line 102 of file L1RCTJetSummaryCard.h.

Referenced by fillOverFlowBits(), and getOverFlowBits().

unsigned short L1RCTJetSummaryCard::quietBits
private

Definition at line 100 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits(), getQuietBits(), and print().

unsigned L1RCTJetSummaryCard::quietThresholdBarrel
private

Definition at line 107 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

unsigned L1RCTJetSummaryCard::quietThresholdEndcap
private

Definition at line 108 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

const L1RCTLookupTables* L1RCTJetSummaryCard::rctLookupTables_
private

Definition at line 89 of file L1RCTJetSummaryCard.h.

Referenced by asicCompare(), fillHFRegionSums(), and fillQuietBits().

unsigned short L1RCTJetSummaryCard::tauBits
private

Definition at line 101 of file L1RCTJetSummaryCard.h.

Referenced by fillTauBits(), getTauBits(), and print().