test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( )

Definition at line 5 of file HtrXmlPatternSet.cc.

References fCCoded, fCQuantized, fCReal, 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 i
Definition: DBlmapReader.cc:9
int fCCoded[SAMPLES]
double fCQuantized[SAMPLES]
static const int SAMPLES
double fCReal[SAMPLES]

Member Function Documentation

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

Definition at line 123 of file HtrXmlPatternSet.cc.

References fCCoded, fCQuantized, cmsHarvester::index, HtrXmlPatternToolParameters::m_presamples_per_event, m_sample_pos, HtrXmlPatternToolParameters::m_samples_per_event, and SAMPLES.

Referenced by HtrXmlPatternTool::Fill().

123  {
124  //first fill with pedestal value (currently hard-coded to 0)
125  for (int samples=0; samples<params->m_samples_per_event; samples++) {
126  int index = m_sample_pos + samples;
127  if (index>=SAMPLES) continue;
128 
129  fCCoded [index] = 0;
130  fCQuantized[index] = 0;
131  }
132 
133  //now fill with actual samples
134  for (int samples=0; samples<data->size(); samples++) {
135  int index = m_sample_pos + params->m_presamples_per_event - data->presamples() + samples;
136  if (index<m_sample_pos ||
137  index>=(m_sample_pos+params->m_samples_per_event) ||
138  index>=SAMPLES) continue;
139 
140  fCCoded [index] = data->sample(samples).adc();
141  fCQuantized[index] = data->sample(samples).nominal_fC();
142  }
143 
145 }
int fCCoded[SAMPLES]
double fCQuantized[SAMPLES]
static const int SAMPLES
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ChannelPattern::Fill ( HtrXmlPatternToolParameters params,
HFDigiCollection::const_iterator  data 
)

Definition at line 147 of file HtrXmlPatternSet.cc.

References fCCoded, fCQuantized, cmsHarvester::index, HtrXmlPatternToolParameters::m_presamples_per_event, m_sample_pos, HtrXmlPatternToolParameters::m_samples_per_event, and SAMPLES.

147  {
148  //first fill with pedestal value (currently hard-coded to 0)
149  for (int samples=0; samples<params->m_samples_per_event; samples++) {
150  int index = m_sample_pos + samples;
151  if (index>=SAMPLES) continue;
152 
153  fCCoded [index] = 0;
154  fCQuantized[index] = 0;
155  }
156 
157  //now fill with actual samples
158  for (int samples=0; samples<data->size(); samples++) {
159  int index = m_sample_pos + params->m_presamples_per_event - data->presamples() + samples;
160  if (index<m_sample_pos ||
161  index>=(m_sample_pos+params->m_samples_per_event) ||
162  index>=SAMPLES) continue;
163 
164  fCCoded [index] = data->sample(samples).adc();
165  fCQuantized[index] = data->sample(samples).nominal_fC();
166  }
167 
169 }
int fCCoded[SAMPLES]
double fCQuantized[SAMPLES]
static const int SAMPLES
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void ChannelPattern::Fill ( HtrXmlPatternToolParameters params,
HODigiCollection::const_iterator  data 
)

Definition at line 171 of file HtrXmlPatternSet.cc.

References fCCoded, fCQuantized, cmsHarvester::index, HtrXmlPatternToolParameters::m_presamples_per_event, m_sample_pos, HtrXmlPatternToolParameters::m_samples_per_event, and SAMPLES.

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

Definition at line 14 of file HtrXmlPatternSet.cc.

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

Referenced by HtrXmlPattern::do_hand_fill().

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

Definition at line 20 of file HtrXmlPatternSet.h.

References m_chan.

20 { return m_chan; }
int ChannelPattern::getCoded ( int  bc) const
inline

Definition at line 24 of file HtrXmlPatternSet.h.

References fCCoded.

Referenced by HtrXmlPatternTool::createHists(), and HtrXmlPatternWriter::writePattern().

24 { return fCCoded[bc]; }
int fCCoded[SAMPLES]
int ChannelPattern::getCrate ( ) const
inline

Definition at line 17 of file HtrXmlPatternSet.h.

References m_crate.

17 { return m_crate; }
double ChannelPattern::getQuantized ( int  bc) const
inline

Definition at line 25 of file HtrXmlPatternSet.h.

References fCQuantized.

Referenced by HtrXmlPatternTool::createHists().

25 { return fCQuantized[bc]; }
double fCQuantized[SAMPLES]
int ChannelPattern::getSlot ( ) const
inline

Definition at line 18 of file HtrXmlPatternSet.h.

References m_slot.

18 { return m_slot; }
int ChannelPattern::getTB ( ) const
inline

Definition at line 19 of file HtrXmlPatternSet.h.

References m_tb.

19 { return m_tb; }
double& ChannelPattern::operator[] ( int  bc)
inline

Definition at line 21 of file HtrXmlPatternSet.h.

References fCReal.

21 { return fCReal[bc]; }
double fCReal[SAMPLES]
const double ChannelPattern::operator[] ( int  bc) const
inline

Definition at line 22 of file HtrXmlPatternSet.h.

References fCReal.

22 { return fCReal[bc]; }
double fCReal[SAMPLES]
void ChannelPattern::setLoc ( int  crate,
int  slot,
int  tb,
int  chan 
)
inline

Definition at line 16 of file HtrXmlPatternSet.h.

References m_chan, m_crate, m_slot, and m_tb.

Member Data Documentation

int ChannelPattern::fCCoded[SAMPLES]
private

Definition at line 33 of file HtrXmlPatternSet.h.

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

double ChannelPattern::fCQuantized[SAMPLES]
private

Definition at line 32 of file HtrXmlPatternSet.h.

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

double ChannelPattern::fCReal[SAMPLES]
private

Definition at line 31 of file HtrXmlPatternSet.h.

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

int ChannelPattern::m_chan
private

Definition at line 34 of file HtrXmlPatternSet.h.

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

int ChannelPattern::m_crate
private

Definition at line 34 of file HtrXmlPatternSet.h.

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

int ChannelPattern::m_sample_pos
private

Definition at line 35 of file HtrXmlPatternSet.h.

Referenced by ChannelPattern(), and Fill().

int ChannelPattern::m_slot
private

Definition at line 34 of file HtrXmlPatternSet.h.

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

int ChannelPattern::m_tb
private

Definition at line 34 of file HtrXmlPatternSet.h.

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

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