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

#include <HcalCovarianceMatrices.h>

Public Member Functions

bool addValues (const HcalCovarianceMatrix &myHcalCovarianceMatrix, bool h2mode_=false)
 
const bool exists (DetId fId) const
 
std::vector< DetIdgetAllChannels () const
 
const HcalCovarianceMatrixgetValues (DetId fId) const
 
 HcalCovarianceMatrices ()
 
std::string myname () const
 
 ~HcalCovarianceMatrices ()
 

Private Member Functions

void initContainer (int container, bool h2mode_=false)
 

Private Attributes

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

Detailed Description

Definition at line 13 of file HcalCovarianceMatrices.h.

Constructor & Destructor Documentation

HcalCovarianceMatrices::HcalCovarianceMatrices ( )

Definition at line 4 of file HcalCovarianceMatrices.cc.

5 {
6 }
HcalCovarianceMatrices::~HcalCovarianceMatrices ( )

Definition at line 8 of file HcalCovarianceMatrices.cc.

9 {
10 }

Member Function Documentation

bool HcalCovarianceMatrices::addValues ( const HcalCovarianceMatrix myHcalCovarianceMatrix,
bool  h2mode_ = false 
)

Definition at line 110 of file HcalCovarianceMatrices.cc.

References abs, edm::hlt::Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HBcontainer, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HEcontainer, HFcontainer, HOcontainer, getHLTprescales::index, initContainer(), myname(), HcalCovarianceMatrix::rawId(), and summarizeEdmComparisonLogfiles::success.

Referenced by HcalPedestalMCWidths::~HcalPedestalMCWidths().

111 {
112  unsigned long myRawId = myHcalCovarianceMatrix.rawId();
113  HcalGenericDetId myId(myRawId);
114  int index = myId.hashedId(h2mode_);
115  bool success = false;
116  if (index < 0) success = false;
117  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
118 
119  switch (myId.genericSubdet() ) {
121  if (!HBcontainer.size() ) initContainer(myId.genericSubdet() );
122  if (index1 < HBcontainer.size())
123  {
124  HBcontainer.at(index1) = myHcalCovarianceMatrix;
125  success = true;
126  }
127  break;
129  if (!HEcontainer.size() ) initContainer(myId.genericSubdet(), h2mode_ );
130  if (index1 < HEcontainer.size())
131  {
132  HEcontainer.at(index1) = myHcalCovarianceMatrix;
133  success = true;
134  }
135  break;
137  if (!HOcontainer.size() ) initContainer(myId.genericSubdet() );
138  if (index1 < HOcontainer.size())
139  {
140  HOcontainer.at(index1) = myHcalCovarianceMatrix;
141  success = true;
142  }
143  break;
145  if (!HFcontainer.size() ) initContainer(myId.genericSubdet() );
146  if (index1 < HFcontainer.size())
147  {
148  HFcontainer.at(index1) = myHcalCovarianceMatrix;
149  success = true;
150  }
151  break;
152  default: break;
153  }
154 
155  if (!success)
156  throw cms::Exception ("Filling of conditions failed")
157  << " no valid filling possible for Conditions of type " << myname() << " for DetId " << myId;
158  return success;
159 }
uint32_t rawId() const
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
void initContainer(int container, bool h2mode_=false)
std::vector< HcalCovarianceMatrix > HOcontainer
std::string myname() const
std::vector< HcalCovarianceMatrix > HEcontainer
const bool HcalCovarianceMatrices::exists ( DetId  fId) const

Definition at line 75 of file HcalCovarianceMatrices.cc.

References abs, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HBcontainer, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HEcontainer, HcalGenericDetId::HEhalfh2mode, HFcontainer, HOcontainer, getHLTprescales::index, NULL, and HcalCovarianceMatrix::rawId().

76 {
77  HcalGenericDetId myId(fId);
78  bool h2mode_ = (HEcontainer.size()==(2*HcalGenericDetId::HEhalfh2mode));
79 
80  int index = myId.hashedId(h2mode_);
81  if (index < 0) return false;
82  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
83  const HcalCovarianceMatrix* cell = NULL;
84  switch (myId.genericSubdet() ) {
86  if (index1 < HBcontainer.size()) cell = &(HBcontainer.at(index1) );
87  break;
89  if (index1 < HEcontainer.size()) cell = &(HEcontainer.at(index1) );
90  break;
92  if (index1 < HOcontainer.size()) cell = &(HOcontainer.at(index1) );
93  break;
95  if (index1 < HFcontainer.size()) cell = &(HFcontainer.at(index1) );
96  break;
97  default: return false; break;
98  }
99 
100  // HcalCovarianceMatrix emptyHcalCovarianceMatrix;
101  if (cell)
102  // if (cell->rawId() != emptyHcalCovarianceMatrix.rawId() )
103  if (cell->rawId() == fId )
104  return true;
105 
106  return false;
107 }
uint32_t rawId() const
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
std::vector< HcalCovarianceMatrix > HOcontainer
std::vector< HcalCovarianceMatrix > HEcontainer
std::vector< DetId > HcalCovarianceMatrices::getAllChannels ( ) const

Definition at line 162 of file HcalCovarianceMatrices.cc.

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

