CMS 3D CMS Logo

CastorPedestals Class Reference

Author:
Panos Katsas (UoA) POOL container to store Pedestal values 4xCapId $Author: katsas
More...

#include <CondFormats/CastorObjects/interface/CastorPedestals.h>

List of all members.

Public Types

typedef std::vector< ItemContainer
typedef CastorPedestal Item

Public Member Functions

bool addValue (DetId fId, float fValue0, float fValue1, float fValue2, float fValue3)
 fill values
bool addValue (DetId fId, const float fValues[4])
 fill values
 CastorPedestals ()
std::vector< DetIdgetAllChannels () const
 get list of all available channels
float getValue (DetId fId, int fCapId) const
 get value for given capId = 0..3
const CastorPedestalgetValues (DetId fId) const
 get array of values for 4 capIds
void sort ()
 sort values by channelId
bool sorted () const
 check if data are sorted
 ~CastorPedestals ()

Private Attributes

Container mItems
bool mSorted


Detailed Description

Author:
Panos Katsas (UoA) POOL container to store Pedestal values 4xCapId $Author: katsas

Author:
Panos Katsas (UoA) POOL object to store Pedestal values 4xCapId

Definition at line 18 of file CastorPedestals.h.


Member Typedef Documentation

typedef std::vector<Item> CastorPedestals::Container

Definition at line 38 of file CastorPedestals.h.

typedef CastorPedestal CastorPedestals::Item

Definition at line 37 of file CastorPedestals.h.


Constructor & Destructor Documentation

CastorPedestals::CastorPedestals (  ) 

Definition at line 32 of file CastorPedestals.cc.

00033   : mSorted (false) {}

CastorPedestals::~CastorPedestals (  ) 

Definition at line 35 of file CastorPedestals.cc.

00035 {}


Member Function Documentation

bool CastorPedestals::addValue ( DetId  fId,
float  fValue0,
float  fValue1,
float  fValue2,
float  fValue3 
)

fill values

Definition at line 68 of file CastorPedestals.cc.

References mItems, mSorted, and DetId::rawId().

00068                                                                                                      {
00069   Item item (fId.rawId (), fValue0, fValue1, fValue2, fValue3);
00070   mItems.push_back (item);
00071   mSorted = false;
00072   return true;
00073 }

bool CastorPedestals::addValue ( DetId  fId,
const float  fValues[4] 
)

fill values

Definition at line 64 of file CastorPedestals.cc.

Referenced by CastorPedestalAnalysis::CastorPedVal().

00064                                                                   {
00065   return addValue (fId, fValues [0], fValues [1], fValues [2], fValues [3]);
00066 }

std::vector< DetId > CastorPedestals::getAllChannels (  )  const

get list of all available channels

Definition at line 75 of file CastorPedestals.cc.

References mItems, and HLT_VtxMuL3::result.

Referenced by CastorPedestalAnalysis::CastorPedVal().

00075                                                         {
00076   std::vector<DetId> result;
00077   for (std::vector<Item>::const_iterator item = mItems.begin (); item != mItems.end (); item++) {
00078     result.push_back (DetId (item->rawId ()));
00079   }
00080   return result;
00081 }

float CastorPedestals::getValue ( DetId  fId,
int  fCapId 
) const

get value for given capId = 0..3

Definition at line 52 of file CastorPedestals.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), CastorPedestal::getValue(), getValues(), and values.

Referenced by CastorPedestalAnalysis::CastorPedVal().

00052                                                             {
00053   const CastorPedestal* values;
00054   if (fCapId >= 0 && fCapId < 4) {
00055     values = getValues (fId);
00056     if (values) return values->getValue (fCapId);
00057   }
00058   else {
00059     std::cerr << "CastorPedestals::getValue-> capId " << fCapId << " is out of range [0..3]" << std::endl;
00060   }
00061   return -1;
00062 }

const CastorPedestal * CastorPedestals::getValues ( DetId  fId  )  const

get array of values for 4 capIds

Definition at line 37 of file CastorPedestals.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), find(), mItems, DetId::rawId(), sorted(), and target.

Referenced by CastorDbService::getPedestal(), and getValue().

00037                                                                  {
00038   Item target (fId.rawId (), 0, 0, 0, 0);
00039   std::vector<Item>::const_iterator cell;
00040   if (sorted ()) {
00041     cell = std::lower_bound (mItems.begin(), mItems.end(), target, compareItems ());
00042   }
00043   else {
00044     std::cerr << "CastorPedestals::getValues-> container is not sorted. Please sort it to search effectively" << std::endl;
00045     cell = find (mItems, fId.rawId ());
00046   }
00047   if (cell == mItems.end() || cell->rawId () != target.rawId ()) 
00048     throw cms::Exception ("Conditions not found") << "Unavailable Pedestals for cell " << HcalGenericDetId(fId);
00049   return &(*cell);
00050 }

void CastorPedestals::sort (  ) 

sort values by channelId

Definition at line 84 of file CastorPedestals.cc.

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

Referenced by CastorPedestalAnalysis::done().

00084                             {
00085   if (!mSorted) {
00086     std::sort (mItems.begin(), mItems.end(), compareItems ());
00087     mSorted = true;
00088   }
00089 }

bool CastorPedestals::sorted (  )  const [inline]

check if data are sorted

Definition at line 29 of file CastorPedestals.h.

References mSorted.

Referenced by getValues().

00029 {return mSorted;}


Member Data Documentation

Container CastorPedestals::mItems [private]

Definition at line 40 of file CastorPedestals.h.

Referenced by addValue(), getAllChannels(), getValues(), and sort().

bool CastorPedestals::mSorted [private]

Definition at line 41 of file CastorPedestals.h.

Referenced by addValue(), sort(), and sorted().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:12 2009 for CMSSW by  doxygen 1.5.4