CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
EcalSampleMask Class Reference

#include <EcalSampleMask.h>

Public Member Functions

 EcalSampleMask ()
 
 EcalSampleMask (const unsigned int ebmask, const unsigned int eemask)
 
 EcalSampleMask (const std::vector< unsigned int > &ebmask, const std::vector< unsigned int > &eemask)
 
float getEcalSampleMaskRecordEB () const
 
float getEcalSampleMaskRecordEE () const
 
void print (std::ostream &s) const
 
void setEcalSampleMaskRecordEB (const unsigned int mask)
 
void setEcalSampleMaskRecordEB (const std::vector< unsigned int > &ebmask)
 
void setEcalSampleMaskRecordEE (const unsigned int mask)
 
void setEcalSampleMaskRecordEE (const std::vector< unsigned int > &eemask)
 
bool useSample (const int sampleId, DetId &theCrystal) const
 
bool useSampleEB (const int sampleId) const
 
bool useSampleEE (const int sampleId) const
 
 ~EcalSampleMask ()
 

Private Member Functions

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

Private Attributes

unsigned int sampleMaskEB_
 
unsigned int sampleMaskEE_
 

Friends

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

Detailed Description

Author: Giovanni Franzoni, UMN Created: 09 Apr 2012

Id
EcalSampleMask.h,v 1.1 2012/05/10 08:22:10 argiro Exp

Definition at line 16 of file EcalSampleMask.h.

Constructor & Destructor Documentation

◆ EcalSampleMask() [1/3]

EcalSampleMask::EcalSampleMask ( )

Definition at line 14 of file EcalSampleMask.cc.

References EcalDataFrame::MAXSAMPLES, funct::pow(), sampleMaskEB_, and sampleMaskEE_.

14  {
15  // by default, all samples are set as active
18 }
unsigned int sampleMaskEB_
unsigned int sampleMaskEE_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ EcalSampleMask() [2/3]

EcalSampleMask::EcalSampleMask ( const unsigned int  ebmask,
const unsigned int  eemask 
)

Definition at line 20 of file EcalSampleMask.cc.

References sampleMaskEB_, and sampleMaskEE_.

20  {
21  sampleMaskEB_ = ebmask;
22  sampleMaskEE_ = eemask;
23 }
unsigned int sampleMaskEB_
unsigned int sampleMaskEE_

◆ EcalSampleMask() [3/3]

EcalSampleMask::EcalSampleMask ( const std::vector< unsigned int > &  ebmask,
const std::vector< unsigned int > &  eemask 
)

Definition at line 25 of file EcalSampleMask.cc.

References setEcalSampleMaskRecordEB(), and setEcalSampleMaskRecordEE().

25  {
28 }
void setEcalSampleMaskRecordEE(const unsigned int mask)
void setEcalSampleMaskRecordEB(const unsigned int mask)

◆ ~EcalSampleMask()

EcalSampleMask::~EcalSampleMask ( )

Definition at line 30 of file EcalSampleMask.cc.

30 {}

Member Function Documentation

◆ getEcalSampleMaskRecordEB()

float EcalSampleMask::getEcalSampleMaskRecordEB ( ) const
inline

Definition at line 32 of file EcalSampleMask.h.

References sampleMaskEB_.

32 { return sampleMaskEB_; }
unsigned int sampleMaskEB_

◆ getEcalSampleMaskRecordEE()

float EcalSampleMask::getEcalSampleMaskRecordEE ( ) const
inline

Definition at line 33 of file EcalSampleMask.h.

References sampleMaskEE_.

33 { return sampleMaskEE_; }
unsigned int sampleMaskEE_

◆ print()

void EcalSampleMask::print ( std::ostream &  s) const
inline

Definition at line 34 of file EcalSampleMask.h.

References alignCSCRings::s, sampleMaskEB_, and sampleMaskEE_.

34 { s << "EcalSampleMask: EB " << sampleMaskEB_ << "; EE " << sampleMaskEE_; }
unsigned int sampleMaskEB_
unsigned int sampleMaskEE_

