CMS 3D CMS Logo

Classes | Public Member Functions | Private Types | Private Attributes

CastorCalibrationWidthsSet Class Reference

#include <CastorCalibrationWidthsSet.h>

List of all members.

Classes

struct  CalibWidthSetObject

Public Member Functions

 CastorCalibrationWidthsSet ()
void clear ()
const CastorCalibrationWidthsgetCalibrationWidths (const DetId id) const
void setCalibrationWidths (const DetId id, const CastorCalibrationWidths &ca)
void sort ()

Private Types

typedef CalibWidthSetObject Item

Private Attributes

CastorCalibrationWidths dummy
std::vector< CalibWidthSetObjectmItems
bool sorted_

Detailed Description

Date:
2009/03/26 17:55:06
Revision:
1.1
Author:
R.Ofierzynski Adapted for CASTOR by L. Mundim

Definition at line 15 of file CastorCalibrationWidthsSet.h.


Member Typedef Documentation

Definition at line 30 of file CastorCalibrationWidthsSet.h.


Constructor & Destructor Documentation

CastorCalibrationWidthsSet::CastorCalibrationWidthsSet ( )

Definition at line 8 of file CastorCalibrationWidthsSet.cc.

  : sorted_ (false) {}

Member Function Documentation

void CastorCalibrationWidthsSet::clear ( void  )

Definition at line 42 of file CastorCalibrationWidthsSet.cc.

References mItems.

Referenced by CastorDbService::buildCalibWidths().

                                       {
  mItems.clear();
}
const CastorCalibrationWidths & CastorCalibrationWidthsSet::getCalibrationWidths ( const DetId  id) const

Definition at line 11 of file CastorCalibrationWidthsSet.cc.

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

Referenced by CastorDbService::getCastorCalibrationWidths().

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

Definition at line 25 of file CastorCalibrationWidthsSet.cc.

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

Referenced by CastorDbService::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 CastorCalibrationWidthsSet::sort ( )

Definition at line 36 of file CastorCalibrationWidthsSet.cc.

References mItems, and sorted_.

Referenced by CastorDbService::buildCalibWidths().

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

Member Data Documentation

Definition at line 31 of file CastorCalibrationWidthsSet.h.

Definition at line 33 of file CastorCalibrationWidthsSet.h.

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