CMS 3D CMS Logo

Static Public Member Functions | Static Public Attributes | Private Member Functions

HcalHPDRBXMap Class Reference

#include <HcalHPDRBXMap.h>

List of all members.

Static Public Member Functions

static int indexHPD (const HcalDetId &)
static void indexHPDfromEtaPhi (int ieta, int iphi, std::vector< int > &hpdindices)
static int indexRBX (const HcalDetId &)
static void indexRBXfromEtaPhi (int ieta, int iphi, std::vector< int > &rbxindices)
static int indexRBXfromHPD (int hpdindex)
static void indicesHPDfromRBX (int rbxindex, boost::array< int, NUM_HPDS_PER_RBX > &hpdindices)
static int iphihiHPD (int index)
static int iphihiRBX (int index)
static int iphiloHPD (int index)
static int iphiloRBX (int index)
static bool isValid (int ieta, int iphi)
static bool isValid (const HcalDetId &)
static bool isValidHPD (int index)
static bool isValidRBX (int index)
static int numHPDs (void)
static int numHPDsPerRBX (void)
static int numHPDsPerSubdet (void)
static int numRBXs (void)
static int numRBXsPerSubdet (void)
static HcalSubdetector subdetHPD (int index)
static HcalSubdetector subdetRBX (int index)
static int zsideHPD (int index)
static int zsideRBX (int index)

Static Public Attributes

static const int NUM_HPDS = 288
static const int NUM_HPDS_PER_RBX = 4
static const int NUM_HPDS_PER_SUBDET = 72
static const int NUM_RBXS = 72
static const int NUM_RBXS_PER_SUBDET = 18

Private Member Functions

 HcalHPDRBXMap ()
 ~HcalHPDRBXMap ()

Detailed Description

Definition at line 23 of file HcalHPDRBXMap.h.


Constructor & Destructor Documentation

HcalHPDRBXMap::HcalHPDRBXMap ( ) [private]

Definition at line 14 of file HcalHPDRBXMap.cc.

{}
HcalHPDRBXMap::~HcalHPDRBXMap ( ) [private]

Definition at line 15 of file HcalHPDRBXMap.cc.

{}

Member Function Documentation

int HcalHPDRBXMap::indexHPD ( const HcalDetId id) [static]

Definition at line 187 of file HcalHPDRBXMap.cc.

References abs, Exception, HcalBarrel, HcalEndcap, getHLTprescales::index, isValid(), edm::errors::LogicError, and NUM_HPDS_PER_SUBDET.

Referenced by HBHEIsolatedNoiseReflagger::DumpHBHEHitMap(), reco::HcalNoiseRBXArray::findHPD(), HBHEHitMapOrganizer::getHPDNeighbors(), HBHEHitMapOrganizer::HBHEHitMapOrganizer(), indexHPDfromEtaPhi(), and indexRBX().

{
  // return bad index if subdetector is invalid
  if(!isValid(id)) {
    throw edm::Exception(edm::errors::LogicError)
      << " HcalDetId " << id << " is invalid in HcalHPDRBXMap::indexHPD().\n";
  }

  // specify the readout module (subdet and number)
  int subdet=-1;
  if(id.subdet()==HcalBarrel && id.zside()==1)  subdet=0;
  if(id.subdet()==HcalBarrel && id.zside()==-1) subdet=1;
  if(id.subdet()==HcalEndcap && id.zside()==1)  subdet=2;
  if(id.subdet()==HcalEndcap && id.zside()==-1) subdet=3;

  int iphi=id.iphi();
  int absieta=abs(id.ieta());

  // adjust for offset between iphi and the HPD index
  // index-->iphi
  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
  int index=iphi+1;
  if(index>=NUM_HPDS_PER_SUBDET) index-=NUM_HPDS_PER_SUBDET;
  index+=subdet*NUM_HPDS_PER_SUBDET;

  // modify the index in the HE
  if((subdet==2 || subdet==3) && absieta>=21 && absieta<=29) {
    if(iphi%4==3 && absieta%2==1 && absieta!=29) index++;
    if(iphi%4==3 && absieta==29 && id.depth()==2) index++;
    if(iphi%4==1 && absieta%2==0 && absieta!=29) index++;
    if(iphi%4==1 && absieta==29 && id.depth()==1) index++;
  }
  return index;
}
void HcalHPDRBXMap::indexHPDfromEtaPhi ( int  ieta,
int  iphi,
std::vector< int > &  hpdindices 
) [static]

