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

Constructor & Destructor Documentation

CastorCalibrationsSet::CastorCalibrationsSet ( )

Definition at line 7 of file CastorCalibrationsSet.cc.

8  : sorted_ (false) {}

Member Function Documentation

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

Definition at line 10 of file CastorCalibrationsSet.cc.

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

Referenced by CastorDbService::getCastorCalibrations().

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

Definition at line 24 of file CastorCalibrationsSet.cc.

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

Referenced by CastorDbService::buildCalibrations().

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  {
29  mItems.push_back(Item(fId));
30  mItems.at(mItems.size()-1).calib=ca;
31  return;
32  }
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< CalibSetObject > mItems
void CastorCalibrationsSet::sort ( )

Definition at line 36 of file CastorCalibrationsSet.cc.

References mItems, and sorted_.

Referenced by CastorDbService::buildCalibrations().

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

Member Data Documentation

CastorCalibrations CastorCalibrationsSet::dummy
private

Definition at line 24 of file CastorCalibrationsSet.h.

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

Definition at line 25 of file CastorCalibrationsSet.h.

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

bool CastorCalibrationsSet::sorted_
private

Definition at line 26 of file CastorCalibrationsSet.h.

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