6 #include <StEventTypes.h>
8 #include <TStopwatch.h>
11 #include <StEmcUtil/others/emcDetectorName.h>
12 #include <StEmcUtil/geometry/StEmcGeom.h>
15 #include <StDaqLib/GENERIC/EventReader.hh>
16 #include <StDaqLib/EMC/EMC_Reader.hh>
17 #include <StDAQMaker/StDAQReader.h>
18 #include <StEmcUtil/database/StEmcDecoder.h>
19 #include <StMessMgr.h>
22 #include <StEEmcUtil/database/StEEmcDb.h>
23 #include <StEEmcUtil/database/EEmcDbCrate.h>
25 #include "StEmcRawMaker.h"
26 #include "StEemcRaw.h"
41 mBemcRaw->towerMapBug(kFALSE);
42 mBemcRaw->psdMapBug2(kFALSE);
43 mBemcRaw->smdMapBug(kFALSE);
63 if(IAttr(
"BEmcCheckStatus")) {
64 LOG_INFO <<
"StEmcRawMaker will suppress hits from towers with bad status" << endm;
68 TString EmcOpts = SAttr(
".gopt.emc");
69 if (EmcOpts.IsHex()) {
70 Int_t optionMap[] = {0, 2, 4, 4, 1, 3, 5, 5};
72 for(Int_t i=0; i<MAXDETBARREL; i++) {
74 TString optIs = EmcOpts(optionMap[i],1);
75 sscanf(optIs.Data(),
"%x",&optI);
76 tab->CheckStatus[i] = (optI>>0) & 1;
77 tab->CutOffType[i] = (optI>>1) & 1;
82 mBemcRaw->initHisto();
86 LOG_INFO <<
"Setting BEMC debug Mode -> save all hits into StEvent"<<endm;
88 mBemcRaw->initQAHisto();
92 LOG_INFO <<
"Saveing all BTOW hits for bfc->picoDst production" << endm;
99 LOG_ERROR <<
"FATAL !!! \n did not found \"eeDb-maker\", all EEMC data will be ignored\n fix it, JB\n" <<endm;
102 mEemcRaw->initHisto();
104 if (IAttr(
".histos"))
123 return StMaker::Init();
134 LOG_INFO <<
"Getting database tables for the BEMC detector "<<endm;
140 LOG_INFO <<
"(" << runNumber <<
")" << endm;
144 LOG_ERROR <<
"did not found \"eeDb-maker\", all EEMC data will be ignored\n\n"<<endm;
146 else if (
eeStDb->valid()==0 )
148 LOG_ERROR <<
"found \"eeDb-maker\", but without any DB data, all EEMC data will be ignored\n\n"<<endm;
156 return StMaker::InitRun(runNumber);
170 LOG_INFO <<
"this function is obsolete. Use logger config file to set verbosity instead." << endm;
180 LOG_DEBUG <<
"StEmcRawMaker::Make()******************************************************************"<<endm;
182 { LOG_WARN <<
"Could not prepare the environment to process the event "<<endm; }
185 { LOG_WARN <<
"Could not process BEMC information properly "<<endm; }
188 { LOG_WARN <<
"Could not process EEMC information properly "<<endm; }
192 LOG_DEBUG <<
"Time to run StEmcRawMaker::Make() real = "<<clock.RealTime()<<
" cpu = "<<clock.CpuTime()<<endm;
193 LOG_DEBUG <<
"*******************************************************************************************"<<endm;
197 if( mEvent->id()%555 ) {
199 StEmcRawData *eemcRaw = mEvent->emcCollection()->eemcRawData();
200 for (i=0; i<eemcRaw->getNBlocks();i++) eemcRaw->deleteBank(i);
201 StEmcRawData *bemcRaw = mEvent->emcCollection()->bemcRawData();
202 for (i=0; i<bemcRaw->getNBlocks();i++) bemcRaw->deleteBank(i);
204 LOG_INFO<< Form(
"B+EmcRawData are retained for eve=%d\n",mEvent->id())<<endm;
216 LOG_DEBUG <<
"Get StEvent pointer and make it ready for filling"<<endm;
220 mEvent = (
StEvent*)GetInputDS(
"StEvent");
225 emc = mEvent->emcCollection();
231 emc = mEvent->emcCollection();
237 mEvent->setEmcCollection(emc);
238 LOG_DEBUG <<
"::prepareEnvironment() has added a non existing StEmcCollection()"<<endm;
244 LOG_WARN <<
"::prepareEnvironment() found old StEmcRawData *bemcRaw. Will delete it and create a new one"<<endm;
248 emc->setBemcRawData(bemcRaw);
253 LOG_FATAL <<
"::prepareEnvironment() found old StEmcRawData *eemcRaw, TOTAL failure,\n STOP this chain, JB"<<endm;
257 emc->setEemcRawData(eemcRaw);
272 LOG_DEBUG <<
"Copying BEMC information from DAQ structure "<<endm;
274 if(GetDate() < 20081101){
275 TDataSet* TheData = GetDataSet(
"StDAQReader");
277 LOG_ERROR <<
"Could not find DAQ Reader "<<endm;
282 return mBemcRaw->make(TheData,mEvent);
295 LOG_DEBUG <<
"Copying EEMC information from daqReader->StEvent "<<endm;
297 if(GetDate() < 20081101){
301 LOG_ERROR <<
"::makeEemc() , StDAQReader not available" << endm;
308 LOG_ERROR <<
"::makeEemc() , daq->GetObject() failed" << endm;
317 LOG_ERROR <<
"::makeEemc() , fromVictor->getEEMCReader() failed" << endm;
320 return mEemcRaw->make(eeReader,mEvent);
332 mBemcRaw->fillHisto();
virtual ~StEmcRawMaker()
StEmcRawMaker destructor.
void fillHistograms()
Fill QA histograms.
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.
virtual Int_t Init()
Init function. This method initializes the histograms.
void setPrint(Bool_t a)
Obsolete function; users can control messages with logger config file.
void saveAllBTOW(Bool_t a)
Set to kTRUE if all BTOW hits are to be saved on StEvent (for picoDst/triggerSimu) ...
StEEmcDb * eeStDb
to assess EEMC DB
virtual Int_t Finish()
Finish function.
controlADCtoE_st * getControlTable()
Return Control table (NULL)
StBemcTables * getTables()
Return the StBemcTable pointer.
void setDate(Int_t d)
Set event date.
void setDb(StEEmcDb *aa)
DB-reader must exist.
void createDecoder(Int_t, Int_t)
Create new StEmcDecoder.
Bool_t makeBemc()
Make the Barrel-EMC detector.
virtual Int_t Make()
Process each event.
void loadTables(StMaker *anyMaker)
load tables.
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
Bool_t prepareEnvironment()
Prepare the StEvent environment to fill the EMC data.
void saveAllStEvent(Bool_t a)
Set to kTRUE if all hits are to be saved on StEvent.
virtual Int_t InitRun(Int_t runumber)
InitRun function.
void printConf()
Print configuration.
Bool_t makeEemc()
Make the Endcap-EMC detector.