1 #include "StMuRHICfHit.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 StMuRHICfHit::StMuRHICfHit()
14 mIsSaveDataArray =
false;
18 StMuRHICfHit::~StMuRHICfHit()
22 void StMuRHICfHit::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 StMuRHICfHit::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 Bool_t StMuRHICfHit::isSaveDataArray(){
return mIsSaveDataArray;}
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)
73 if(tower==0){mGSOBarSmallE[layer][xy][bar] = val;}
74 if(tower==1){mGSOBarLargeE[layer][xy][bar] = val;}
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);}}
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));}}
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));}}
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));}}
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)
98 if(tower==0){
return mGSOBarSmallE[layer][xy][bar];}
99 if(tower==1){
return mGSOBarLargeE[layer][xy][bar];}
103 Float_t StMuRHICfHit::getL20(Int_t tower)
105 if(mL20){
return mL20->At(tower);}
109 Float_t StMuRHICfHit::getL90(Int_t tower)
111 if(mL90){
return mL90->At(tower);}
115 Int_t StMuRHICfHit::getGSOMaxLayer(Int_t tower, Int_t order)
117 if(mGSOMaxLayer){
return mGSOMaxLayer->At(RHICF_MAXLAYER_INDEX(tower,order));}
121 Int_t StMuRHICfHit::getMaxPeakBin(Int_t tower, Int_t layer, Int_t xy)
123 if(mMaxPeakBin){
return mMaxPeakBin->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
127 Int_t StMuRHICfHit::getSingleHitNum(Int_t tower, Int_t layer, Int_t xy)
129 if(mSingleHitNum){
return mSingleHitNum->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
133 Float_t StMuRHICfHit::getSingleHitPos(Int_t tower, Int_t layer, Int_t xy)
135 if(mSingleHitPos){
return mSingleHitPos->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
139 Float_t StMuRHICfHit::getSinglePeakHeight(Int_t tower, Int_t layer, Int_t xy)
141 if(mSinglePeakHeight){
return mSinglePeakHeight->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
145 Float_t StMuRHICfHit::getSingleFitChi2(Int_t tower, Int_t layer, Int_t xy)
147 if(mSingleChiSquare){
return mSingleChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}
151 Int_t StMuRHICfHit::getMultiHitNum(Int_t tower)
153 if(mMultiHitNum){
return mMultiHitNum->At(tower);}
157 Float_t StMuRHICfHit::getMultiHitPos(Int_t tower, Int_t layer, Int_t xy, Int_t order)
159 if(mMultiHitPos){
return mMultiHitPos->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
163 Float_t StMuRHICfHit::getMultiPeakHeight(Int_t tower, Int_t layer, Int_t xy, Int_t order)
165 if(mMultiPeakHeight){
return mMultiPeakHeight->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
169 Float_t StMuRHICfHit::getMultiPeakRaw(Int_t tower, Int_t layer, Int_t xy, Int_t order)
171 if(mMultiPeakRaw){
return mMultiPeakRaw->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
175 Float_t StMuRHICfHit::getMultiEnergySum(Int_t tower, Int_t layer, Int_t xy, Int_t order)
177 if(mMultiEnergySum){
return mMultiEnergySum->At(RHICF_MULTI_INDEX(tower,layer,xy,order));}
181 Float_t StMuRHICfHit::getMultiFitChi2(Int_t tower, Int_t layer, Int_t xy)
183 if(mMultiChiSquare){
return mMultiChiSquare->At(RHICF_SINGLE_INDEX(tower,layer,xy));}