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.

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

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 }
std::vector< uint32_t > pattern_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
static int setIf(const std::string &name, const std::map< std::string, std::string > &params)

Member Function Documentation

◆ crate()

int HcalFiberPattern::crate ( ) const
inline

Definition at line 19 of file HcalFiberPattern.h.

References crate_.

19 { return crate_; }

◆ fiber()

int HcalFiberPattern::fiber ( ) const
inline

Definition at line 21 of file HcalFiberPattern.h.

References fiber_.

21 { return fiber_; }

◆ getId()

HcalElectronicsId HcalFiberPattern::getId ( int  fiberChan)

Definition at line 68 of file HcalFiberPattern.cc.

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

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

◆ getSamples()

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

Definition at line 49 of file HcalFiberPattern.cc.

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

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 }
std::vector< uint32_t > pattern_
HcalQIESample unpack(int bc, int fc)

◆ slot()

int HcalFiberPattern::slot ( void  ) const
inline

Definition at line 20 of file HcalFiberPattern.h.

References slot_.

20 { return slot_; }

◆ unpack()

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

Definition at line 22 of file HcalFiberPattern.cc.

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

Referenced by getSamples().

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 }
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
weight_default_t w1[2000]
Definition: w1.h:9
std::vector< uint32_t > pattern_
uint16_t *__restrict__ uint16_t const *__restrict__ adc

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