StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuRHICfHit.cxx
1 #include "StMuRHICfHit.h"
2 
3 ClassImp(StMuRHICfHit)
4 
5 #define RHICF_MAXLAYER_TOWERNUM 2
6 #define RHICF_SINGLE_TOWERNUM 8
7 #define RHICF_MULTI_TOWERNUM 16
8 #define RHICF_MAXLAYER_INDEX(a, b) (2*a+b)
9 #define RHICF_SINGLE_INDEX(a, b, c) (8*a+2*b+c)
10 #define RHICF_MULTI_INDEX(a, b, c, d) (16*a+4*b+2*c+d)
11 
12 StMuRHICfHit::StMuRHICfHit()
13 {
14  mIsSaveDataArray = false;
15  clear();
16 }
17 
18 StMuRHICfHit::~StMuRHICfHit()
19 {
20 }
21 
22 void StMuRHICfHit::clear()
23 {
24  memset(mPlateE, 0., sizeof(mPlateE));
25  memset(mGSOBarSmallE, 0., sizeof(mGSOBarSmallE));
26  memset(mGSOBarLargeE, 0., sizeof(mGSOBarLargeE));
27 
28  if(mIsSaveDataArray){
29  mL20 -> Reset();
30  mL90 -> Reset();
31  mGSOMaxLayer -> Reset();
32  mMaxPeakBin -> Reset();
33  mSingleHitNum -> Reset();
34  mSingleHitPos -> Reset();
35  mSinglePeakHeight -> Reset();
36  mSingleChiSquare -> Reset();
37  mMultiHitNum -> Reset();
38  mMultiHitPos -> Reset();
39  mMultiPeakHeight -> Reset();
40  mMultiPeakRaw-> Reset();
41  mMultiEnergySum -> Reset();
42  mMultiChiSquare -> Reset();
43  }
44 }
45 
46 void StMuRHICfHit::initDataArray()
47 {
48  mIsSaveDataArray = true;
49  mL20 = new TArrayF(RHICF_MAXLAYER_TOWERNUM);
50  mL90 = new TArrayF(RHICF_MAXLAYER_TOWERNUM);
51 
52  mGSOMaxLayer = new TArrayI(2*RHICF_MAXLAYER_TOWERNUM);
53  mMaxPeakBin = new TArrayI(2*RHICF_SINGLE_TOWERNUM);
54 
55  mSingleHitNum = new TArrayI(2*RHICF_SINGLE_TOWERNUM);
56  mSingleHitPos = new TArrayF(2*RHICF_SINGLE_TOWERNUM);
57  mSinglePeakHeight = new TArrayF(2*RHICF_SINGLE_TOWERNUM);
58  mSingleChiSquare = new TArrayF(2*RHICF_SINGLE_TOWERNUM);
59 
60  mMultiHitNum = new TArrayI(RHICF_MAXLAYER_TOWERNUM);
61  mMultiHitPos = new TArrayF(2*RHICF_MULTI_TOWERNUM);
62  mMultiPeakHeight = new TArrayF(2*RHICF_MULTI_TOWERNUM);
63  mMultiPeakRaw = new TArrayF(2*RHICF_MULTI_TOWERNUM);
64  mMultiEnergySum = new TArrayF(2*RHICF_MULTI_TOWERNUM);
65  mMultiChiSquare = new TArrayF(2*RHICF_SINGLE_TOWERNUM);
66 }
67 
68 Bool_t StMuRHICfHit::isSaveDataArray(){return mIsSaveDataArray;}
69 
70 void StMuRHICfHit::setPlateEnergy(Int_t tower, Int_t plate, Float_t val) {mPlateE[tower][plate] = val;}
71 void StMuRHICfHit::setGSOBarEnergy(Int_t tower, Int_t layer, Int_t xy, Int_t bar, Float_t val)
72 {
73  if(tower==0){mGSOBarSmallE[layer][xy][bar] = val;}
74  if(tower==1){mGSOBarLargeE[layer][xy][bar] = val;}
75 }
76 
77 void StMuRHICfHit::setL20(Int_t tower, Float_t val){if(mL20){mL20->AddAt(val, tower);}}
78 void StMuRHICfHit::setL90(Int_t tower, Float_t val){if(mL90){mL90->AddAt(val, tower);}}
79 
80 void StMuRHICfHit::setGSOMaxLayer(Int_t tower, Int_t order, Int_t val){if(mGSOMaxLayer){mGSOMaxLayer->AddAt(val, RHICF_MAXLAYER_INDEX(tower, order));}}
81 void StMuRHICfHit::setMaxPeakBin(Int_t tower, Int_t layer, Int_t xy, Int_t val){if(mMaxPeakBin){mMaxPeakBin->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
82 
83 void StMuRHICfHit::setSingleHitNum(Int_t tower, Int_t layer, Int_t xy, Int_t val){if(mSingleHitNum){mSingleHitNum->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
84 void StMuRHICfHit::setSingleHitPos(Int_t tower, Int_t layer, Int_t xy, Float_t val){if(mSingleHitPos){mSingleHitPos->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
85 void StMuRHICfHit::setSinglePeakHeight(Int_t tower, Int_t layer, Int_t xy, Float_t val){if(mSinglePeakHeight){mSinglePeakHeight->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
86 void StMuRHICfHit::setSingleFitChi2(Int_t tower, Int_t layer, Int_t xy, Float_t val){if(mSingleChiSquare){mSingleChiSquare->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
87 
88 void StMuRHICfHit::setMultiHitNum(Int_t tower, Int_t val){if(mMultiHitNum){mMultiHitNum->AddAt(val, tower);}}
89 void StMuRHICfHit::setMultiHitPos(Int_t tower, Int_t layer, Int_t xy, Int_t order, Float_t val){if(mMultiHitPos){mMultiHitPos->AddAt(val, RHICF_MULTI_INDEX(tower,layer,xy,order));}}
90 void StMuRHICfHit::setMultiPeakHeight(Int_t tower, Int_t layer, Int_t xy, Int_t order, Float_t val){if(mMultiPeakHeight){mMultiPeakHeight->AddAt(val, RHICF_MULTI_INDEX(tower,layer,xy,order));}}
91 void StMuRHICfHit::setMultiPeakRaw(Int_t tower, Int_t layer, Int_t xy, Int_t order, Float_t val){if(mMultiPeakRaw){mMultiPeakRaw->AddAt(val, RHICF_MULTI_INDEX(tower,layer,xy,order));}}
92 void StMuRHICfHit::setMultiEnergySum(Int_t tower, Int_t layer, Int_t xy, Int_t order, Float_t val){if(mMultiEnergySum){mMultiEnergySum->AddAt(val, RHICF_MULTI_INDEX(tower,layer,xy,order));}}
93 void StMuRHICfHit::setMultiFitChi2(Int_t tower, Int_t layer, Int_t xy, Float_t val){if(mMultiChiSquare){mMultiChiSquare->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
94 
95 Float_t StMuRHICfHit::getPlateEnergy(Int_t tower, Int_t plate){return mPlateE[tower][plate];}
96 Float_t StMuRHICfHit::getGSOBarEnergy(Int_t tower, Int_t layer, Int_t xy, Int_t bar)
97 {
98  if(tower==0){return mGSOBarSmallE[layer][xy][bar];}
99  if(tower==1){return mGSOBarLargeE[layer][xy][bar];}
100  return 0;
101 }
102 
103 Float_t StMuRHICfHit::getL20(Int_t tower)
104 {
105  if(mL20){return mL20->At(tower);}
106  return 0.;
107 }
108 
109 Float_t StMuRHICfHit::getL90(Int_t tower)
110 {
111  if(mL90){return mL90->At(tower);}
112  return 0.;
113 }
114 
115 Int_t StMuRHICfHit::getGSOMaxLayer(Int_t tower, Int_t order)
116 {
117  if(mGSOMaxLayer){return mGSOMaxLayer->At(RHICF_MAXLAYER_INDEX(tower,order));}
118  return -999;
119 }
120 
121 Int_t StMuRHICfHit::getMaxPeakBin(Int_t tower, Int_t layer, Int_t xy)
122 {
123  if(mMaxPeakBin){return mMaxPeakBin->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
124  return -999;
125 }
126 
127 Int_t StMuRHICfHit::getSingleHitNum(Int_t tower, Int_t layer, Int_t xy)
128 {
129  if(mSingleHitNum){return mSingleHitNum->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
130  return -999;
131 }
132 
133 Float_t StMuRHICfHit::getSingleHitPos(Int_t tower, Int_t layer, Int_t xy)
134 {
135  if(mSingleHitPos){return mSingleHitPos->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
136  return 0.;
137 }
138 
139 Float_t StMuRHICfHit::getSinglePeakHeight(Int_t tower, Int_t layer, Int_t xy)
140 {
141  if(mSinglePeakHeight){return mSinglePeakHeight->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
142  return 0.;
143 }
144 
145 Float_t StMuRHICfHit::getSingleFitChi2(Int_t tower, Int_t layer, Int_t xy)
146 {
147  if(mSingleChiSquare){return mSingleChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
148  return 0.;
149 }
150 
151 Int_t StMuRHICfHit::getMultiHitNum(Int_t tower)
152 {
153  if(mMultiHitNum){return mMultiHitNum->At(tower);}
154  return -999;
155 }
156 
157 Float_t StMuRHICfHit::getMultiHitPos(Int_t tower, Int_t layer, Int_t xy, Int_t order)
158 {
159  if(mMultiHitPos){return mMultiHitPos->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
160  return 0.;
161 }
162 
163 Float_t StMuRHICfHit::getMultiPeakHeight(Int_t tower, Int_t layer, Int_t xy, Int_t order)
164 {
165  if(mMultiPeakHeight){return mMultiPeakHeight->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
166  return 0.;
167 }
168 
169 Float_t StMuRHICfHit::getMultiPeakRaw(Int_t tower, Int_t layer, Int_t xy, Int_t order)
170 {
171  if(mMultiPeakRaw){return mMultiPeakRaw->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
172  return 0.;
173 }
174 
175 Float_t StMuRHICfHit::getMultiEnergySum(Int_t tower, Int_t layer, Int_t xy, Int_t order)
176 {
177  if(mMultiEnergySum){return mMultiEnergySum->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
178  return 0.;
179 }
180 
181 Float_t StMuRHICfHit::getMultiFitChi2(Int_t tower, Int_t layer, Int_t xy)
182 {
183  if(mMultiChiSquare){return mMultiChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
184  return 0.;
185 }