CMS 3D CMS Logo

Public Types | Public Member Functions

HcalGenericDetId Class Reference

#include <HcalGenericDetId.h>

Inheritance diagram for HcalGenericDetId:
DetId

List of all members.

Public Types

enum  hashlimits {
  HBhalf = 1296, HEhalf = 1296, HEhalfh2mode = 4032, HOhalf = 1080,
  HFhalf = 864, HThalf = 2088, ZDChalf = 11, CASTORhalf = 224,
  CALIBhalf = 693
}
enum  HcalGenericSubdetector {
  HcalGenEmpty = 0, HcalGenBarrel = 1, HcalGenEndcap = 2, HcalGenOuter = 3,
  HcalGenForward = 4, HcalGenTriggerTower = 5, HcalGenZDC = 8, HcalGenCalibration = 9,
  HcalGenCastor = 10, HcalGenUnknown = 99
}

Public Member Functions

HcalGenericSubdetector genericSubdet () const
int hashedId (bool h2mode_=false) const
 HcalGenericDetId (uint32_t rawid)
 HcalGenericDetId ()
 HcalGenericDetId (const DetId &id)
bool isHcalCalibDetId () const
bool isHcalCastorDetId () const
bool isHcalDetId () const
bool isHcalTrigTowerDetId () const
bool isHcalZDCDetId () const
HcalOtherSubdetector otherSubdet () const

Detailed Description

Author:
F.Ratnikov, UMd Generic HCAL detector ID suitable for all Hcal subdetectors
Id:
HcalGenericDetId.h,v 1.8 2009/03/24 16:05:36 rofierzy Exp

R.Ofierzynski, 22.02.2008, added hashedId

Author:
F.Ratnikov, UMd Generic HCAL detector ID suitable for all Hcal subdetectors

Definition at line 16 of file HcalGenericDetId.h.


Member Enumeration Documentation

Enumerator:
HBhalf 
HEhalf 
HEhalfh2mode 
HOhalf 
HFhalf 
HThalf 
ZDChalf 
CASTORhalf 
CALIBhalf 

Definition at line 35 of file HcalGenericDetId.h.

                 {
    HBhalf = 1296,
    HEhalf = 1296,
    HEhalfh2mode = 4032,
    HOhalf = 1080,
    HFhalf = 864,
    HThalf = 2088,
    ZDChalf = 11,
    CASTORhalf = 224,
    CALIBhalf = 693
  };
Enumerator:
HcalGenEmpty 
HcalGenBarrel 
HcalGenEndcap 
HcalGenOuter 
HcalGenForward 
HcalGenTriggerTower 
HcalGenZDC 
HcalGenCalibration 
HcalGenCastor 
HcalGenUnknown 

Definition at line 18 of file HcalGenericDetId.h.


Constructor & Destructor Documentation

HcalGenericDetId::HcalGenericDetId ( ) [inline]

Definition at line 20 of file HcalGenericDetId.h.

: DetId () {}
HcalGenericDetId::HcalGenericDetId ( uint32_t  rawid) [inline]

Definition at line 21 of file HcalGenericDetId.h.

: DetId (rawid) {}
HcalGenericDetId::HcalGenericDetId ( const DetId id) [inline]

Definition at line 22 of file HcalGenericDetId.h.

: DetId (id) {}

Member Function Documentation

HcalGenericDetId::HcalGenericSubdetector HcalGenericDetId::genericSubdet ( ) const

Definition at line 20 of file HcalGenericDetId.cc.

References DetId::Calo, DetId::det(), DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalGenBarrel, HcalGenCalibration, HcalGenCastor, HcalGenEmpty, HcalGenEndcap, HcalGenForward, HcalGenOuter, HcalGenTriggerTower, HcalGenUnknown, HcalGenZDC, HcalOther, HcalOuter, HcalTriggerTower, DetId::null(), otherSubdet(), HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, and DetId::subdetId().

