CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Attributes | Private Attributes
ChannelPattern Class Reference

#include <HtrXmlPatternSet.h>

Public Member Functions

 ChannelPattern ()
 
void encode ()
 
void Fill (HtrXmlPatternToolParameters *params, HBHEDigiCollection::const_iterator data)
 
void Fill (HtrXmlPatternToolParameters *params, HFDigiCollection::const_iterator data)
 
void Fill (HtrXmlPatternToolParameters *params, HODigiCollection::const_iterator data)
 
void Fill_by_hand (const HcalElectronicsMap *, int)
 
int getChan () const
 
int getCoded (int bc) const
 
int getCrate () const
 
double getQuantized (int bc) const
 
int getSlot () const
 
int getTB () const
 
double & operator[] (int bc)
 
const double operator[] (int bc) const
 
void setLoc (int crate, int slot, int tb, int chan)
 

Static Public Attributes

static const int NUM_CRATES = 18
 
static const int NUM_SLOTS = 22
 
static const int SAMPLES = 512
 

Private Attributes

int fCCoded [SAMPLES]
 
double fCQuantized [SAMPLES]
 
double fCReal [SAMPLES]
 
int m_chan
 
int m_crate
 
int m_sample_pos
 
int m_slot
 
int m_tb
 

Detailed Description

Definition at line 8 of file HtrXmlPatternSet.h.

Constructor & Destructor Documentation

◆ ChannelPattern()

ChannelPattern::ChannelPattern ( )

Definition at line 5 of file HtrXmlPatternSet.cc.

References fCCoded, fCQuantized, fCReal, mps_fire::i, m_sample_pos, and SAMPLES.

5  {
6  for (int i = 0; i < SAMPLES; i++) {
7  fCReal[i] = 0;
8  fCCoded[i] = 0;
9  fCQuantized[i] = 0;
10  }
11  m_sample_pos = 0;
12 }
int fCCoded[SAMPLES]
double fCQuantized[SAMPLES]
static const int SAMPLES
double fCReal[SAMPLES]

Member Function Documentation

◆ encode()

void ChannelPattern::encode ( )

◆ Fill() [1/3]

void ChannelPattern::Fill ( HtrXmlPatternToolParameters params,
HBHEDigiCollection::const_iterator  data 
)

Definition at line 168 of file HtrXmlPatternSet.cc.

References data, fCCoded, fCQuantized, m_sample_pos, submitPVValidationJobs::params, SAMPLES, and EgammaValidation_cff::samples.

168  {
169  //first fill with pedestal value (currently hard-coded to 0)
170  for (int samples = 0; samples < params->m_samples_per_event; samples++) {
171  int index = m_sample_pos + samples;
172  if (index >= SAMPLES)
173  continue;
174 
175  fCCoded[index] = 0;
176  fCQuantized[index] = 0;
177  }
178 
179  //now fill with actual samples
180  for (int samples = 0; samples < data->size(); samples++) {
181  int index = m_sample_pos + params->m_presamples_per_event - data->presamples() + samples;
182  if (index < m_sample_pos || index >= (m_sample_pos + params->m_samples_per_event) || index >= SAMPLES)
183  continue;
184 
185  fCCoded[index] = data->sample(samples).adc();
186  fCQuantized[index] = data->sample(samples).nominal_fC();
187  }
188 
189  m_sample_pos += params->m_samples_per_event;
190 }
int fCCoded[SAMPLES]
double fCQuantized[SAMPLES]
static const int SAMPLES
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79

◆ Fill() [2/3]

void ChannelPattern::Fill ( HtrXmlPatternToolParameters params,
HFDigiCollection::const_iterator  data 
)

◆ Fill() [3/3]

void ChannelPattern::Fill ( HtrXmlPatternToolParameters params,
HODigiCollection::const_iterator  data 
)

◆ Fill_by_hand()

void ChannelPattern::Fill_by_hand ( const HcalElectronicsMap emap,
int  pattern_number 
)

Definition at line 14 of file HtrXmlPatternSet.cc.

References gather_cfg::cout, LEDCalibrationChannels::depth, HcalDetId::depth(), fCCoded, fCQuantized, mps_fire::i, HcalDetId::ietaAbs(), HcalDetId::iphi(), dqmiolumiharvest::j, HcalElectronicsMap::lookup(), m_chan, m_crate, m_slot, m_tb, NUM_CRATES, phi, SAMPLES, HcalElectronicsId::setHTR(), HcalDetId::subdet(), and HcalDetId::zside().

