test
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

Author
R.Ofierzynski

Definition at line 14 of file HcalCalibrationWidthsSet.h.

Member Typedef Documentation

Definition at line 31 of file HcalCalibrationWidthsSet.h.

Constructor & Destructor Documentation

HcalCalibrationWidthsSet::HcalCalibrationWidthsSet ( )

Definition at line 8 of file HcalCalibrationWidthsSet.cc.

Member Function Documentation

void HcalCalibrationWidthsSet::clear ( )
const HcalCalibrationWidths & HcalCalibrationWidthsSet::getCalibrationWidths ( const DetId  id) const

Definition at line 11 of file HcalCalibrationWidthsSet.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 HcalCalibrationWidths for cell " << HcalGenericDetId(fId);
21  return cell->calib;
22 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
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 24 of file HcalCalibrationWidthsSet.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 }
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 35 of file HcalCalibrationWidthsSet.cc.

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

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

Member Data Documentation

HcalCalibrationWidths HcalCalibrationWidthsSet::dummy
private

Definition at line 32 of file HcalCalibrationWidthsSet.h.

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

Definition at line 33 of file HcalCalibrationWidthsSet.h.

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

bool HcalCalibrationWidthsSet::sorted_
private

Definition at line 34 of file HcalCalibrationWidthsSet.h.

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