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.

15  : crtNo(crtNo), rctLookupTables_(rctLookupTables), isolatedEGObjects(4),
18 // quietThreshold(3)
19 {}
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 256 of file L1RCTJetSummaryCard.cc.

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

Referenced by asicSort().

256  {
257  int i;
258  unsigned short temp;
259  for (i = 0; i < 4; i++) {
260 
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 212 of file L1RCTJetSummaryCard.cc.

References asicCompare(), and groupFilesInBlocks::temp.

Referenced by fillIsolatedEGObjects(), and fillNonIsolatedEGObjects().

212  {
213  unsigned short temp, temp2;
214 
216 
217  // Rotate items prior to next compare
218 
219  temp = electrons.at(7);
220  electrons.at(7) = electrons.at(5);
221  electrons.at(5) = electrons.at(3);
222  electrons.at(3) = electrons.at(1);
223  electrons.at(1) = temp;
224 
225  // Second compare
226 
228 
229  // Second rotate, different order this time
230 
231  temp = electrons.at(7);
232  temp2 = electrons.at(5);
233  electrons.at(7) = electrons.at(3);
234  electrons.at(5) = electrons.at(1);
235  electrons.at(3) = temp;
236  electrons.at(1) = temp2;
237 
238  // Third compare
239 
241 
242  // Third rotate, different again
243 
244  temp = electrons.at(1);
245  electrons.at(1) = electrons.at(3);
246  electrons.at(3) = electrons.at(5);
247  electrons.at(5) = electrons.at(7);
248  electrons.at(7) = temp;
249 
250  // Fourth compare
251 
253 }
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 21 of file L1RCTJetSummaryCard.cc.

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

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

22  {
23  // std::cout << "JSC.fillHFRegionSums() entered" << std::endl;
24  for (int i = 0; i < 8; i++) {
25  // std::cout << "filling hf region at " << i << std::endl;
26  HFRegions.at(i) =
27  rctLookupTables_->lookup((hfRegionSums.at(i) / 2), crtNo, 999, i);
28  // std::cout << "hf region " << i << " et filled" << std::endl;
29  hfFineGrainBits.at(i) = (hfRegionSums.at(i) & 1);
30  // std::cout << "hf region " << i << " fine grain bit filled" << std::endl;
31  }
32 }
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 79 of file L1RCTJetSummaryCard.cc.

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

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

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

Definition at line 34 of file L1RCTJetSummaryCard.cc.

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

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

34  {
35  if (crtNo < 9) {
36  for (int i = 0; i < 4; i++) {
37  jetRegions.at(i) = HFRegions.at(i);
38  jetRegions.at(i + 11) = HFRegions.at(i + 4);
39  }
40  jetRegions.at(4) = barrelRegions.at(12);
41  jetRegions.at(5) = barrelRegions.at(9);
42  jetRegions.at(6) = barrelRegions.at(8);
43  jetRegions.at(7) = barrelRegions.at(5);
44  jetRegions.at(8) = barrelRegions.at(4);
45  jetRegions.at(9) = barrelRegions.at(1);
46  jetRegions.at(10) = barrelRegions.at(0);
47 
48  jetRegions.at(15) = barrelRegions.at(13);
49  jetRegions.at(16) = barrelRegions.at(11);
50  jetRegions.at(17) = barrelRegions.at(10);
51  jetRegions.at(18) = barrelRegions.at(7);
52  jetRegions.at(19) = barrelRegions.at(6);
53  jetRegions.at(20) = barrelRegions.at(3);
54  jetRegions.at(21) = barrelRegions.at(2);
55  }
56  if (crtNo >= 9) {
57  jetRegions.at(0) = barrelRegions.at(0);
58  jetRegions.at(1) = barrelRegions.at(1);
59  jetRegions.at(2) = barrelRegions.at(4);
60  jetRegions.at(3) = barrelRegions.at(5);
61  jetRegions.at(4) = barrelRegions.at(8);
62  jetRegions.at(5) = barrelRegions.at(9);
63  jetRegions.at(6) = barrelRegions.at(12);
64 
65  jetRegions.at(11) = barrelRegions.at(2);
66  jetRegions.at(12) = barrelRegions.at(3);
67  jetRegions.at(13) = barrelRegions.at(6);
68  jetRegions.at(14) = barrelRegions.at(7);
69  jetRegions.at(15) = barrelRegions.at(10);
70  jetRegions.at(16) = barrelRegions.at(11);
71  jetRegions.at(17) = barrelRegions.at(13);
72  for (int i = 0; i < 4; i++) {
73  jetRegions.at(i + 7) = HFRegions.at(i);
74  jetRegions.at(i + 18) = HFRegions.at(i + 4);
75  }
76  }
77 }
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 163 of file L1RCTJetSummaryCard.cc.

References mps_fire::i, and mipBits.

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

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

Definition at line 121 of file L1RCTJetSummaryCard.cc.

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

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

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

Definition at line 177 of file L1RCTJetSummaryCard.cc.

References mps_fire::i, and overFlowBits.

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

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

Definition at line 185 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().

185  {
186  bitset<14> quiet;
187 
192 
193  // use one threshold for barrel regions (first 8 in list, cards 0-3)
194  for (int i = 0; i < 8; i++) {
196  quiet[i] = false; // switched 0 and 1
197  else
198  quiet[i] = true;
199  }
200  // use second for endcap regions (last 6 in list, cards 4-6)
201  for (int i = 8; i < 14; i++) {
203  quiet[i] = false; // switched 0 and 1
204  else
205  quiet[i] = true;
206  }
207 
208  quietBits = quiet.to_ulong();
209 }
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 170 of file L1RCTJetSummaryCard.cc.

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

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

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

Definition at line 56 of file L1RCTJetSummaryCard.h.

References barrelRegions.

Referenced by L1RCTCrate::getBarrelRegions().

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

Definition at line 74 of file L1RCTJetSummaryCard.h.

References fillHFRegionSums(), and hfFineGrainBits.

Referenced by L1RCTCrate::getHFFineGrainBits().

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

Definition at line 57 of file L1RCTJetSummaryCard.h.

References HFRegions.

Referenced by L1RCTCrate::getHFRegions().

57 { 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  {
26  return isolatedEGObjects;
27  }
std::vector< unsigned short > isolatedEGObjects
std::vector<unsigned short> L1RCTJetSummaryCard::getJetRegions ( )
inline

Definition at line 55 of file L1RCTJetSummaryCard.h.

References jetRegions.

Referenced by L1RCTCrate::getJetRegions().

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

Definition at line 68 of file L1RCTJetSummaryCard.h.

References mipBits.

Referenced by L1RCTCrate::getMIPBits().

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

Definition at line 28 of file L1RCTJetSummaryCard.h.

References nonisolatedEGObjects.

Referenced by L1RCTCrate::getNonisolatedEGObjects().

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

Definition at line 72 of file L1RCTJetSummaryCard.h.

References overFlowBits.

Referenced by L1RCTCrate::getOverFlowBits().

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

Definition at line 69 of file L1RCTJetSummaryCard.h.

References quietBits.

Referenced by L1RCTCrate::getQuietBits().

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

Definition at line 71 of file L1RCTJetSummaryCard.h.

References tauBits.

Referenced by L1RCTCrate::getTauBits().

71 { 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)
279  << std::endl;
280  ;
281  std::cout << "nonIsoElectron " << i << " " << nonisolatedEGObjects.at(i)
282  << std::endl;
283  }
284  std::cout << "Jets ";
285  for (int i = 0; i < 22; i++)
286  std::cout << jetRegions.at(i) << " ";
287  std::cout << std::endl;
288 }
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 94 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 112 of file L1RCTJetSummaryCard.h.

Referenced by fillHFRegionSums(), and getHFFineGrainBits().

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

Definition at line 102 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 98 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 100 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::mipBits
private

Definition at line 107 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 99 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::overFlowBits
private

Definition at line 110 of file L1RCTJetSummaryCard.h.

Referenced by fillOverFlowBits(), and getOverFlowBits().

unsigned short L1RCTJetSummaryCard::quietBits
private

Definition at line 108 of file L1RCTJetSummaryCard.h.

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

unsigned L1RCTJetSummaryCard::quietThresholdBarrel
private

Definition at line 115 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

unsigned L1RCTJetSummaryCard::quietThresholdEndcap
private

Definition at line 116 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

const L1RCTLookupTables* L1RCTJetSummaryCard::rctLookupTables_
private

Definition at line 96 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::tauBits
private

Definition at line 109 of file L1RCTJetSummaryCard.h.

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