CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

HcalCondObjectContainer< Item > Class Template Reference

#include <HcalCondObjectContainer.h>

Inheritance diagram for HcalCondObjectContainer< Item >:
HcalCondObjectContainerBase

List of all members.

Public Types

typedef std::vector< tHcalConttAllContWithNames
typedef std::pair< std::string,
std::vector< Item > > 
tHcalCont

Public Member Functions

bool addValues (const Item &myItem)
const bool exists (DetId fId) const
std::vector< DetIdgetAllChannels () const
const tAllContWithNames getAllContainers () const
const Item * getValues (DetId fId, bool throwOnFail=true) const
 HcalCondObjectContainer (const HcalTopology *topo)
virtual std::string myname () const
virtual ~HcalCondObjectContainer ()

Private Member Functions

void initContainer (DetId container)

Private Attributes

std::vector< Item > CALIBcontainer
std::vector< Item > CASTORcontainer
std::vector< Item > HBcontainer
std::vector< Item > HEcontainer
std::vector< Item > HFcontainer
std::vector< Item > HOcontainer
std::vector< Item > HTcontainer
std::vector< Item > ZDCcontainer

Detailed Description

template<class Item>
class HcalCondObjectContainer< Item >

Definition at line 33 of file HcalCondObjectContainer.h.


Member Typedef Documentation

template<class Item>
typedef std::vector< tHcalCont > HcalCondObjectContainer< Item >::tAllContWithNames

Definition at line 57 of file HcalCondObjectContainer.h.

template<class Item>
typedef std::pair< std::string, std::vector<Item> > HcalCondObjectContainer< Item >::tHcalCont

Definition at line 56 of file HcalCondObjectContainer.h.


Constructor & Destructor Documentation

template<class Item>
HcalCondObjectContainer< Item >::HcalCondObjectContainer ( const HcalTopology topo) [inline]

Definition at line 36 of file HcalCondObjectContainer.h.

template<class Item >
HcalCondObjectContainer< Item >::~HcalCondObjectContainer ( ) [virtual]

Definition at line 91 of file HcalCondObjectContainer.h.

{
}

Member Function Documentation

template<class Item>
bool HcalCondObjectContainer< Item >::addValues ( const Item &  myItem)

Definition at line 182 of file HcalCondObjectContainer.h.

References DetId::Calo, Exception, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, getHLTprescales::index, NULL, HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, and summarizeEdmComparisonLogfiles::success.

Referenced by HcalPedestalsCheck::analyze(), HcalGainsCheck::analyze(), cms::HcalConstantsASCIIWriter::analyze(), HcalPedestalsAnalysis::endJob(), HcalDbOnline::getObject(), HcalPedestalAnalysis::HcalPedVal(), main(), and HcalMonitorClient::writeChannelStatus().

{
  bool success = false;
  DetId fId(myItem.rawId());
  unsigned int index=indexFor(fId);
  
  Item* cell = NULL;

  if (index<0xFFFFFFFu) {
    if (fId.det()==DetId::Hcal) {
      switch (HcalSubdetector(fId.subdetId())) {
      case(HcalBarrel) : if (!HBcontainer.size() ) initContainer(fId);
        if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );  break;
      case(HcalEndcap) : if (!HEcontainer.size() ) initContainer(fId);
        if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );  break;
      case(HcalForward) : if (!HFcontainer.size() ) initContainer(fId);
        if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );  break;
      case(HcalOuter) : if (!HOcontainer.size() ) initContainer(fId);
        if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );  break;
      case(HcalTriggerTower) : if (!HTcontainer.size() ) initContainer(fId);
        if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );  break;  
      case(HcalOther) : if (extractOther(fId)==HcalCalibration) {
          if (!CALIBcontainer.size() ) initContainer(fId);
          if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );  
        }
        break; 
      default: break;
      }
    } else if (fId.det()==DetId::Calo) {
      if (fId.subdetId()==HcalCastorDetId::SubdetectorId) {
        if (!CASTORcontainer.size() ) initContainer(fId);
        if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
      } else if (fId.subdetId()==HcalZDCDetId::SubdetectorId) { 
        if (!ZDCcontainer.size() ) initContainer(fId);
        if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
      }
    }
  }

  if (cell!=0) {
    (*cell)=myItem;
    success=true;
  }

  if (!success) 
    throw cms::Exception ("Filling of conditions failed") 
      << " no valid filling possible for Conditions of type " << myname() << " for DetId " << textForId(fId);
  return success;
}
template<class Item >
const bool HcalCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 170 of file HcalCondObjectContainer.h.

Referenced by HcalCondXML::dumpObject(), HcalDbOnline::getObject(), main(), and cms::HitReCalibrator::produce().

{
  const Item* cell = getValues(fId,false);

  if (cell)
    if (cell->rawId() == fId ) 
      return true;
  
  return false;
}
template<class Item >
std::vector< DetId > HcalCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 233 of file HcalCondObjectContainer.h.

References i.

