CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1RCTJetSummaryCard Class Reference

#include <L1RCTJetSummaryCard.h>

List of all members.

Public Member Functions

int crateNumber ()
void fillHFRegionSums (std::vector< unsigned short > hfRegionSums)
void fillIsolatedEGObjects (std::vector< unsigned short > isoElectrons)
void fillJetRegions ()
void fillMIPBits (std::vector< unsigned short > mip)
void fillNonIsolatedEGObjects (std::vector< unsigned short > nonIsoElectrons)
void fillOverFlowBits (std::vector< unsigned short > overflow)
void fillQuietBits ()
void fillRegionSums (std::vector< unsigned short > regSums)
void fillTauBits (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 ()

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.

                                                                                            : 
  crtNo(crtNo),
  rctLookupTables_(rctLookupTables),
  isolatedEGObjects(4),
  nonisolatedEGObjects(4),
  jetRegions(22),
  HFRegions(8),
  barrelRegions(14),
  mipBits(0),
  quietBits(0),
  tauBits(0),
  overFlowBits(0),
  hfFineGrainBits(8)
  //quietThreshold(3)
{
}
L1RCTJetSummaryCard::L1RCTJetSummaryCard ( ) [private]

Member Function Documentation

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

Definition at line 260 of file L1RCTJetSummaryCard.cc.

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

Referenced by asicSort().

{
  int i;
  unsigned short temp;
  for (i = 0; i < 4; i++)
    {

      unsigned short rank1 = rctLookupTables_->emRank(array.at(2 * i)>>4);
      unsigned short rank2 = rctLookupTables_->emRank(array.at(2 * i + 1)>>4);

      if (rank1 < rank2) // currently bottom 3 bits are rgn,crd
        {
          temp = array.at(2 * i);
          array.at(2 * i) = array.at((2 * i) + 1);
          array.at((2 * i) + 1) = temp;
        }
    }
}
void L1RCTJetSummaryCard::asicSort ( std::vector< unsigned short > &  electrons) [private]

Definition at line 214 of file L1RCTJetSummaryCard.cc.

References asicCompare(), and groupFilesInBlocks::temp.

Referenced by fillIsolatedEGObjects(), and fillNonIsolatedEGObjects().

{
  unsigned short temp, temp2;

  asicCompare(electrons);

  // Rotate items prior to next compare

  temp = electrons.at(7);
  electrons.at(7) = electrons.at(5);
  electrons.at(5) = electrons.at(3);
  electrons.at(3) = electrons.at(1);
  electrons.at(1) = temp;

  // Second compare

  asicCompare(electrons);

  // Second rotate, different order this time

  temp = electrons.at(7);
  temp2 = electrons.at(5);
  electrons.at(7) = electrons.at(3);
  electrons.at(5) = electrons.at(1);
  electrons.at(3) = temp;
  electrons.at(1) = temp2;

  // Third compare

  asicCompare(electrons);

  // Third rotate, different again

  temp = electrons.at(1);
  electrons.at(1) = electrons.at(3);
  electrons.at(3) = electrons.at(5);
  electrons.at(5) = electrons.at(7);
  electrons.at(7) = temp;

  // Fourth compare

  asicCompare(electrons);

}
int L1RCTJetSummaryCard::crateNumber ( ) [inline]

Definition at line 17 of file L1RCTJetSummaryCard.h.

References crtNo.

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

Definition at line 30 of file L1RCTJetSummaryCard.cc.

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

Referenced by L1RCTCrate::input().

                                                                                {
  //std::cout << "JSC.fillHFRegionSums() entered" << std::endl;
  for(int i=0;i<8;i++){
    //std::cout << "filling hf region at " << i << std::endl;
    HFRegions.at(i) = rctLookupTables_->lookup( (hfRegionSums.at(i)/2), crtNo, 999, i);
    //std::cout << "hf region " << i << " et filled" << std::endl;
    hfFineGrainBits.at(i) = (hfRegionSums.at(i)&1);
    //std::cout << "hf region " << i << " fine grain bit filled" << std::endl;
  }
}
void L1RCTJetSummaryCard::fillIsolatedEGObjects ( std::vector< unsigned short >  isoElectrons)

Definition at line 86 of file L1RCTJetSummaryCard.cc.

References asicSort(), i, and isolatedEGObjects.

Referenced by L1RCTCrate::fillJetSummaryCard().

                                                                                     {
  //sort(isoElectrons.begin(),isoElectrons.end());
  //reverse(isoElectrons.begin(),isoElectrons.end());

  std::vector<unsigned short> isoCards03(8);
  std::vector<unsigned short> isoCards46(8);
  std::vector<unsigned short> sortIso(8);

  for (int i = 0; i < 8; i++){
    isoCards03.at(i) = isoElectrons.at(i);
  }
  for (int i = 0; i < 6; i++){
    isoCards46.at(i) = isoElectrons.at(i+8);
  }
  isoCards46.at(6) = 0;
  isoCards46.at(7) = 0;

  asicSort(isoCards03);
  asicSort(isoCards46);

  sortIso.at(0) = isoCards03.at(0);
  sortIso.at(2) = isoCards03.at(2);
  sortIso.at(4) = isoCards03.at(4);
  sortIso.at(6) = isoCards03.at(6);
  sortIso.at(1) = isoCards46.at(0);
  sortIso.at(3) = isoCards46.at(2);
  sortIso.at(5) = isoCards46.at(4);
  sortIso.at(7) = isoCards46.at(6);

  asicSort(sortIso);

  //for(int i = 0; i<4; i++){
    //isolatedEGObjects.at(i) = isoElectrons.at(i);
    //isolatedEGObjects.at(i) = sortIso.at(2*i);
  //}
  isolatedEGObjects.at(0) = sortIso.at(4);
  isolatedEGObjects.at(1) = sortIso.at(6);
  isolatedEGObjects.at(2) = sortIso.at(0);
  isolatedEGObjects.at(3) = sortIso.at(2);
}
void L1RCTJetSummaryCard::fillJetRegions ( )

Definition at line 41 of file L1RCTJetSummaryCard.cc.

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

Referenced by L1RCTCrate::processJetSummaryCard().

                                        {
  if(crtNo<9){
    for(int i = 0; i<4;i++){
      jetRegions.at(i) = HFRegions.at(i);
      jetRegions.at(i+11) = HFRegions.at(i+4);
    }
    jetRegions.at(4) = barrelRegions.at(12);
    jetRegions.at(5) = barrelRegions.at(9);
    jetRegions.at(6) = barrelRegions.at(8);
    jetRegions.at(7) = barrelRegions.at(5);
    jetRegions.at(8) = barrelRegions.at(4);
    jetRegions.at(9) = barrelRegions.at(1);
    jetRegions.at(10) = barrelRegions.at(0);

    jetRegions.at(15) = barrelRegions.at(13);
    jetRegions.at(16) = barrelRegions.at(11);
    jetRegions.at(17) = barrelRegions.at(10);
    jetRegions.at(18) = barrelRegions.at(7);
    jetRegions.at(19) = barrelRegions.at(6);
    jetRegions.at(20) = barrelRegions.at(3);
    jetRegions.at(21) = barrelRegions.at(2);
  }
  if(crtNo>=9){
    jetRegions.at(0) = barrelRegions.at(0);
    jetRegions.at(1) = barrelRegions.at(1);
    jetRegions.at(2) = barrelRegions.at(4);
    jetRegions.at(3) = barrelRegions.at(5);
    jetRegions.at(4) = barrelRegions.at(8);
    jetRegions.at(5) = barrelRegions.at(9);
    jetRegions.at(6) = barrelRegions.at(12);
    
    jetRegions.at(11) = barrelRegions.at(2);
    jetRegions.at(12) = barrelRegions.at(3);
    jetRegions.at(13) = barrelRegions.at(6);
    jetRegions.at(14) = barrelRegions.at(7);
    jetRegions.at(15) = barrelRegions.at(10);
    jetRegions.at(16) = barrelRegions.at(11);
    jetRegions.at(17) = barrelRegions.at(13);
    for(int i = 0; i<4;i++){
      jetRegions.at(i+7) = HFRegions.at(i);
      jetRegions.at(i+18) = HFRegions.at(i+4);
    }
  }
}
void L1RCTJetSummaryCard::fillMIPBits ( std::vector< unsigned short >  mip)

Definition at line 168 of file L1RCTJetSummaryCard.cc.

References i, and mipBits.

Referenced by L1RCTCrate::fillJetSummaryCard().

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

Definition at line 127 of file L1RCTJetSummaryCard.cc.

References asicSort(), i, and nonisolatedEGObjects.

Referenced by L1RCTCrate::fillJetSummaryCard().

                                                                                           {
  //sort(nonIsoElectrons.begin(),nonIsoElectrons.end());
  //reverse(nonIsoElectrons.begin(),nonIsoElectrons.end());

  std::vector<unsigned short> nonIsoCards03(8);
  std::vector<unsigned short> nonIsoCards46(8);
  std::vector<unsigned short> sortNonIso(8);

  for (int i = 0; i < 8; i++){
    nonIsoCards03.at(i) = nonIsoElectrons.at(i);
  }
  for (int i = 0; i < 6; i++){
    nonIsoCards46.at(i) = nonIsoElectrons.at(i+8);
  }
  nonIsoCards46.at(6) = 0;
  nonIsoCards46.at(7) = 0;

  asicSort(nonIsoCards03);
  asicSort(nonIsoCards46);

  sortNonIso.at(0) = nonIsoCards03.at(0);
  sortNonIso.at(2) = nonIsoCards03.at(2);
  sortNonIso.at(4) = nonIsoCards03.at(4);
  sortNonIso.at(6) = nonIsoCards03.at(6);
  sortNonIso.at(1) = nonIsoCards46.at(0);
  sortNonIso.at(3) = nonIsoCards46.at(2);
  sortNonIso.at(5) = nonIsoCards46.at(4);
  sortNonIso.at(7) = nonIsoCards46.at(6);

  asicSort(sortNonIso);

  //for(int i = 0; i<4; i++){
    //nonisolatedEGObjects.at(i) = nonIsoElectrons.at(i);
    //nonisolatedEGObjects.at(i) = sortNonIso.at(2*i);
  //}
  nonisolatedEGObjects.at(0) = sortNonIso.at(4);
  nonisolatedEGObjects.at(1) = sortNonIso.at(6);
  nonisolatedEGObjects.at(2) = sortNonIso.at(0);
  nonisolatedEGObjects.at(3) = sortNonIso.at(2);
}
void L1RCTJetSummaryCard::fillOverFlowBits ( std::vector< unsigned short >  overflow)

Definition at line 182 of file L1RCTJetSummaryCard.cc.

References i, and overFlowBits.

Referenced by L1RCTCrate::fillJetSummaryCard().

                                                                            {
  bitset<14> overflows;
  for(int i = 0; i<14; i++)
    overflows[i] = overflow.at(i);
  overFlowBits = overflows.to_ulong();
}
void L1RCTJetSummaryCard::fillQuietBits ( )

Definition at line 189 of file L1RCTJetSummaryCard.cc.

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

Referenced by L1RCTCrate::processJetSummaryCard().

                                       {
  bitset<14> quiet;

  quietThresholdBarrel = rctLookupTables_->rctParameters()->jscQuietThresholdBarrel();
  quietThresholdEndcap = rctLookupTables_->rctParameters()->jscQuietThresholdEndcap();

  // use one threshold for barrel regions (first 8 in list, cards 0-3)
  for(int i = 0; i<8; i++){
    if((barrelRegions.at(i))>quietThresholdBarrel)
      quiet[i] = 0;  //switched 0 and 1
    else
      quiet[i] = 1;
  }
  // use second for endcap regions (last 6 in list, cards 4-6)
  for(int i = 8; i<14; i++){
    if((barrelRegions.at(i))>quietThresholdEndcap)
      quiet[i] = 0;  //switched 0 and 1
    else
      quiet[i] = 1;
  }

  quietBits = quiet.to_ulong();
}
void L1RCTJetSummaryCard::fillRegionSums ( std::vector< unsigned short >  regSums) [inline]

Definition at line 75 of file L1RCTJetSummaryCard.h.

References barrelRegions.

Referenced by L1RCTCrate::fillJetSummaryCard().

                                                        {
    barrelRegions = regSums;
  }
void L1RCTJetSummaryCard::fillTauBits ( std::vector< unsigned short >  tau)

Definition at line 175 of file L1RCTJetSummaryCard.cc.

References i, and tauBits.

Referenced by L1RCTCrate::fillJetSummaryCard().

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

Definition at line 54 of file L1RCTJetSummaryCard.h.

References barrelRegions.

Referenced by L1RCTCrate::getBarrelRegions().

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

Definition at line 72 of file L1RCTJetSummaryCard.h.

References hfFineGrainBits.

Referenced by L1RCTCrate::getHFFineGrainBits().

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

Definition at line 55 of file L1RCTJetSummaryCard.h.

References HFRegions.

Referenced by L1RCTCrate::getHFRegions().

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

Definition at line 27 of file L1RCTJetSummaryCard.h.

References isolatedEGObjects.

Referenced by L1RCTCrate::getIsolatedEGObjects().

std::vector<unsigned short> L1RCTJetSummaryCard::getJetRegions ( ) [inline]

Definition at line 53 of file L1RCTJetSummaryCard.h.

References jetRegions.

Referenced by L1RCTCrate::getJetRegions().

{return jetRegions;}
unsigned short L1RCTJetSummaryCard::getMIPBits ( ) [inline]

Definition at line 66 of file L1RCTJetSummaryCard.h.

References mipBits.

Referenced by L1RCTCrate::getMIPBits().

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

Definition at line 28 of file L1RCTJetSummaryCard.h.

References nonisolatedEGObjects.

Referenced by L1RCTCrate::getNonisolatedEGObjects().

unsigned short L1RCTJetSummaryCard::getOverFlowBits ( ) [inline]

Definition at line 70 of file L1RCTJetSummaryCard.h.

References overFlowBits.

Referenced by L1RCTCrate::getOverFlowBits().

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

Definition at line 67 of file L1RCTJetSummaryCard.h.

References quietBits.

Referenced by L1RCTCrate::getQuietBits().

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

Definition at line 69 of file L1RCTJetSummaryCard.h.

References tauBits.

Referenced by L1RCTCrate::getTauBits().

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

Definition at line 280 of file L1RCTJetSummaryCard.cc.

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

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

                               {
  std::cout << "tauBits " << tauBits << std::endl;
  std::cout << "MIPBits " << mipBits << std::endl;
  std::cout << "QuietBits " << quietBits << std::endl;
  for(int i=0; i<4;i++) {
    std::cout << "isoElectron " << i << " " << isolatedEGObjects.at(i) << std::endl;;
    std::cout << "nonIsoElectron " << i <<" "<< nonisolatedEGObjects.at(i) << std::endl;
  }
  std::cout << "Jets ";
  for(int i=0; i<22;i++)
    std::cout << jetRegions.at(i) << " ";
  std::cout << std::endl;
}

Member Data Documentation

std::vector<unsigned short> L1RCTJetSummaryCard::barrelRegions [private]

Definition at line 91 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 107 of file L1RCTJetSummaryCard.h.

Referenced by fillHFRegionSums(), and getHFFineGrainBits().

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

Definition at line 99 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 95 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 97 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::mipBits [private]

Definition at line 102 of file L1RCTJetSummaryCard.h.

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

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

Definition at line 96 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::overFlowBits [private]

Definition at line 105 of file L1RCTJetSummaryCard.h.

Referenced by fillOverFlowBits(), and getOverFlowBits().

unsigned short L1RCTJetSummaryCard::quietBits [private]

Definition at line 103 of file L1RCTJetSummaryCard.h.

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

Definition at line 110 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

Definition at line 111 of file L1RCTJetSummaryCard.h.

Referenced by fillQuietBits().

Definition at line 93 of file L1RCTJetSummaryCard.h.

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

unsigned short L1RCTJetSummaryCard::tauBits [private]

Definition at line 104 of file L1RCTJetSummaryCard.h.

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