CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CastorCondObjectContainer< Item > Class Template Reference

#include <CastorCondObjectContainer.h>

Public Member Functions

bool addValues (const Item &myItem)
 
 CastorCondObjectContainer ()
 
const bool exists (DetId fId) const
 
std::vector< DetIdgetAllChannels () const
 
const Item * getValues (DetId fId) const
 
std::string myname () const
 
 ~CastorCondObjectContainer ()
 

Private Member Functions

void initContainer (int container)
 

Private Attributes

std::vector< Item > CASTORcontainer
 

Detailed Description

template<class Item>
class CastorCondObjectContainer< Item >

Definition at line 13 of file CastorCondObjectContainer.h.

Constructor & Destructor Documentation

template<class Item >
CastorCondObjectContainer< Item >::CastorCondObjectContainer ( )

Definition at line 47 of file CastorCondObjectContainer.h.

48 {
49 }
template<class Item >
CastorCondObjectContainer< Item >::~CastorCondObjectContainer ( )

Definition at line 52 of file CastorCondObjectContainer.h.

53 {
54 }

Member Function Documentation

template<class Item>
bool CastorCondObjectContainer< Item >::addValues ( const Item &  myItem)

Definition at line 127 of file CastorCondObjectContainer.h.

References abs, edm::hlt::Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and summarizeEdmComparisonLogfiles::success.

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorPedestalAnalysis::GetPedConst(), and CastorPedestalsAnalysis::~CastorPedestalsAnalysis().

128 {
129  unsigned long myRawId = myItem.rawId();
130  HcalGenericDetId myId(myRawId);
131  //int index = myId.hashedId(h2mode_);
132  int index = myId.hashedId();
133  bool success = false;
134  if (index < 0) success = false;
135  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
136 
137 
138  switch (myId.genericSubdet() ) {
140  if (!CASTORcontainer.size() ) initContainer(myId.genericSubdet() );
141  if (index1 < CASTORcontainer.size())
142  {
143  CASTORcontainer.at(index1) = myItem;
144  success = true;
145  }
146  break;
147  default: break;
148  }
149 
150  if (!success)
151  throw cms::Exception ("Filling of conditions failed")
152  << " no valid filling possible for Conditions of type " << myname() << " for DetId " << myId;
153 
154  return success;
155 }
#define abs(x)
Definition: mlp_lapack.h:159
template<class Item >
const bool CastorCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 101 of file CastorCondObjectContainer.h.

References abs, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and NULL.

102 {
103  HcalGenericDetId myId(fId);
104  //int index = myId.hashedId(m_h2mode);
105  int index = myId.hashedId();
106  if (index < 0) return false;
107  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
108  const Item* cell = NULL;
109  switch (myId.genericSubdet() ) {
111  if (index1 < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index1) );
112  break;
113  default: return false; break;
114  }
115 
116  // Item emptyItem;
117  if (cell)
118  // if (cell->rawId() != emptyItem.rawId() )
119  if (cell->rawId() == fId )
120  return true;
121 
122  return false;
123 }
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
template<class Item >
std::vector< DetId > CastorCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 158 of file CastorCondObjectContainer.h.

References i.

Referenced by CastorDbService::buildCalibrations(), CastorDbService::buildCalibWidths(), CastorPedestalAnalysis::CastorPedVal(), and CastorDbXml::dumpObject().

159 {
160  std::vector<DetId> channels;
161  Item emptyItem;
162  for (unsigned int i=0; i<CASTORcontainer.size(); i++)
163  {
164  if (emptyItem.rawId() != CASTORcontainer.at(i).rawId() )
165  channels.push_back( DetId(CASTORcontainer.at(i).rawId()) );
166  }
167 
168  return channels;
169 }
int i
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
template<class Item >
const Item * CastorCondObjectContainer< Item >::getValues ( DetId  fId) const

Definition at line 74 of file CastorCondObjectContainer.h.

References abs, edm::hlt::Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HcalGenericDetId::HcalGenCastor, getHLTprescales::index, and NULL.

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorDbService::getCastorChannelStatus(), CastorDbService::getGain(), CastorDbService::getGainWidth(), CastorDbService::getPedestal(), and CastorDbService::getPedestalWidth().

75 {
76  HcalGenericDetId myId(fId);
77  //int index = myId.hashedId(m_h2mode);
78  int index = myId.hashedId();
79  // std::cout << "::::: getting values at index " << index << ", DetId " << myId << std::endl;
80  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
81 
82  const Item* cell = NULL;
83  if (index >= 0)
84  switch (myId.genericSubdet() ) {
86  if (index1 < CASTORcontainer.size())
87  cell = &(CASTORcontainer.at(index1) );
88  break;
89  default: break;
90  }
91 
92  // Item emptyItem;
93  // if (cell->rawId() == emptyItem.rawId() )
94  if ((!cell) || (cell->rawId() != fId ) )
95  throw cms::Exception ("Conditions not found")
96  << "Unavailable Conditions of type " << myname() << " for cell " << myId;
97  return cell;
98 }
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
template<class Item >
void CastorCondObjectContainer< Item >::initContainer ( int  container)
private

Definition at line 58 of file CastorCondObjectContainer.h.

References HcalGenericDetId::CASTORhalf, HcalGenericDetId::HcalGenCastor, and i.

59 {
60  //m_h2mode = h2mode_;
61 
62  Item emptyItem;
63 
64  switch (container)
65  {
67  for (int i=0; i<(2*HcalGenericDetId::CASTORhalf); i++) CASTORcontainer.push_back(emptyItem); break;
68  default: break;
69  }
70 }
int i
Definition: DBlmapReader.cc:9
template<class Item>
std::string CastorCondObjectContainer< Item >::myname ( ) const
inline

Definition at line 35 of file CastorCondObjectContainer.h.

35 {return (std::string)"Castor Undefined";}

Member Data Documentation

template<class Item>
std::vector<Item> CastorCondObjectContainer< Item >::CASTORcontainer
private

Definition at line 41 of file CastorCondObjectContainer.h.