CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

CastorCalibrationsSet Class Reference

#include <CastorCalibrationsSet.h>

List of all members.

Classes

struct  CalibSetObject

Public Member Functions

 CastorCalibrationsSet ()
void clear ()
const CastorCalibrationsgetCalibrations (const DetId id) const
void setCalibrations (const DetId id, const CastorCalibrations &ca)
void sort ()

Private Types

typedef CalibSetObject Item

Private Attributes

CastorCalibrations dummy
std::vector< CalibSetObjectmItems
bool sorted_

Detailed Description

Definition at line 8 of file CastorCalibrationsSet.h.


Member Typedef Documentation

Definition at line 23 of file CastorCalibrationsSet.h.


Constructor & Destructor Documentation

CastorCalibrationsSet::CastorCalibrationsSet ( )

Definition at line 7 of file CastorCalibrationsSet.cc.

  : sorted_ (false) {}

Member Function Documentation

void CastorCalibrationsSet::clear ( void  )

Definition at line 42 of file CastorCalibrationsSet.cc.

References mItems.

Referenced by CastorDbService::buildCalibrations().

                                  {
  mItems.clear();
}
const CastorCalibrations & CastorCalibrationsSet::getCalibrations ( const DetId  id) const

Definition at line 10 of file CastorCalibrationsSet.cc.

References spr::find(), mItems, sorted_, and filterCSVwithJSON::target.

Referenced by CastorDbService::getCastorCalibrations().

                                                                                      {
  Item target(fId);
  std::vector<Item>::const_iterator cell;
  if (sorted_) {
    cell = std::lower_bound (mItems.begin(), mItems.end(), target);
  }
  else {
    cell = std::find(mItems.begin(),mItems.end(), target);
  }
  if (cell == mItems.end() || cell->id != fId) 
    throw cms::Exception ("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId);
  return cell->calib;
}
void CastorCalibrationsSet::setCalibrations ( const DetId  id,
const CastorCalibrations ca 
)

Definition at line 24 of file CastorCalibrationsSet.cc.

References calib, spr::find(), mItems, and sorted_.

Referenced by CastorDbService::buildCalibrations().

                                                                                   {
  sorted_=false;
  std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
 if (cell==mItems.end())
    {
      mItems.push_back(Item(fId));
      mItems.at(mItems.size()-1).calib=ca;
      return;
    }

  cell->calib=ca;
}
void CastorCalibrationsSet::sort ( )

Definition at line 36 of file CastorCalibrationsSet.cc.

References mItems, and sorted_.

Referenced by CastorDbService::buildCalibrations().

                                  {
  if (!sorted_) {
    std::sort (mItems.begin(), mItems.end());
    sorted_ = true;
  }
}

Member Data Documentation

Definition at line 24 of file CastorCalibrationsSet.h.

Definition at line 25 of file CastorCalibrationsSet.h.

Referenced by clear(), getCalibrations(), setCalibrations(), and sort().

Definition at line 26 of file CastorCalibrationsSet.h.

Referenced by getCalibrations(), setCalibrations(), and sort().