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

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

Definition at line 53 of file CastorCondObjectContainer.h.

53 {}

Member Function Documentation

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

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

98  {
99  unsigned long myRawId = myItem.rawId();
100  HcalCastorDetId myId(myRawId);
101  unsigned int index = hashed_id(myId);
102  bool success = false;
103 
104  if (CASTORcontainer.empty())
105  initContainer();
106  if (index < CASTORcontainer.size()) {
107  CASTORcontainer.at(index) = myItem;
108  success = true;
109  }
110 
111  if (!success)
112  throw cms::Exception("Filling of conditions failed")
113  << " no valid filling possible for Conditions of type " << myname() << " for DetId " << myId;
114 
115  return success;
116 }
unsigned int hashed_id(DetId fId) const
template<class Item >
const bool CastorCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 88 of file CastorCondObjectContainer.h.

References CastorCondObjectContainer< Item >::getValues().

Referenced by CastorDbASCIIIO::getObject().

88  {
89  const Item* cell = getValues(fId, false);
90  if (cell)
91  // if (cell->rawId() != emptyItem.rawId() )
92  if (cell->rawId() == fId)
93  return true;
94  return false;
95 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
template<class Item >
std::vector< DetId > CastorCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 119 of file CastorCondObjectContainer.h.

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

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

119  {
120  std::vector<DetId> channels;
121  Item emptyItem;
122  for (unsigned int i = 0; i < CASTORcontainer.size(); i++) {
123  if (emptyItem.rawId() != CASTORcontainer.at(i).rawId())
124  channels.push_back(DetId(CASTORcontainer.at(i).rawId()));
125  }
126 
127  return channels;
128 }
Definition: DetId.h:17
template<class Item >
const Item * CastorCondObjectContainer< Item >::getValues ( DetId  fId,
bool  throwOnFail = true 
) const

Definition at line 65 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(), CastorDigiMonitor::getDbData(), CastorDbService::getGain(), CastorDbService::getGainWidth(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), CastorSimpleReconstructor::produce(), and RecHitCorrector::produce().

65  {
66  const Item* cell = nullptr;
67  HcalCastorDetId myId(fId);
68 
69  if (fId.det() == DetId::Calo && fId.subdetId() == HcalCastorDetId::SubdetectorId) {
70  unsigned int index = hashed_id(fId);
71 
72  if (index < CASTORcontainer.size())
73  cell = &(CASTORcontainer.at(index));
74  }
75 
76  if ((!cell) || (cell->rawId() != fId)) {
77  if (throwOnFail) {
78  throw cms::Exception("Conditions not found")
79  << "Unavailable Conditions of type " << myname() << " for cell " << myId;
80  } else {
81  cell = nullptr;
82  }
83  }
84  return cell;
85 }
unsigned int hashed_id(DetId fId) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static const int SubdetectorId
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
template<class Item >
unsigned int CastorCondObjectContainer< Item >::hashed_id ( DetId  fId) const
private

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

131  {
132  // the historical packing from HcalGeneric is different from HcalCastorDetId, so we clone the old packing here.
133  HcalCastorDetId tid(fId);
134  int zside = tid.zside();
135  int sector = tid.sector();
136  int module = tid.module();
137  static const int CASTORhalf = 224;
138 
139  int index = 14 * (sector - 1) + (module - 1);
140  if (zside == -1)
141  index += CASTORhalf;
142 
143  return index;
144 }
module()
Definition: vlib.cc:913
int zside(DetId const &)
Definition: vlib.h:198
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 45 of file CastorCondObjectContainer.h.

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

Definition at line 45 of file CastorCondObjectContainer.h.

Member Data Documentation

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