CMS 3D CMS Logo

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::HcalFiberPattern ( const std::map< std::string, std::string > &  params,
const std::vector< uint32_t > &  data 
)

Definition at line 12 of file HcalFiberPattern.cc.

13  : pattern_(data) {
14  crate_ = setIf("CRATE", params);
15  slot_ = setIf("SLOT", params);
16  fiber_ = setIf("FIBER", params);
17  dcc_ = setIf("DCC", params);
18  spigot_ = setIf("SPIGOT", params);
19  tb_ = setIf("TOPBOTTOM", params);
20 }

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

Member Function Documentation

◆ crate()

int HcalFiberPattern::crate ( ) const
inline

Definition at line 19 of file HcalFiberPattern.h.

19 { return crate_; }

References crate_.

◆ fiber()

int HcalFiberPattern::fiber ( ) const
inline

Definition at line 21 of file HcalFiberPattern.h.

21 { return fiber_; }

References fiber_.

◆ getId()

HcalElectronicsId HcalFiberPattern::getId ( int  fiberChan)

Definition at line 68 of file HcalFiberPattern.cc.

68  {
69  HcalElectronicsId retval(fiberChan, fiber_, spigot_, dcc_);
70  retval.setHTR(crate_, slot_, tb_);
71  return retval;
72 }

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

◆ getSamples()

std::vector< HcalQIESample > HcalFiberPattern::getSamples ( int  bunch,
int  npresamples,
int  nsamples,
int  fiberChan 
)

Definition at line 49 of file HcalFiberPattern.cc.

49  {
50  if (bunch < npresamples)
51  throw cms::Exception("InvalidArgument")
52  << "Asked for " << npresamples << " presamples with event at bunch " << bunch;
53  if (nsamples - npresamples + bunch >= (int)(pattern_.size() / 2))
54  throw cms::Exception("InvalidArgument")
55  << "Asked for " << nsamples << " with event at " << bunch << " and " << npresamples << " presamples, but only "
56  << pattern_.size() / 2 << " bunches are available";
57 
58  std::vector<HcalQIESample> retval;
59  retval.reserve(nsamples);
60 
61  for (int i = 0; i < nsamples; i++) {
62  int bc = bunch + i - npresamples;
63  retval.push_back(unpack(bc, fiberChan));
64  }
65  return retval;
66 }

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

◆ slot()

int HcalFiberPattern::slot ( void  ) const
inline

Definition at line 20 of file HcalFiberPattern.h.

20 { return slot_; }

References slot_.

◆ unpack()

HcalQIESample HcalFiberPattern::unpack ( int  bc,
int  fc 
)
private

Definition at line 22 of file HcalFiberPattern.cc.

22  {
23  uint32_t w1 = pattern_[bc * 2]; // lsw
24  uint32_t w2 = pattern_[bc * 2 + 1]; // msw
25 
26  int adc = 0, capid = 0;
27  bool dv = (w1 & 0x10000) != 0;
28  bool er = (w1 & 0x20000) != 0;
29 
30  switch (fc) {
31  case (0):
32  adc = (w2 & 0xFE00) >> 9;
33  capid = (w1 & 0x0180) >> 7;
34  break;
35  case (1):
36  adc = (w2 & 0xFE) >> 1;
37  capid = (w1 & 0x0060) >> 5;
38  break;
39  case (2):
40  adc = (w1 & 0xFE00) >> 9;
41  capid = (w1 & 0x0018) >> 3;
42  break;
43  default:
44  break;
45  }
46  return HcalQIESample(adc, capid, fiber_, fc, dv, er);
47 }

References gpuClustering::adc, fiber_, pattern_, and w2.

Referenced by getSamples().

Member Data Documentation

◆ crate_

int HcalFiberPattern::crate_
private

Definition at line 25 of file HcalFiberPattern.h.

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

◆ dcc_

int HcalFiberPattern::dcc_
private

Definition at line 25 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

◆ fiber_

int HcalFiberPattern::fiber_
private

Definition at line 25 of file HcalFiberPattern.h.

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

◆ pattern_

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

Definition at line 26 of file HcalFiberPattern.h.

Referenced by getSamples(), and unpack().

◆ slot_

int HcalFiberPattern::slot_
private

Definition at line 25 of file HcalFiberPattern.h.

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

◆ spigot_

int HcalFiberPattern::spigot_
private

Definition at line 25 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

◆ tb_

int HcalFiberPattern::tb_
private

Definition at line 25 of file HcalFiberPattern.h.

Referenced by getId(), and HcalFiberPattern().

w2
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
mps_fire.i
i
Definition: mps_fire.py:428
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
gpuClustering::adc
uint16_t *__restrict__ uint16_t const *__restrict__ adc
Definition: gpuClusterChargeCut.h:20
HcalFiberPattern::spigot_
int spigot_
Definition: HcalFiberPattern.h:25
HcalFiberPattern::crate_
int crate_
Definition: HcalFiberPattern.h:25
HcalFiberPattern::unpack
HcalQIESample unpack(int bc, int fc)
Definition: HcalFiberPattern.cc:22
HcalQIESample
Definition: HcalQIESample.h:32
HcalFiberPattern::pattern_
std::vector< uint32_t > pattern_
Definition: HcalFiberPattern.h:26
HcalFiberPattern::tb_
int tb_
Definition: HcalFiberPattern.h:25
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
HcalFiberPattern::dcc_
int dcc_
Definition: HcalFiberPattern.h:25
HcalFiberPattern::slot_
int slot_
Definition: HcalFiberPattern.h:25
HcalFiberPattern::fiber_
int fiber_
Definition: HcalFiberPattern.h:25
Exception
Definition: hltDiff.cc:245
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
setIf
static int setIf(const std::string &name, const std::map< std::string, std::string > &params)
Definition: HcalFiberPattern.cc:4