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
HcalCalibrationWidthsSet Class Reference

#include <HcalCalibrationWidthsSet.h>

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.

Member Function Documentation

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

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 HcalCalibrationWidths for cell " << HcalGenericDetId(fId);
22  return cell->calib;
23 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< CalibWidthSetObject > mItems
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().

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 }
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
std::vector< CalibWidthSetObject > mItems
void HcalCalibrationWidthsSet::sort ( )

Definition at line 36 of file HcalCalibrationWidthsSet.cc.

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

Referenced by HcalDbService::buildCalibWidths().

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

Member Data Documentation

HcalCalibrationWidths HcalCalibrationWidthsSet::dummy
private

Definition at line 30 of file HcalCalibrationWidthsSet.h.

std::vector<CalibWidthSetObject> HcalCalibrationWidthsSet::mItems
private

Definition at line 31 of file HcalCalibrationWidthsSet.h.

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

bool HcalCalibrationWidthsSet::sorted_
private

Definition at line 32 of file HcalCalibrationWidthsSet.h.

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