CMS 3D CMS Logo

CastorGains Class Reference

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

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

List of all members.

Public Types

typedef std::vector< ItemContainer
typedef CastorGain 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
 CastorGains ()
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 CastorGaingetValues (DetId fId) const
 get array of values for 4 capIds
void sort ()
 sort values by channelId
bool sorted () const
 check if data are sorted
 ~CastorGains ()

Private Attributes

Container mItems
bool mSorted


Detailed Description

Author:
Panos Katsas (UoA) POOL container to store Gain values 4xCapId

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

Definition at line 17 of file CastorGains.h.


Member Typedef Documentation

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

Definition at line 37 of file CastorGains.h.

typedef CastorGain CastorGains::Item

Definition at line 36 of file CastorGains.h.


Constructor & Destructor Documentation

CastorGains::CastorGains (  ) 

Definition at line 32 of file CastorGains.cc.

00033   : mSorted (false) {}

CastorGains::~CastorGains (  ) 

Definition at line 35 of file CastorGains.cc.

00035 {}


Member Function Documentation

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

fill values

Definition at line 68 of file CastorGains.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 CastorGains::addValue ( DetId  fId,
const float  fValues[4] 
)

fill values

Definition at line 64 of file CastorGains.cc.

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

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

get list of all available channels

Definition at line 75 of file CastorGains.cc.

References mItems, and HLT_VtxMuL3::result.

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 CastorGains::getValue ( DetId  fId,
int  fCapId 
) const

get value for given capId = 0..3

Definition at line 52 of file CastorGains.cc.

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

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

const CastorGain * CastorGains::getValues ( DetId  fId  )  const

get array of values for 4 capIds

Definition at line 37 of file CastorGains.cc.

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

Referenced by CastorDbService::getGain(), 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 << "CastorGains::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 Gains for cell " << HcalGenericDetId(fId);
00049   return &(*cell);
00050 }

void CastorGains::sort (  ) 

sort values by channelId

Definition at line 84 of file CastorGains.cc.

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

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

bool CastorGains::sorted (  )  const [inline]

check if data are sorted

Definition at line 28 of file CastorGains.h.

References mSorted.

Referenced by getValues().

00028 {return mSorted;}


Member Data Documentation

Container CastorGains::mItems [private]

Definition at line 39 of file CastorGains.h.

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

bool CastorGains::mSorted [private]

Definition at line 40 of file CastorGains.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:09 2009 for CMSSW by  doxygen 1.5.4