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 Member Functions | Private Attributes
HcalFiberPattern Class Reference

#include <HcalFiberPattern.h>

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

Author
J. Mans - Minnesota

Definition at line 14 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_.

10  : pattern_(data) {
11  crate_=setIf("CRATE",params);
12  slot_=setIf("SLOT",params);
13  fiber_=setIf("FIBER",params);
14  dcc_=setIf("DCC",params);
15  spigot_=setIf("SPIGOT",params);
16  tb_=setIf("TOPBOTTOM",params);
17 }
std::vector< uint32_t > pattern_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
static int setIf(const std::string &name, const std::map< std::string, std::string > &params)

Member Function Documentation

int HcalFiberPattern::crate ( ) const
inline

Definition at line 19 of file HcalFiberPattern.h.

References crate_.

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

Definition at line 21 of file HcalFiberPattern.h.

References fiber_.

21 { 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_.

60  {
61  HcalElectronicsId retval(fiberChan,fiber_,spigot_,dcc_);
62  retval.setHTR(crate_,slot_,tb_);
63  return retval;
64 }
Readout chain identification for Hcal.
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().

46  {
47  if (bunch<npresamples) throw cms::Exception("InvalidArgument") << "Asked for " << npresamples << " presamples with event at bunch " << bunch;
48  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";
49 
50  std::vector<HcalQIESample> retval;
51  retval.reserve(nsamples);
52 
53  for (int i=0; i<nsamples; i++) {
54  int bc=bunch+i-npresamples;
55  retval.push_back(unpack(bc,fiberChan));
56  }
57  return retval;
58 }
int i
Definition: DBlmapReader.cc:9
std::vector< uint32_t > pattern_
HcalQIESample unpack(int bc, int fc)
int HcalFiberPattern::slot ( void  ) const
inline

Definition at line 20 of file HcalFiberPattern.h.

References slot_.

20 { 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().

19  {
20  uint32_t w1=pattern_[bc*2]; // lsw
21  uint32_t w2=pattern_[bc*2+1]; // msw
22 
23  int adc=0, capid=0;
24  bool dv=(w1&0x10000)!=0;
25  bool er=(w1&0x20000)!=0;
26 
27  switch (fc) {
28  case (0):
29  adc=(w2&0xFE00)>>9;
30  capid=(w1&0x0180)>>7;
31  break;
32  case (1):
33  adc=(w2&0xFE)>>1;
34  capid=(w1&0x0060)>>5;
35  break;
36  case (2):
37  adc=(w1&0xFE00)>>9;
38  capid=(w1&0x0018)>>3;
39  break;
40  default:
41  break;
42  }
43  return HcalQIESample(adc,capid,fiber_,fc,dv,er);
44 }
int adc(sample_type sample)
get the ADC sample (12 bits)
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
std::vector< uint32_t > pattern_

Member Data Documentation

int HcalFiberPattern::crate_
private

Definition at line 24 of file HcalFiberPattern.h.

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

int HcalFiberPattern::dcc_
private

Definition at line 24 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

int HcalFiberPattern::fiber_
private

Definition at line 24 of file HcalFiberPattern.h.

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

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

Definition at line 25 of file HcalFiberPattern.h.

Referenced by getSamples(), and unpack().

int HcalFiberPattern::slot_
private

Definition at line 24 of file HcalFiberPattern.h.

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

int HcalFiberPattern::spigot_
private

Definition at line 24 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

int HcalFiberPattern::tb_
private

Definition at line 24 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().