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 14 of file CastorCondObjectContainer.h.

Constructor & Destructor Documentation

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

Definition at line 48 of file CastorCondObjectContainer.h.

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

Definition at line 53 of file CastorCondObjectContainer.h.

54 {
55 }

Member Function Documentation

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

Definition at line 128 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().

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

Definition at line 102 of file CastorCondObjectContainer.h.

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

103 {
104  HcalGenericDetId myId(fId);
105  //int index = myId.hashedId(m_h2mode);
106  int index = myId.hashedId();
107  if (index < 0) return false;
108  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
109  const Item* cell = NULL;
110  switch (myId.genericSubdet() ) {
112  if (index1 < CASTORcontainer.size()) cell = &(CASTORcontainer.at(index1) );
113  break;
114  default: return false; break;
115  }
116 
117  // Item emptyItem;
118  if (cell)
119  // if (cell->rawId() != emptyItem.rawId() )
120  if (cell->rawId() == fId )
121  return true;
122 
123  return false;
124 }
#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 159 of file CastorCondObjectContainer.h.

References i.

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

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

Definition at line 75 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().

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

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

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

Definition at line 36 of file CastorCondObjectContainer.h.

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

Member Data Documentation

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

Definition at line 42 of file CastorCondObjectContainer.h.