CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes
HcalCalibrationsSet Class Reference

#include <HcalCalibrationsSet.h>

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.

9  : sorted_ (false) {}

Member Function Documentation

void HcalCalibrationsSet::clear ( void  )
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().

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

25  {
26  sorted_=false;
27  std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
28  if (cell==mItems.end())
29  {
30  mItems.push_back(Item(fId));
31  mItems.at(mItems.size()-1).calib=ca;
32  return;
33  }
34  cell->calib=ca;
35 }
std::vector< CalibSetObject > mItems
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
void HcalCalibrationsSet::sort ( )

Definition at line 36 of file HcalCalibrationsSet.cc.

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

Referenced by HcalDbService::buildCalibrations().

36  {
37  if (!sorted_) {
38  std::sort (mItems.begin(), mItems.end());
39  sorted_ = true;
40  }
41 }
std::vector< CalibSetObject > mItems

Member Data Documentation

HcalCalibrations HcalCalibrationsSet::dummy
private

Definition at line 30 of file HcalCalibrationsSet.h.

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

Definition at line 31 of file HcalCalibrationsSet.h.

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

bool HcalCalibrationsSet::sorted_
private

Definition at line 32 of file HcalCalibrationsSet.h.

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