CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Attributes | Private Attributes
CastorDataFrame Class Reference

#include <CastorDataFrame.h>

Public Types

typedef HcalCastorDetId key_type
 For the sorted collection. More...
 

Public Member Functions

 CastorDataFrame ()
 
 CastorDataFrame (const HcalCastorDetId &id)
 
int fiberIdleOffset () const
 offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable) More...
 
const HcalCastorDetIdid () const
 
const HcalQIESampleoperator[] (int i) const
 access a sample More...
 
int presamples () const
 number of samples before the sample from the triggered beam crossing (according to the hardware) More...
 
const HcalQIESamplesample (int i) const
 access a sample More...
 
void setFiberIdleOffset (int offset)
 
void setPresamples (int ps)
 
void setSample (int i, const HcalQIESample &sam)
 
void setSize (int size)
 
void setZSInfo (bool unsuppressed, bool markAndPass, uint32_t crossingMask=0)
 
int size () const
 total number of samples in the digi More...
 
bool validate (int firstSample=0, int nSamples=100) const
 validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all) More...
 
uint32_t zsCrossingMask () const
 zs crossing mask (which sums considered) More...
 
bool zsMarkAndPass () const
 was ZS MarkAndPass? More...
 
bool zsUnsuppressed () const
 was ZS unsuppressed? More...
 

Static Public Attributes

static const int MAXSAMPLES = 10
 

Private Attributes

HcalQIESample data_ [MAXSAMPLES]
 
int hcalPresamples_
 
HcalCastorDetId id_
 
int size_
 

Detailed Description

Precision readout digi for Castor

Definition at line 15 of file CastorDataFrame.h.

Member Typedef Documentation

◆ key_type

For the sorted collection.

Definition at line 17 of file CastorDataFrame.h.

Constructor & Destructor Documentation

◆ CastorDataFrame() [1/2]

CastorDataFrame::CastorDataFrame ( )

Definition at line 3 of file CastorDataFrame.cc.

3 : id_(0), size_(0), hcalPresamples_(0) {}

◆ CastorDataFrame() [2/2]

CastorDataFrame::CastorDataFrame ( const HcalCastorDetId id)
explicit

Definition at line 5 of file CastorDataFrame.cc.

5  : id_(id), size_(0), hcalPresamples_(0) {
6  // TODO : test id for CASTOR
7 }

Member Function Documentation

◆ fiberIdleOffset()

int CastorDataFrame::fiberIdleOffset ( ) const

offset of bunch number for this channel relative to nominal set in the unpacker (range is +7->-7. -1000 indicates the data is invalid/unavailable)

Definition at line 47 of file CastorDataFrame.cc.

47  {
48  int val = (hcalPresamples_ & 0xF00) >> 8;
49  return (val == 0) ? (-1000) : (((val & 0x8) == 0) ? (-(val & 0x7)) : (val & 0x7));
50 }

References hcalPresamples_, and heppy_batch::val.

Referenced by operator<<().

◆ id()

const HcalCastorDetId& CastorDataFrame::id ( ) const
inline

◆ operator[]()

const HcalQIESample& CastorDataFrame::operator[] ( int  i) const
inline

access a sample

Definition at line 37 of file CastorDataFrame.h.

37 { return data_[i]; }

References data_, and mps_fire::i.

◆ presamples()

int CastorDataFrame::presamples ( ) const
inline

number of samples before the sample from the triggered beam crossing (according to the hardware)

Definition at line 28 of file CastorDataFrame.h.

28 { return hcalPresamples_ & 0xF; }

References hcalPresamples_.

Referenced by operator<<().

◆ sample()

const HcalQIESample& CastorDataFrame::sample ( int  i) const
inline

◆ setFiberIdleOffset()

void CastorDataFrame::setFiberIdleOffset ( int  offset)

Definition at line 52 of file CastorDataFrame.cc.

52  {
53  hcalPresamples_ &= 0x7FFFF0FF;
54  if (offset >= 7)
55  hcalPresamples_ |= 0xF00;
56  else if (offset >= 0)
57  hcalPresamples_ |= (0x800) | (offset << 8);
58  else if (offset >= -7)
59  hcalPresamples_ |= ((-offset) << 8);
60  else
61  hcalPresamples_ |= 0x700;
62 }

References hcalPresamples_, and hltrates_dqm_sourceclient-live_cfg::offset.

◆ setPresamples()

void CastorDataFrame::setPresamples ( int  ps)

Definition at line 18 of file CastorDataFrame.cc.

18 { hcalPresamples_ |= ps & 0xF; }

References hcalPresamples_.

Referenced by CastorCtdcUnpacker::unpack().

◆ setSample()

void CastorDataFrame::setSample ( int  i,
const HcalQIESample sam 
)
inline

Definition at line 49 of file CastorDataFrame.h.

49 { data_[i] = sam; }

References data_, and mps_fire::i.

Referenced by CastorCtdcUnpacker::unpack().

