er  dev
WCalHit.cxx
1 /*
2  * WCalHit.cpp
3  *
4  * Created on: Apr 7, 2017
5  * Author: vratik
6  */
7 
8 #include "WCalHit.h"
9 
10 WCalHit::WCalHit() :
11 //fTimestamp(0),
12 fChannel(0),
13 //fRawAdcVal(0),
14 //fAdcVal(0),
15 fAdcCal(0.)
16 {
17  //todo
18 // fXpixel = -1;
19 // fYpixel = -1;
20 
21  for (UInt_t i=0; i<8; i++) {
22 // fPixelFromFebCh[i*8+0] = i*8+1;
23 // fPixelFromFebCh[i*8+1] = i*8+5;
24 // fPixelFromFebCh[i*8+2] = i*8+3;
25 // fPixelFromFebCh[i*8+3] = i*8+7;
26 // fPixelFromFebCh[i*8+4] = i*8+2;
27 // fPixelFromFebCh[i*8+5] = i*8+6;
28 // fPixelFromFebCh[i*8+6] = i*8+4;
29 // fPixelFromFebCh[i*8+7] = i*8+8;
30 
31  fPixelFromFebCh[i*8+0] = i*8;
32  fPixelFromFebCh[i*8+1] = i*8+4;
33  fPixelFromFebCh[i*8+2] = i*8+2;
34  fPixelFromFebCh[i*8+3] = i*8+6;
35  fPixelFromFebCh[i*8+4] = i*8+1;
36  fPixelFromFebCh[i*8+5] = i*8+5;
37  fPixelFromFebCh[i*8+6] = i*8+3;
38  fPixelFromFebCh[i*8+7] = i*8+7;
39  }
40 
41 }
42 
43 WCalHit::WCalHit(UChar_t p_ch, Int_t p_adc, Float_t p_adcNonLin, Float_t p_adcNonLinCorr, Float_t p_adcCalib) :
44 // fTimestamp(p_ts),
45  fChannel(p_ch),
46  fAdcVal(p_adc),
47  fAdcNonLin(p_adcNonLin),
48  fAdcNonLinCorr(p_adcNonLinCorr),
49  fAdcCal(p_adcCalib)
50 {
51 
52  for (UInt_t i=0; i<8; i++) {
53  fPixelFromFebCh[i*8+0] = i*8;
54  fPixelFromFebCh[i*8+1] = i*8+4;
55  fPixelFromFebCh[i*8+2] = i*8+2;
56  fPixelFromFebCh[i*8+3] = i*8+6;
57  fPixelFromFebCh[i*8+4] = i*8+1;
58  fPixelFromFebCh[i*8+5] = i*8+5;
59  fPixelFromFebCh[i*8+6] = i*8+3;
60  fPixelFromFebCh[i*8+7] = i*8+7;
61  }
62 
63  SetXY();
64 
65 // std::cout << "!!!!\t" << fAdcCalibrated << std::endl;
66 }
67 
68 WCalHit::~WCalHit() {
69  // TODO Auto-generated destructor stub
70  Clear();
71 }
72 
73 void WCalHit::Clear(Option_t * /*option*/)
74 {
75  TObject::Clear();
76 }
77 
78 WCalHit &WCalHit::operator=(const WCalHit &orig)
79 {
80  TObject::operator=(orig);
81 
82 // fTimestamp = orig.fTimestamp;
83  fChannel = orig.fChannel;
84 // fRawAdcVal = orig.fRawAdcVal;
85 // fAdcVal = orig.fAdcVal;
86  fAdcCal = orig.fAdcCal;
87 
88  return *this;
89 }
90 
91 void WCalHit::SetXY() {
92 
93  if (fChannel >= 0 && fChannel < 64) {
94  UInt_t v_pixelID = fPixelFromFebCh[(Int_t)fChannel];
95 // std::cout << (Int_t)fChannel << "\t" << v_pixelID << std::endl;
96 
97 // fXpixel = (fChannel)%8;
98 // fYpixel = -(fChannel)/8;
99 
100  fXpixel = (v_pixelID)%8;
101  fYpixel = -((v_pixelID)/8);
102 
103 // std::cout << fXpixel << "\t" << fYpixel << std::endl;
104 
105 // *o_row = (v_pixelID-1)/8;
106 // *o_col = (v_pixelID-1)%8;
107 // return 1; // OK
108 
109  } else {
110 // return 0; // FAIL
111  }
112 
113 }