14  {
15  for (int iSample = 0; iSample < SAMPLES; iSample++) {
16  fCCoded[iSample] = 0;
17  fCQuantized[iSample] = 0;
18  }
19 
20  int dcc9[NUM_CRATES];
21  int dcc19[NUM_CRATES];
22  for (int jCrate = 0; jCrate < NUM_CRATES; jCrate++) {
23  dcc9[jCrate] = -1;
24  dcc19[jCrate] = -1;
25  }
26 
27  int iCrate;
28  iCrate = 4;
29  dcc9[iCrate] = 700;
30  dcc19[iCrate] = 701;
31  iCrate = 0;
32  dcc9[iCrate] = 702;
33  dcc19[iCrate] = 703;
34  iCrate = 1;
35  dcc9[iCrate] = 704;
36  dcc19[iCrate] = 705;
37  iCrate = 5;
38  dcc9[iCrate] = 706;
39  dcc19[iCrate] = 707;
40  iCrate = 11;
41  dcc9[iCrate] = 708;
42  dcc19[iCrate] = 709;
43  iCrate = 15;
44  dcc9[iCrate] = 710;
45  dcc19[iCrate] = 711;
46  iCrate = 17;
47  dcc9[iCrate] = 712;
48  dcc19[iCrate] = 713;
49  iCrate = 14;
50  dcc9[iCrate] = 714;
51  dcc19[iCrate] = 715;
52  iCrate = 10;
53  dcc9[iCrate] = 716;
54  dcc19[iCrate] = 717;
55  iCrate = 2;
56  dcc9[iCrate] = 718;
57  dcc19[iCrate] = 719;
58  iCrate = 9;
59  dcc9[iCrate] = 720;
60  dcc19[iCrate] = 721;
61  iCrate = 12;
62  dcc9[iCrate] = 722;
63  dcc19[iCrate] = 723;
64  iCrate = 3;
65  dcc9[iCrate] = 724;
66  dcc19[iCrate] = 725;
67  iCrate = 7;
68  dcc9[iCrate] = 726;
69  dcc19[iCrate] = 727;
70  iCrate = 6;
71  dcc9[iCrate] = 728;
72  dcc19[iCrate] = 729;
73  iCrate = 13;
74  dcc9[iCrate] = 730;
75  dcc19[iCrate] = 731;
76 
77  int* dcc = nullptr;
78  int spigot = -100;
79  if (m_slot >= 2 && m_slot <= 8) {
80  spigot = 2 * m_slot - m_tb - 3;
81  dcc = dcc9;
82  } else if (m_slot >= 13 && m_slot <= 18) {
83  spigot = 2 * m_slot - m_tb - 25;
84  dcc = dcc19;
85  } else
86  return;
87 
88  int fiber_channel = (m_chan - 1) % 3;
89  int fiber = (m_chan - fiber_channel - 1) / 3 + 1;
90  int dcc_num = dcc[m_crate] - 700;
91 
92  HcalElectronicsId heid(fiber_channel, fiber, spigot, dcc_num);
93  heid.setHTR(m_crate, m_slot, m_tb);
94 
95  //if (heid.readoutVMECrateId()!=m_crate) std::cout << "crate: " << heid.readoutVMECrateId() << "; " << m_crate << std::endl;
96  //if (heid.htrSlot()!=m_slot) std::cout << "slot: " << heid.htrSlot() << "; " << m_slot << std::endl;
97  //if (heid.htrTopBottom()!=m_tb) std::cout << "tb: " << heid.htrTopBottom() << "; " << m_tb << std::endl;
98  //if (heid.htrChanId()!=m_chan) std::cout << "chan: " << heid.htrChanId() << "; " << m_chan << std::endl;
99  //
100  //if (heid.readoutVMECrateId()==14 && heid.htrTopBottom()==0 && heid.htrChanId()==3) {
101  // std::cout << heid.rawId() << " " << heid << std::endl;
102  //}
103 
104  try {
105  const HcalDetId hdid = emap->lookup(heid);
106 
107  int etaabs = hdid.ietaAbs();
108  int phi = hdid.iphi();
109  int side = hdid.zside();
110  int depth = hdid.depth();
111  int subdet = hdid.subdet();
112 
114  if (pattern_number == 1) {
115  if (m_crate == 2 || m_crate == 9 || m_crate == 12)
116  return;
117  //fill only one channel per half-crate
118  if (m_slot != 2 && m_slot != 13)
119  return;
120  if (m_tb != 0)
121  return;
122  if (m_chan != 5)
123  return;
124 
125  //put some data here
126  fCCoded[31] = 17;
127  }
129  if (pattern_number == 2) {
130  if (depth > 1)
131  return;
132  if (subdet == 4 && etaabs < 30)
133  return;
134 
135  if ((etaabs + 2) % 4 != 0)
136  return;
137  int i = (etaabs + 2) / 4;
138  if (i < 1 || i > 7)
139  return;
140 
141  if ((phi + 3) % 4 != 0)
142  return;
143  int j = (phi + 3) / 4;
144  if (j < 1 || j > 18)
145  return;
146 
147  //add one to BX?
148  if (side < 0)
149  fCCoded[phi + 10] = i;
150  if (side > 0)
151  fCCoded[phi + 10] = i + 16;
152  }
154  if (pattern_number == 3) {
155  if (depth > 1 || etaabs != 18 || side != 1 || phi != 32)
156  return;
157  std::cout << "hello" << std::endl;
158  //add one to BX?
159  if (side > 0)
160  fCCoded[15] = 20;
161  }
162 
163  } catch (...) {
164  return;
165  }
166 }
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
const DetId lookup(HcalElectronicsId fId) const
lookup the logical detid associated with the given electronics id
int fCCoded[SAMPLES]
static const int NUM_CRATES
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
double fCQuantized[SAMPLES]
static const int SAMPLES
Readout chain identification for Hcal.
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ getChan()

