119 #include "St_base/StMessMgr.h"
122 #include "StChain/StRtsTable.h"
123 #include "StEvent/StEvent.h"
124 #include "DAQ_FGT/daq_fgt.h"
125 #include "DAQ_READER/daq_dta.h"
127 #include "StEvent/StFgtCollection.h"
128 #include "StEvent/StFgtStripCollection.h"
129 #include "StEvent/StFgtStrip.h"
130 #include "StFgtDbMaker/StFgtDbMaker.h"
131 #include "St_base/StMessMgr.h"
135 #include "StFgtRawMaker.h"
144 eventPtr= (
StEvent*)StRTSBaseMaker::GetInputDS(
"StEvent");
146 mFgtCollectionPtr=NULL;
149 mFgtCollectionPtr=eventPtr->fgtCollection();
156 LOG_DEBUG <<
"::prepareEnvironment could not create StFgtEvent" <<endm;
160 mFgtCollectionPtr=eventPtr->fgtCollection();
162 if(!mFgtCollectionPtr)
165 if(!mFgtCollectionPtr)
167 LOG_DEBUG <<
"::prepareEnvironment could not create StFgtCollection" <<endm;
170 eventPtr->setFgtCollection(mFgtCollectionPtr);
171 LOG_DEBUG <<
"::prepareEnvironment() has added a non existing StFgtCollection()"<<endm;
176 mFgtCollectionPtr->Clear();
187 LOG_DEBUG <<
"StEmcRawMaker::Make()******************************************************************"<<endm;
191 LOG_ERROR <<
"Error preparing enviroment" << endm;
202 LOG_ERROR << s << endm;
218 Double_t lowerSpan=0;
219 Double_t upperSpan=0;
237 }
else if(mDataType==1){
239 }
else if(mDataType==2){
249 for(
int r=1;r<=FGT_RDO_COU;r++) {
250 if(meta->arc[r].present == 0) continue ;
251 for(
int arm=0;arm<FGT_ARM_COU;arm++) {
252 if(meta->arc[r].arm[arm].present == 0) continue ;
253 for(
int apv=0;apv<FGT_APV_COU;apv++) {
254 if(meta->arc[r].arm[arm].apv[apv].present == 0) continue ;
255 int nt=meta->arc[r].arm[arm].apv[apv].ntim;
257 if(ntimebin!=0 && nt!=0 && ntimebin!=nt) {
258 LOG_ERROR <<
"Different number of timebins in different APV!!! Taking larger one!!!" << endm;
260 if(ntimebin<nt) ntimebin=nt;
261 if(ntimebin>kFgtNumTimeBins)
264 ss<<
"timebin nr read from APV ("<<ntimebin<<
") larger than allocated space ("<<kFgtNumTimeBins<<
")";
278 channel=mFgtRawData->ch;
279 timebin=mFgtRawData->tb;
281 adc=mFgtRawData->adc;
282 arm=rts_tbl->Sector();
286 if(apv>=22 || apv < 0 || apv ==10|| apv==11)
continue;
287 if(arm<0 || arm>5)
continue;
288 if(timebin<0 || timebin>ntimebin || timebin>kFgtNumTimeBins)
continue;
289 if(channel<0 || channel>=128)
continue;
290 if(rdo<1 || rdo>2)
continue;
305 LOG_FATAL<<Form(
"StFgtRawMaker: No DB available")<<endm;
310 geoId=mFgtDb->getGeoIdFromElecCoord(rdo, arm, apv, channel);
311 mFgtDb->getPhysCoordFromElecCoord(rdo,arm,apv,channel,discIdx,quadrant,layer,ordinate,lowerSpan,upperSpan);
320 if( stripCollectionPtr )
322 Int_t elecId = StFgtGeom::getElectIdFromElecCoord( rdo, arm, apv, channel );
323 StFgtStrip* stripPtr = stripCollectionPtr->getStrip( elecId );
324 stripPtr->setAdc( adc, timebin );
326 stripPtr->setGeoId( geoId );
327 stripPtr->setElecCoords( rdo, arm, apv, channel );
330 { LOG_WARN <<
"StFgtRawMaker::Make() -- Could not access disc " << discIdx << endm; }
334 if(mEvent<3) LOG_INFO <<
"StFgtRawMaker:: Number of Timebin from meta data = " << Form(
"%d",ntimebin) << endm;
335 mFgtCollectionPtr->setNumTimeBins(ntimebin);
345 LOG_INFO <<
"StFgtRawMaker::Init we are named " <<
GetName() << endm;
353 LOG_INFO <<
"StFgtRawMaker::InitRun with run = " << runNumber << endm;
361 mFgtDb = fgtMaker->getDbTables();
362 LOG_INFO <<
"::InitRun Getting fgtDb info" << endm;
364 LOG_ERROR <<
"::InitRun we will fail as fgtDb is not present" << endm;
377 mFgtCollectionPtr(0), mFgtDb(0), mEvent(0), mDataType(0)
382 StFgtRawMaker::~StFgtRawMaker()
389 if( mFgtCollectionPtr )
390 mFgtCollectionPtr->Clear( opts );
391 mFgtCollectionPtr=NULL;
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.
Int_t InitRun(Int_t runNumber)
InitRun will be called after FgtDb due to chain dependencies.
StFgtRawMaker(const Char_t *name="FgtRaw")
void Clear(Option_t *opts="")
User defined functions.
Int_t prepareEnvironment()
virtual const char * GetName() const
special overload