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

For the sorted collection.

Definition at line 17 of file CastorDataFrame.h.

Constructor & Destructor Documentation

CastorDataFrame::CastorDataFrame ( )

Definition at line 3 of file CastorDataFrame.cc.

3  : id_(0),
4  size_(0),
6 {
7 }
HcalCastorDetId id_
CastorDataFrame::CastorDataFrame ( const HcalCastorDetId id)
explicit

Definition at line 9 of file CastorDataFrame.cc.

9  :
10  id_(id),
11  size_(0),
13 {
14  // TODO : test id for CASTOR
15 }
HcalCastorDetId id_

Member Function Documentation

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 49 of file CastorDataFrame.cc.

References hcalPresamples_, and heppy_batch::val.

Referenced by operator<<(), and sample().

49  {
50  int val=(hcalPresamples_&0xF00)>>8;
51  return (val==0)?(-1000):(((val&0x8)==0)?(-(val&0x7)):(val&0x7));
52 }
const HcalCastorDetId& CastorDataFrame::id ( ) const
inline
const HcalQIESample& CastorDataFrame::operator[] ( int  i) const
inline

access a sample

Definition at line 37 of file CastorDataFrame.h.

References data_, and i.

37 { return data_[i]; }
int i
Definition: DBlmapReader.cc:9
HcalQIESample data_[MAXSAMPLES]
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.

References hcalPresamples_.

Referenced by CastorNominalCoder::adc2fC(), and operator<<().

28 { return hcalPresamples_&0xF; }
const HcalQIESample& CastorDataFrame::sample ( int  i) const
inline
void CastorDataFrame::setFiberIdleOffset ( int  offset)

Definition at line 54 of file CastorDataFrame.cc.

References hcalPresamples_, and PFRecoTauDiscriminationByIsolation_cfi::offset.

Referenced by setSample().

54  {
55  hcalPresamples_&=0x7FFFF0FF;
56  if (offset>=7) hcalPresamples_|=0xF00;
57  else if (offset>=0) hcalPresamples_|=(0x800)|(offset<<8);
58  else if (offset>=-7) hcalPresamples_|=((-offset)<<8);
59  else hcalPresamples_|=0x700;
60 }
void CastorDataFrame::setPresamples ( int  ps)

Definition at line 23 of file CastorDataFrame.cc.

References hcalPresamples_.

Referenced by sample(), and CastorCtdcUnpacker::unpack().

23  {
24  hcalPresamples_|=ps&0xF;
25 }
void CastorDataFrame::setSample ( int  i,
const HcalQIESample sam 
)
inline

Definition at line 49 of file CastorDataFrame.h.

References data_, i, PFRecoTauDiscriminationByIsolation_cfi::offset, and setFiberIdleOffset().

Referenced by CastorCtdcUnpacker::unpack().

49 { data_[i]=sam; }
int i
Definition: DBlmapReader.cc:9
HcalQIESample data_[MAXSAMPLES]
void CastorDataFrame::setSize ( int  size)

Definition at line 17 of file CastorDataFrame.cc.

References MAXSAMPLES, size(), and size_.

Referenced by sample(), and CastorCtdcUnpacker::unpack().

17  {
19  else if (size<=0) size_=0;
20  else size_=size;
21 }
int size() const
total number of samples in the digi
static const int MAXSAMPLES
void CastorDataFrame::setZSInfo ( bool  unsuppressed,
bool  markAndPass,
uint32_t  crossingMask = 0 
)

Definition at line 42 of file CastorDataFrame.cc.

References hcalPresamples_.

Referenced by sample().

42  {
43  hcalPresamples_&=0x7FC00F0F; // preserve actual presamples and fiber idle offset
44  if (markAndPass) hcalPresamples_|=0x10;
45  if (unsuppressed) hcalPresamples_|=0x20;
46  hcalPresamples_|=(crossingMask&0x3FF)<<12;
47 }
int CastorDataFrame::size ( void  ) const
inline
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 30 of file CastorDataFrame.cc.

References HcalQIESample::capid(), data_, CastorSimpleReconstructor_cfi::firstSample, i, convertSQLiteXML::ok, and size_.

Referenced by sample().

30  {
31  int capid=-1;
32  bool ok=true;
33  for (int i=0; ok && i<nSamples && i+firstSample<size_; i++) {
34  if (data_[i+firstSample].er() || !data_[i+firstSample].dv()) ok=false;
35  if (i==0) capid=data_[i+firstSample].capid();
36  if (capid!=data_[i+firstSample].capid()) ok=false;
37  capid=(capid+1)%4;
38  }
39  return ok;
40 }
int i
Definition: DBlmapReader.cc:9
constexpr size_t nSamples
HcalQIESample data_[MAXSAMPLES]
int capid() const
get the Capacitor id
Definition: HcalQIESample.h:26
uint32_t CastorDataFrame::zsCrossingMask ( ) const
inline

zs crossing mask (which sums considered)

Definition at line 34 of file CastorDataFrame.h.

References hcalPresamples_.

34 { return (hcalPresamples_&0x3FF000)>>12; }
bool CastorDataFrame::zsMarkAndPass ( ) const
inline

was ZS MarkAndPass?

Definition at line 30 of file CastorDataFrame.h.

References hcalPresamples_.

30 { return (hcalPresamples_&0x10); }
bool CastorDataFrame::zsUnsuppressed ( ) const
inline

was ZS unsuppressed?

Definition at line 32 of file CastorDataFrame.h.

References hcalPresamples_.

32 { return (hcalPresamples_&0x20); }

Member Data Documentation

HcalQIESample CastorDataFrame::data_[MAXSAMPLES]
private

Definition at line 60 of file CastorDataFrame.h.

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

int CastorDataFrame::hcalPresamples_
private
HcalCastorDetId CastorDataFrame::id_
private

Definition at line 56 of file CastorDataFrame.h.

Referenced by id().

const int CastorDataFrame::MAXSAMPLES = 10
static
int CastorDataFrame::size_
private

Definition at line 58 of file CastorDataFrame.h.

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