From cb7b57afb736e3822674041f1a836a1131fbc136 Mon Sep 17 00:00:00 2001 From: akioogawa <85249930+akioogawa@users.noreply.github.com> Date: Mon, 6 Dec 2021 17:40:29 -0500 Subject: [PATCH] Adding option to read from MuDst in StFcsRawHitMaker (#226) * Adding option to read from Mudst in StFcsRawHitMaker, and example macro to read from Mudst, re-create StFcsHit in StEvent on momery, and re-run FCS reconstruction makers. * unsigned int -> int --- .../StFcsFastSimulatorMaker/macro/runMudst.C | 64 +++++++++++++++++++ StRoot/StFcsRawHitMaker/StFcsRawHitMaker.cxx | 16 +++++ StRoot/StFcsRawHitMaker/StFcsRawHitMaker.h | 8 ++- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 StRoot/StFcsFastSimulatorMaker/macro/runMudst.C diff --git a/StRoot/StFcsFastSimulatorMaker/macro/runMudst.C b/StRoot/StFcsFastSimulatorMaker/macro/runMudst.C new file mode 100644 index 00000000000..83b867340d5 --- /dev/null +++ b/StRoot/StFcsFastSimulatorMaker/macro/runMudst.C @@ -0,0 +1,64 @@ +void runMudst(char* file="st_cosmic_adc_22326042_raw_0000005.MuDst.root", + int ifile=-1, Int_t nevt=-1, char* outdir=".", int readMuDst=1){ + gROOT->Macro("Load.C"); + gROOT->Macro("$STAR/StRoot/StMuDSTMaker/COMMON/macros/loadSharedLibraries.C"); + gSystem->Load("StEventMaker"); + gSystem->Load("StFcsDbMaker"); + gSystem->Load("StFcsRawHitMaker"); + gSystem->Load("StFcsWaveformFitMaker"); + gSystem->Load("StFcsClusterMaker"); + gSystem->Load("libMinuit"); + gSystem->Load("StFcsPointMaker"); + + StChain* chain = new StChain("StChain"); chain->SetDEBUG(0); + StMuDstMaker* muDstMaker = new StMuDstMaker(0, 0, "", file,".", 1000, "MuDst"); + int n=muDstMaker->tree()->GetEntries(); + printf("Found %d entries in Mudst\n",n); + int start=0, stop=n; + if(ifile>=0){ + int start=ifile*nevt; + int stop=(ifile+1)*nevt-1; + if(n=0 && nevtSetAttr("blacklist", "tpc"); + dbMk->SetAttr("blacklist", "svt"); + dbMk->SetAttr("blacklist", "ssd"); + dbMk->SetAttr("blacklist", "ist"); + dbMk->SetAttr("blacklist", "pxl"); + dbMk->SetAttr("blacklist", "pp2pp"); + dbMk->SetAttr("blacklist", "ftpc"); + dbMk->SetAttr("blacklist", "emc"); + dbMk->SetAttr("blacklist", "eemc"); + dbMk->SetAttr("blacklist", "mtd"); + dbMk->SetAttr("blacklist", "pmd"); + dbMk->SetAttr("blacklist", "tof"); + dbMk->SetAttr("blacklist", "etof"); + dbMk->SetAttr("blacklist", "rhicf"); + } + + StFcsDbMaker *fcsDbMkr= new StFcsDbMaker(); + StFcsDb* fcsDb = (StFcsDb*) chain->GetDataSet("fcsDb"); + StEventMaker* eventMk = new StEventMaker(); + StFcsRawHitMaker* hit = new StFcsRawHitMaker(); + hit->setReadMuDst(readMuDst); + StFcsWaveformFitMaker *wff= new StFcsWaveformFitMaker(); + StFcsClusterMaker *clu= new StFcsClusterMaker(); + StFcsPointMaker *poi= new StFcsPointMaker(); + wff->SetDebug(); + clu->SetDebug(); + poi->SetDebug(); + + chain->Init(); + chain->EventLoop(start,stop); + chain->Finish(); + delete chain; +} diff --git a/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.cxx b/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.cxx index 2c07d1643c3..4e4aaee80b0 100644 --- a/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.cxx +++ b/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.cxx @@ -11,6 +11,8 @@ #include "StRoot/StEvent/StFcsCollection.h" #include "StRoot/StEvent/StFcsHit.h" #include "StRoot/StFcsDbMaker/StFcsDb.h" +#include "StMuDSTMaker/COMMON/StMuTypes.hh" +#include "StMuDSTMaker/COMMON/StMuFcsUtil.h" StFcsRawHitMaker::StFcsRawHitMaker( const char* name) : StRTSBaseMaker("fcs",name){ @@ -37,6 +39,9 @@ int StFcsRawHitMaker::Make() { AddData(mEvent); LOG_INFO <<"Added StEvent"<0) return readMuDst(); + mFcsCollectionPtr=mEvent->fcsCollection(); if(!mFcsCollectionPtr) { mFcsCollectionPtr=new StFcsCollection(); @@ -47,6 +52,7 @@ int StFcsRawHitMaker::Make() { LOG_DEBUG <<"Found StFcsCollection"<muFcsCollection(); + if(!mufcsColl){LOG_ERROR<<"StFcsRawHitMaker::readMuDst found no MuFcsCollection"<setFcsCollection(mFcsCollectionPtr); +} + void StFcsRawHitMaker::Clear( Option_t *opts ){}; ClassImp(StFcsRawHitMaker); diff --git a/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.h b/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.h index 1479db1b3a9..95e5368e457 100644 --- a/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.h +++ b/StRoot/StFcsRawHitMaker/StFcsRawHitMaker.h @@ -25,7 +25,8 @@ class StFcsRawHitMaker : public StRTSBaseMaker { void setReadMode(int v) {mReadMode=v;} void setDebug(int v=1) {SetDebug(v);} //!backward compatubility - + void setReadMuDst(int v=1) {mReadMuDst=v;} //!reading Mudst/StMuFcsHit into StEvent/StFcsHit + // Get CVS virtual const char *GetCVS() const; @@ -34,7 +35,10 @@ class StFcsRawHitMaker : public StRTSBaseMaker { StFcsCollection *mFcsCollectionPtr; unsigned int mRun=0; StFcsDb* mFcsDb=0; - unsigned int mReadMode=1; + int mReadMode=1; + int mReadMuDst=0; + + int readMuDst(); ClassDef(StFcsRawHitMaker,1); };