◆ serialize()

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

◆ setEcalSampleMaskRecordEB() [1/2]

void EcalSampleMask::setEcalSampleMaskRecordEB ( const unsigned int  mask)
inline

Definition at line 27 of file EcalSampleMask.h.

References gpuClustering::pixelStatus::mask, and sampleMaskEB_.

Referenced by EcalSampleMask().

27 { sampleMaskEB_ = mask; }
unsigned int sampleMaskEB_
constexpr uint32_t mask
Definition: gpuClustering.h:26

◆ setEcalSampleMaskRecordEB() [2/2]

void EcalSampleMask::setEcalSampleMaskRecordEB ( const std::vector< unsigned int > &  ebmask)

Definition at line 32 of file EcalSampleMask.cc.

References cms::cuda::assert(), EcalDataFrame::MAXSAMPLES, alignCSCRings::s, and sampleMaskEB_.

32  {
33  // check that size of the vector is adequate
34  if (ebmask.size() != static_cast<unsigned int>(EcalDataFrame::MAXSAMPLES)) {
35  LogError("DataMismatch") << " in EcalSampleMask::setEcalSampleMaskRecordEB size of ebmask (" << ebmask.size()
36  << ") need to be: " << EcalDataFrame::MAXSAMPLES << ". Bailing out." << std::endl;
37  assert(0);
38  }
39 
40  // check that values of vector are allowed
41  for (unsigned int s = 0; s < ebmask.size(); s++) {
42  if (ebmask.at(s) == 0 || ebmask.at(s) == 1) {
43  ;
44  } else {
45  LogError("DataMismatch")
46  << "in EcalSampleMask::setEcalSampleMaskRecordEB ebmask can only have values 0 or 1, while " << ebmask.at(s)
47  << " was found. Bailing out. " << std::endl;
48  assert(0);
49  }
50  }
51 
52  // ordering of bits:
53  // ebmask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEB_
54  // ebmask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEB_
55  sampleMaskEB_ = 0;
56  for (unsigned int sampleId = 0; sampleId < ebmask.size(); sampleId++) {
57  sampleMaskEB_ |= (0x1 << (EcalDataFrame::MAXSAMPLES - (sampleId + 1)));
58  }
59 }
Log< level::Error, false > LogError
assert(be >=bs)
unsigned int sampleMaskEB_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ setEcalSampleMaskRecordEE() [1/2]

void EcalSampleMask::setEcalSampleMaskRecordEE ( const unsigned int  mask)
inline

Definition at line 28 of file EcalSampleMask.h.

References gpuClustering::pixelStatus::mask, and sampleMaskEE_.

Referenced by EcalSampleMask().

28 { sampleMaskEE_ = mask; }
constexpr uint32_t mask
Definition: gpuClustering.h:26
unsigned int sampleMaskEE_

◆ setEcalSampleMaskRecordEE() [2/2]

void EcalSampleMask::setEcalSampleMaskRecordEE ( const std::vector< unsigned int > &  eemask)

Definition at line 61 of file EcalSampleMask.cc.

References cms::cuda::assert(), EcalDataFrame::MAXSAMPLES, alignCSCRings::s, and sampleMaskEE_.

61  {
62  // check that size of the vector is adequate
63  if (eemask.size() != static_cast<unsigned int>(EcalDataFrame::MAXSAMPLES)) {
64  LogError("DataMismatch") << " in EcalSampleMask::setEcalSampleMaskRecordEE size of eemask (" << eemask.size()
65  << ") need to be: " << EcalDataFrame::MAXSAMPLES << ". Bailing out." << std::endl;
66  assert(0);
67  }
68 
69  // check that values of vector are allowed
70  for (unsigned int s = 0; s < eemask.size(); s++) {
71  if (eemask.at(s) == 0 || eemask.at(s) == 1) {
72  ;
73  } else {
74  LogError("DataMismatch")
75  << "in EcalSampleMask::setEcalSampleMaskRecordEE eemask can only have values 0 or 1, while " << eemask.at(s)
76  << " was found. Bailing out. " << std::endl;
77  assert(0);
78  }
79  }
80 
81  // ordering of bits:
82  // eemask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEE_
83  // eemask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEE_
84  sampleMaskEE_ = 0;
85  for (unsigned int sampleId = 0; sampleId < eemask.size(); sampleId++) {
86  sampleMaskEE_ |= (0x1 << (EcalDataFrame::MAXSAMPLES - (sampleId + 1)));
87  }
88 }
Log< level::Error, false > LogError
assert(be >=bs)
unsigned int sampleMaskEE_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ useSample()