Referenced by HcalAmplifier::addPedestals(), CastorCondObjectContainer< Item >::addValues(), HcalCholeskyMatrices::addValues(), HcalCondObjectContainer< Item >::addValues(), HcalCovarianceMatrices::addValues(), HcalLuttoDB::analyze(), HcalShapes::defaultShape(), HcalCondObjectContainer< Item >::exists(), CastorCondObjectContainer< Item >::exists(), HcalCholeskyMatrices::exists(), HcalCovarianceMatrices::exists(), HcalPacker::findSamples(), HcalLogicalMap::getHcalFrontEndId(), HcalSeverityLevelComputer::getSeverityLevel(), CastorCondObjectContainer< Item >::getValues(), HcalCholeskyMatrices::getValues(), HcalCondObjectContainer< Item >::getValues(), HcalCovarianceMatrices::getValues(), hashedId(), HcalText2DetIdConverter::init(), isHcalCalibDetId(), isHcalCastorDetId(), isHcalDetId(), isHcalTrigTowerDetId(), isHcalZDCDetId(), CastorDbHardcode::makeGain(), CastorDbHardcode::makePedestal(), CastorDbHardcode::makeQIECoder(), CastorDbASCIIIO::DetIdLess::operator()(), and HcalSeverityLevelComputer::recoveredRecHit().

                                                                              {
  if (null()) return HcalGenEmpty;
  switch (det()) {
  case Calo : 
    switch (subdetId()) {
    case HcalZDCDetId::SubdetectorId : return HcalGenZDC;
    case HcalCastorDetId::SubdetectorId : return HcalGenCastor;
    default: return HcalGenUnknown;
    } 
  case Hcal :
    switch (HcalSubdetector(subdetId())) {
    case 0: return HcalGenEmpty;
    case HcalBarrel: return HcalGenBarrel;
    case HcalEndcap: return HcalGenEndcap;
    case HcalOuter: return HcalGenOuter;
    case HcalForward: return HcalGenForward;
    case HcalTriggerTower: return HcalGenTriggerTower;
    case HcalOther:
      switch (otherSubdet ()) {
      case HcalCalibration: return HcalGenCalibration;
      default: return HcalGenUnknown;
    }
    default: return HcalGenUnknown;
    }
    default: return HcalGenUnknown;
  }
  return HcalGenUnknown;
}
int HcalGenericDetId::hashedId ( bool  h2mode_ = false) const

Definition at line 91 of file HcalGenericDetId.cc.

References abs, HcalCalibDetId::calibFlavor(), HcalCalibDetId::CalibrationBox, CASTORhalf, HcalCalibDetId::cboxChannel(), HcalZDCDetId::channel(), gather_cfg::cout, HcalDetId::depth(), HcalZDCDetId::EM, genericSubdet(), HcalZDCDetId::HAD, HBhalf, HcalBarrel, HcalEndcap, HcalForward, HcalGenBarrel, HcalGenCalibration, HcalGenCastor, HcalGenEndcap, HcalGenForward, HcalGenOuter, HcalGenTriggerTower, HcalGenZDC, HcalOuter, HcalCalibDetId::hcalSubdet(), HEhalf, HFhalf, HcalCalibDetId::HOCrosstalk, HOhalf, HThalf, HcalCalibDetId::ieta(), HcalDetId::ietaAbs(), HcalTrigTowerDetId::ietaAbs(), getHLTprescales::index, HcalCalibDetId::iphi(), HcalTrigTowerDetId::iphi(), HcalDetId::iphi(), HcalZDCDetId::LUM, HcalCastorDetId::module(), DetId::rawId(), HcalZDCDetId::section(), HcalCastorDetId::sector(), ZDChalf, HcalCalibDetId::zside(), HcalCastorDetId::zside(), HcalZDCDetId::zside(), HcalDetId::zside(), and HcalTrigTowerDetId::zside().