Definition at line 227 of file HcalHPDRBXMap.cc.

References abs, HcalBarrel, HcalEndcap, and indexHPD().

Referenced by reco::HcalNoiseRBXArray::findHPD().

{
  // clear the vector
  hpdindices.clear();
  int absieta=abs(ieta);

  if(absieta<=15) {        // HB only, depth doesn't matter
    hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
  } else if(absieta==16) { // HB and HE, depth doesn't matter
    hpdindices.push_back(indexHPD(HcalDetId(HcalBarrel, ieta, iphi, 1)));
    hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 3)));
  } else if(absieta<29) {  // HE only, depth doesn't matter
    hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
  } else {                 // HE only, but depth matters
    hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 1)));
    hpdindices.push_back(indexHPD(HcalDetId(HcalEndcap, ieta, iphi, 2)));
  }

  return;
}
int HcalHPDRBXMap::indexRBX ( const HcalDetId id) [static]
void HcalHPDRBXMap::indexRBXfromEtaPhi ( int  ieta,
int  iphi,
std::vector< int > &  rbxindices 
) [static]

Definition at line 248 of file HcalHPDRBXMap.cc.

References abs, HcalBarrel, HcalEndcap, and indexRBX().

Referenced by reco::HcalNoiseRBXArray::findRBX().

{
  // clear the vector
  rbxindices.clear();
  int absieta=abs(ieta);

  if(absieta<=15) {        // HB only
    rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
  } else if(absieta==16) { // HB and HE
    rbxindices.push_back(indexRBX(HcalDetId(HcalBarrel, ieta, iphi, 1)));
    rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 3)));
  } else {                 // HE only
    rbxindices.push_back(indexRBX(HcalDetId(HcalEndcap, ieta, iphi, 1)));
  }

  return;
}
int HcalHPDRBXMap::indexRBXfromHPD ( int  hpdindex) [static]

Definition at line 176 of file HcalHPDRBXMap.cc.

References Exception, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

Referenced by reco::HcalNoiseRBXArray::findHPD(), and indexRBX().

{
  if(!isValidHPD(hpdindex))
    throw edm::Exception(edm::errors::LogicError)
      << " HPD index " << hpdindex << " is invalid in HcalHPDRBXMap::indexRBX().\n";

  return hpdindex/NUM_HPDS_PER_RBX;
}
void HcalHPDRBXMap::indicesHPDfromRBX ( int  rbxindex,
boost::array< int, NUM_HPDS_PER_RBX > &  hpdindices 
) [static]

Definition at line 163 of file HcalHPDRBXMap.cc.

