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 std::vector< unsigned int > &ebmask, const std::vector< unsigned int > &eemask)
 
 EcalSampleMask (const unsigned int ebmask, const unsigned int eemask)
 
float getEcalSampleMaskRecordEB () const
 
float getEcalSampleMaskRecordEE () const
 
void print (std::ostream &s) const
 
void setEcalSampleMaskRecordEB (const std::vector< unsigned int > &ebmask)
 
void setEcalSampleMaskRecordEB (const unsigned int mask)
 
void setEcalSampleMaskRecordEE (const std::vector< unsigned int > &eemask)
 
void setEcalSampleMaskRecordEE (const unsigned int mask)
 
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.

14  {
15  // by default, all samples are set as active
18 }

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

◆ EcalSampleMask() [2/3]

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

Definition at line 20 of file EcalSampleMask.cc.

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

References sampleMaskEB_, and 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.

25  {
28 }

References setEcalSampleMaskRecordEB(), and setEcalSampleMaskRecordEE().

◆ ~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.

32 { return sampleMaskEB_; }

References sampleMaskEB_.

Referenced by EcalTrivialObjectAnalyzer::analyze().

◆ getEcalSampleMaskRecordEE()

float EcalSampleMask::getEcalSampleMaskRecordEE ( ) const
inline

Definition at line 33 of file EcalSampleMask.h.

33 { return sampleMaskEE_; }

References sampleMaskEE_.

Referenced by EcalTrivialObjectAnalyzer::analyze().

◆ print()

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

Definition at line 34 of file EcalSampleMask.h.

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

References alignCSCRings::s, sampleMaskEB_, and sampleMaskEE_.

◆ serialize()

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

◆ setEcalSampleMaskRecordEB() [1/2]

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

Definition at line 32 of file EcalSampleMask.cc.

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 }

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

◆ setEcalSampleMaskRecordEB() [2/2]

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

Definition at line 27 of file EcalSampleMask.h.

27 { sampleMaskEB_ = mask; }

References sampleMaskEB_.

Referenced by EcalSampleMask().

◆ setEcalSampleMaskRecordEE() [1/2]

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

Definition at line 61 of file EcalSampleMask.cc.

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 }

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

◆ setEcalSampleMaskRecordEE() [2/2]

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

Definition at line 28 of file EcalSampleMask.h.

28 { sampleMaskEE_ = mask; }

References sampleMaskEE_.

Referenced by EcalSampleMask().

◆ useSample()

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

Definition at line 116 of file EcalSampleMask.cc.

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 }

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

◆ useSampleEB()

bool EcalSampleMask::useSampleEB ( const int  sampleId) const

Definition at line 90 of file EcalSampleMask.cc.

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 }

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

Referenced by useSample().

◆ useSampleEE()

bool EcalSampleMask::useSampleEE ( const int  sampleId) const

Definition at line 103 of file EcalSampleMask.cc.

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 }

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

Referenced by useSample().

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
EcalDataFrame::MAXSAMPLES
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
EcalSampleMask::setEcalSampleMaskRecordEB
void setEcalSampleMaskRecordEB(const unsigned int mask)
Definition: EcalSampleMask.h:27
cms::cuda::assert
assert(be >=bs)
EcalSampleMask::setEcalSampleMaskRecordEE
void setEcalSampleMaskRecordEE(const unsigned int mask)
Definition: EcalSampleMask.h:28
EcalBarrel
Definition: EcalSubdetector.h:10
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
EcalSampleMask::useSampleEE
bool useSampleEE(const int sampleId) const
Definition: EcalSampleMask.cc:103
EcalSampleMask::sampleMaskEE_
unsigned int sampleMaskEE_
Definition: EcalSampleMask.h:42
EcalEndcap
Definition: EcalSubdetector.h:10
edm::LogError
Definition: MessageLogger.h:183
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
EcalSampleMask::useSampleEB
bool useSampleEB(const int sampleId) const
Definition: EcalSampleMask.cc:90
EcalSampleMask::sampleMaskEB_
unsigned int sampleMaskEB_
Definition: EcalSampleMask.h:41