CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

HcalCondObjectContainerBase Class Reference

#include <HcalCondObjectContainer.h>

Inheritance diagram for HcalCondObjectContainerBase:
HcalCholeskyMatrices HcalCondObjectContainer< Item > HcalCondObjectContainer< HcalCalibrationQIECoder > HcalCondObjectContainer< HcalChannelStatus > HcalCondObjectContainer< HcalFlagHFDigiTimeParam > HcalCondObjectContainer< HcalGain > HcalCondObjectContainer< HcalGainWidth > HcalCondObjectContainer< HcalL1TriggerObject > HcalCondObjectContainer< HcalLongRecoParam > HcalCondObjectContainer< HcalLUTCorr > HcalCondObjectContainer< HcalLutMetadatum > HcalCondObjectContainer< HcalMCParam > HcalCondObjectContainer< HcalPedestal > HcalCondObjectContainer< HcalPedestalWidth > HcalCondObjectContainer< HcalPFCorr > HcalCondObjectContainer< HcalQIECoder > HcalCondObjectContainer< HcalRecoParam > HcalCondObjectContainer< HcalRespCorr > HcalCondObjectContainer< HcalTimeCorr > HcalCondObjectContainer< HcalTimingParam > HcalCondObjectContainer< HcalValidationCorr > HcalCondObjectContainer< HcalZSThreshold > HcalCovarianceMatrices

List of all members.

Public Member Functions

int getCreatorPackedIndexVersion () const
void setTopo (const HcalTopology *topo)
void setTopo (const HcalTopology *topo) const
const HcalTopologytopo () const

Protected Member Functions

HcalOtherSubdetector extractOther (const DetId &id) const
 HcalCondObjectContainerBase (const HcalTopology *)
unsigned int indexFor (DetId) const
unsigned int sizeFor (DetId) const
std::string textForId (const DetId &id) const

Protected Attributes

int packedIndexVersion_

Private Attributes

const HcalTopologytopo_

Detailed Description

Definition at line 15 of file HcalCondObjectContainer.h.


Constructor & Destructor Documentation

HcalCondObjectContainerBase::HcalCondObjectContainerBase ( const HcalTopology topo) [protected]

Member Function Documentation

HcalOtherSubdetector HcalCondObjectContainerBase::extractOther ( const DetId id) const [inline, protected]

Definition at line 26 of file HcalCondObjectContainer.h.

Referenced by indexFor(), sizeFor(), and textForId().

{ return HcalOtherSubdetector((id.rawId()>>20)&0x1F); }
int HcalCondObjectContainerBase::getCreatorPackedIndexVersion ( ) const [inline]

Definition at line 18 of file HcalCondObjectContainer.h.

References packedIndexVersion_.

{ return packedIndexVersion_; }
unsigned int HcalCondObjectContainerBase::indexFor ( DetId  fId) const [protected]

Definition at line 28 of file HcalCondObjectContainerBase.cc.

References DetId::Calo, HcalZDCDetId::channel(), HcalZDCDetId::denseIndex(), DetId::det(), HcalTopology::detId2denseIdCALIB(), HcalTopology::detId2denseIdHB(), HcalTopology::detId2denseIdHE(), HcalTopology::detId2denseIdHF(), HcalTopology::detId2denseIdHO(), HcalTopology::detId2denseIdHT(), Exception, extractOther(), DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, getHLTprescales::index, HcalCastorDetId::module(), HcalZDCDetId::section(), HcalCastorDetId::sector(), HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, DetId::subdetId(), topo_, HcalCastorDetId::zside(), and HcalZDCDetId::zside().

Referenced by HcalCholeskyMatrices::addValues(), HcalCholeskyMatrices::getValues(), and HcalCovarianceMatrices::getValues().

                                                                  { 
  unsigned int retval=0xFFFFFFFFu;
  if (!topo_) {
    edm::LogError("HCAL") << "Topology pointer not set, HCAL conditions non-functional";
    throw cms::Exception("Topology pointer not set, HCAL conditions non-functional");
    return retval;
  }

  if (fId.det()==DetId::Hcal) {
    switch (HcalSubdetector(fId.subdetId())) {
    case(HcalBarrel) : retval=topo_->detId2denseIdHB(fId); break;
    case(HcalEndcap) : retval=topo_->detId2denseIdHE(fId); break;
    case(HcalOuter) : retval=topo_->detId2denseIdHO(fId); break;
    case(HcalForward) : retval=topo_->detId2denseIdHF(fId); break;
    case(HcalTriggerTower) : retval=topo_->detId2denseIdHT(fId); break;
    case(HcalOther) : if (extractOther(fId)==HcalCalibration)
        retval=topo_->detId2denseIdCALIB(fId);
      break; 
    default: break;
    }
  } else if (fId.det()==DetId::Calo) {
    if (fId.subdetId()==HcalCastorDetId::SubdetectorId) {
      // the historical packing from HcalGeneric is different from HcalCastorDetId, so we clone the old packing here.
      HcalCastorDetId tid(fId); 
      int zside = tid.zside();
      int sector = tid.sector();
      int module = tid.module();
      static const int CASTORhalf=224;

      int index = 14*(sector-1) + (module-1);
      if (zside == -1) index += CASTORhalf;

      retval=(unsigned int)(index);
    } else if (fId.subdetId()==HcalZDCDetId::SubdetectorId) {
      HcalZDCDetId direct(fId);
      // THIS IS A HORRIBLE HACK because there were _two_ dense indices for ZDC differing in their handling of +/-z
      HcalZDCDetId swapZ(direct.section(),direct.zside()<0,direct.channel());
      retval=swapZ.denseIndex();
    }
  }
  return retval;
}
void HcalCondObjectContainerBase::setTopo ( const HcalTopology topo)

