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 | Friends
HcalCovarianceMatrices Class Reference

#include <HcalCovarianceMatrices.h>

Inheritance diagram for HcalCovarianceMatrices:
HcalCondObjectContainerBase

Public Member Functions

bool addValues (const HcalCovarianceMatrix &myHcalCovarianceMatrix)
 
const bool exists (DetId fId) const
 
std::vector< DetIdgetAllChannels () const
 
const HcalCovarianceMatrixgetValues (DetId fId, bool throwOnFail=true) const
 
 HcalCovarianceMatrices ()
 
 HcalCovarianceMatrices (const HcalTopology *topo)
 
std::string myname () const
 
 ~HcalCovarianceMatrices ()
 
- Public Member Functions inherited from HcalCondObjectContainerBase
int getCreatorPackedIndexVersion () const
 
void setTopo (const HcalTopology *topo)
 
const HcalTopologytopo () const
 

Private Member Functions

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

Private Attributes

std::vector< HcalCovarianceMatrixHBcontainer
 
std::vector< HcalCovarianceMatrixHEcontainer
 
std::vector< HcalCovarianceMatrixHFcontainer
 
std::vector< HcalCovarianceMatrixHOcontainer
 

Friends

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

Additional Inherited Members

- Protected Member Functions inherited from HcalCondObjectContainerBase
HcalOtherSubdetector extractOther (const DetId &id) const
 
 HcalCondObjectContainerBase (HcalCondObjectContainerBase const &o)
 
 HcalCondObjectContainerBase (HcalCondObjectContainerBase &&)=default
 
 HcalCondObjectContainerBase (const HcalTopology *)
 
unsigned int indexFor (DetId) const
 
HcalCondObjectContainerBaseoperator= (HcalCondObjectContainerBase const &o)
 
HcalCondObjectContainerBaseoperator= (HcalCondObjectContainerBase &&)=default
 
unsigned int sizeFor (DetId) const
 
std::string textForId (const DetId &id) const
 
- Protected Attributes inherited from HcalCondObjectContainerBase
int packedIndexVersion_
 

Detailed Description

Definition at line 17 of file HcalCovarianceMatrices.h.

Constructor & Destructor Documentation

HcalCovarianceMatrices::HcalCovarianceMatrices ( )
inline

Definition at line 21 of file HcalCovarianceMatrices.h.

HcalCondObjectContainerBase(HcalCondObjectContainerBase const &o)
HcalCovarianceMatrices::HcalCovarianceMatrices ( const HcalTopology topo)

Definition at line 5 of file HcalCovarianceMatrices.cc.

6 {
7 }
HcalCondObjectContainerBase(HcalCondObjectContainerBase const &o)
HcalCovarianceMatrices::~HcalCovarianceMatrices ( )

Definition at line 9 of file HcalCovarianceMatrices.cc.

10 {
11 }

Member Function Documentation

bool HcalCovarianceMatrices::addValues ( const HcalCovarianceMatrix myHcalCovarianceMatrix)

Definition at line 84 of file HcalCovarianceMatrices.cc.

References Exception, HBcontainer, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HEcontainer, HFcontainer, HOcontainer, cmsHarvester::index, initContainer(), myname(), HcalCovarianceMatrix::rawId(), and summarizeEdmComparisonLogfiles::success.

85 {
86  unsigned int index=0;
87  bool success = false;
88  HcalCovarianceMatrix* cell=0;
89  DetId fId(myHcalCovarianceMatrix.rawId());
90 
91  if (index<0xFFFFFFFu) {
92  if (fId.det()==DetId::Hcal) {
93  switch (HcalSubdetector(fId.subdetId())) {
94  case(HcalBarrel) : if (!HBcontainer.size() ) initContainer(fId);
95  if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) ); break;
96  case(HcalEndcap) : if (!HEcontainer.size() ) initContainer(fId);
97  if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) ); break;
98  case(HcalForward) : if (!HFcontainer.size() ) initContainer(fId);
99  if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) ); break;
100  case(HcalOuter) : if (!HOcontainer.size() ) initContainer(fId);
101  if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) ); break;
102  default: break;
103  }
104  }
105  }
106  if (cell) {
107  *cell=myHcalCovarianceMatrix;
108  success = true;
109  }
110 
111 
112  if (!success)
113  throw cms::Exception ("Filling of conditions failed")
114  << " no valid filling possible for Conditions of type " << myname() << " for DetId " << fId.rawId();
115  return success;
116 }
uint32_t rawId() const
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
void initContainer(DetId container)
HcalSubdetector
Definition: HcalAssistant.h:31
Definition: DetId.h:18
std::vector< HcalCovarianceMatrix > HOcontainer
std::string myname() const
std::vector< HcalCovarianceMatrix > HEcontainer
const bool HcalCovarianceMatrices::exists ( DetId  fId) const