◆ setSize()

void CastorDataFrame::setSize ( int  size)

Definition at line 9 of file CastorDataFrame.cc.

9  {
10  if (size > MAXSAMPLES)
11  size_ = MAXSAMPLES;
12  else if (size <= 0)
13  size_ = 0;
14  else
15  size_ = size;
16 }

References MAXSAMPLES, size(), and size_.

Referenced by CastorCtdcUnpacker::unpack().

◆ setZSInfo()

void CastorDataFrame::setZSInfo ( bool  unsuppressed,
bool  markAndPass,
uint32_t  crossingMask = 0 
)

Definition at line 38 of file CastorDataFrame.cc.

38  {
39  hcalPresamples_ &= 0x7FC00F0F; // preserve actual presamples and fiber idle offset
40  if (markAndPass)
41  hcalPresamples_ |= 0x10;
42  if (unsuppressed)
43  hcalPresamples_ |= 0x20;
44  hcalPresamples_ |= (crossingMask & 0x3FF) << 12;
45 }

References hcalPresamples_, and DigiNZS_cff::markAndPass.

◆ size()

int CastorDataFrame::size ( void  ) const
inline

◆ validate()

bool CastorDataFrame::validate ( int  firstSample = 0,
int  nSamples = 100 
) const

validate appropriate DV and ER bits as well as capid rotation for the specified samples (default is all)

Definition at line 23 of file CastorDataFrame.cc.

23  {
24  int capid = -1;
25  bool ok = true;
26  for (int i = 0; ok && i < nSamples && i + firstSample < size_; i++) {
27  if (data_[i + firstSample].er() || !data_[i + firstSample].dv())
28  ok = false;
29  if (i == 0)
30  capid = data_[i + firstSample].capid();
31  if (capid != data_[i + firstSample].capid())
32  ok = false;
33  capid = (capid + 1) % 4;
34  }
35  return ok;
36 }

References HcalQIESample::capid(), data_, castor_dqm_sourceclient-live_cfg::firstSample, mps_fire::i, PresampleTask_cfi::nSamples, convertSQLiteXML::ok, and size_.

◆ zsCrossingMask()

uint32_t CastorDataFrame::zsCrossingMask ( ) const
inline

zs crossing mask (which sums considered)

Definition at line 34 of file CastorDataFrame.h.

34 { return (hcalPresamples_ & 0x3FF000) >> 12; }

References hcalPresamples_.

◆ zsMarkAndPass()

bool CastorDataFrame::zsMarkAndPass ( ) const
inline

was ZS MarkAndPass?

Definition at line 30 of file CastorDataFrame.h.

30 { return (hcalPresamples_ & 0x10); }

References hcalPresamples_.

◆ zsUnsuppressed()

bool CastorDataFrame::zsUnsuppressed ( ) const
inline

was ZS unsuppressed?

Definition at line 32 of file CastorDataFrame.h.

32 { return (hcalPresamples_ & 0x20); }

References hcalPresamples_.

Member Data Documentation

◆ data_

HcalQIESample CastorDataFrame::data_[MAXSAMPLES]
private

Definition at line 61 of file CastorDataFrame.h.

Referenced by operator[](), sample(), setSample(), and validate().

◆ hcalPresamples_

int CastorDataFrame::hcalPresamples_
private

◆ id_

HcalCastorDetId CastorDataFrame::id_
private

Definition at line 57 of file CastorDataFrame.h.

Referenced by id().

◆ MAXSAMPLES

const int CastorDataFrame::MAXSAMPLES = 10
static

◆ size_

int CastorDataFrame::size_
private

Definition at line 59 of file CastorDataFrame.h.

Referenced by setSize(), size(), and validate().

mps_fire.i
i
Definition: mps_fire.py:428
CastorDataFrame::data_
HcalQIESample data_[MAXSAMPLES]
Definition: CastorDataFrame.h:61
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
PresampleTask_cfi.nSamples
nSamples
Definition: PresampleTask_cfi.py:7
CastorDataFrame::id_
HcalCastorDetId id_
Definition: CastorDataFrame.h:57
CastorDataFrame::size_
int size_
Definition: CastorDataFrame.h:59
DigiNZS_cff.markAndPass
markAndPass
Definition: DigiNZS_cff.py:6
CastorDataFrame::size
int size() const
total number of samples in the digi
Definition: CastorDataFrame.h:26
castor_dqm_sourceclient-live_cfg.firstSample
firstSample
Definition: castor_dqm_sourceclient-live_cfg.py:64
HcalQIESample::capid
constexpr int capid() const
get the Capacitor id
Definition: HcalQIESample.h:47
CastorDataFrame::hcalPresamples_
int hcalPresamples_
Definition: CastorDataFrame.h:60
heppy_batch.val
val
Definition: heppy_batch.py:351
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
CastorDataFrame::MAXSAMPLES
static const int MAXSAMPLES
Definition: CastorDataFrame.h:54