Belle II Software  release-08-01-10
SVDTransparentDigit.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #ifndef SVD_TRANSPARENT_DIGIT_H
10 #define SVD_TRANSPARENT_DIGIT_H
11 
12 #include <string>
13 #include <sstream>
14 
15 #include <vxd/dataobjects/VxdID.h>
16 
17 #include <framework/datastore/RelationsObject.h>
18 
19 namespace Belle2 {
35 
36  public:
37 
52  SVDTransparentDigit(const VxdID sensorID, const bool isU,
53  const unsigned short fadcID,
54  const unsigned short apvID,
55  const unsigned short nSample = 0,
56  const short** adc = nullptr,
57  const short* cmc1 = nullptr,
58  const short* cmc2 = nullptr,
59  const short** corradc = nullptr,
60  const short** fine_cmc1 = nullptr,
61  const short** fine_cmc2 = nullptr,
62  const short** fine_corradc = nullptr)
63  : m_sensorID(sensorID), m_isU(isU),
64  m_fadcID(fadcID), m_apvID(apvID), m_nSample(nSample)
65  {
66  if (adc != nullptr) {
67  for (int channel = 0; channel < 128; channel++) {
68  //for(int index=0;index<SVDPar::maxSample;index++) {
69  for (int index = 0; index < 6; index++) {
70  m_ADC[channel][index] = adc[channel][index];
71  }
72  }
73  } else {
74  memset(m_ADC, 0, sizeof(m_ADC));
75  }
76 
77  if (cmc1 != nullptr) {
78  //for(int index=0;index<SVDPar::maxSample;index++) {
79  for (int index = 0; index < 6; index++) {
80  m_cmc1[index] = cmc1[index];
81  }
82  } else {
83  memset(m_cmc1, 0, sizeof(m_cmc1));
84  }
85 
86  if (cmc2 != nullptr) {
87  //for(int index=0;index<SVDPar::maxSample;index++) {
88  for (int index = 0; index < 6; index++) {
89  m_cmc2[index] = cmc2[index];
90  }
91  } else {
92  memset(m_cmc2, 0, sizeof(m_cmc2));
93  }
94 
95  if (corradc != nullptr) {
96  for (int channel = 0; channel < 128; channel++) {
97  //for(int index=0;index<SVDPar::maxSample;index++) {
98  for (int index = 0; index < 6; index++) {
99  m_corrADC[channel][index] = corradc[channel][index];
100  }
101  }
102  } else {
103  memset(m_corrADC, 0, sizeof(m_corrADC));
104  }
105 
106  if (fine_cmc1 != nullptr) {
107  for (int channel = 0; channel < 128; channel++) {
108  //for(int index=0;index<SVDPar::maxSample;index++) {
109  for (int index = 0; index < 6; index++) {
110  m_fine_cmc1[channel][index] = fine_cmc1[channel][index];
111  }
112  }
113  } else {
114  memset(m_fine_cmc1, 0, sizeof(m_fine_cmc1));
115  }
116 
117  if (fine_cmc2 != nullptr) {
118  for (int channel = 0; channel < 128; channel++) {
119  //for(int index=0;index<SVDPar::maxSample;index++) {
120  for (int index = 0; index < 6; index++) {
121  m_fine_cmc2[channel][index] = fine_cmc2[channel][index];
122  }
123  }
124  } else {
125  memset(m_fine_cmc2, 0, sizeof(m_fine_cmc2));
126  }
127 
128  if (fine_corradc != nullptr) {
129  for (int channel = 0; channel < 128; channel++) {
130  //for(int index=0;index<SVDPar::maxSample;index++) {
131  for (int index = 0; index < 6; index++) {
132  m_fine_corrADC[channel][index] = fine_corradc[channel][index];
133  }
134  }
135  } else {
136  memset(m_fine_corrADC, 0, sizeof(m_fine_corrADC));
137  }
138  memset(m_cmc, 0, sizeof(m_cmc));
139  memset(m_fine_cmc, 0, sizeof(m_fine_cmc));
140  }
141 
144  : SVDTransparentDigit(0, true, 0, 0, 0, nullptr, nullptr, nullptr, nullptr)
145  {}
146 
150  VxdID getSensorID() const { return m_sensorID; }
151 
155  bool isUStrip() const { return m_isU; }
156 
160  unsigned short getFadcID() const { return m_fadcID; }
161 
165  unsigned short getApvID() const { return m_apvID; }
166 
170  unsigned short getNSample() const { return m_nSample; }
171 
175  const short* getADC(short channel) const
176  {
177  if (channel < 0 || 128 <= channel) return nullptr;
178  else return m_ADC[channel];
179  }
180 
184  short getADC(short channel, short index) const
185  {
186  //if(index<0||SVDPar::maxSample<=index) return -1;
187  if (index < 0 || 6 <= index) return -9999;
188  if (channel < 0 || 128 <= channel) return -9999;
189  return m_ADC[channel][index];
190  }
191 
195  const short* getCMC1() const { return m_cmc1; }
196 
200  short getCMC1(short index) const
201  {
202  if (index < 0 || 6 <= index) return -9999;
203  return m_cmc1[index];
204  }
205 
209  const short* getCMC2() const { return m_cmc2; }
213  short getCMC2(short index) const
214  {
215  if (index < 0 || 6 <= index) return -9999;
216  return m_cmc2[index];
217  }
218 
222  const short* getCMC() const { return m_cmc; }
226  short getCMC(short index) const
227  {
228  if (index < 0 || 6 <= index) return -9999;
229  return m_cmc[index] ;
230  }
231 
235  const short* getFineCMC1(short channel) const
236  {
237  if (channel < 0 || 128 <= channel) return nullptr;
238  return m_fine_cmc1[channel];
239  }
243  short getFineCMC1(short channel, short index) const
244  {
245  //if(index<0||SVDPar::maxSample<=index) return -1;
246  if (index < 0 || 6 <= index) return -9999;
247  if (channel < 0 || 128 <= channel) return -9999;
248  else return m_fine_cmc1[channel][index];
249  }
253  const short* getFineCMC2(short channel) const
254  {
255  if (channel < 0 || 128 <= channel) return nullptr;
256  return m_fine_cmc2[channel];
257  }
261  short getFineCMC2(short channel, short index) const
262  {
263  //if(index<0||SVDPar::maxSample<=index) return -1;
264  if (index < 0 || 6 <= index) return -9999;
265  if (channel < 0 || 128 <= channel) return -9999;
266  else return m_fine_cmc2[channel][index];
267  }
271  const short* getFineCMC(short channel) const
272  {
273  if (channel < 0 || 128 <= channel) return nullptr;
274  return m_fine_cmc[channel];
275  }
279  short getFineCMC(short channel, short index) const
280  {
281  //if(index<0||SVDPar::maxSample<=index) return -1;
282  if (index < 0 || 6 <= index) return -9999;
283  if (channel < 0 || 128 <= channel) return -9999;
284  else return m_fine_cmc[channel][index];
285  }
286 
290  const short* getCorrADC(short channel) const
291  {
292  if (channel < 0 || 128 <= channel) return nullptr;
293  return m_corrADC[channel];
294  }
298  short getCorrADC(short channel, short index) const
299  {
300  //if(index<0||SVDPar::maxSample<=index) return -1;
301  if (index < 0 || 6 <= index) return -9999;
302  if (channel < 0 || 128 <= channel) return -9999;
303  else return m_corrADC[channel][index];
304  }
305 
309  const short* getFineCorrADC(short channel) const
310  {
311  if (channel < 0 || 128 <= channel) return nullptr;
312  return m_fine_corrADC[channel];
313  }
317  short getFineCorrADC(short channel, short index) const
318  {
319  //if(index<0||SVDPar::maxSample<=index) return -1;
320  if (index < 0 || 6 <= index) return -9999;
321  if (channel < 0 || 128 <= channel) return -9999;
322  else return m_fine_corrADC[channel][index];
323  }
324 
325 
328  void setSensorID(VxdID vxdid) { m_sensorID = vxdid.getID(); }
329 
332  void setUStrip(bool isu) { m_isU = isu; }
333 
336  void setFadcID(unsigned short fadcID) { m_fadcID = fadcID; }
337 
340  void setApvID(unsigned short apvID) { m_apvID = apvID; }
341 
344  void setNSample(unsigned short nSample) { m_nSample = nSample; }
345 
348  void setADC(short** adc)
349  {
350  if (adc != nullptr) {
351  for (int channel = 0; channel < 128; channel++) {
352  //for(int index=0;index<SVDPar::maxSample;index++) {
353  for (int index = 0; index < 6; index++) {
354  m_ADC[channel][index] = adc[channel][index];
355  }
356  }
357  }
358  }
361  void setADC(short* adc, short channel)
362  {
363  if (adc != nullptr) {
364  //for(int index=0;index<SVDPar::maxSample;index++) {
365  for (int index = 0; index < 6; index++) {
366  m_ADC[channel][index] = adc[index];
367  }
368  }
369  }
372  void setADC(short adc, short channel, short index)
373  {
374  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
375  m_ADC[channel][index] = adc;
376  }
377 
380  void setCMC1(short* cmc1)
381  {
382  for (int index = 0; index < 6; index++) {
383  m_cmc1[index] = cmc1[index];
384  }
385  }
386 
389  void setCMC1(short cmc1, int index)
390  {
391  if (0 <= index && index < 6) m_cmc1[index] = cmc1;
392  }
393 
396  void setCMC2(short* cmc2)
397  {
398  for (int index = 0; index < 6; index++) {
399  m_cmc2[index] = cmc2[index];
400  }
401  }
404  void setCMC2(short cmc2, int index)
405  {
406  if (0 <= index && index < 6) m_cmc2[index] = cmc2;
407  }
408 
411  void setCMC(short* cmc)
412  {
413  for (int index = 0; index < 6; index++) {
414  m_cmc[index] = cmc[index];
415  }
416  }
419  void setCMC(short cmc, int index)
420  {
421  if (0 <= index && index < 6) m_cmc[index] = cmc;
422  }
423 
426  void setFineCMC1(short** fine_cmc1)
427  {
428  if (fine_cmc1 != nullptr) {
429  for (int channel = 0; channel < 128; channel++) {
430  //for(int index=0;index<SVDPar::maxSample;index++) {
431  for (int index = 0; index < 6; index++) {
432  m_fine_cmc1[channel][index] = fine_cmc1[channel][index];
433  }
434  }
435  }
436  }
439  void setFineCMC1(short* fine_cmc1, short channel)
440  {
441  if (fine_cmc1 != nullptr) {
442  //for(int index=0;index<SVDPar::maxSample;index++) {
443  for (int index = 0; index < 6; index++) {
444  m_fine_cmc1[channel][index] = fine_cmc1[index];
445  }
446  }
447  }
450  void setFineCMC1(short fine_cmc1, short channel, short index)
451  {
452  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
453  m_fine_cmc1[channel][index] = fine_cmc1;
454  }
455 
458  void setFineCMC2(short** fine_cmc2)
459  {
460  if (fine_cmc2 != nullptr) {
461  for (int channel = 0; channel < 128; channel++) {
462  //for(int index=0;index<SVDPar::maxSample;index++) {
463  for (int index = 0; index < 6; index++) {
464  m_fine_cmc2[channel][index] = fine_cmc2[channel][index];
465  }
466  }
467  }
468  }
471  void setFineCMC2(short* fine_cmc2, short channel)
472  {
473  if (fine_cmc2 != nullptr) {
474  //for(int index=0;index<SVDPar::maxSample;index++) {
475  for (int index = 0; index < 6; index++) {
476  m_fine_cmc2[channel][index] = fine_cmc2[index];
477  }
478  }
479  }
482  void setFineCMC2(short fine_cmc2, short channel, short index)
483  {
484  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
485  m_fine_cmc2[channel][index] = fine_cmc2;
486  }
487 
490  void setFineCMC(short** fine_cmc)
491  {
492  if (fine_cmc != nullptr) {
493  for (int channel = 0; channel < 128; channel++) {
494  //for(int index=0;index<SVDPar::maxSample;index++) {
495  for (int index = 0; index < 6; index++) {
496  m_fine_cmc[channel][index] = fine_cmc[channel][index];
497  }
498  }
499  }
500  }
503  void setFineCMC(short* fine_cmc, short channel)
504  {
505  if (fine_cmc != nullptr) {
506  //for(int index=0;index<SVDPar::maxSample;index++) {
507  for (int index = 0; index < 6; index++) {
508  m_fine_cmc[channel][index] = fine_cmc[index];
509  }
510  }
511  }
514  void setFineCMC(short fine_cmc, short channel, short index)
515  {
516  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
517  m_fine_cmc[channel][index] = fine_cmc;
518  }
519 
522  void setCorrADC(short** corradc)
523  {
524  if (corradc != nullptr) {
525  for (int channel = 0; channel < 128; channel++) {
526  //for(int index=0;index<SVDPar::maxSample;index++) {
527  for (int index = 0; index < 6; index++) {
528  m_corrADC[channel][index] = corradc[channel][index];
529  }
530  }
531  }
532  }
535  void setCorrADC(short* corradc, short channel)
536  {
537  if (corradc != nullptr) {
538  //for(int index=0;index<SVDPar::maxSample;index++) {
539  for (int index = 0; index < 6; index++) {
540  m_corrADC[channel][index] = corradc[index];
541  }
542  }
543  }
546  void setCorrADC(short corradc, short channel, short index)
547  {
548  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
549  m_corrADC[channel][index] = corradc;
550  }
551 
554  void setFineCorrADC(short** corradc)
555  {
556  if (corradc != nullptr) {
557  for (int channel = 0; channel < 128; channel++) {
558  //for(int index=0;index<SVDPar::maxSample;index++) {
559  for (int index = 0; index < 6; index++) {
560  m_fine_corrADC[channel][index] = corradc[channel][index];
561  }
562  }
563  }
564  }
567  void setFineCorrADC(short* corradc, short channel)
568  {
569  if (corradc != nullptr) {
570  //for(int index=0;index<SVDPar::maxSample;index++) {
571  for (int index = 0; index < 6; index++) {
572  m_fine_corrADC[channel][index] = corradc[index];
573  }
574  }
575  }
578  void setFineCorrADC(short corradc, short channel, short index)
579  {
580  if (0 <= index && index < 6 && 0 <= channel && channel < 128)
581  m_fine_corrADC[channel][index] = corradc;
582  }
583 
586  std::string print()
587  {
588  VxdID thisSensorID = static_cast<VxdID>(m_sensorID);
589  VxdID::baseType id = thisSensorID.getID();
590  VxdID::baseType layer = thisSensorID.getLayerNumber();
591  VxdID::baseType ladder = thisSensorID.getLadderNumber();
592  VxdID::baseType sensor = thisSensorID.getSensorNumber();
593  VxdID::baseType segment = thisSensorID.getSegmentNumber();
594 
595  std::ostringstream os;
596  os << std::endl;
597  os << "Sensor ID : " << m_sensorID << ", (VXD ID: " << id << ")" << std::endl;
598  os << "(layer: " << layer << ", ladder: " << ladder
599  << ", sensor: " << sensor << ", segment: " << segment << ")"
600  << std::endl;
601  if (m_isU)
602  os << "Strip side : U" << std::endl;
603  else
604  os << "Strip side : V" << std::endl;
605 
606  return os.str();
607  }
608 
609  private:
610 
611  unsigned short m_sensorID;
612  bool m_isU;
614  unsigned short m_fadcID;
615  unsigned short m_apvID;
617  unsigned short m_nSample;
619  //int m_ADC[SVDPar::maxSample]; /**< ADC values fo strip signal. Index represents samples.*/
620  short m_ADC[128][6];
622  short m_cmc1[6];
623  short m_cmc2[6];
624  short m_cmc[6];
626  short m_fine_cmc1[128][6];
627  short m_fine_cmc2[128][6];
628  short m_fine_cmc [128][6];
630  short m_corrADC[128][6];
631  short m_fine_corrADC[128][6];
634 
635  }; // class SVDTransparentDigit
636 
637 
639 } // end namespace Belle2
640 
641 #endif
Defines interface for accessing relations of objects in StoreArray.
ClassDef(RelationsInterface, 0)
defines interface for accessing relations of objects in StoreArray.
short m_fine_cmc[128][6]
Channel-dependent total common-mode correction values.
unsigned short m_apvID
APV25 ID.
void setFadcID(unsigned short fadcID)
Set FADC ID.
void setFineCMC(short **fine_cmc)
Set CMC values.
const short * getADC(short channel) const
Get ADC value.
const short * getCorrADC(short channel) const
Get corrected ADC value with pedestal and common-mode.
unsigned short getFadcID() const
Get FADC ID.
void setADC(short adc, short channel, short index)
Set ADC values.
void setFineCMC2(short *fine_cmc2, short channel)
Set channel-dependent 2nd CMC values.
unsigned short m_nSample
Number of samples.
void setNSample(unsigned short nSample)
Set number of samples.
short m_cmc2[6]
2nd common-mode correction values.
const short * getFineCMC2(short channel) const
Get 2nd fine commom-mode correction value.
SVDTransparentDigit(const VxdID sensorID, const bool isU, const unsigned short fadcID, const unsigned short apvID, const unsigned short nSample=0, const short **adc=nullptr, const short *cmc1=nullptr, const short *cmc2=nullptr, const short **corradc=nullptr, const short **fine_cmc1=nullptr, const short **fine_cmc2=nullptr, const short **fine_corradc=nullptr)
Useful Constructor.
bool m_isU
True if U, false if V.
SVDTransparentDigit()
Default constructor for the ROOT IO.
void setFineCorrADC(short *corradc, short channel)
Set precisely corrected ADC values.
void setFineCorrADC(short corradc, short channel, short index)
Set precisely corrected ADC values.
void setCorrADC(short *corradc, short channel)
Set corrected ADC values.
void setFineCMC2(short **fine_cmc2)
Set channel-dependent 2nd CMC values.
unsigned short m_sensorID
Compressed sensor identifier.
short m_fine_cmc1[128][6]
Channel-dependent 1st common-mode correction values.
unsigned short m_fadcID
FADC ID.
void setFineCorrADC(short **corradc)
Set precisely corrected ADC values.
void setFineCMC2(short fine_cmc2, short channel, short index)
Set channel-dependent 2nd CMC values.
void setCMC(short cmc, int index)
Set Total commom-mode correction value.
const short * getFineCMC1(short channel) const
Get 1st fine commom-mode correction value.
short getFineCMC(short channel, short index) const
Get total fine commom-mode correction value.
void setCMC2(short *cmc2)
Set 2nd commom-mode correction value.
void setCMC1(short cmc1, int index)
Set 1st commom-mode correction value.
const short * getCMC2() const
Get 2nd commom-mode correction value.
short m_corrADC[128][6]
ADC values of strip signal corrected by pedestal and commom-mode.
short getFineCMC1(short channel, short index) const
Get 1st fine commom-mode correction value.
void setFineCMC1(short **fine_cmc1)
Set channel-dependent 1st CMC values.
const short * getFineCMC(short channel) const
Get total fine commom-mode correction value.
void setCorrADC(short **corradc)
Set corrected ADC values.
short getCMC2(short index) const
Get 2nd commom-mode correction value.
unsigned short getNSample() const
Get number of samples.
const short * getCMC1() const
Get 1st commom-mode correction value.
short getFineCorrADC(short channel, short index) const
Get precisely corrected ADC value with pedestal and fine common-mode.
void setFineCMC1(short fine_cmc1, short channel, short index)
Set channel-dependent 1st CMC values.
void setUStrip(bool isu)
Set strip direction.
void setCorrADC(short corradc, short channel, short index)
Set corrected ADC values.
short getCorrADC(short channel, short index) const
Get corrected ADC value with pedestal and common-mode.
std::string print()
Display main parameters in this object.
short m_fine_corrADC[128][6]
ADC values of strip signal precisely corrected by pedestal and fine commom-mode.
void setCMC1(short *cmc1)
Set 1st commom-mode correction value.
void setSensorID(VxdID vxdid)
Set the sensor ID.
VxdID getSensorID() const
Get the sensor ID.
void setFineCMC(short fine_cmc, short channel, short index)
Set channel-dependent CMC values.
short getCMC(short index) const
Get total commom-mode correction value.
void setFineCMC1(short *fine_cmc1, short channel)
Set channel-dependent 1st CMC values.
const short * getFineCorrADC(short channel) const
Get precisely corrected ADC value with pedestal and fine common-mode.
void setApvID(unsigned short apvID)
Set APV ID.
short getCMC1(short index) const
Get 1st commom-mode correction value.
bool isUStrip() const
Get strip direction.
short m_ADC[128][6]
ADC values of strip signal.
short getFineCMC2(short channel, short index) const
Get 2nd fine commom-mode correction value.
const short * getCMC() const
Get total commom-mode correction value.
void setFineCMC(short *fine_cmc, short channel)
Set channel-dependent CMC values.
void setADC(short *adc, short channel)
Set ADC values.
unsigned short getApvID() const
Get APV ID.
void setCMC2(short cmc2, int index)
Set 2nd commom-mode correction value.
short m_cmc1[6]
1st common-mode correction values.
void setADC(short **adc)
Set ADC values.
short m_fine_cmc2[128][6]
Channel-dependent 2nd common-mode correction values.
short getADC(short channel, short index) const
Get ADC value.
short m_cmc[6]
total common-mode correction values.
void setCMC(short *cmc)
Set Total commom-mode correction value.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
baseType getID() const
Get the unique id.
Definition: VxdID.h:94
baseType getSensorNumber() const
Get the sensor id.
Definition: VxdID.h:100
baseType getSegmentNumber() const
Get the sensor segment.
Definition: VxdID.h:102
unsigned short baseType
The base integer type for VxdID.
Definition: VxdID.h:36
baseType getLadderNumber() const
Get the ladder id.
Definition: VxdID.h:98
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
Abstract base class for different kinds of events.