1 #include "StRHICfHit.h"
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)
12 StRHICfHit::StRHICfHit()
14 mIsSaveDataArray =
false;
18 StRHICfHit::~StRHICfHit()
22 void StRHICfHit::clear()
24 memset(mPlateE, 0.,
sizeof(mPlateE));
25 memset(mGSOBarSmallE, 0.,
sizeof(mGSOBarSmallE));
26 memset(mGSOBarLargeE, 0.,
sizeof(mGSOBarLargeE));
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();
46 void StRHICfHit::initDataArray()
48 mIsSaveDataArray =
true;
49 mL20 =
new TArrayF(RHICF_MAXLAYER_TOWERNUM);
50 mL90 =
new TArrayF(RHICF_MAXLAYER_TOWERNUM);
52 mGSOMaxLayer =
new TArrayI(2*RHICF_MAXLAYER_TOWERNUM);
53 mMaxPeakBin =
new TArrayI(2*RHICF_SINGLE_TOWERNUM);
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);
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);
68 void StRHICfHit::deleteDataArray()
70 mIsSaveDataArray =
false;
78 delete mSinglePeakHeight;
79 delete mSingleChiSquare;
82 delete mMultiPeakHeight;
84 delete mMultiEnergySum;
85 delete mMultiChiSquare;
89 mGSOMaxLayer =
nullptr;
90 mMaxPeakBin =
nullptr;
91 mSingleHitNum =
nullptr;
92 mSingleHitPos =
nullptr;
93 mSinglePeakHeight =
nullptr;
94 mSingleChiSquare =
nullptr;
95 mMultiHitNum =
nullptr;
96 mMultiHitPos =
nullptr;
97 mMultiPeakHeight =
nullptr;
98 mMultiPeakRaw =
nullptr;
99 mMultiEnergySum =
nullptr;
100 mMultiChiSquare =
nullptr;
103 Bool_t StRHICfHit::isSaveDataArray(){
return mIsSaveDataArray;}
105 void StRHICfHit::setPlateEnergy(Int_t tower, Int_t plate, Float_t val) {mPlateE[tower][plate] = val;}
106 void StRHICfHit::setGSOBarEnergy(Int_t tower, Int_t layer, Int_t xy, Int_t bar, Float_t val)
108 if(tower==0){mGSOBarSmallE[layer][xy][bar] = val;}
109 if(tower==1){mGSOBarLargeE[layer][xy][bar] = val;}
112 void StRHICfHit::setL20(Int_t tower, Float_t val){
if(mL20){mL20->AddAt(val, tower);}}
113 void StRHICfHit::setL90(Int_t tower, Float_t val){
if(mL90){mL90->AddAt(val, tower);}}
115 void StRHICfHit::setGSOMaxLayer(Int_t tower, Int_t order, Int_t val){
if(mGSOMaxLayer){mGSOMaxLayer->AddAt(val, RHICF_MAXLAYER_INDEX(tower, order));}}
116 void StRHICfHit::setMaxPeakBin(Int_t tower, Int_t layer, Int_t xy, Int_t val){
if(mMaxPeakBin){mMaxPeakBin->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
118 void StRHICfHit::setSingleHitNum(Int_t tower, Int_t layer, Int_t xy, Int_t val){
if(mSingleHitNum){mSingleHitNum->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
119 void StRHICfHit::setSingleHitPos(Int_t tower, Int_t layer, Int_t xy, Float_t val){
if(mSingleHitPos){mSingleHitPos->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
120 void StRHICfHit::setSinglePeakHeight(Int_t tower, Int_t layer, Int_t xy, Float_t val){
if(mSinglePeakHeight){mSinglePeakHeight->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
121 void StRHICfHit::setSingleFitChi2(Int_t tower, Int_t layer, Int_t xy, Float_t val){
if(mSingleChiSquare){mSingleChiSquare->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
123 void StRHICfHit::setMultiHitNum(Int_t tower, Int_t val){
if(mMultiHitNum){mMultiHitNum->AddAt(val, tower);}}
124 void StRHICfHit::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));}}
125 void StRHICfHit::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));}}
126 void StRHICfHit::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));}}
127 void StRHICfHit::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));}}
128 void StRHICfHit::setMultiFitChi2(Int_t tower, Int_t layer, Int_t xy, Float_t val){
if(mMultiChiSquare){mMultiChiSquare->AddAt(val, RHICF_SINGLE_INDEX(tower,layer,xy));}}
130 Float_t StRHICfHit::getPlateEnergy(Int_t tower, Int_t plate){
return mPlateE[tower][plate];}
131 Float_t StRHICfHit::getGSOBarEnergy(Int_t tower, Int_t layer, Int_t xy, Int_t bar)
133 if(tower==0){
return mGSOBarSmallE[layer][xy][bar];}
134 if(tower==1){
return mGSOBarLargeE[layer][xy][bar];}
138 Float_t StRHICfHit::getL20(Int_t tower)
140 if(mL20){
return mL20->At(tower);}
144 Float_t StRHICfHit::getL90(Int_t tower)
146 if(mL90){
return mL90->At(tower);}
150 Int_t StRHICfHit::getGSOMaxLayer(Int_t tower, Int_t order)
152 if(mGSOMaxLayer){
return mGSOMaxLayer->At(RHICF_MAXLAYER_INDEX(tower,order));}
156 Int_t StRHICfHit::getMaxPeakBin(Int_t tower, Int_t layer, Int_t xy)
158 if(mMaxPeakBin){
return mMaxPeakBin->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
162 Int_t StRHICfHit::getSingleHitNum(Int_t tower, Int_t layer, Int_t xy)
164 if(mSingleHitNum){
return mSingleHitNum->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
168 Float_t StRHICfHit::getSingleHitPos(Int_t tower, Int_t layer, Int_t xy)
170 if(mSingleHitPos){
return mSingleHitPos->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
174 Float_t StRHICfHit::getSinglePeakHeight(Int_t tower, Int_t layer, Int_t xy)
176 if(mSinglePeakHeight){
return mSinglePeakHeight->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
180 Float_t StRHICfHit::getSingleFitChi2(Int_t tower, Int_t layer, Int_t xy)
182 if(mSingleChiSquare){
return mSingleChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
186 Int_t StRHICfHit::getMultiHitNum(Int_t tower)
188 if(mMultiHitNum){
return mMultiHitNum->At(tower);}
192 Float_t StRHICfHit::getMultiHitPos(Int_t tower, Int_t layer, Int_t xy, Int_t order)
194 if(mMultiHitPos){
return mMultiHitPos->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
198 Float_t StRHICfHit::getMultiPeakHeight(Int_t tower, Int_t layer, Int_t xy, Int_t order)
200 if(mMultiPeakHeight){
return mMultiPeakHeight->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
204 Float_t StRHICfHit::getMultiPeakRaw(Int_t tower, Int_t layer, Int_t xy, Int_t order)
206 if(mMultiPeakRaw){
return mMultiPeakRaw->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
210 Float_t StRHICfHit::getMultiEnergySum(Int_t tower, Int_t layer, Int_t xy, Int_t order)
212 if(mMultiEnergySum){
return mMultiEnergySum->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
216 Float_t StRHICfHit::getMultiFitChi2(Int_t tower, Int_t layer, Int_t xy)
218 if(mMultiChiSquare){
return mMultiChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}