CMS 3D CMS Logo

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

HcalCondObjectContainer< Item > Class Template Reference

#include <HcalCondObjectContainer.h>

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, bool h2mode_=false)
const bool exists (DetId fId) const
std::vector< DetIdgetAllChannels () const
const tAllContWithNames getAllContainers () const
const Item * getValues (DetId fId) const
 HcalCondObjectContainer ()
virtual std::string myname () const
virtual ~HcalCondObjectContainer ()

Private Member Functions

void initContainer (int container, bool h2mode_=false)

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 13 of file HcalCondObjectContainer.h.


Member Typedef Documentation

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

Definition at line 38 of file HcalCondObjectContainer.h.

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

Definition at line 37 of file HcalCondObjectContainer.h.


Constructor & Destructor Documentation

template<class Item >
HcalCondObjectContainer< Item >::HcalCondObjectContainer ( )

Definition at line 70 of file HcalCondObjectContainer.h.

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

Definition at line 76 of file HcalCondObjectContainer.h.

{
}

Member Function Documentation

template<class Item>
bool HcalCondObjectContainer< Item >::addValues ( const Item &  myItem,
bool  h2mode_ = false 
)

Definition at line 216 of file HcalCondObjectContainer.h.

References abs, Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenCastor, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenTriggerTower, HcalGenericDetId::HcalGenZDC, getHLTprescales::index, and summarizeEdmComparisonLogfiles::success.

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

