CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

HcalCalibrationsSet Class Reference

#include <HcalCalibrationsSet.h>

List of all members.

Classes

struct  CalibSetObject

Public Member Functions

void clear ()
const HcalCalibrationsgetCalibrations (const DetId id) const
 HcalCalibrationsSet ()
void setCalibrations (const DetId id, const HcalCalibrations &ca)
void sort ()

Private Types

typedef CalibSetObject Item

Private Attributes

HcalCalibrations dummy
std::vector< CalibSetObjectmItems
bool sorted_

Detailed Description

Date:
2007/12/20 01:39:52
Revision:
1.1
Author:
J. Mans - Minnesota

Definition at line 14 of file HcalCalibrationsSet.h.


Member Typedef Documentation

Definition at line 29 of file HcalCalibrationsSet.h.


Constructor & Destructor Documentation

HcalCalibrationsSet::HcalCalibrationsSet ( )

Definition at line 8 of file HcalCalibrationsSet.cc.

  : sorted_ (false) {}

Member Function Documentation

void HcalCalibrationsSet::clear ( void  )

Definition at line 42 of file HcalCalibrationsSet.cc.

References mItems.

Referenced by HcalDbService::buildCalibrations().

                                {
  mItems.clear();
}
const HcalCalibrations & HcalCalibrationsSet::getCalibrations ( const DetId  id) const

Definition at line 11 of file HcalCalibrationsSet.cc.

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

Referenced by HcalDbService::getHcalCalibrations().

                                                                                  {
  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 HcalCalibrations for cell " << HcalGenericDetId(fId);
  return cell->calib;
}
void HcalCalibrationsSet::setCalibrations ( const DetId  id,
const HcalCalibrations ca 
)

Definition at line 25 of file HcalCalibrationsSet.cc.

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

Referenced by HcalDbService::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 HcalCalibrationsSet::sort ( )

Definition at line 36 of file HcalCalibrationsSet.cc.

References mItems, and sorted_.

Referenced by HcalDbService::buildCalibrations().

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

Member Data Documentation

Definition at line 30 of file HcalCalibrationsSet.h.

Definition at line 31 of file HcalCalibrationsSet.h.

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

Definition at line 32 of file HcalCalibrationsSet.h.

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