7 #include "StFcsRawHitMaker.h"
8 #include "StRoot/StEvent/StEvent.h"
9 #include "StRoot/St_base/StMessMgr.h"
10 #include "StChain/StRtsTable.h"
11 #include "StRoot/StEvent/StFcsCollection.h"
12 #include "StRoot/StEvent/StFcsHit.h"
13 #include "StRoot/StFcsDbMaker/StFcsDb.h"
14 #include "StMuDSTMaker/COMMON/StMuTypes.hh"
15 #include "StMuDSTMaker/COMMON/StMuFcsUtil.h"
17 StFcsRawHitMaker::StFcsRawHitMaker(
const char* name) :
21 StFcsRawHitMaker::~StFcsRawHitMaker(){};
23 int StFcsRawHitMaker::InitRun(
int runNumber){
25 mFcsDb =
static_cast<StFcsDb*
>(GetDataSet(
"fcsDb"));
27 LOG_FATAL <<
"Error finding StFcsDbMaker"<< endm;
34 mEvent = (
StEvent*)GetInputDS(
"StEvent");
36 LOG_DEBUG<<
"Found StEvent"<<endm;
40 LOG_INFO <<
"Added StEvent"<<endm;
43 if(mReadMuDst>0)
return readMuDst();
45 mFcsCollectionPtr=mEvent->fcsCollection();
46 if(!mFcsCollectionPtr) {
48 mEvent->setFcsCollection(mFcsCollectionPtr);
49 LOG_INFO <<
"Added StFcsCollection"<<endm;
51 mFcsCollectionPtr=mEvent->fcsCollection();
52 LOG_DEBUG <<
"Found StFcsCollection"<<endm;
57 int nData=0, nValidData=0;
58 const char* mode[2]={
"adc",
"zs"};
60 sprintf(node,
"fcs/%s",mode[mReadMode]);
63 int sec = ((s >> 11) & 0x1F) + 1;
64 int rdo = ((s >> 8) & 0x7) + 1;
65 int ehp = (s >> 6) & 0x3;
66 int ns = (s >> 5) & 1;
72 uint16_t *d16 = (uint16_t *)dd->GetTable();
75 hit =
new StFcsHit(0,detid,
id,ns,ehp,dep,ch,n,d16);
77 hit =
new StFcsHit(1,detid,
id,ns,ehp,dep,ch,2*n,d16);
79 mFcsCollectionPtr->addHit(detid,hit);
81 if(detid<6) nValidData++;
83 printf(
"FCS %3s : S%d:%d [det %d, ns %d, dep %d ch %2d] det=%1d id=%4d : size=%2d : adc=",
84 mode[mReadMode],sec,rdo,ehp,ns,dep,ch,detid,
id,n) ;
86 for(
int tb=0; tb<hit->nTimeBin(); tb++) {
87 printf(
"%4d ", hit->adc(tb));
91 printf(
" sum=%d\n",sum);
94 LOG_INFO <<Form(
"FCS found %d data lines, and %d valid data lines",
95 nData,nValidData)<<endm;
96 if(nData>0 && GetDebug()) mFcsCollectionPtr->print(3);
100 int StFcsRawHitMaker::readMuDst() {
102 if(!mudst){LOG_ERROR<<
"StFcsRawHitMaker::readMuDst() found no MuDst"<<endm;
return kStErr;}
104 if(!mufcsColl){LOG_ERROR<<
"StFcsRawHitMaker::readMuDst found no MuFcsCollection"<<endm;
return kStErr;}
106 mFcsCollectionPtr = util.getFcs(mufcsColl);
107 mEvent->setFcsCollection(mFcsCollectionPtr);
static StMuFcsCollection * muFcsCollection()
returns pointer to current StMuFcsCollection
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...
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
void getIdfromDep(int ehp, int ns, int dep, int ch, int &detectorId, int &id, int &crt, int &slt) const
Get DEP map.
virtual Long_t GetNRows() const
Returns the number of the used rows for the wrapped table.
void Clear(Option_t *opts="")
User defined functions.