{
  unsigned long myRawId = myItem.rawId();
  HcalGenericDetId myId(myRawId);
  int index = myId.hashedId(h2mode_);
  bool success = false;
  if (index < 0) success = false;
  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int

  switch (myId.genericSubdet() ) {
  case HcalGenericDetId::HcalGenBarrel:
    if (!HBcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < HBcontainer.size())
      {
        HBcontainer.at(index1)  = myItem;
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenEndcap: 
    if (!HEcontainer.size() ) initContainer(myId.genericSubdet(), h2mode_ );
    if (index1 < HEcontainer.size())
      {
        HEcontainer.at(index1)  = myItem; 
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenOuter:  
    if (!HOcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < HOcontainer.size())
      {
        HOcontainer.at(index1)  = myItem; 
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenForward: 
    if (!HFcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < HFcontainer.size())
      {
        HFcontainer.at(index1)  = myItem;
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenTriggerTower: 
    if (!HTcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < HTcontainer.size())
      {
        HTcontainer.at(index1)  = myItem;
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenZDC: 
    if (!ZDCcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < ZDCcontainer.size())
      {
        ZDCcontainer.at(index1)  = myItem; 
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenCastor: 
    if (!CASTORcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < CASTORcontainer.size())
      {
        CASTORcontainer.at(index1)  = myItem; 
        success = true;
      }
    break;
  case HcalGenericDetId::HcalGenCalibration: 
    if (!CALIBcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < CALIBcontainer.size())
      {
        CALIBcontainer.at(index1)  = myItem;  
        success = true;
      }
    break;
  default: break;
  }

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

Definition at line 169 of file HcalCondObjectContainer.h.

References abs, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenCastor, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenTriggerTower, HcalGenericDetId::HcalGenZDC, HcalGenericDetId::HEhalfh2mode, getHLTprescales::index, and NULL.

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

{
  HcalGenericDetId myId(fId);
  bool h2mode_ = (HEcontainer.size()==(2*HcalGenericDetId::HEhalfh2mode));

  int index = myId.hashedId(h2mode_);
  if (index < 0) return false;
  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
  const Item* cell = NULL;
  switch (myId.genericSubdet() ) {
  case HcalGenericDetId::HcalGenBarrel: 
    if (index1 < HBcontainer.size()) cell = &(HBcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenEndcap: 
    if (index1 < HEcontainer.size()) cell = &(HEcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenOuter: 
    if (index1 < HOcontainer.size()) cell = &(HOcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenForward: 
    if (index1 < HFcontainer.size()) cell = &(HFcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenTriggerTower: 
    if (index1 < HTcontainer.size()) cell = &(HTcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenZDC: 
    if (index1 < ZDCcontainer.size()) cell = &(ZDCcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenCastor: 
    if (index1 < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index1) );  
    break;
  case HcalGenericDetId::HcalGenCalibration: 
    if (index1 < CALIBcontainer.size()) cell = &(CALIBcontainer.at(index1) );  
    break;
  default: return false; break;
  }
  
  //  Item emptyItem;
  if (cell)
    //    if (cell->rawId() != emptyItem.rawId() ) 
    if (cell->rawId() == fId ) 
      return true;

  return false;
}
template<class Item >
std::vector< DetId > HcalCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 300 of file HcalCondObjectContainer.h.

References i.

Referenced by 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 40 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) const

Definition at line 113 of file HcalCondObjectContainer.h.

References abs, Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenCastor, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenTriggerTower, HcalGenericDetId::HcalGenZDC, HcalGenericDetId::HEhalfh2mode, getHLTprescales::index, and NULL.

Referenced by HcalAmplifier::addPedestals(), cms::HcalConstantsASCIIWriter::analyze(), HcalDetDiagLEDMonitor::beginRun(), HcalDetDiagPedestalMonitor::beginRun(), HcalDigiMonitor::beginRun(), HcalMonitorClient::beginRun(), HcalBeamMonitor::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(), 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().

{
  HcalGenericDetId myId(fId);
  bool h2mode_ = (HEcontainer.size()==(2*HcalGenericDetId::HEhalfh2mode));

  int index = myId.hashedId(h2mode_);
  //  std::cout << "::::: getting values at index " << index  << ", DetId " << myId << std::endl;
  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int

  const Item* cell = NULL;
  if (index >= 0)
    switch (myId.genericSubdet() ) {
    case HcalGenericDetId::HcalGenBarrel: 
      if (index1 < HBcontainer.size()) 
        cell = &(HBcontainer.at(index1) );  
      break;
    case HcalGenericDetId::HcalGenEndcap: 
      if (index1 < HEcontainer.size()) 
        cell = &(HEcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenOuter: 
      if (index1 < HOcontainer.size())
        cell = &(HOcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenForward:
      if (index1 < HFcontainer.size()) 
        cell = &(HFcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenTriggerTower: 
      if (index1 < HTcontainer.size()) 
        cell = &(HTcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenZDC:    
      if (index1 < ZDCcontainer.size()) 
        cell = &(ZDCcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenCastor:
      if (index1 < CASTORcontainer.size()) 
        cell = &(CASTORcontainer.at(index1) ); 
      break;
    case HcalGenericDetId::HcalGenCalibration:
      if (index1 < CALIBcontainer.size())
        cell = &(CALIBcontainer.at(index1) ); 
      break;
    default: break;
    }
  
  //  Item emptyItem;
  //  if (cell->rawId() == emptyItem.rawId() ) 
  if ((!cell) || (cell->rawId() != fId ) )
    throw cms::Exception ("Conditions not found") 
      << "Unavailable Conditions of type " << myname() << " for cell " << myId;
  return cell;
}
template<class Item >
void HcalCondObjectContainer< Item >::initContainer ( int  container,
bool  h2mode_ = false 
) [private]

Definition at line 81 of file HcalCondObjectContainer.h.

References HcalGenericDetId::CALIBhalf, HcalGenericDetId::CASTORhalf, HcalGenericDetId::HBhalf, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenCastor, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenTriggerTower, HcalGenericDetId::HcalGenZDC, HcalGenericDetId::HEhalf, HcalGenericDetId::HEhalfh2mode, HcalGenericDetId::HFhalf, HcalGenericDetId::HOhalf, HcalGenericDetId::HThalf, i, and HcalGenericDetId::ZDChalf.

{
  //  if (!m_h2mode) m_h2mode = h2mode_;

  Item emptyItem;

  switch (container) 
    {
    case HcalGenericDetId::HcalGenBarrel: 
      for (int i=0; i<(2*HcalGenericDetId::HBhalf); i++) HBcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenEndcap: 
      if (!h2mode_) for (int i=0; i<(2*HcalGenericDetId::HEhalf); i++) HEcontainer.push_back(emptyItem); 
      else for (int i=0; i<(2*HcalGenericDetId::HEhalfh2mode); i++) HEcontainer.push_back(emptyItem); 
      break;
    case HcalGenericDetId::HcalGenOuter: 
      for (int i=0; i<(2*HcalGenericDetId::HOhalf); i++) HOcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenForward: 
      for (int i=0; i<(2*HcalGenericDetId::HFhalf); i++) HFcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenTriggerTower: 
      for (int i=0; i<(2*HcalGenericDetId::HThalf); i++) HTcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenZDC: 
      for (int i=0; i<(2*HcalGenericDetId::ZDChalf); i++) ZDCcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenCalibration: 
      for (int i=0; i<(2*HcalGenericDetId::CALIBhalf); i++) CALIBcontainer.push_back(emptyItem); break;
    case HcalGenericDetId::HcalGenCastor: 
      for (int i=0; i<(2*HcalGenericDetId::CASTORhalf); i++) CASTORcontainer.push_back(emptyItem); break;
    default: break;
    }
}
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]