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

◆ CastorCondObjectContainer()

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

Definition at line 50 of file CastorCondObjectContainer.h.

50 {}

◆ ~CastorCondObjectContainer()

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

Definition at line 53 of file CastorCondObjectContainer.h.

53 {}

Member Function Documentation

◆ addValues()

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

Definition at line 98 of file CastorCondObjectContainer.h.

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 }

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

◆ exists()

template<class Item >
const bool CastorCondObjectContainer< Item >::exists ( DetId  fId) const

Definition at line 88 of file CastorCondObjectContainer.h.

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 }

Referenced by CastorDbASCIIIO::getObject().

◆ getAllChannels()

template<class Item >
std::vector< DetId > CastorCondObjectContainer< Item >::getAllChannels ( ) const

Definition at line 119 of file CastorCondObjectContainer.h.

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 }

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

◆ getValues()

template<class Item >
const Item * CastorCondObjectContainer< Item >::getValues ( DetId  fId,
bool  throwOnFail = true 
) const

Definition at line 65 of file CastorCondObjectContainer.h.

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 }

Referenced by CastorPedestalAnalysis::CastorPedVal(), CastorDbXml::dumpObject(), CastorDbASCIIIO::dumpObject(), CastorDbService::getCastorChannelStatus(), CastorDigiMonitor::getDbData(), CastorDbService::getGain(), CastorDbService::getGainWidth(), CastorDbService::getPedestal(), CastorDbService::getPedestalWidth(), CastorSimpleReconstructor::produce(), and RecHitCorrector::produce().

◆ hashed_id()

template<class Item >
unsigned int CastorCondObjectContainer< Item >::hashed_id ( DetId  fId) const
private

Definition at line 131 of file CastorCondObjectContainer.h.

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 }

◆ initContainer()

template<class Item >
void CastorCondObjectContainer< Item >::initContainer ( )
private

Definition at line 56 of file CastorCondObjectContainer.h.

56  {
57  Item emptyItem;
58 
59  if (CASTORcontainer.empty())
60  for (int i = 0; i < HcalCastorDetId::kSizeForDenseIndexing; i++)
61  CASTORcontainer.push_back(emptyItem);
62 }

◆ myname()

template<class Item>
std::string CastorCondObjectContainer< Item >::myname ( ) const
inline

Definition at line 37 of file CastorCondObjectContainer.h.

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

◆ serialize()

template<class Item>
template<class Archive >
void CastorCondObjectContainer< Item >::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

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

Definition at line 45 of file CastorCondObjectContainer.h.

◆ cond::serialization::access

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

◆ CASTORcontainer

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

Definition at line 43 of file CastorCondObjectContainer.h.

CastorCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: CastorCondObjectContainer.h:65
mps_fire.i
i
Definition: mps_fire.py:428
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
CastorCondObjectContainer::CASTORcontainer
std::vector< Item > CASTORcontainer
Definition: CastorCondObjectContainer.h:43
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
HcalCastorDetId::SubdetectorId
static const int SubdetectorId
Definition: HcalCastorDetId.h:28
DetId::Calo
Definition: DetId.h:29
DetId
Definition: DetId.h:17
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
CastorCondObjectContainer::initContainer
void initContainer()
Definition: CastorCondObjectContainer.h:56
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalCastorDetId
Definition: HcalCastorDetId.h:23
CastorCondObjectContainer::hashed_id
unsigned int hashed_id(DetId fId) const
Definition: CastorCondObjectContainer.h:131
HcalCastorDetId::kSizeForDenseIndexing
Definition: HcalCastorDetId.h:71
Exception
Definition: hltDiff.cc:246
ewkTauDQM_cfi.channels
channels
Definition: ewkTauDQM_cfi.py:14
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CastorCondObjectContainer::myname
std::string myname() const
Definition: CastorCondObjectContainer.h:37