CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Attributes
CastorCalibrationsSet Class Reference

#include <CastorCalibrationsSet.h>

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 24 of file CastorCalibrationsSet.h.

Constructor & Destructor Documentation

CastorCalibrationsSet::CastorCalibrationsSet ( )

Definition at line 6 of file CastorCalibrationsSet.cc.

Member Function Documentation

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

Definition at line 8 of file CastorCalibrationsSet.cc.

References spr::find(), pfDeepBoostedJetPreprocessParams_cfi::lower_bound, mItems, sorted_, and edmPickEvents::target.

Referenced by CastorDbService::getCastorCalibrations().

8  {
9  Item target(fId);
10  std::vector<Item>::const_iterator cell;
11  if (sorted_) {
12  cell = std::lower_bound(mItems.begin(), mItems.end(), target);
13  } else {
14  cell = std::find(mItems.begin(), mItems.end(), target);
15  }
16  if (cell == mItems.end() || cell->id != fId)
17  throw cms::Exception("Conditions not found") << "Unavailable CastorCalibrations for cell " << HcalGenericDetId(fId);
18  return cell->calib;
19 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< CalibSetObject > mItems
void CastorCalibrationsSet::setCalibrations ( const DetId  id,
const CastorCalibrations ca 
)

Definition at line 21 of file CastorCalibrationsSet.cc.

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

Referenced by CastorDbService::buildCalibrations().

21  {
22  sorted_ = false;
23  std::vector<Item>::iterator cell = std::find(mItems.begin(), mItems.end(), Item(fId)); //slow, but guaranteed
24  if (cell == mItems.end()) {
25  mItems.push_back(Item(fId));
26  mItems.at(mItems.size() - 1).calib = ca;
27  return;
28  }
29 
30  cell->calib = ca;
31 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< CalibSetObject > mItems
void CastorCalibrationsSet::sort ( )

Definition at line 32 of file CastorCalibrationsSet.cc.

References mItems, and sorted_.

Referenced by CastorDbService::buildCalibrations().

32  {
33  if (!sorted_) {
34  std::sort(mItems.begin(), mItems.end());
35  sorted_ = true;
36  }
37 }
std::vector< CalibSetObject > mItems

Member Data Documentation

CastorCalibrations CastorCalibrationsSet::dummy
private

Definition at line 25 of file CastorCalibrationsSet.h.

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

Definition at line 26 of file CastorCalibrationsSet.h.

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

bool CastorCalibrationsSet::sorted_
private

Definition at line 27 of file CastorCalibrationsSet.h.

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