Referenced by HcalQIEDataCheck::analyze(), HcalAutoPedestalValidator::analyze(), HcalPedestalsCheck::analyze(), HcalPedestalWidthsCheck::analyze(), HcalGainsCheck::analyze(), HcalDetDiagLEDMonitor::beginRun(), HcalDetDiagPedestalMonitor::beginRun(), HcalDigiMonitor::beginRun(), HcalBeamMonitor::beginRun(), HcalMonitorClient::beginRun(), HcalDeadCellMonitor::beginRun(), HcalDetDiagLaserMonitor::beginRun(), HcalDbService::buildCalibrations(), HcalDbService::buildCalibWidths(), HcalDbXml::dumpObject(), HcalCondXML::dumpObject(), HcalPedestalAnalysis::HcalPedVal(), main(), CaloTowersCreationAlgo::makeHcalDropChMap(), and HcalMonitorClient::writeChannelStatus().

{
  std::vector<DetId> channels;
  Item emptyItem;
  for (unsigned int i=0; i<HBcontainer.size(); i++)
    {
      if (emptyItem.rawId() != HBcontainer.at(i).rawId() )
        channels.push_back( DetId(HBcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<HEcontainer.size(); i++)
    {
      if (emptyItem.rawId() != HEcontainer.at(i).rawId() )
        channels.push_back( DetId(HEcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<HOcontainer.size(); i++)
    {
      if (emptyItem.rawId() != HOcontainer.at(i).rawId() )
        channels.push_back( DetId(HOcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<HFcontainer.size(); i++)
    {
      if (emptyItem.rawId() != HFcontainer.at(i).rawId() )
        channels.push_back( DetId(HFcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<HTcontainer.size(); i++)
    {
      if (emptyItem.rawId() != HTcontainer.at(i).rawId() )
        channels.push_back( DetId(HTcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<ZDCcontainer.size(); i++)
    {
      if (emptyItem.rawId() != ZDCcontainer.at(i).rawId() )
        channels.push_back( DetId(ZDCcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<CALIBcontainer.size(); i++)
    {
      if (emptyItem.rawId() != CALIBcontainer.at(i).rawId() )
        channels.push_back( DetId(CALIBcontainer.at(i).rawId()) );
    }
  for (unsigned int i=0; i<CASTORcontainer.size(); i++)
    {
      if (emptyItem.rawId() != CASTORcontainer.at(i).rawId() )
        channels.push_back( DetId(CASTORcontainer.at(i).rawId()) );
    }

  return channels;
}
template<class Item>
const tAllContWithNames HcalCondObjectContainer< Item >::getAllContainers ( ) const [inline]

Definition at line 59 of file HcalCondObjectContainer.h.

                                                  {
    tAllContWithNames allContainers;
    allContainers.push_back(tHcalCont("HB",HBcontainer));
    allContainers.push_back(tHcalCont("HE",HEcontainer));
    allContainers.push_back(tHcalCont("HO",HOcontainer));
    allContainers.push_back(tHcalCont("HF",HFcontainer));
    allContainers.push_back(tHcalCont("HT",HTcontainer));
    allContainers.push_back(tHcalCont("ZDC",ZDCcontainer));
    allContainers.push_back(tHcalCont("CALIB",CALIBcontainer));
    allContainers.push_back(tHcalCont("CASTOR",CASTORcontainer));
    return allContainers;
  }
template<class Item >
const Item * HcalCondObjectContainer< Item >::getValues ( DetId  fId,
bool  throwOnFail = true 
) const

Definition at line 123 of file HcalCondObjectContainer.h.

References DetId::Calo, DetId::det(), Exception, DetId::Hcal, HcalBarrel, HcalCalibration, HcalEndcap, HcalForward, HcalOther, HcalOuter, HcalTriggerTower, getHLTprescales::index, NULL, HcalCastorDetId::SubdetectorId, HcalZDCDetId::SubdetectorId, and DetId::subdetId().

Referenced by HcalAmplifier::addPedestals(), cms::HcalConstantsASCIIWriter::analyze(), HcalDetDiagLEDMonitor::beginRun(), HcalDetDiagPedestalMonitor::beginRun(), HcalDigiMonitor::beginRun(), HcalBeamMonitor::beginRun(), HcalMonitorClient::beginRun(), HcalDeadCellMonitor::beginRun(), HcalDetDiagLaserMonitor::beginRun(), HcalDbXml::dumpObject(), HcalCondXML::dumpObject(), reco::HcalNoiseInfoProducer::filldigis(), reco::HcalNoiseInfoProducer::fillrechits(), HcalDbService::getGain(), HcalDbService::getGainWidth(), HcalDbService::getHcalChannelStatus(), HcalDbService::getHcalL1TriggerObject(), HcalDbService::getHcalLUTCorr(), HcalDbService::getHcalPFCorr(), HcalDbService::getHcalRespCorr(), HcalDbService::getHcalTimeCorr(), HcalDbService::getHcalZSThreshold(), HcalDbService::getPedestal(), HcalDbService::getPedestalWidth(), CaloTowersCreationAlgo::hcalChanStatusForCaloTower(), HcalPedestalAnalysis::HcalPedVal(), HcalRecHitsAnalyzer::hcalSevLvl(), HcalRecHitsValidation::hcalSevLvl(), HcalHF_PETalgorithm::HFSetFlagFromPET(), HcalHFStatusBitFromRecHits::hfSetFlagFromRecHits(), HcalHF_S9S1algorithm::HFSetFlagFromS9S1(), MuonHOAcceptance::initIds(), HcalRecHitsMaker::loadHcalRecHits(), main(), CaloTowersCreationAlgo::makeHcalDropChMap(), EgammaHLTHcalIsolation::passCleaning_(), HcalSimpleReconstructor::process(), ZdcHitReconstructor::produce(), HcalHitReconstructor::produce(), cms::HitReCalibrator::produce(), ZdcSimpleReconstructor::produce(), HcalShapes::shape(), HcalPulseShapes::shape(), HcalPulseShapes::shapeForReco(), HcaluLUTTPGCoder::update(), ObjectValidator::validHit(), and HcalMonitorClient::writeChannelStatus().

{
  unsigned int index=indexFor(fId);
  
  const Item* cell = NULL;

  if (index<0xFFFFFFFu) {
    if (fId.det()==DetId::Hcal) {
      switch (HcalSubdetector(fId.subdetId())) {
      case(HcalBarrel) : if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );  break;
      case(HcalEndcap) : if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );  break;
      case(HcalForward) : if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );   break; 
      case(HcalOuter) : if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );    break;
      case(HcalTriggerTower) : if (index < HTcontainer.size()) cell = &(HTcontainer.at(index) );    break;
      case(HcalOther) : if (extractOther(fId)==HcalCalibration) 
          if (index < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index) );  
        break; 
      default: break;
      }
    } else if (fId.det()==DetId::Calo) {
      if (fId.subdetId()==HcalCastorDetId::SubdetectorId) {
        if (index < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index) );
      } else if (fId.subdetId()==HcalZDCDetId::SubdetectorId) {
        if (index < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index) );
      }
    }
  }
  
  //  Item emptyItem;
  //  if (cell->rawId() == emptyItem.rawId() ) 
  if ((!cell)) {
    if (throwOnFail) {
      throw cms::Exception ("Conditions not found") 
        << "Unavailable Conditions of type " << myname() << " for cell " << textForId(fId);
    } 
  } else if (cell->rawId() != fId) {
    if (throwOnFail) {
      throw cms::Exception ("Conditions mismatch") 
        << "Requested conditions of type " << myname() << " for cell " << textForId(fId) << " got conditions for cell " << textForId(DetId(cell->rawId()));
    } 
    cell=0;
  }

  return cell;
}
template<class Item >
void HcalCondObjectContainer< Item >::initContainer ( DetId  container) [private]

Definition at line 96 of file HcalCondObjectContainer.h.

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

{
  Item emptyItem;

  if (fId.det()==DetId::Hcal) {
    switch (HcalSubdetector(fId.subdetId())) {
    case(HcalBarrel) : for (unsigned int i=0; i<sizeFor(fId); i++) HBcontainer.push_back(emptyItem); break;
    case(HcalEndcap) : for (unsigned int i=0; i<sizeFor(fId); i++) HEcontainer.push_back(emptyItem); break;
    case(HcalOuter) : for (unsigned int i=0; i<sizeFor(fId); i++) HOcontainer.push_back(emptyItem); break;
    case(HcalForward) : for (unsigned int i=0; i<sizeFor(fId); i++) HFcontainer.push_back(emptyItem); break;
    case(HcalTriggerTower) : for (unsigned int i=0; i<sizeFor(fId); i++) HTcontainer.push_back(emptyItem); break;
    case(HcalOther) : if (extractOther(fId)==HcalCalibration) 
        for (unsigned int i=0; i<sizeFor(fId); i++) CALIBcontainer.push_back(emptyItem); break;
      break; 
    default: break;
    }
  } else if (fId.det()==DetId::Calo) {
    if (fId.subdetId()==HcalCastorDetId::SubdetectorId) {
      for (unsigned int i=0; i<sizeFor(fId); i++) CASTORcontainer.push_back(emptyItem); 
    } else if (fId.subdetId()==HcalZDCDetId::SubdetectorId) {
      for (unsigned int i=0; i<sizeFor(fId); i++) ZDCcontainer.push_back(emptyItem); 
    }
  }
}
template<class Item>
virtual std::string HcalCondObjectContainer< Item >::myname ( ) const [inline, virtual]

Member Data Documentation

template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::CALIBcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::CASTORcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::HBcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::HEcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::HFcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::HOcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::HTcontainer [private]
template<class Item>
std::vector<Item> HcalCondObjectContainer< Item >::ZDCcontainer [private]