16 #include "StFpsRawHitMaker.h"
18 #include "St_base/StMessMgr.h"
20 #include "RTS/src/DAQ_FPS/daq_fps.h"
21 #include "RTS/src/DAQ_READER/daq_dta.h"
22 #include "StChain/StRtsTable.h"
23 #include "StEvent/StEvent.h"
24 #include "StEvent/StFmsCollection.h"
25 #include "StEvent/StFmsHit.h"
26 #include "StRoot/StFmsDbMaker/StFmsDbMaker.h"
28 StFpsRawHitMaker::StFpsRawHitMaker(
const Char_t* name) :
29 StRTSBaseMaker(
"adc", name ), mPrePost(0), mFmsCollection(0), mFmsDbMaker(0) {}
31 StFpsRawHitMaker::~StFpsRawHitMaker(){}
35 LOG_DEBUG <<
"StFpsRawHitMaker::InitRun with run = " << runNumber << endm;
36 mFmsDbMaker =
static_cast<StFmsDbMaker*
>(GetMaker(
"fmsDb"));
38 LOG_ERROR <<
"StFpsRawHitMaker::InitRun Failed to get StFmsDbMaker" << endm;
45 Int_t StFpsRawHitMaker::prepareEnvironment(){
47 eventPtr= (
StEvent*)StRTSBaseMaker::GetInputDS(
"StEvent");
50 LOG_DEBUG <<
"StFpsRawHitMaker::prepareEnvironment found StEvent" <<endm;
51 mFmsCollection=eventPtr->fmsCollection();
53 LOG_ERROR <<
"StFpsRawHitMaker::prepareEnvironment found no StEvent"<<endm;
57 LOG_DEBUG <<
"StFpsRawHitMaker::prepareEnvironment creating new StFmsCollection" <<endm;
60 LOG_ERROR <<
"StFpsRawHitMaker::prepareEnvironment could not create StFmsCollection" <<endm;
63 LOG_DEBUG <<
"StFpsRawHitMaker::prepareEnvironment setting new StFmsCollection to StEvent" <<endm;
64 eventPtr->setFmsCollection(mFmsCollection);
72 int n[2]={0,0}, ngood[2]={0,0};
73 if(
int ret=prepareEnvironment()!=
kStOK )
return ret;
85 int fpsfpost=rts_tbl->Sector();
86 int xing=rts_tbl->Pad();
if(xing>=128) xing-=256;
87 int qt=rts_tbl->Row();
90 LOG_DEBUG << Form(
"FPS: fps/fpost=%1d xing=%4d QT=%02d NData=%d",fpsfpost,xing,qt,ndata)<<endm;
91 if(mPrePost==0 && xing!=0)
continue;
98 int slatid,q,l,s,det,crate;
100 slatid = mFmsDbMaker->fpsSlatidFromQT(qt,ch);
101 mFmsDbMaker->fpsQLSfromSlatId(slatid,&q,&l,&s);
102 LOG_DEBUG << Form(
"FPS: xing=%4d QT%02d ch%02d Slaiid=%3d Q%1dL%1dS%02d ADC=%4d TDC=%2d",xing,qt,ch,slatid,q,l,s,adc,tdc)<<endm;
106 slatid = mFmsDbMaker->fpostSlatidFromQT(qt,ch);
107 mFmsDbMaker->fpostQLSfromSlatId(slatid,&q,&l,&s);
108 LOG_DEBUG << Form(
"FPO: xing=%4d QT%02d ch%02d Slaiid=%3d Q%1dL%1dS%02d ADC=%4d TDC=%2d",xing,qt,ch,slatid,q,l,s,adc,tdc)<<endm;
114 if(slatid<0) { flag=1; }
115 if(q<1 || l<1 || s<1) { flag=1; }
118 hit->setDetectorId(det);
119 hit->setChannel(slatid);
120 hit->setQtCrate(crate);
122 hit->setQtChannel(ch);
126 if(fpsfpost==0) {mFmsDbMaker->fpsGain(slatid);}
127 else {mFmsDbMaker->fpostGain(slatid);}
129 if(gain>0.0) nmip=adc/gain;
130 hit->setEnergy(nmip);
131 mFmsCollection->addHit(hit);
132 if(Debug()) hit->print();
137 LOG_DEBUG << Form(
"StFpsRawHitMaker:: FPS found total %d hits and %d good",n[0],ngood[0]) << endm;
138 LOG_DEBUG<< Form(
"StFpsRawHitMaker:: FPOST found total %d hits and %d good",n[1],ngood[1]) << endm;
StRtsTable * GetNextDaqElement(const char *elementPath)
Query the STAR production chain for the DAQ data.
Class StRTSBaseMaker - is an abstract StMaker to define the interface to access the DAQ data from the...
Int_t InitRun(Int_t runNumber)
Check if global pointer for StFmsDbMaker is available.
Int_t Make()
Read FPS data from daq file, and add to StFmsCollection as a StFmsHit.
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.