1 #include "StMuRHICfUtil.h"
3 #include "StEvent/StEvent.h"
4 #include "StEvent/StEventTypes.h"
5 #include "StEvent/StTriggerData.h"
6 #include "StEvent/StRHICfCollection.h"
7 #include "StEvent/StRHICfRawHit.h"
8 #include "StEvent/StRHICfHit.h"
9 #include "StEvent/StRHICfPoint.h"
11 #include "StMuEvent.h"
13 #include "StMuRHICfCollection.h"
14 #include "StMuRHICfRawHit.h"
15 #include "StMuRHICfHit.h"
16 #include "StMuRHICfPoint.h"
25 StMuRHICfUtil::~StMuRHICfUtil()
31 if(!coll)
return NULL;
34 fillMuRHICf(muColl, coll);
40 if(!muColl)
return NULL;
43 fillRHICf(coll, muColl);
55 muRHICfRawHit -> setRHICfRunNumber(coll->getRHICfRunNumber());
56 muRHICfRawHit -> setRHICfEventNumber(coll->getRHICfEventNumber());
57 muRHICfRawHit -> setRunType(coll->getRunType());
58 muRHICfRawHit -> setBunchNumber(coll->getBunchNumber());
59 muRHICfRawHit -> setTriggerNumber(coll->getTriggerNumber());
60 muRHICfRawHit -> setRunTime(0, coll->getRunTime(0));
61 muRHICfRawHit -> setRunTime(1, coll->getRunTime(1));
62 muRHICfRawHit -> setRunTRGM(coll->getRunTRGM());
64 fillMuRHICfRawHit(muRHICfRawHit, rhicfRawHit);
66 StRHICfHit* rhicfHit = coll -> hitCollection();
69 fillMuRHICfHit(muRHICfHit, rhicfHit);
72 for (
unsigned i(0); i < coll->numberOfPoints(); ++i){
76 if(rhicfPoint && muRHICfPoint){
77 fillMuRHICfPoint(muRHICfPoint, rhicfPoint);
90 coll -> setRHICfRunNumber(muRHICfRawHit->getRHICfRunNumber());
91 coll -> setRHICfEventNumber(muRHICfRawHit->getRHICfEventNumber());
92 coll -> setRunType(muRHICfRawHit->getRunType());
93 coll -> setBunchNumber(muRHICfRawHit->getBunchNumber());
94 coll -> setTriggerNumber(muRHICfRawHit->getTriggerNumber());
95 coll -> setRunTime(0, muRHICfRawHit->getRunTime(0));
96 coll -> setRunTime(1, muRHICfRawHit->getRunTime(1));
97 coll -> setRunTRGM(muRHICfRawHit->getRunTRGM());
99 fillRHICfRawHit(rhicfRawHit, muRHICfRawHit);
103 StRHICfHit* rhicfHit = coll -> hitCollection();
104 fillRHICfHit(rhicfHit, muRHICfHit);
107 for(
unsigned i(0); i < muColl->numberOfPoints(); ++i){
111 if(muRHICfPoint && rhicfPoint){
112 fillRHICfPoint(rhicfPoint, muRHICfPoint);
113 coll -> addPoint(rhicfPoint);
118 Int_t StMuRHICfUtil::checkGSOBarSize(Int_t tower)
120 if(tower==0){
return kRHICfNbarSmall;}
121 else if(tower==1){
return kRHICfNbarLarge;}
127 for(
int it=0; it<kRHICfNtower; it++){
128 for(
int il=0; il<kRHICfNlayer; il++){
129 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
130 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
131 Int_t gsoBarADC = rhicfRawHit -> getGSOBarADC(it, il, ixy, ich);
132 muRHICfRawHit -> setGSOBarADC(it, il, ixy, ich, gsoBarADC);
136 for(
int ip=0; ip<kRHICfNplate; ip++){
137 for(
int ir=0; ir<2; ir++){
138 Int_t plateADC = rhicfRawHit -> getPlateADC(it, ip, ir);
139 Int_t plateADCD = rhicfRawHit -> getPlateADCDelay(it, ip, ir);
140 muRHICfRawHit -> setPlateADC(it, ip, ir, plateADC);
141 muRHICfRawHit -> setPlateADCDelay(it, ip, ir, plateADCD);
145 for(Int_t idx=0; idx<kRHICfNtdc; idx++){
146 if(idx<kRHICfNcad0){muRHICfRawHit -> setCAD0(idx, rhicfRawHit->getCAD0(idx));}
147 if(idx<kRHICfNgpi0){muRHICfRawHit -> setGPI0(idx, rhicfRawHit->getGPI0(idx));}
148 if(idx<kRHICfNgpi1){muRHICfRawHit -> setGPI1(idx, rhicfRawHit->getGPI1(idx));}
149 muRHICfRawHit -> setTDC(idx, rhicfRawHit->getTDC(idx));
155 if(!muRHICfHit->isSaveDataArray()){
156 for(
int it=0; it<kRHICfNtower; it++){
157 for(
int il=0; il<kRHICfNlayer; il++){
158 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
159 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
160 muRHICfHit -> setGSOBarEnergy(it, il, ixy, ich, rhicfHit->getGSOBarEnergy(it, il, ixy, ich));
164 for(
int ip=0; ip<kRHICfNplate; ip++){
165 muRHICfHit -> setPlateEnergy(it, ip, rhicfHit->getPlateEnergy(it, ip));
170 else if(muRHICfHit->isSaveDataArray()){
171 muRHICfHit -> initDataArray();
173 for(
int it=0; it<kRHICfNtower; it++){
174 muRHICfHit -> setL20(it, rhicfHit->getL20(it));
175 muRHICfHit -> setL90(it, rhicfHit->getL90(it));
176 muRHICfHit -> setMultiHitNum(it, rhicfHit->getMultiHitNum(it));
177 muRHICfHit -> setGSOMaxLayer(it, 0, rhicfHit->getGSOMaxLayer(it, 0));
178 muRHICfHit -> setGSOMaxLayer(it, 1, rhicfHit->getGSOMaxLayer(it, 1));
180 for(
int il=0; il<kRHICfNlayer; il++){
181 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
182 muRHICfHit -> setMaxPeakBin(it, il, ixy, rhicfHit->getMaxPeakBin(it, il, ixy));
183 muRHICfHit -> setSingleHitNum(it, il, ixy, rhicfHit->getSingleHitNum(it, il, ixy));
184 muRHICfHit -> setSingleHitPos(it, il, ixy, rhicfHit->getSingleHitPos(it, il, ixy));
185 muRHICfHit -> setSinglePeakHeight(it, il, ixy, rhicfHit->getSinglePeakHeight(it, il, ixy));
186 muRHICfHit -> setSingleFitChi2(it, il, ixy, rhicfHit->getSingleFitChi2(it, il, ixy));
187 muRHICfHit -> setMultiFitChi2(it, il, ixy, rhicfHit->getMultiFitChi2(it, il, ixy));
189 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
190 muRHICfHit -> setGSOBarEnergy(it, il, ixy, ich, rhicfHit->getGSOBarEnergy(it, il, ixy, ich));
193 for(
int io=0; io<2; io++){
194 muRHICfHit -> setMultiHitPos(it, il, ixy, io, rhicfHit->getMultiHitPos(it, il, ixy, io));
195 muRHICfHit -> setMultiPeakHeight(it, il, ixy, io, rhicfHit->getMultiPeakHeight(it, il, ixy, io));
196 muRHICfHit -> setMultiPeakRaw(it, il, ixy, io, rhicfHit->getMultiPeakRaw(it, il, ixy, io));
197 muRHICfHit -> setMultiEnergySum(it, il, ixy, io, rhicfHit->getMultiEnergySum(it, il, ixy, io));
201 for(
int ip=0; ip<kRHICfNplate; ip++){
202 muRHICfHit -> setPlateEnergy(it, ip, rhicfHit->getPlateEnergy(it, ip));
210 muRHICfPoint -> setTowerIdx(rhicfPoint->getTowerIdx());
211 muRHICfPoint -> setPID(rhicfPoint->getPID());
212 muRHICfPoint -> setTowerSumEnergy(rhicfPoint->getTowerSumEnergy(0), rhicfPoint->getTowerSumEnergy(1));
213 muRHICfPoint -> setPointPos(rhicfPoint->getPointPos(0), rhicfPoint->getPointPos(1));
214 muRHICfPoint -> setPointEnergy(rhicfPoint->getPointEnergy(0), rhicfPoint->getPointEnergy(1));
219 for(
int it=0; it<kRHICfNtower; it++){
220 for(
int il=0; il<kRHICfNlayer; il++){
221 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
222 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
223 Int_t gsoBarADC = muRHICfRawHit -> getGSOBarADC(it, il, ixy, ich);
224 rhicfRawHit -> setGSOBarADC(it, il, ixy, ich, gsoBarADC);
228 for(
int ip=0; ip<kRHICfNplate; ip++){
229 for(
int ir=0; ir<2; ir++){
230 Int_t plateADC = muRHICfRawHit -> getPlateADC(it, ip, ir);
231 Int_t plateADCD = muRHICfRawHit -> getPlateADCDelay(it, ip, ir);
232 rhicfRawHit -> setPlateADC(it, ip, ir, plateADC);
233 rhicfRawHit -> setPlateADCDelay(it, ip, ir, plateADCD);
237 for(Int_t idx=0; idx<kRHICfNtdc; idx++){
238 if(idx<kRHICfNcad0){rhicfRawHit -> setCAD0(idx, muRHICfRawHit->getCAD0(idx));}
239 if(idx<kRHICfNgpi0){rhicfRawHit -> setGPI0(idx, muRHICfRawHit->getGPI0(idx));}
240 if(idx<kRHICfNgpi1){rhicfRawHit -> setGPI1(idx, muRHICfRawHit->getGPI1(idx));}
241 rhicfRawHit -> setTDC(idx, muRHICfRawHit->getTDC(idx));
247 if(!rhicfHit->isSaveDataArray()){
248 for(
int it=0; it<kRHICfNtower; it++){
249 for(
int il=0; il<kRHICfNlayer; il++){
250 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
251 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
252 rhicfHit -> setGSOBarEnergy(it, il, ixy, ich, muRHICfHit->getGSOBarEnergy(it, il, ixy, ich));
256 for(
int ip=0; ip<kRHICfNplate; ip++){
257 rhicfHit -> setPlateEnergy(it, ip, muRHICfHit->getPlateEnergy(it, ip));
262 else if(rhicfHit->isSaveDataArray()){
263 rhicfHit -> initDataArray();
265 for(
int it=0; it<kRHICfNtower; it++){
266 rhicfHit -> setL20(it, muRHICfHit->getL20(it));
267 rhicfHit -> setL90(it, muRHICfHit->getL90(it));
268 rhicfHit -> setMultiHitNum(it, muRHICfHit->getMultiHitNum(it));
269 rhicfHit -> setGSOMaxLayer(it, 0, muRHICfHit->getGSOMaxLayer(it, 0));
270 rhicfHit -> setGSOMaxLayer(it, 1, muRHICfHit->getGSOMaxLayer(it, 1));
272 for(
int il=0; il<kRHICfNlayer; il++){
273 for(
int ixy=0; ixy<kRHICfNxy; ixy++){
274 rhicfHit -> setMaxPeakBin(it, il, ixy, muRHICfHit->getMaxPeakBin(it, il, ixy));
275 rhicfHit -> setSingleHitNum(it, il, ixy, muRHICfHit->getSingleHitNum(it, il, ixy));
276 rhicfHit -> setSingleHitPos(it, il, ixy, muRHICfHit->getSingleHitPos(it, il, ixy));
277 rhicfHit -> setSinglePeakHeight(it, il, ixy, muRHICfHit->getSinglePeakHeight(it, il, ixy));
278 rhicfHit -> setSingleFitChi2(it, il, ixy, muRHICfHit->getSingleFitChi2(it, il, ixy));
279 rhicfHit -> setMultiFitChi2(it, il, ixy, muRHICfHit->getMultiFitChi2(it, il, ixy));
281 for(
int ich=0; ich<checkGSOBarSize(it); ich++){
282 rhicfHit -> setGSOBarEnergy(it, il, ixy, ich, muRHICfHit->getGSOBarEnergy(it, il, ixy, ich));
285 for(
int io=0; io<2; io++){
286 rhicfHit -> setMultiHitPos(it, il, ixy, io, muRHICfHit->getMultiHitPos(it, il, ixy, io));
287 rhicfHit -> setMultiPeakHeight(it, il, ixy, io, muRHICfHit->getMultiPeakHeight(it, il, ixy, io));
288 rhicfHit -> setMultiPeakRaw(it, il, ixy, io, muRHICfHit->getMultiPeakRaw(it, il, ixy, io));
289 rhicfHit -> setMultiEnergySum(it, il, ixy, io, muRHICfHit->getMultiEnergySum(it, il, ixy, io));
293 for(
int ip=0; ip<kRHICfNplate; ip++){
294 rhicfHit -> setPlateEnergy(it, ip, muRHICfHit->getPlateEnergy(it, ip));
302 rhicfPoint -> setTowerIdx(muRHICfPoint->getTowerIdx());
303 rhicfPoint -> setPID(muRHICfPoint->getPID());
304 rhicfPoint -> setTowerSumEnergy(muRHICfPoint->getTowerSumEnergy(0), muRHICfPoint->getTowerSumEnergy(1));
305 rhicfPoint -> setPointPos(muRHICfPoint->getPointPos(0), muRHICfPoint->getPointPos(1));
306 rhicfPoint -> setPointEnergy(muRHICfPoint->getPointEnergy(0), muRHICfPoint->getPointEnergy(1));