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

#include <CastorCalibrationWidthsSet.h>

Classes

struct  CalibWidthSetObject
 

Public Member Functions

 CastorCalibrationWidthsSet ()
 
void clear ()
 
const CastorCalibrationWidthsgetCalibrationWidths (const DetId id) const
 
void setCalibrationWidths (const DetId id, const CastorCalibrationWidths &ca)
 
void sort ()
 

Private Types

typedef CalibWidthSetObject Item
 

Private Attributes

CastorCalibrationWidths dummy
 
std::vector< CalibWidthSetObjectmItems
 
bool sorted_
 

Detailed Description

Author
R.Ofierzynski Adapted for CASTOR by L. Mundim

Definition at line 13 of file CastorCalibrationWidthsSet.h.

Member Typedef Documentation

Definition at line 28 of file CastorCalibrationWidthsSet.h.

Constructor & Destructor Documentation

CastorCalibrationWidthsSet::CastorCalibrationWidthsSet ( )

Definition at line 8 of file CastorCalibrationWidthsSet.cc.

Member Function Documentation

void CastorCalibrationWidthsSet::clear ( )
const CastorCalibrationWidths & CastorCalibrationWidthsSet::getCalibrationWidths ( const DetId  id) const

Definition at line 11 of file CastorCalibrationWidthsSet.cc.

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

Referenced by CastorDbService::getCastorCalibrationWidths().

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 CastorCalibrationWidths 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 CastorCalibrationWidthsSet::setCalibrationWidths ( const DetId  id,
const CastorCalibrationWidths ca 
)

Definition at line 25 of file CastorCalibrationWidthsSet.cc.

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

Referenced by CastorDbService::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 CastorCalibrationWidthsSet::sort ( )

Definition at line 36 of file CastorCalibrationWidthsSet.cc.

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

Referenced by CastorDbService::buildCalibWidths().

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

Member Data Documentation

CastorCalibrationWidths CastorCalibrationWidthsSet::dummy
private

Definition at line 29 of file CastorCalibrationWidthsSet.h.

std::vector<CalibWidthSetObject> CastorCalibrationWidthsSet::mItems
private
bool CastorCalibrationWidthsSet::sorted_
private

Definition at line 31 of file CastorCalibrationWidthsSet.h.

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