CMS 3D CMS Logo

CastorCalibrationsSet Class Reference

#include <CalibFormats/CastorObjects/interface/CastorCalibrationsSet.h>

List of all members.

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_

Classes

struct  CalibSetObject


Detailed Description

Definition at line 8 of file CastorCalibrationsSet.h.


Member Typedef Documentation

typedef CalibSetObject CastorCalibrationsSet::Item [private]

Definition at line 23 of file CastorCalibrationsSet.h.


Constructor & Destructor Documentation

CastorCalibrationsSet::CastorCalibrationsSet (  ) 

Definition at line 7 of file CastorCalibrationsSet.cc.

00008   : sorted_ (false) {}


Member Function Documentation

void CastorCalibrationsSet::clear ( void   ) 

Definition at line 36 of file CastorCalibrationsSet.cc.

References mItems.

00036                                   {
00037   mItems.clear();
00038 }

const CastorCalibrations & CastorCalibrationsSet::getCalibrations ( const DetId  id  )  const

Definition at line 10 of file CastorCalibrationsSet.cc.

References find(), mItems, sorted_, and target.

00010                                                                                       {
00011   Item target(fId);
00012   std::vector<Item>::const_iterator cell;
00013   if (sorted_) {
00014     cell = std::lower_bound (mItems.begin(), mItems.end(), target);
00015   }
00016   else {
00017     cell = std::find(mItems.begin(),mItems.end(), target);
00018   }
00019   if (cell == mItems.end() || cell->id != fId) 
00020     throw cms::Exception ("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId);
00021   return cell->calib;
00022 }

void CastorCalibrationsSet::setCalibrations ( const DetId  id,
const CastorCalibrations ca 
)

Definition at line 24 of file CastorCalibrationsSet.cc.

References find(), mItems, and sorted_.

00024                                                                                    {
00025   sorted_=false;
00026   std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
00027   if (cell==mItems.end()) mItems.push_back(Item(fId));
00028   cell->calib=ca;
00029 }

void CastorCalibrationsSet::sort (  ) 

Definition at line 30 of file CastorCalibrationsSet.cc.

References mItems, python::multivaluedict::sort(), and sorted_.

00030                                   {
00031   if (!sorted_) {
00032     std::sort (mItems.begin(), mItems.end());
00033     sorted_ = true;
00034   }
00035 }


Member Data Documentation

CastorCalibrations CastorCalibrationsSet::dummy [private]

Definition at line 24 of file CastorCalibrationsSet.h.

std::vector<CalibSetObject> CastorCalibrationsSet::mItems [private]

Definition at line 25 of file CastorCalibrationsSet.h.

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

bool CastorCalibrationsSet::sorted_ [private]

Definition at line 26 of file CastorCalibrationsSet.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:08 2009 for CMSSW by  doxygen 1.5.4