00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "StMuFmsHit.h"
00018 #include "StMuFmsUtil.h"
00019 #include "StMuFmsCollection.h"
00020 #include "StEvent.h"
00021 #include "StMessMgr.h"
00022 #include "StEventTypes.h"
00023
00024 ClassImp(StMuFmsUtil)
00025
00026
00027 StMuFmsUtil::StMuFmsUtil()
00028 {
00029 }
00030 StMuFmsUtil::~StMuFmsUtil()
00031 {
00032 }
00033
00034 StMuFmsCollection* StMuFmsUtil::getMuFms(StFmsCollection *fmscol)
00035 {
00036 if(!fmscol) return NULL;
00037 StMuFmsCollection* muFms=new StMuFmsCollection();
00038 fillMuFms(muFms,fmscol);
00039 return muFms;
00040 }
00041
00042 StFmsCollection* StMuFmsUtil::getFms(StMuFmsCollection* muFms)
00043 {
00044 if(!muFms) return NULL;
00045
00046 StFmsCollection *fms=new StFmsCollection();
00047 fillFms(fms,muFms);
00048 return fms;
00049 }
00050
00051 void StMuFmsUtil::fillMuFms(StMuFmsCollection *muFms,StFmsCollection *fmscol)
00052 {
00053 if(!fmscol) return;
00054 if(!muFms) return;
00055
00056
00057
00058 StSPtrVecFmsHit vecHit = fmscol->hits();
00059 for(unsigned int i=0; i<fmscol->numberOfHits(); i++){
00060 unsigned short detId = vecHit[i]->detectorId();
00061 unsigned short ch = vecHit[i]->channel();
00062 unsigned short crate = vecHit[i]->qtCrate();
00063 unsigned short slot = vecHit[i]->qtSlot();
00064 unsigned short qtch = vecHit[i]->qtChannel();
00065 unsigned short adc = vecHit[i]->adc();
00066 unsigned short tdc = vecHit[i]->tdc();
00067 float ene = vecHit[i]->energy();
00068 muFms->addHit();
00069 StMuFmsHit* muFmsHit = muFms->getHit(i);
00070 muFmsHit->setDetectorId(detId);
00071 muFmsHit->setChannel(ch);
00072 muFmsHit->setQtCrate(crate);
00073 muFmsHit->setQtSlot(slot);
00074 muFmsHit->setQtChannel(qtch);
00075 muFmsHit->setAdc(adc);
00076 muFmsHit->setTdc(tdc);
00077 muFmsHit->setEnergy(ene);
00078 }
00079
00080 return;
00081 }
00082
00083 void StMuFmsUtil::fillFms(StFmsCollection* fmscol,StMuFmsCollection* muFms)
00084 {
00085 if(!muFms) return;
00086 if(!fmscol) return;
00087
00088 TClonesArray* arrHit = muFms->getHitArray();
00089 for(unsigned int i=0; i<muFms->numberOfHits(); i++){
00090 unsigned short detId = ((StMuFmsHit*)(arrHit->At(i)))->detectorId();
00091 unsigned short ch = ((StMuFmsHit*)(arrHit->At(i)))->channel();
00092 unsigned short crate = ((StMuFmsHit*)(arrHit->At(i)))->qtCrate();
00093 unsigned short slot = ((StMuFmsHit*)(arrHit->At(i)))->qtSlot();
00094 unsigned short qtch = ((StMuFmsHit*)(arrHit->At(i)))->qtChannel();
00095 unsigned short adc = ((StMuFmsHit*)(arrHit->At(i)))->adc();
00096 unsigned short tdc = ((StMuFmsHit*)(arrHit->At(i)))->tdc();
00097 float ene = ((StMuFmsHit*)(arrHit->At(i)))->energy();
00098
00099 StFmsHit* hit = new StFmsHit();
00100 hit->setDetectorId(detId);
00101 hit->setChannel(ch);
00102 hit->setQtCrate(crate);
00103 hit->setQtSlot(slot);
00104 hit->setQtChannel(qtch);
00105 hit->setAdc(adc);
00106 hit->setTdc(tdc);
00107 hit->setEnergy(ene);
00108 fmscol->addHit(hit);
00109 }
00110
00111
00112 return;
00113 }
00114