bool EcalSampleMask::useSample ( const int  sampleId,
DetId theCrystal 
) const

Definition at line 116 of file EcalSampleMask.cc.

References cms::cuda::assert(), EcalBarrel, EcalEndcap, EcalDataFrame::MAXSAMPLES, DetId::subdetId(), useSampleEB(), and useSampleEE().

116  {
117  if (sampleId >= EcalDataFrame::MAXSAMPLES) {
118  LogError("DataMismatch") << "in EcalSampleMask::useSample only sampleId up to: " << EcalDataFrame::MAXSAMPLES
119  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
120  assert(0);
121  }
122 
123  if (theCrystalId.subdetId() == EcalBarrel) {
124  return useSampleEB(sampleId);
125  } else if (theCrystalId.subdetId() == EcalEndcap) {
126  return useSampleEE(sampleId);
127  } else {
128  LogError("DataMismatch")
129  << "EcalSampleMaskuseSample::useSample can only be called for EcalBarrel or EcalEndcap DetID" << std::endl;
130  assert(0);
131  }
132 }
bool useSampleEB(const int sampleId) const
bool useSampleEE(const int sampleId) const
Log< level::Error, false > LogError
assert(be >=bs)
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ useSampleEB()

bool EcalSampleMask::useSampleEB ( const int  sampleId) const

Definition at line 90 of file EcalSampleMask.cc.

References cms::cuda::assert(), EcalDataFrame::MAXSAMPLES, sampleMaskEB_, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by useSample().

90  {
91  if (sampleId >= EcalDataFrame::MAXSAMPLES) {
92  LogError("DataMismatch") << "in EcalSampleMask::useSampleEB only sampleId up to: " << EcalDataFrame::MAXSAMPLES
93  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
94  assert(0);
95  }
96 
97  // ordering convention:
98  // ebmask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEB_
99  // ebmask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEB_
100  return (sampleMaskEB_ & (0x1 << (EcalDataFrame::MAXSAMPLES - (sampleId + 1))));
101 }
Log< level::Error, false > LogError
assert(be >=bs)
unsigned int sampleMaskEB_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

◆ useSampleEE()

bool EcalSampleMask::useSampleEE ( const int  sampleId) const

Definition at line 103 of file EcalSampleMask.cc.

References cms::cuda::assert(), EcalDataFrame::MAXSAMPLES, sampleMaskEE_, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by useSample().

103  {
104  if (sampleId >= EcalDataFrame::MAXSAMPLES) {
105  LogError("DataMismatch") << "in EcalSampleMask::useSampleEE only sampleId up to: " << EcalDataFrame::MAXSAMPLES
106  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
107  assert(0);
108  }
109 
110  // ordering convention:
111  // ebmask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEB_
112  // ebmask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEB_
113  return (sampleMaskEE_ & (0x1 << (EcalDataFrame::MAXSAMPLES - (sampleId + 1))));
114 }
Log< level::Error, false > LogError
assert(be >=bs)
unsigned int sampleMaskEE_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 44 of file EcalSampleMask.h.

◆ cond::serialization::access

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

Definition at line 44 of file EcalSampleMask.h.

Member Data Documentation

◆ sampleMaskEB_

unsigned int EcalSampleMask::sampleMaskEB_
private

◆ sampleMaskEE_

unsigned int EcalSampleMask::sampleMaskEE_
private