CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalFiberPattern Class Reference

#include <HcalFiberPattern.h>

List of all members.

Public Member Functions

int crate () const
int fiber () const
HcalElectronicsId getId (int fiberChan)
std::vector< HcalQIESamplegetSamples (int bunch, int npresamples, int nsamples, int fiberChan)
 HcalFiberPattern (const std::map< std::string, std::string > &params, const std::vector< uint32_t > &data)
int slot () const

Private Member Functions

HcalQIESample unpack (int bc, int fc)

Private Attributes

int crate_
int dcc_
int fiber_
std::vector< uint32_t > pattern_
int slot_
int spigot_
int tb_

Detailed Description

Date:
2006/09/29 17:57:39
Revision:
1.1
Author:
J. Mans - Minnesota

Definition at line 16 of file HcalFiberPattern.h.


Constructor & Destructor Documentation

HcalFiberPattern::HcalFiberPattern ( const std::map< std::string, std::string > &  params,
const std::vector< uint32_t > &  data 
)

Definition at line 10 of file HcalFiberPattern.cc.

References crate_, dcc_, fiber_, setIf(), slot_, spigot_, and tb_.

                                                                                                              : pattern_(data) {
  crate_=setIf("CRATE",params);
  slot_=setIf("SLOT",params);
  fiber_=setIf("FIBER",params);
  dcc_=setIf("DCC",params);
  spigot_=setIf("SPIGOT",params);
  tb_=setIf("TOPBOTTOM",params);
}

Member Function Documentation

int HcalFiberPattern::crate ( ) const [inline]

Definition at line 21 of file HcalFiberPattern.h.

References crate_.

{ return crate_; }
int HcalFiberPattern::fiber ( ) const [inline]

Definition at line 23 of file HcalFiberPattern.h.

References fiber_.

{ return fiber_; }
HcalElectronicsId HcalFiberPattern::getId ( int  fiberChan)

Definition at line 60 of file HcalFiberPattern.cc.

References crate_, dcc_, fiber_, HcalElectronicsId::setHTR(), slot_, spigot_, and tb_.

                                                       {
  HcalElectronicsId retval(fiberChan,fiber_,spigot_,dcc_);
  retval.setHTR(crate_,slot_,tb_);
  return retval;
}
std::vector< HcalQIESample > HcalFiberPattern::getSamples ( int  bunch,
int  npresamples,
int  nsamples,
int  fiberChan 
)

Definition at line 46 of file HcalFiberPattern.cc.

References Exception, i, pattern_, and unpack().

                                                                                                             {
  if (bunch<npresamples) throw cms::Exception("InvalidArgument") << "Asked for " << npresamples << " presamples with event at bunch " << bunch;
  if (nsamples-npresamples+bunch>=(int)(pattern_.size()/2)) throw cms::Exception("InvalidArgument") << "Asked for " << nsamples << " with event at " << bunch << " and " << npresamples << " presamples, but only " << pattern_.size()/2 << " bunches are available";

  std::vector<HcalQIESample> retval;
  retval.reserve(nsamples);

  for (int i=0; i<nsamples; i++) {
    int bc=bunch+i-npresamples;
    retval.push_back(unpack(bc,fiberChan));
  }
  return retval;
}
int HcalFiberPattern::slot ( void  ) const [inline]

Definition at line 22 of file HcalFiberPattern.h.

References slot_.

{ return slot_; }
HcalQIESample HcalFiberPattern::unpack ( int  bc,
int  fc 
) [private]

Definition at line 19 of file HcalFiberPattern.cc.

References ecalMGPA::adc(), fiber_, pattern_, and w2.

Referenced by getSamples().

                                                     {
  uint32_t w1=pattern_[bc*2]; // lsw
  uint32_t w2=pattern_[bc*2+1]; // msw

  int adc=0, capid=0;
  bool dv=(w1&0x10000)!=0;
  bool er=(w1&0x20000)!=0;
  
  switch (fc) {
  case (0):
    adc=(w2&0xFE00)>>9;
    capid=(w1&0x0180)>>7;
    break;
  case (1):
    adc=(w2&0xFE)>>1;
    capid=(w1&0x0060)>>5;
    break;
  case (2):
    adc=(w1&0xFE00)>>9;
    capid=(w1&0x0018)>>3;
    break;
  default:
    break;
  }
  return HcalQIESample(adc,capid,fiber_,fc,dv,er);
}

Member Data Documentation

int HcalFiberPattern::crate_ [private]

Definition at line 26 of file HcalFiberPattern.h.

Referenced by crate(), getId(), and HcalFiberPattern().

int HcalFiberPattern::dcc_ [private]

Definition at line 26 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

int HcalFiberPattern::fiber_ [private]

Definition at line 26 of file HcalFiberPattern.h.

Referenced by fiber(), getId(), HcalFiberPattern(), and unpack().

std::vector<uint32_t> HcalFiberPattern::pattern_ [private]

Definition at line 27 of file HcalFiberPattern.h.

Referenced by getSamples(), and unpack().

int HcalFiberPattern::slot_ [private]

Definition at line 26 of file HcalFiberPattern.h.

Referenced by getId(), HcalFiberPattern(), and slot().

Definition at line 26 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

int HcalFiberPattern::tb_ [private]

Definition at line 26 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().