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

Author
J. Mans - Minnesota

Definition at line 14 of file HcalCalibrationsSet.h.

Member Typedef Documentation

Definition at line 31 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 ( )
const HcalCalibrations & HcalCalibrationsSet::getCalibrations ( const DetId  id) const

Definition at line 11 of file HcalCalibrationsSet.cc.

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

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  } else {
17  cell = std::find(mItems.begin(),mItems.end(), target);
18  }
19  if ((cell == mItems.end()) || (!hcalEqualDetId(cell->id.rawId(),fId)))
20  throw cms::Exception ("Conditions not found") << "Unavailable HcalCalibrations for cell " << HcalGenericDetId(fId);
21  return cell->calib;
22 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
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 24 of file HcalCalibrationsSet.cc.

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

24  {
25  sorted_=false;
26  std::vector<Item>::iterator cell=std::find(mItems.begin(),mItems.end(),Item(fId)); //slow, but guaranteed
27  if (cell==mItems.end()) {
28  mItems.push_back(Item(fId));
29  mItems.at(mItems.size()-1).calib=ca;
30  return;
31  }
32  cell->calib=ca;
33 }
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 35 of file HcalCalibrationsSet.cc.

References mItems, and sorted_.

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

Member Data Documentation

HcalCalibrations HcalCalibrationsSet::dummy
private

Definition at line 32 of file HcalCalibrationsSet.h.

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

Definition at line 33 of file HcalCalibrationsSet.h.

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

bool HcalCalibrationsSet::sorted_
private

Definition at line 34 of file HcalCalibrationsSet.h.

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