Definition at line 68 of file HcalCovarianceMatrices.cc.

References getValues(), and hcalEqualDetId().

69 {
70  const HcalCovarianceMatrix* cell = getValues(fId,false);
71 
72  // HcalCovarianceMatrix emptyHcalCovarianceMatrix;
73  if (cell)
74  if (hcalEqualDetId(cell,fId))
75 // (fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) == HcalDetId(fId)) ||
76 // (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) == HcalZDCDetId(fId)) ||
77 // (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() == fId)))
78  return true;
79 
80  return false;
81 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
const HcalCovarianceMatrix * getValues(DetId fId, bool throwOnFail=true) const
std::vector< DetId > HcalCovarianceMatrices::getAllChannels ( ) const

Definition at line 119 of file HcalCovarianceMatrices.cc.

References HBcontainer, HEcontainer, HFcontainer, HOcontainer, i, and HcalCovarianceMatrix::rawId().

120 {
121  std::vector<DetId> channels;
122  HcalCovarianceMatrix emptyHcalCovarianceMatrix;
123  for (unsigned int i=0; i<HBcontainer.size(); i++) {
124  if (emptyHcalCovarianceMatrix.rawId() != HBcontainer.at(i).rawId() )
125  channels.push_back( DetId(HBcontainer.at(i).rawId()) );
126  }
127  for (unsigned int i=0; i<HEcontainer.size(); i++) {
128  if (emptyHcalCovarianceMatrix.rawId() != HEcontainer.at(i).rawId() )
129  channels.push_back( DetId(HEcontainer.at(i).rawId()) );
130  }
131  for (unsigned int i=0; i<HOcontainer.size(); i++) {
132  if (emptyHcalCovarianceMatrix.rawId() != HOcontainer.at(i).rawId() )
133  channels.push_back( DetId(HOcontainer.at(i).rawId()) );
134  }
135  for (unsigned int i=0; i<HFcontainer.size(); i++) {
136  if (emptyHcalCovarianceMatrix.rawId() != HFcontainer.at(i).rawId() )
137  channels.push_back( DetId(HFcontainer.at(i).rawId()) );
138  }
139  return channels;
140 }
int i
Definition: DBlmapReader.cc:9
uint32_t rawId() const
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
Definition: DetId.h:18
std::vector< HcalCovarianceMatrix > HOcontainer
std::vector< HcalCovarianceMatrix > HEcontainer
const HcalCovarianceMatrix * HcalCovarianceMatrices::getValues ( DetId  fId,
bool  throwOnFail = true 
) const

Definition at line 33 of file HcalCovarianceMatrices.cc.

References DetId::det(), Exception, HBcontainer, DetId::Hcal, HcalBarrel, HcalEndcap, hcalEqualDetId(), HcalForward, HcalOuter, HEcontainer, HFcontainer, HOcontainer, cmsHarvester::index, HcalCondObjectContainerBase::indexFor(), myname(), NULL, DetId::rawId(), and DetId::subdetId().

Referenced by exists().

34 {
35  unsigned int index=indexFor(fId);
36 
37  const HcalCovarianceMatrix* cell = NULL;
38 
39  if (index<0xFFFFFFFFu) {
40  if (fId.det()==DetId::Hcal) {
41  switch (HcalSubdetector(fId.subdetId())) {
42  case(HcalBarrel) : if (index < HBcontainer.size()) cell = &(HBcontainer.at(index) );
43  case(HcalEndcap) : if (index < HEcontainer.size()) cell = &(HEcontainer.at(index) );
44  case(HcalForward) : if (index < HFcontainer.size()) cell = &(HFcontainer.at(index) );
45  case(HcalOuter) : if (index < HOcontainer.size()) cell = &(HOcontainer.at(index) );
46  default: break;
47  }
48  }
49  }
50 
51  // HcalCovarianceMatrix emptyHcalCovarianceMatrix;
52  // if (cell->rawId() == emptyHcalCovarianceMatrix.rawId() )
53  if ((!cell) || (!hcalEqualDetId(cell,fId))) {
54 // (fId.det()==DetId::Hcal && HcalDetId(cell->rawId()) != HcalDetId(fId)) ||
55 // (fId.det()==DetId::Calo && fId.subdetId()==HcalZDCDetId::SubdetectorId && HcalZDCDetId(cell->rawId()) != HcalZDCDetId(fId)) ||
56 // (fId.det()!=DetId::Hcal && (fId.det()==DetId::Calo && fId.subdetId()!=HcalZDCDetId::SubdetectorId) && (cell->rawId() != fId))) {
57  if (throwOnFail) {
58  throw cms::Exception ("Conditions not found")
59  << "Unavailable Conditions of type " << myname() << " for cell " << fId.rawId();
60  } else {
61  cell=0;
62  }
63  }
64  return cell;
65 }
bool hcalEqualDetId(Item *cell, const DetId &fId)
unsigned int indexFor(DetId) const
#define NULL
Definition: scimark2.h:8
std::vector< HcalCovarianceMatrix > HFcontainer
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
std::vector< HcalCovarianceMatrix > HBcontainer
HcalSubdetector
Definition: HcalAssistant.h:31
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
std::vector< HcalCovarianceMatrix > HOcontainer
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
std::string myname() const
std::vector< HcalCovarianceMatrix > HEcontainer
void HcalCovarianceMatrices::initContainer ( DetId  container)
private

Definition at line 14 of file HcalCovarianceMatrices.cc.

References DetId::det(), HBcontainer, DetId::Hcal, HcalBarrel, HcalEndcap, HcalForward, HcalOuter, HEcontainer, HFcontainer, HOcontainer, i, HcalCondObjectContainerBase::sizeFor(), and DetId::subdetId().

Referenced by addValues().

15 {
16  HcalCovarianceMatrix emptyItem;
17 
18 
19  if (fId.det()==DetId::Hcal) {
20  switch (HcalSubdetector(fId.subdetId())) {
21  case(HcalBarrel) : for (unsigned int i=0; i<sizeFor(fId); i++) HBcontainer.push_back(emptyItem); break;
22  case(HcalEndcap) : for (unsigned int i=0; i<sizeFor(fId); i++) HEcontainer.push_back(emptyItem); break;
23  case(HcalOuter) : for (unsigned int i=0; i<sizeFor(fId); i++) HOcontainer.push_back(emptyItem); break;
24  case(HcalForward) : for (unsigned int i=0; i<sizeFor(fId); i++) HFcontainer.push_back(emptyItem); break;
25  default: break;
26  }
27  }
28 
29 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
unsigned int sizeFor(DetId) const
HcalSubdetector
Definition: HcalAssistant.h:31
std::vector< HcalCovarianceMatrix > HOcontainer
std::vector< HcalCovarianceMatrix > HEcontainer
std::string HcalCovarianceMatrices::myname ( ) const
inline

Definition at line 25 of file HcalCovarianceMatrices.h.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by addValues(), and getValues().

25 {return (std::string)"HcalCovarianceMatrices";}
template<class Archive >
void HcalCovarianceMatrices::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 38 of file HcalCovarianceMatrices.h.

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

Definition at line 38 of file HcalCovarianceMatrices.h.

Member Data Documentation

std::vector<HcalCovarianceMatrix> HcalCovarianceMatrices::HBcontainer
private

Definition at line 33 of file HcalCovarianceMatrices.h.

Referenced by addValues(), getAllChannels(), getValues(), and initContainer().

std::vector<HcalCovarianceMatrix> HcalCovarianceMatrices::HEcontainer
private

Definition at line 34 of file HcalCovarianceMatrices.h.

Referenced by addValues(), getAllChannels(), getValues(), and initContainer().

std::vector<HcalCovarianceMatrix> HcalCovarianceMatrices::HFcontainer
private

Definition at line 36 of file HcalCovarianceMatrices.h.

Referenced by addValues(), getAllChannels(), getValues(), and initContainer().

std::vector<HcalCovarianceMatrix> HcalCovarianceMatrices::HOcontainer
private

Definition at line 35 of file HcalCovarianceMatrices.h.

Referenced by addValues(), getAllChannels(), getValues(), and initContainer().