163 {
164  std::vector<DetId> channels;
165  HcalCovarianceMatrix emptyHcalCovarianceMatrix;
166  for (unsigned int i=0; i<HBcontainer.size(); i++)
167  {
168  if (emptyHcalCovarianceMatrix.rawId() != HBcontainer.at(i).rawId() )
169  channels.push_back( DetId(HBcontainer.at(i).rawId()) );
170  }
171  for (unsigned int i=0; i<HEcontainer.size(); i++)
172  {
173  if (emptyHcalCovarianceMatrix.rawId() != HEcontainer.at(i).rawId() )
174  channels.push_back( DetId(HEcontainer.at(i).rawId()) );
175  }
176  for (unsigned int i=0; i<HOcontainer.size(); i++)
177  {
178  if (emptyHcalCovarianceMatrix.rawId() != HOcontainer.at(i).rawId() )
179  channels.push_back( DetId(HOcontainer.at(i).rawId()) );
180  }
181  for (unsigned int i=0; i<HFcontainer.size(); i++)
182  {
183  if (emptyHcalCovarianceMatrix.rawId() != HFcontainer.at(i).rawId() )
184  channels.push_back( DetId(HFcontainer.at(i).rawId()) );
185  }
186  return channels;
187 }
int i
Definition: DBlmapReader.cc:9
uint32_t rawId() const
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
Definition: DetId.h:20
std::vector< HcalCovarianceMatrix > HOcontainer
std::vector< HcalCovarianceMatrix > HEcontainer
const HcalCovarianceMatrix * HcalCovarianceMatrices::getValues ( DetId  fId) const

Definition at line 35 of file HcalCovarianceMatrices.cc.

References abs, edm::hlt::Exception, HcalGenericDetId::genericSubdet(), HcalGenericDetId::hashedId(), HBcontainer, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HEcontainer, HcalGenericDetId::HEhalfh2mode, HFcontainer, HOcontainer, getHLTprescales::index, myname(), NULL, and HcalCovarianceMatrix::rawId().

36 {
37  HcalGenericDetId myId(fId);
38  bool h2mode_ = (HEcontainer.size()==(2*HcalGenericDetId::HEhalfh2mode));
39 
40  int index = myId.hashedId(h2mode_);
41  // std::cout << "::::: getting values at index " << index << ", DetId " << myId << std::endl;
42  unsigned int index1 = abs(index); // b/c I'm fed up with compiler warnings about comparison betw. signed and unsigned int
43 
44  const HcalCovarianceMatrix* cell = NULL;
45  if (index >= 0)
46  switch (myId.genericSubdet() ) {
48  if (index1 < HBcontainer.size())
49  cell = &(HBcontainer.at(index1) );
50  break;
52  if (index1 < HEcontainer.size())
53  cell = &(HEcontainer.at(index1) );
54  break;
56  if (index1 < HOcontainer.size())
57  cell = &(HOcontainer.at(index1) );
58  break;
60  if (index1 < HFcontainer.size())
61  cell = &(HFcontainer.at(index1) );
62  break;
63  default: break;
64  }
65 
66  // HcalCovarianceMatrix emptyHcalCovarianceMatrix;
67  // if (cell->rawId() == emptyHcalCovarianceMatrix.rawId() )
68  if ((!cell) || (cell->rawId() != fId ) )
69  throw cms::Exception ("Conditions not found")
70  << "Unavailable Conditions of type " << myname() << " for cell " << myId;
71  return cell;
72 }
uint32_t rawId() const
#define abs(x)
Definition: mlp_lapack.h:159
#define NULL
Definition: scimark2.h:8
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
std::vector< HcalCovarianceMatrix > HOcontainer
std::string myname() const
std::vector< HcalCovarianceMatrix > HEcontainer
void HcalCovarianceMatrices::initContainer ( int  container,
bool  h2mode_ = false 
)
private

Definition at line 13 of file HcalCovarianceMatrices.cc.

References HBcontainer, HcalGenericDetId::HBhalf, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HEcontainer, HcalGenericDetId::HEhalf, HcalGenericDetId::HEhalfh2mode, HFcontainer, HcalGenericDetId::HFhalf, HOcontainer, HcalGenericDetId::HOhalf, and i.

Referenced by addValues().

14 {
15  HcalCovarianceMatrix emptyHcalCovarianceMatrix;
16 
17  switch (container)
18  {
20  for (int i=0; i<(2*HcalGenericDetId::HBhalf); i++) HBcontainer.push_back(emptyHcalCovarianceMatrix); break;
22  if (!h2mode_) for (int i=0; i<(2*HcalGenericDetId::HEhalf); i++) HEcontainer.push_back(emptyHcalCovarianceMatrix);
23  else for (int i=0; i<(2*HcalGenericDetId::HEhalfh2mode); i++) HEcontainer.push_back(emptyHcalCovarianceMatrix);
24  break;
26  for (int i=0; i<(2*HcalGenericDetId::HOhalf); i++) HOcontainer.push_back(emptyHcalCovarianceMatrix); break;
28  for (int i=0; i<(2*HcalGenericDetId::HFhalf); i++) HFcontainer.push_back(emptyHcalCovarianceMatrix); break;
29  default: break;
30  }
31 }
int i
Definition: DBlmapReader.cc:9
std::vector< HcalCovarianceMatrix > HFcontainer
std::vector< HcalCovarianceMatrix > HBcontainer
std::vector< HcalCovarianceMatrix > HOcontainer
std::vector< HcalCovarianceMatrix > HEcontainer
std::string HcalCovarianceMatrices::myname ( ) const
inline

Definition at line 19 of file HcalCovarianceMatrices.h.

Referenced by addValues(), and getValues().

19 {return (std::string)"HcalCovarianceMatrices";}

Member Data Documentation

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

Definition at line 27 of file HcalCovarianceMatrices.h.

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

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

Definition at line 28 of file HcalCovarianceMatrices.h.

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

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

Definition at line 30 of file HcalCovarianceMatrices.h.

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

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

Definition at line 29 of file HcalCovarianceMatrices.h.

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