References Exception, i, isValidRBX(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

Referenced by reco::HcalNoiseRBXArray::HcalNoiseRBXArray(), iphihiRBX(), and iphiloRBX().

{
  if(!isValidRBX(rbxindex))
    throw edm::Exception(edm::errors::LogicError)
      << " RBX index " << rbxindex << " is invalid in HcalHPDRBXMap::indicesHPD().\n";

  for(unsigned int i=0; i<hpdindices.size(); i++)
    hpdindices[i]=rbxindex*NUM_HPDS_PER_RBX+i;

  return;
}
int HcalHPDRBXMap::iphihiHPD ( int  index) [static]

Definition at line 126 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, isValidHPD(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and subdetHPD().

Referenced by iphihiRBX().

{
  if(!isValidHPD(index))
    throw edm::Exception(edm::errors::LogicError)
      << " HPD index " << index << " is invalid in HcalHPDRBXMap::iphihiHPD().\n";
  
  // adjust for offset between iphi and the HPD index
  // index-->iphi
  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
  int iphi=index%NUM_HPDS_PER_SUBDET-1;
  if(iphi<=0) iphi+=NUM_HPDS_PER_SUBDET;

  // HB
  if(subdetHPD(index)==HcalBarrel) return iphi;

  // HE
  if(iphi%2==0) return iphi;
  else          return iphi+1;
}
int HcalHPDRBXMap::iphihiRBX ( int  index) [static]

Definition at line 147 of file HcalHPDRBXMap.cc.

References Exception, indicesHPDfromRBX(), iphihiHPD(), isValidRBX(), edm::errors::LogicError, and NUM_HPDS_PER_RBX.

{
  if(!isValidRBX(index))
    throw edm::Exception(edm::errors::LogicError)
      << " RBX index " << index << " is invalid in HcalHPDRBXMap::iphihiRBX().\n";
  
  // get the list of HPD indices in the RBX
  boost::array<int, NUM_HPDS_PER_RBX> arr;
  indicesHPDfromRBX(index, arr);

  // return the highest iphi of the last HPD
  return iphihiHPD(arr[NUM_HPDS_PER_RBX-1]);
}
int HcalHPDRBXMap::iphiloHPD ( int  index) [static]

Definition at line 90 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, isValidHPD(), edm::errors::LogicError, NUM_HPDS_PER_SUBDET, and subdetHPD().

Referenced by iphiloRBX().

{
  if(!isValidHPD(index))
    throw edm::Exception(edm::errors::LogicError)
      << " HPD index " << index << " is invalid in HcalHPDRBXMap::iphiloHPD().\n";
  
  // adjust for offset between iphi and the HPD index
  // index-->iphi
  // 0-->71, 1-->72, 2-->1, 3-->2, 4-->3, ..., 70-->69, 71-->70
  int iphi=index%NUM_HPDS_PER_SUBDET-1;
  if(iphi<=0) iphi+=NUM_HPDS_PER_SUBDET;

  // HB
  if(subdetHPD(index)==HcalBarrel) return iphi;

  // HE
  if(iphi%2==0) return iphi-1;
  else          return iphi;
}
int HcalHPDRBXMap::iphiloRBX ( int  index) [static]

Definition at line 111 of file HcalHPDRBXMap.cc.

References Exception, indicesHPDfromRBX(), iphiloHPD(), isValidRBX(), and edm::errors::LogicError.

{
  if(!isValidRBX(index))
    throw edm::Exception(edm::errors::LogicError)
      << " RBX index " << index << " is invalid in HcalHPDRBXMap::iphiloRBX().\n";

  // get the list of HPD indices in the RBX
  boost::array<int, NUM_HPDS_PER_RBX> arr;
  indicesHPDfromRBX(index, arr);

  // return the lowest iphi of the first HPD
  return iphiloHPD(arr[0]);
}
bool HcalHPDRBXMap::isValid ( int  ieta,
int  iphi 
) [static]

Definition at line 35 of file HcalHPDRBXMap.cc.

References abs.

{
  int absieta=abs(ieta);
  if(absieta<=29 && absieta>=1 && iphi>=1 && iphi<=72) {
    if(absieta<=20) return true;
    if(absieta>=21 && iphi%2==1) return true;
  }
  return false;
}
bool HcalHPDRBXMap::isValid ( const HcalDetId id) [static]

Definition at line 29 of file HcalHPDRBXMap.cc.

References HcalBarrel, and HcalEndcap.

Referenced by reco::HcalNoiseRBXArray::findHPD(), reco::HcalNoiseRBXArray::findRBX(), and indexHPD().

{
  if(id.subdet()!=HcalBarrel && id.subdet()!=HcalEndcap) return false;
  return isValid(id.ieta(),id.iphi());
}
bool HcalHPDRBXMap::isValidHPD ( int  index) [static]

Definition at line 18 of file HcalHPDRBXMap.cc.

References NUM_HPDS.

Referenced by reco::HcalNoiseRBXArray::findHPD(), indexRBXfromHPD(), iphihiHPD(), iphiloHPD(), subdetHPD(), and zsideHPD().

{
  return (index>=0 && index<=NUM_HPDS-1);
}
bool HcalHPDRBXMap::isValidRBX ( int  index) [static]

Definition at line 24 of file HcalHPDRBXMap.cc.

References NUM_RBXS.

Referenced by reco::HcalNoiseRBXArray::findRBX(), indicesHPDfromRBX(), iphihiRBX(), iphiloRBX(), subdetRBX(), and zsideRBX().

{
  return (index>=0 && index<=NUM_RBXS-1);
}
static int HcalHPDRBXMap::numHPDs ( void  ) [inline, static]

Definition at line 39 of file HcalHPDRBXMap.h.

References NUM_HPDS.

{ return NUM_HPDS; }
static int HcalHPDRBXMap::numHPDsPerRBX ( void  ) [inline, static]

Definition at line 41 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_RBX.

{ return NUM_HPDS_PER_RBX; }
static int HcalHPDRBXMap::numHPDsPerSubdet ( void  ) [inline, static]

Definition at line 40 of file HcalHPDRBXMap.h.

References NUM_HPDS_PER_SUBDET.

{ return NUM_HPDS_PER_SUBDET; }
static int HcalHPDRBXMap::numRBXs ( void  ) [inline, static]

Definition at line 42 of file HcalHPDRBXMap.h.

References NUM_RBXS.

{ return NUM_RBXS; }
static int HcalHPDRBXMap::numRBXsPerSubdet ( void  ) [inline, static]

Definition at line 43 of file HcalHPDRBXMap.h.

References NUM_RBXS_PER_SUBDET.

{ return NUM_RBXS_PER_SUBDET; }
HcalSubdetector HcalHPDRBXMap::subdetHPD ( int  index) [static]

Definition at line 46 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, HcalEndcap, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_SUBDET.

Referenced by iphihiHPD(), and iphiloHPD().

{
  if(!isValidHPD(index))
    throw edm::Exception(edm::errors::LogicError)
      << " HPD index " << index << " is invalid in HcalHPDRBXMap::subdetHPD().\n";

  if(index/NUM_HPDS_PER_SUBDET<=1) return HcalBarrel;
  else return HcalEndcap;
}
HcalSubdetector HcalHPDRBXMap::subdetRBX ( int  index) [static]

Definition at line 57 of file HcalHPDRBXMap.cc.

References Exception, HcalBarrel, HcalEndcap, isValidRBX(), edm::errors::LogicError, and NUM_RBXS_PER_SUBDET.

{
  if(!isValidRBX(index))
    throw edm::Exception(edm::errors::LogicError)
      << " RBX index " << index << " is invalid in HcalHPDRBXMap::subdetRBX().\n";

  if(index/NUM_RBXS_PER_SUBDET<=1) return HcalBarrel;
  else return HcalEndcap;
}
int HcalHPDRBXMap::zsideHPD ( int  index) [static]

Definition at line 68 of file HcalHPDRBXMap.cc.

References Exception, isValidHPD(), edm::errors::LogicError, and NUM_HPDS_PER_SUBDET.

{
  if(!isValidHPD(index))
    throw edm::Exception(edm::errors::LogicError)
      << " HPD index " << index << " is invalid in HcalHPDRBXMap::zsideHPD().\n";

  if(index/NUM_HPDS_PER_SUBDET==0 || index/NUM_HPDS_PER_SUBDET==2) return 1;
  else return -1;
}
int HcalHPDRBXMap::zsideRBX ( int  index) [static]

Definition at line 79 of file HcalHPDRBXMap.cc.

References Exception, isValidRBX(), edm::errors::LogicError, and NUM_RBXS_PER_SUBDET.

{
  if(!isValidRBX(index))
    throw edm::Exception(edm::errors::LogicError)
      << " RBX index " << index << " is invalid in HcalHPDRBXMap::zsideRBX().\n";

  if(index/NUM_RBXS_PER_SUBDET==0 || index/NUM_RBXS_PER_SUBDET==2) return 1;
  else return -1;
}

Member Data Documentation

const int HcalHPDRBXMap::NUM_HPDS = 288 [static]

Definition at line 28 of file HcalHPDRBXMap.h.

Referenced by isValidHPD(), and numHPDs().

const int HcalHPDRBXMap::NUM_HPDS_PER_RBX = 4 [static]
const int HcalHPDRBXMap::NUM_HPDS_PER_SUBDET = 72 [static]

Definition at line 30 of file HcalHPDRBXMap.h.

Referenced by indexHPD(), iphihiHPD(), iphiloHPD(), numHPDsPerSubdet(), subdetHPD(), and zsideHPD().

const int HcalHPDRBXMap::NUM_RBXS = 72 [static]

Definition at line 34 of file HcalHPDRBXMap.h.

Referenced by isValidRBX(), and numRBXs().

const int HcalHPDRBXMap::NUM_RBXS_PER_SUBDET = 18 [static]

Definition at line 36 of file HcalHPDRBXMap.h.

Referenced by numRBXsPerSubdet(), subdetRBX(), and zsideRBX().