int ChannelPattern::getChan ( ) const
inline

Definition at line 25 of file HtrXmlPatternSet.h.

References m_chan.

25 { return m_chan; }

◆ getCoded()

int ChannelPattern::getCoded ( int  bc) const
inline

Definition at line 29 of file HtrXmlPatternSet.h.

References fCCoded.

29 { return fCCoded[bc]; }
int fCCoded[SAMPLES]

◆ getCrate()

int ChannelPattern::getCrate ( ) const
inline

Definition at line 22 of file HtrXmlPatternSet.h.

References m_crate.

22 { return m_crate; }

◆ getQuantized()

double ChannelPattern::getQuantized ( int  bc) const
inline

Definition at line 30 of file HtrXmlPatternSet.h.

References fCQuantized.

30 { return fCQuantized[bc]; }
double fCQuantized[SAMPLES]

◆ getSlot()

int ChannelPattern::getSlot ( ) const
inline

Definition at line 23 of file HtrXmlPatternSet.h.

References m_slot.

23 { return m_slot; }

◆ getTB()

int ChannelPattern::getTB ( ) const
inline

Definition at line 24 of file HtrXmlPatternSet.h.

References m_tb.

24 { return m_tb; }

◆ operator[]() [1/2]

double& ChannelPattern::operator[] ( int  bc)
inline

Definition at line 26 of file HtrXmlPatternSet.h.

References fCReal.

26 { return fCReal[bc]; }
double fCReal[SAMPLES]

◆ operator[]() [2/2]

const double ChannelPattern::operator[] ( int  bc) const
inline

Definition at line 27 of file HtrXmlPatternSet.h.

References fCReal.

27 { return fCReal[bc]; }
double fCReal[SAMPLES]

◆ setLoc()

void ChannelPattern::setLoc ( int  crate,
int  slot,
int  tb,
int  chan 
)
inline

Definition at line 16 of file HtrXmlPatternSet.h.

References officialStyle::chan, m_chan, m_crate, m_slot, and m_tb.

16  {
17  m_crate = crate;
18  m_slot = slot;
19  m_tb = tb;
20  m_chan = chan;
21  }
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi...

Member Data Documentation

◆ fCCoded

int ChannelPattern::fCCoded[SAMPLES]
private

Definition at line 39 of file HtrXmlPatternSet.h.

Referenced by ChannelPattern(), Fill(), Fill_by_hand(), and getCoded().

◆ fCQuantized

double ChannelPattern::fCQuantized[SAMPLES]
private

Definition at line 38 of file HtrXmlPatternSet.h.

Referenced by ChannelPattern(), Fill(), Fill_by_hand(), and getQuantized().

◆ fCReal

double ChannelPattern::fCReal[SAMPLES]
private

Definition at line 37 of file HtrXmlPatternSet.h.

Referenced by ChannelPattern(), and operator[]().

◆ m_chan

int ChannelPattern::m_chan
private

Definition at line 40 of file HtrXmlPatternSet.h.

Referenced by Fill_by_hand(), getChan(), and setLoc().

◆ m_crate

int ChannelPattern::m_crate
private

Definition at line 40 of file HtrXmlPatternSet.h.

Referenced by Fill_by_hand(), getCrate(), and setLoc().

◆ m_sample_pos

int ChannelPattern::m_sample_pos
private

Definition at line 41 of file HtrXmlPatternSet.h.

Referenced by ChannelPattern(), and Fill().

◆ m_slot

int ChannelPattern::m_slot
private

Definition at line 40 of file HtrXmlPatternSet.h.

Referenced by Fill_by_hand(), getSlot(), and setLoc().

◆ m_tb

int ChannelPattern::m_tb
private

Definition at line 40 of file HtrXmlPatternSet.h.

Referenced by Fill_by_hand(), getTB(), and setLoc().

◆ NUM_CRATES

const int ChannelPattern::NUM_CRATES = 18
static

◆ NUM_SLOTS

const int ChannelPattern::NUM_SLOTS = 22
static

◆ SAMPLES

const int ChannelPattern::SAMPLES = 512
static