CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CastorCondObjectContainer< Item > Class Template Reference

#include <CastorCondObjectContainer.h>

List of all members.

Public Member Functions

bool addValues (const Item &myItem)
 CastorCondObjectContainer ()
const bool exists (DetId fId) const
std::vector< DetIdgetAllChannels () const
const Item * getValues (DetId fId) const
std::string myname () const
 ~CastorCondObjectContainer ()

Private Member Functions

void initContainer (int container)

Private Attributes

std::vector< Item > CASTORcontainer

Detailed Description

template<class Item>
class CastorCondObjectContainer< Item >

Definition at line 14 of file CastorCondObjectContainer.h.


Constructor & Destructor Documentation

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

Definition at line 48 of file CastorCondObjectContainer.h.

{
}
template<class Item >
CastorCondObjectContainer< Item >::~CastorCondObjectContainer ( )

Definition at line 53 of file CastorCondObjectContainer.h.

{
}

Member Function Documentation

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

Definition at line 128 of file CastorCondObjectContainer.h.

References abs, Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and summarizeEdmComparisonLogfiles::success.

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), HcalPedestalAnalysis::GetPedConst(), and CastorPedestalsAnalysis::~CastorPedestalsAnalysis().

{
  unsigned long myRawId = myItem.rawId();
  HcalGenericDetId myId(myRawId);
  //int index = myId.hashedId(h2mode_);
  int index = myId.hashedId();
  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::HcalGenCastor: 
    if (!CASTORcontainer.size() ) initContainer(myId.genericSubdet() );
    if (index1 < CASTORcontainer.size())
      {
        CASTORcontainer.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 CastorCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 102 of file CastorCondObjectContainer.h.

References abs, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and NULL.

{
  HcalGenericDetId myId(fId);
  //int index = myId.hashedId(m_h2mode);
  int index = myId.hashedId();
  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::HcalGenCastor: 
    if (index1 < CASTORcontainer.size()) cell = &(CASTORcontainer.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 > CastorCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 159 of file CastorCondObjectContainer.h.

References i.

Referenced by CastorDbService::buildCalibrations(), CastorDbService::buildCalibWidths(), CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), and CastorSimpleReconstructor::produce().

{
  std::vector<DetId> channels;
  Item emptyItem;
  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 Item * CastorCondObjectContainer< Item >::getValues ( DetId  fId) const

Definition at line 75 of file CastorCondObjectContainer.h.

References abs, Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and NULL.

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorDbService::getCastorChannelStatus(), CastorDbService::getGain(), CastorDbService::getGainWidth(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), and CastorSimpleReconstructor::produce().

{
  HcalGenericDetId myId(fId);
  //int index = myId.hashedId(m_h2mode);
  int index = myId.hashedId();
  //  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::HcalGenCastor:
      if (index1 < CASTORcontainer.size()) 
        cell = &(CASTORcontainer.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 CastorCondObjectContainer< Item >::initContainer ( int  container) [private]

Definition at line 59 of file CastorCondObjectContainer.h.

References HcalGenericDetId::CASTORhalf, HcalGenericDetId::HcalGenCastor, and i.

{
  //m_h2mode = h2mode_;

  Item emptyItem;

  switch (container) 
    {
    case HcalGenericDetId::HcalGenCastor:
      for (int i=0; i<(2*HcalGenericDetId::CASTORhalf); i++) CASTORcontainer.push_back(emptyItem); break;
    default: break;
    }
}
template<class Item>
std::string CastorCondObjectContainer< Item >::myname ( ) const [inline]

Reimplemented in CastorChannelQuality, CastorGains, CastorGainWidths, CastorQIEData, and CastorRecoParams.

Definition at line 36 of file CastorCondObjectContainer.h.

{return (std::string)"Castor Undefined";}

Member Data Documentation

template<class Item>
std::vector<Item> CastorCondObjectContainer< Item >::CASTORcontainer [private]

Definition at line 42 of file CastorCondObjectContainer.h.