Referenced by CastorCondObjectContainer< Item >::addValues(), HcalCholeskyMatrices::addValues(), HcalCondObjectContainer< Item >::addValues(), HcalCovarianceMatrices::addValues(), HcalLogicalMapGenerator::buildCALIBMap(), HcalLogicalMapGenerator::buildHBEFTMap(), HcalLogicalMapGenerator::buildHOXMap(), HcalCondObjectContainer< Item >::exists(), CastorCondObjectContainer< Item >::exists(), HcalCholeskyMatrices::exists(), HcalCovarianceMatrices::exists(), HcalLogicalMap::getHcalFrontEndId(), CastorCondObjectContainer< Item >::getValues(), HcalCholeskyMatrices::getValues(), HcalCondObjectContainer< Item >::getValues(), and HcalCovarianceMatrices::getValues().

                                                 {
  int index = -1;

  int zside=0, ietaAbs=0, ieta=0, iphi=0, depth=0, channel=0, sector=0, module=0;

  switch (genericSubdet()) {
    // HB valid DetIds: phi=1-72,eta=1-14,depth=1; phi=1-72,eta=15-16,depth=1-2
  case HcalGenericDetId::HcalGenBarrel:
    {
      HcalDetId tid(rawId() ); 
      zside = tid.zside();
      ietaAbs = tid.ietaAbs();
      iphi = tid.iphi();
      depth = tid.depth();
      
      // if (ietaAbs < 16)   index = (iphi - 1)*18 + (ietaAbs - 1) + (depth - 1);
      // if (ietaAbs == 16)  index = (iphi - 1)*18 + ietaAbs + (depth - 1);

      index = (iphi - 1)*18 + ietaAbs + depth - 2;
      if (ietaAbs == 16) ++index;
      
      if (zside == -1) index += HBhalf;
    }
    break;
    // HE valid DetIds: phi=1-72,eta=16-17,depth=1; phi=1-72,eta=18-20,depth=1-2; 
    //                  phi=1-71(in steps of 2),eta=21-26,depth=1-2; phi=1-71(in steps of 2),eta=27-28,depth=1-3
    //                  phi=1-71(in steps of 2),eta=29,depth=1-2
  case HcalGenericDetId::HcalGenEndcap:
    {
      HcalDetId tid(rawId() ); 
      zside = tid.zside();
      ietaAbs = tid.ietaAbs();
      iphi = tid.iphi();
      depth = tid.depth();
      
      if (!h2mode_)
        {
          if (ietaAbs == 16 || ietaAbs == 17)  index = (iphi - 1)*8 + (iphi/2)*20 + (ietaAbs - 16);
          if (ietaAbs >= 18 && ietaAbs <= 20)  index = (iphi - 1)*8 + (iphi/2)*20 + 2  + 2*(ietaAbs-18) + (depth - 1);
          if (ietaAbs >= 21 && ietaAbs <= 26)  index = (iphi - 1)*8 + (iphi/2)*20 + 8  + 2*(ietaAbs-21) + (depth - 1);
          if (ietaAbs >= 27 && ietaAbs <= 28)  index = (iphi - 1)*8 + (iphi/2)*20 + 20 + 3*(ietaAbs-27) + (depth - 1);
          if (ietaAbs == 29)                   index = (iphi - 1)*8 + (iphi/2)*20 + 26 + 2*(ietaAbs-29) + (depth - 1);
        }
      else
        {
          // make as general as possible, don't care about tight packing for the moment
          //      index = (iphi-1)*(4*14) + (ietaAbs - 16)*4 + (depth - 1);
          index = 4*( 14*(iphi-1) + (ietaAbs - 16)) + (depth - 1);
          
          //      if (ietaAbs == 16)                   index = (iphi - 1)*11 + (iphi/2)*20 + (ietaAbs - 16);
          //      if (ietaAbs == 17)                   index = (iphi - 1)*11 + (iphi/2)*20 + 1 + (ietaAbs - 17) + (depth - 1);
          //      if (ietaAbs >= 18 && ietaAbs <= 20)  index = (iphi - 1)*11 + (iphi/2)*20 + 5  + 2*(ietaAbs-18) + (depth - 1);
          //      if (ietaAbs >= 21 && ietaAbs <= 26)  index = (iphi - 1)*11 + (iphi/2)*20 + 11 + 2*(ietaAbs-21) + (depth - 1);
          //      if (ietaAbs >= 27 && ietaAbs <= 28)  index = (iphi - 1)*11 + (iphi/2)*20 + 23 + 3*(ietaAbs-27) + (depth - 1);
          //      if (ietaAbs == 29)                   index = (iphi - 1)*11 + (iphi/2)*20 + 29 + 2*(ietaAbs-29) + (depth - 1);
        }
      if (zside == -1) index += HEhalf;
      
    }
    break;
  // HO valid DetIds: phi=1-72,eta=1-15,depth=4!
  case HcalGenericDetId::HcalGenOuter:
    {
      HcalDetId tid(rawId() ); 
      zside = tid.zside();
      ietaAbs = tid.ietaAbs();
      iphi = tid.iphi();
      depth = tid.depth();
      
      index = (iphi - 1)*15 + (ietaAbs - 1);
      
      if (zside == -1) index += HOhalf;
    }
    break;
    // HF valid DetIds: phi=1-71(in steps of 2),eta=29-39,depth=1-2; phi=3-71(in steps of 4),eta=40-41,depth=1-2
  case HcalGenericDetId::HcalGenForward:
    {
      HcalDetId tid(rawId() ); 
      zside = tid.zside();
      ietaAbs = tid.ietaAbs();
      iphi = tid.iphi();
      depth = tid.depth();
      
      index = ((iphi-1)/4)*4 + ((iphi-1)/2)*22 + 2*(ietaAbs-29) + (depth - 1);
      
      if (zside == -1)  index += HFhalf;
    }
    break;
  // TriggerTower:
  case HcalGenericDetId::HcalGenTriggerTower:
    {
      HcalTrigTowerDetId tid(rawId() ); 
      zside = tid.zside();
      ietaAbs = tid.ietaAbs();
      iphi = tid.iphi();
      
      if ((iphi-1)%4==0) index = (iphi-1)*32 + (ietaAbs-1) - (12*((iphi-1)/4));
      else               index = (iphi-1)*28 + (ietaAbs-1) + (4*(((iphi-1)/4)+1));
      
      if (zside == -1) index += HThalf;
      // ieta = ietaAbs*zside;      
    }
    break;
  // ZDC: ZDC_EM: 1 to 5, ZDC_HAD: 1 to 4, ZDC_LUM: 1,2, eta = +1, -1
  case HcalGenericDetId::HcalGenZDC:
    {
      HcalZDCDetId tid(rawId() ); 
      zside   = tid.zside();
      channel = tid.channel();
      //depth   = tid.depth();//depth is not unique, channel is
      
      switch (tid.section() ) {
      case HcalZDCDetId::EM:   index = (channel-1); break;
      case HcalZDCDetId::HAD:  index = 5 + (channel-1); break;
      case HcalZDCDetId::LUM:  index = 9 + (channel-1); break;
      default: break;
      }
      if (zside == -1) index += ZDChalf;
    }
    break;
    // Castor: zside +-1, sector (phi-segmentation) 1..16, module (z segm.) 1..14
    // total: 14*16=224 per zside
  case HcalGenericDetId::HcalGenCastor:
    {
      HcalCastorDetId tid(rawId() ); 
      zside = tid.zside();
      sector = tid.sector();
      module = tid.module();
      
      index = 14*(sector-1) + (module-1);
      if (zside == -1) index += CASTORhalf;
      
    }
    break;
  // Calibration channels: no zside=-1 ! with current naming convention
  case HcalGenericDetId::HcalGenCalibration:
    {
      HcalCalibDetId tid(rawId() );
      channel = tid.cboxChannel();
      ieta = tid.ieta();
      iphi = tid.iphi();
      zside = tid.zside();
      
      
      if (tid.calibFlavor()==HcalCalibDetId::CalibrationBox) {
        
        HcalSubdetector subDet = tid.hcalSubdet();
        
        if (subDet==HcalBarrel) {
          //std::cout<<"CALIB_HB:  ";
          //dphi = 4 (18 phi values), 3 channel types (0,1,2), eta = -1 or 1
          //total of 18*3*2=108 channels
          index = ((iphi+1)/4-1) + 18*channel + 27*(ieta+1);
        }
        else if (subDet==HcalEndcap) {
          //std::cout<<"CALIB_HE:  ";
          //dphi = 4 (18 phi values), 6 channel types (0,1,3,4,5,6), eta = -1 or 1
          //total of 18*6*2=216 channels
          if (channel>2) channel-=1;
          index = ((iphi+1)/4-1) + 18*channel + 54*(ieta+1) + 108;
        } 
        else if (subDet==HcalForward) {
          //std::cout<<"CALIB_HF:  ";
          //dphi = 18 (4 phi values), 3 channel types (0,1,8), eta = -1 or 1
          if (channel==8) channel = 2;
          //total channels 4*3*2=24
          index = (iphi-1)/18 + 4*channel + 6*(ieta+1) + 324;
        }
        else if (subDet==HcalOuter) {
          //std::cout<<"CALIB_HO:  ";
          //there are 5 special calib crosstalk channels, one in each ring
          if (channel==7) {
            channel = 2;
            index = (ieta+2) + 420;
          }
          //for HOM/HOP dphi = 6 (12 phi values),  2 channel types (0,1), eta = -2,-1 or 1,2
          //for HO0/YB0 dphi = 12 (6 phi values),  2 channel types (0,1), eta = 0
          else{
            if (ieta<0) index      = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 348;
            else if (ieta>0) index = ((iphi+1)/12-1) + 36*channel + 6*(ieta+2) + 6 + 348;
            else index             = ((iphi+1)/6-1)  + 36*channel + 6*(ieta+2) + 348;
          }
        } 
        else {
          std::cout << "HCAL Det Id not valid!" << std::endl;
          index = 0;
        }
        
      }
      else if (tid.calibFlavor()==HcalCalibDetId::HOCrosstalk) {
        //std::cout<<"HX:  ";
        //for YB0/HO0 phi is grouped in 6 groups of 6 with dphi=2 but the transitions are 1 or 3
        // in such a way that the %36 operation yeilds unique values for every iphi
        if (abs(ieta)==4)  index = ((iphi-1)%36) + (((zside+1)*36)/2) + 72 + 425;   //ieta = 1 YB0/HO0;
        else               index = (iphi-1) + (36*(zside+1)*2) + 425;  //ieta = 0 for HO2M/HO1M ieta=2 for HO1P/HO2P;
      }
      //std::cout << "  " << ieta << "  " << zside << "  " << iphi << "  " << depth << "  " << index << std::endl;
    }
    //std::cout << "eta:  " << ieta << "  side:  " << zside << "  phi:  " << iphi << "  depth:  " << depth << "  index:  " << index << std::endl;

    break;
  default: break;
 
  } // end switch
  
  return index;
}
bool HcalGenericDetId::isHcalCalibDetId ( ) const
bool HcalGenericDetId::isHcalCastorDetId ( ) const
bool HcalGenericDetId::isHcalDetId ( ) const
bool HcalGenericDetId::isHcalTrigTowerDetId ( ) const
bool HcalGenericDetId::isHcalZDCDetId ( ) const
HcalOtherSubdetector HcalGenericDetId::otherSubdet ( ) const

Definition at line 15 of file HcalGenericDetId.cc.

References HcalOther, HcalOtherEmpty, DetId::rawId(), and DetId::subdetId().

Referenced by genericSubdet().

                                                          {
  if (HcalSubdetector(subdetId()) != HcalOther) return HcalOtherEmpty;
  return HcalOtherSubdetector ((rawId()>>20)&0x1F);
}