Definition at line 21 of file HcalCondObjectContainerBase.cc.

References CaloSubdetectorTopology::denseIdConsistent(), packedIndexVersion_, topo(), topo_, and HcalTopology::topoVersion().

                                                                  {
  if (topo && !topo->denseIdConsistent(packedIndexVersion_)) {
    edm::LogError("HCAL") << "Inconsistent dense packing between current topology (" << topo->topoVersion() << ") and calibration object (" << packedIndexVersion_ << ")";
  }
  topo_=topo;  
}
void HcalCondObjectContainerBase::setTopo ( const HcalTopology topo) const
unsigned int HcalCondObjectContainerBase::sizeFor ( DetId  fId) const [protected]

Definition at line 71 of file HcalCondObjectContainerBase.cc.

References DetId::Calo, DetId::det(), Exception, extractOther(), HcalTopology::getCALIBSize(), HcalTopology::getHBSize(), HcalTopology::getHESize(), HcalTopology::getHFSize(), HcalTopology::getHOSize(), HcalTopology::getHTSize(), DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, HcalCastorDetId::kSizeForDenseIndexing, HcalZDCDetId::kSizeForDenseIndexing, HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, DetId::subdetId(), and topo_.

Referenced by HcalCholeskyMatrices::initContainer(), and HcalCovarianceMatrices::initContainer().

                                                                 {
  unsigned int retval=0;

  if (!topo_) {
    edm::LogError("HCAL") << "Topology pointer not set, HCAL conditions non-functional";
    throw cms::Exception("Topology pointer not set, HCAL conditions non-functional");
    return retval;
  }

  if (fId.det()==DetId::Hcal) {
    switch (HcalSubdetector(fId.subdetId())) {
    case(HcalBarrel) : retval=topo_->getHBSize(); break;
    case(HcalEndcap) : retval=topo_->getHESize(); break;
    case(HcalOuter) : retval=topo_->getHOSize(); break;
    case(HcalForward) : retval=topo_->getHFSize(); break;
    case(HcalTriggerTower) : retval=topo_->getHTSize(); break;
    case(HcalOther) : if (extractOther(fId)==HcalCalibration) retval=topo_->getCALIBSize();
      break; 
    default: break;
    }
  } else if (fId.det()==DetId::Calo) {
    if (fId.subdetId()==HcalCastorDetId::SubdetectorId) {
      retval=HcalCastorDetId::kSizeForDenseIndexing;
    } else if (fId.subdetId()==HcalZDCDetId::SubdetectorId) {
      retval=HcalZDCDetId::kSizeForDenseIndexing;
    }
  }
  return retval;
}
std::string HcalCondObjectContainerBase::textForId ( const DetId id) const [protected]

Definition at line 101 of file HcalCondObjectContainerBase.cc.

References DetId::Calo, extractOther(), DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, HcalCastorDetId::SubdetectorId, and HcalZDCDetId::SubdetectorId.

                                                                      {
  std::ostringstream os;
  os << std::hex << "(0x" << id.rawId() << ") " << std::dec;

  if (id.det()==DetId::Hcal) {
    switch (HcalSubdetector(id.subdetId())) {
    case(HcalBarrel) : 
    case(HcalEndcap) : 
    case(HcalOuter) : 
    case(HcalForward) : os << HcalDetId(id); break;
    case(HcalTriggerTower) : os << HcalTrigTowerDetId(id); break;
    case(HcalOther) : 
      if (extractOther(id)==HcalCalibration) os << HcalCalibDetId(id);
      break; 
    default: break;
    }
  } else if (id.det()==DetId::Calo) {
    if (id.subdetId()==HcalCastorDetId::SubdetectorId) {
      os << HcalCastorDetId(id);
    } else if (id.subdetId()==HcalZDCDetId::SubdetectorId) {
      os << HcalZDCDetId(id);
    }
  }  
  return os.str();
}
const HcalTopology* HcalCondObjectContainerBase::topo ( ) const [inline]

Member Data Documentation