CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
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, bool throwOnFail=true) const
 
std::string myname () const
 
 ~CastorCondObjectContainer ()
 

Private Member Functions

unsigned int hashed_id (DetId fId) const
 
void initContainer ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::vector< Item > CASTORcontainer
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

template<class Item>
class CastorCondObjectContainer< Item >

Definition at line 16 of file CastorCondObjectContainer.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file CastorCondObjectContainer.h.

53 {
54 }
template<class Item >
CastorCondObjectContainer< Item >::~CastorCondObjectContainer ( )

Definition at line 57 of file CastorCondObjectContainer.h.

58 {
59 }

Member Function Documentation

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

Definition at line 110 of file CastorCondObjectContainer.h.

References CastorCondObjectContainer< Item >::CASTORcontainer, Exception, CastorCondObjectContainer< Item >::hashed_id(), CastorCondObjectContainer< Item >::initContainer(), CastorCondObjectContainer< Item >::myname(), and summarizeEdmComparisonLogfiles::success.

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

111 {
112  unsigned long myRawId = myItem.rawId();
113  HcalCastorDetId myId(myRawId);
114  unsigned int index = hashed_id(myId);
115  bool success = false;
116 
117 
118  if (CASTORcontainer.empty() ) initContainer();
119  if (index < CASTORcontainer.size())
120  {
121  CASTORcontainer.at(index) = myItem;
122  success = true;
123  }
124 
125 
126  if (!success)
127  throw cms::Exception ("Filling of conditions failed")
128  << " no valid filling possible for Conditions of type " << myname() << " for DetId " << myId;
129 
130  return success;
131 }
unsigned int hashed_id(DetId fId) const
template<class Item >
const bool CastorCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 99 of file CastorCondObjectContainer.h.

References CastorCondObjectContainer< Item >::getValues().

Referenced by CastorDbASCIIIO::getObject().

100 {
101  const Item* cell = getValues(fId,false);
102  if (cell)
103  // if (cell->rawId() != emptyItem.rawId() )
104  if (cell->rawId() == fId )
105  return true;
106  return false;
107 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
template<class Item >
std::vector< DetId > CastorCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 134 of file CastorCondObjectContainer.h.

References CastorCondObjectContainer< Item >::CASTORcontainer, and mps_fire::i.

Referenced by CastorDbService::buildCalibrations(), CastorDbService::buildCalibWidths(), CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorDbASCIIIO::dumpObject(), RecHitCorrector::produce(), and CastorTowerProducer::produce().

135 {
136  std::vector<DetId> channels;
137  Item emptyItem;
138  for (unsigned int i=0; i<CASTORcontainer.size(); i++)
139  {
140  if (emptyItem.rawId() != CASTORcontainer.at(i).rawId() )
141  channels.push_back( DetId(CASTORcontainer.at(i).rawId()) );
142  }
143 
144  return channels;
145 }
Definition: DetId.h:18
template<class Item >
const Item * CastorCondObjectContainer< Item >::getValues ( DetId  fId,
bool  throwOnFail = true 
) const

Definition at line 74 of file CastorCondObjectContainer.h.

References DetId::Calo, CastorCondObjectContainer< Item >::CASTORcontainer, DetId::det(), Exception, CastorCondObjectContainer< Item >::hashed_id(), CastorCondObjectContainer< Item >::myname(), HcalCastorDetId::SubdetectorId, and DetId::subdetId().

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorDbASCIIIO::dumpObject(), CastorCondObjectContainer< Item >::exists(), CastorDbService::getCastorChannelStatus(), CastorDbService::getGain(), CastorDbService::getGainWidth(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), CastorSimpleReconstructor::produce(), and RecHitCorrector::produce().

75 {
76  const Item* cell = nullptr;
77  HcalCastorDetId myId(fId);
78 
80  unsigned int index = hashed_id(fId);
81 
82  if (index < CASTORcontainer.size())
83  cell = &(CASTORcontainer.at(index) );
84  }
85 
86 
87  if ((!cell) || (cell->rawId() != fId ) ) {
88  if (throwOnFail) {
89  throw cms::Exception ("Conditions not found")
90  << "Unavailable Conditions of type " << myname() << " for cell " << myId;
91  } else {
92  cell=nullptr;
93  }
94  }
95  return cell;
96 }
unsigned int hashed_id(DetId fId) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:38
static const int SubdetectorId
Detector det() const
get the detector field from this detid
Definition: DetId.h:36
template<class Item >
unsigned int CastorCondObjectContainer< Item >::hashed_id ( DetId  fId) const
private

Definition at line 149 of file CastorCondObjectContainer.h.

References HcalCastorDetId::module(), HcalCastorDetId::sector(), HcalCastorDetId::zside(), and ecaldqm::zside().

Referenced by CastorCondObjectContainer< Item >::addValues(), CastorCondObjectContainer< Item >::getValues(), and CastorCondObjectContainer< CastorQIECoder >::myname().

149  {
150  // the historical packing from HcalGeneric is different from HcalCastorDetId, so we clone the old packing here.
151  HcalCastorDetId tid(fId);
152  int zside = tid.zside();
153  int sector = tid.sector();
154  int module = tid.module();
155  static const int CASTORhalf=224;
156 
157  int index = 14*(sector-1) + (module-1);
158  if (zside == -1) index += CASTORhalf;
159 
160  return index;
161 }
module()
Definition: vlib.cc:994
int zside(DetId const &)
Definition: vlib.h:208
template<class Item >
void CastorCondObjectContainer< Item >::initContainer ( )
private
template<class Item>
std::string CastorCondObjectContainer< Item >::myname ( ) const
inline
template<class Item>
template<class Archive >
void CastorCondObjectContainer< Item >::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

template<class Item>
friend class boost::serialization::access
friend

Definition at line 46 of file CastorCondObjectContainer.h.

template<class Item>
template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 46 of file CastorCondObjectContainer.h.

Member Data Documentation

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