CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

HcalCalibrationWidthsSet Class Reference

#include <HcalCalibrationWidthsSet.h>

List of all members.

Classes

struct  CalibWidthSetObject

Public Member Functions

void clear ()
const HcalCalibrationWidthsgetCalibrationWidths (const DetId id) const
 HcalCalibrationWidthsSet ()
void setCalibrationWidths (const DetId id, const HcalCalibrationWidths &ca)
void sort ()

Private Types

typedef CalibWidthSetObject Item

Private Attributes

HcalCalibrationWidths dummy
std::vector< CalibWidthSetObjectmItems
bool sorted_

Detailed Description

Date:
2008/11/08 21:19:28
Revision:
1.1
Author:
R.Ofierzynski

Definition at line 14 of file HcalCalibrationWidthsSet.h.


Member Typedef Documentation

Definition at line 29 of file HcalCalibrationWidthsSet.h.


Constructor & Destructor Documentation

HcalCalibrationWidthsSet::HcalCalibrationWidthsSet ( )

Definition at line 8 of file HcalCalibrationWidthsSet.cc.

  : sorted_ (false) {}

Member Function Documentation

void HcalCalibrationWidthsSet::clear ( void  )

Definition at line 42 of file HcalCalibrationWidthsSet.cc.

References mItems.

Referenced by HcalDbService::buildCalibWidths().

                                     {
  mItems.clear();
}
const HcalCalibrationWidths & HcalCalibrationWidthsSet::getCalibrationWidths ( const DetId  id) const

Definition at line 11 of file HcalCalibrationWidthsSet.cc.

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

Referenced by HcalDbService::getHcalCalibrationWidths().

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

Definition at line 25 of file HcalCalibrationWidthsSet.cc.

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

Referenced by HcalDbService::buildCalibWidths().

                                                                                              {
  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 HcalCalibrationWidthsSet::sort ( )

Definition at line 36 of file HcalCalibrationWidthsSet.cc.

References mItems, and sorted_.

Referenced by HcalDbService::buildCalibWidths().

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

Member Data Documentation

Definition at line 30 of file HcalCalibrationWidthsSet.h.

Definition at line 31 of file HcalCalibrationWidthsSet.h.

Referenced by clear(), getCalibrationWidths(), setCalibrationWidths(), and sort().

Definition at line 32 of file HcalCalibrationWidthsSet.h.

Referenced by getCalibrationWidths(), setCalibrationWidths(), and sort().