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 Attributes
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 Attributes

unsigned int sampleMaskEB_
 
unsigned int sampleMaskEE_
 

Detailed Description

Author: Giovanni Franzoni, UMN Created: 09 Apr 2012

Id:
EcalSampleMask.h,v 1.2 2012/05/10 14:59:40 argiro Exp

Definition at line 14 of file EcalSampleMask.h.

Constructor & Destructor Documentation

EcalSampleMask::EcalSampleMask ( )

Author: Giovanni Franzoni, UMN Created: 08 May 2012

Id:
EcalSampleMask.cc,v 1.2 2012/05/10 14:59:38 argiro Exp

Definition at line 11 of file EcalSampleMask.cc.

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

12 {
13  // by default, all samples are set as active
16 }
unsigned int sampleMaskEB_
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
EcalSampleMask::EcalSampleMask ( const unsigned int  ebmask,
const unsigned int  eemask 
)

Definition at line 19 of file EcalSampleMask.cc.

References sampleMaskEB_, and sampleMaskEE_.

19  {
20  sampleMaskEB_ = ebmask;
21  sampleMaskEE_ = eemask;
22 }
unsigned int sampleMaskEB_
unsigned int sampleMaskEE_
EcalSampleMask::EcalSampleMask ( const std::vector< unsigned int > &  ebmask,
const std::vector< unsigned int > &  eemask 
)

Definition at line 25 of file EcalSampleMask.cc.

References setEcalSampleMaskRecordEB().

25  {
26  setEcalSampleMaskRecordEB( ebmask );
27  setEcalSampleMaskRecordEB( eemask );
28 }
void setEcalSampleMaskRecordEB(const unsigned int mask)
EcalSampleMask::~EcalSampleMask ( )

Definition at line 31 of file EcalSampleMask.cc.

31  {
32 
33 }

Member Function Documentation

float EcalSampleMask::getEcalSampleMaskRecordEB ( ) const
inline

Definition at line 30 of file EcalSampleMask.h.

References sampleMaskEB_.

30 { return sampleMaskEB_; }
unsigned int sampleMaskEB_
float EcalSampleMask::getEcalSampleMaskRecordEE ( ) const
inline

Definition at line 31 of file EcalSampleMask.h.

References sampleMaskEE_.

31 { return sampleMaskEE_; }
unsigned int sampleMaskEE_
void EcalSampleMask::print ( std::ostream &  s) const
inline

Definition at line 32 of file EcalSampleMask.h.

References sampleMaskEB_, and sampleMaskEE_.

32  {
33  s << "EcalSampleMask: EB " << sampleMaskEB_ << "; EE " << sampleMaskEE_ ;
34  }
unsigned int sampleMaskEB_
unsigned int sampleMaskEE_
void EcalSampleMask::setEcalSampleMaskRecordEB ( const unsigned int  mask)
inline

Definition at line 25 of file EcalSampleMask.h.

References sampleMaskEB_.

Referenced by EcalSampleMask().

25 { sampleMaskEB_ = mask; }
unsigned int sampleMaskEB_
void EcalSampleMask::setEcalSampleMaskRecordEB ( const std::vector< unsigned int > &  ebmask)

Definition at line 36 of file EcalSampleMask.cc.

References gather_cfg::cout, EcalDataFrame::MAXSAMPLES, alignCSCRings::s, and sampleMaskEB_.

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

Definition at line 26 of file EcalSampleMask.h.

References sampleMaskEB_.

26 { sampleMaskEB_ = mask; }
unsigned int sampleMaskEB_
void EcalSampleMask::setEcalSampleMaskRecordEE ( const std::vector< unsigned int > &  eemask)

Definition at line 64 of file EcalSampleMask.cc.

References gather_cfg::cout, EcalDataFrame::MAXSAMPLES, alignCSCRings::s, and sampleMaskEE_.

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

Definition at line 125 of file EcalSampleMask.cc.

References gather_cfg::cout, EcalBarrel, EcalEndcap, EcalDataFrame::MAXSAMPLES, DetId::subdetId(), useSampleEB(), and useSampleEE().

125  {
126 
127  if( sampleId >= EcalDataFrame::MAXSAMPLES ){
128  std::cout << "in EcalSampleMask::useSample only sampleId up to: " << EcalDataFrame::MAXSAMPLES
129  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
130  assert(0);
131  }
132 
133 
134  if (theCrystalId.subdetId()==EcalBarrel) {
135  return useSampleEB ( sampleId );
136  }
137  else if (theCrystalId.subdetId()==EcalEndcap) {
138  return useSampleEE ( sampleId );
139  }
140  else {
141  std::cout << "EcalSampleMaskuseSample::useSample can only be called for EcalBarrel or EcalEndcap DetID" << std::endl;
142  assert(0);
143  }
144 
145 }
bool useSampleEB(const int sampleId) const
tuple cout
Definition: gather_cfg.py:121
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
bool useSampleEE(const int sampleId) const
bool EcalSampleMask::useSampleEB ( const int  sampleId) const

Definition at line 93 of file EcalSampleMask.cc.

References gather_cfg::cout, EcalDataFrame::MAXSAMPLES, and sampleMaskEB_.

Referenced by useSample().

93  {
94 
95  if( sampleId >= EcalDataFrame::MAXSAMPLES ){
96  std::cout << "in EcalSampleMask::useSampleEB only sampleId up to: " << EcalDataFrame::MAXSAMPLES
97  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
98  assert(0);
99  }
100 
101  // ordering convention:
102  // ebmask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEB_
103  // ebmask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEB_
104  return ( sampleMaskEB_ & ( 0x1<< (EcalDataFrame::MAXSAMPLES -(sampleId+1) )) );
105 
106 }
unsigned int sampleMaskEB_
tuple cout
Definition: gather_cfg.py:121
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49
bool EcalSampleMask::useSampleEE ( const int  sampleId) const

Definition at line 109 of file EcalSampleMask.cc.

References gather_cfg::cout, EcalDataFrame::MAXSAMPLES, and sampleMaskEE_.

Referenced by useSample().

109  {
110 
111  if( sampleId >= EcalDataFrame::MAXSAMPLES ){
112  std::cout << "in EcalSampleMask::useSampleEE only sampleId up to: " << EcalDataFrame::MAXSAMPLES
113  << " can be used, while: " << sampleId << " was found. Bailing out." << std::endl;
114  assert(0);
115  }
116 
117  // ordering convention:
118  // ebmask.at(0) refers to the first sample read out and is mapped into the _most_ significant bit of sampleMaskEB_
119  // ebmask.at(EcalDataFrame::MAXSAMPLES) refers to the last sample read out and is mapped into the _least_ significant bit of sampleMaskEB_
120  return ( sampleMaskEE_ & ( 0x1<< (EcalDataFrame::MAXSAMPLES -(sampleId+1) )) );
121 
122 }
unsigned int sampleMaskEE_
tuple cout
Definition: gather_cfg.py:121
static const int MAXSAMPLES
Definition: EcalDataFrame.h:49

Member Data Documentation

unsigned int EcalSampleMask::sampleMaskEB_
private
unsigned int EcalSampleMask::sampleMaskEE_
private