From 7edea648d8bd56271f098fdbf82d84f1de404b4e Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Mon, 18 Jul 2022 20:28:15 +0800 Subject: [PATCH 01/21] Add FST raw hits in StMuDst --- StRoot/StMuDSTMaker/COMMON/StMuArrays.cxx | 8 +- StRoot/StMuDSTMaker/COMMON/StMuArrays.h | 4 +- StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx | 16 +- .../StMuDSTMaker/COMMON/StMuFstCollection.cxx | 24 ++- .../StMuDSTMaker/COMMON/StMuFstCollection.h | 9 +- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx | 160 ++++++++++++++++++ StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h | 77 +++++++++ StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx | 35 +++- StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h | 8 +- StRoot/StMuDSTMaker/COMMON/StMuTypes.hh | 1 + 10 files changed, 323 insertions(+), 19 deletions(-) create mode 100644 StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx create mode 100644 StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h diff --git a/StRoot/StMuDSTMaker/COMMON/StMuArrays.cxx b/StRoot/StMuDSTMaker/COMMON/StMuArrays.cxx index 61737990efb..f2ef0013835 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuArrays.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuArrays.cxx @@ -30,7 +30,7 @@ const char* StMuArrays::arrayNames [__NALLARRAYS__ ] = {"MuEvent","PrimaryVer /*fmsArrayNames [__NFMSARRAYS__ ]*/ "FmsHit","FmsCluster","FmsPoint","FmsInfo", /*fcsArrayNames [__NFCSARRAYS__ ]*/ "FcsHit","FcsCluster","FcsPoint", "FcsInfo", /*fttArrayNames [__NFTTARRAYS__ ]*/ "FttRawHit","FttCluster","FttPoint", -/*fstArrayNames [__NFSTARRAYS__ ]*/ "FstHit", +/*fstArrayNames [__NFSTARRAYS__ ]*/ "FstRawHit", "FstHit", /*tofArrayNames [__NTOFARRAYS__ ]*/ "TofHit","TofData", "TofRawData", /*btofArrayNames [__NBTOFARRAYS__ ]*/ "BTofHit","BTofRawHit","BTofHeader", // dongx /*etofArrayNames [__NETOFARRAYS__ ]*/ "ETofDigi","ETofHit","ETofHeader", // jdb @@ -80,7 +80,7 @@ const char* StMuArrays::arrayTypes [__NALLARRAYS__ ] = {"StMuEvent","StMuPrim /*fmsArrayTypes [__NFMSARRAYS__ ]*/ "StMuFmsHit","StMuFmsCluster","StMuFmsPoint","StMuFmsInfo", /*fcsArrayTypes [__NFCSARRAYS__ ]*/ "StMuFcsHit","StMuFcsCluster","StMuFcsPoint","StMuFcsInfo", /*fttArrayTypes [__NFTTARRAYS__ ]*/ "StMuFttRawHit","StMuFttCluster","StMuFttPoint", -/*fstArrayTypes [__NFSTARRAYS__ ]*/ "StMuFstHit", +/*fstArrayTypes [__NFSTARRAYS__ ]*/ "StMuFstRawHit","StMuFstHit", /*tofArrayTypes [__NTOFARRAYS__ ]*/ "StMuTofHit","StTofData","StTofRawData", /*btofArrayTypes [__NBTOFARRAYS__ ]*/ "StMuBTofHit","StBTofRawHit","StBTofHeader", // dongx /*etofArrayTypes [__NETOFARRAYS__ ]*/ "StMuETofDigi","StMuETofHit","StMuETofHeader", // jdb+fseck @@ -123,7 +123,7 @@ int StMuArrays::arraySizes [__NALLARRAYS__ ] = {1,10,1000,1000,1000,1 /*fmsArraySizes [__NFMSARRAYS__ ]*/ 1,1,1,1, /*fcsArraySizes [__NFCSARRAYS__ ]*/ 1,1,1,1, /*fttArraySizes [__NFTTARRAYS__ ]*/ 1,1,1, -/*fstArraySizes [__NFSTARRAYS__ ]*/ 1, +/*fstArraySizes [__NFSTARRAYS__ ]*/ 1,1, /*tofArraySizes [__NTOFARRAYS__ ]*/ 100, 200, 1000, /*btofArraySizes [__NBTOFARRAYS__ ]*/ 1000,1000,1, // dongx /*etofArraySizes [__NETOFARRAYS__ ]*/ 1000,1000,1, // jdb @@ -163,7 +163,7 @@ int StMuArrays::arrayCounters [__NALLARRAYS__ ] = {0,0,0,0,0,0,0,0,0,0,0 /*fmsArrayCounters [__NFMSARRAYS__ ]*/ 0,0,0,0, /*fcsArrayCounters [__NFCSARRAYS__ ]*/ 0,0,0,0, /*fttArrayCounters [__NFTTARRAYS__ ]*/ 0,0,0, -/*fstArrayCounters [__NFSTARRAYS__ ]*/ 0, +/*fstArrayCounters [__NFSTARRAYS__ ]*/ 0,0, /*tofArrayCounters [__NTOFARRAYS__ ]*/ 0, 0, 0, /*btofArrayCounters [__NBTOFARRAYS__ ]*/ 0, 0, 0, // dongx /*etofArrayCounters [__NETOFARRAYS__ ]*/ 0, 0, 0, // jdb diff --git a/StRoot/StMuDSTMaker/COMMON/StMuArrays.h b/StRoot/StMuDSTMaker/COMMON/StMuArrays.h index b36bbc4f209..4b454f8ed4b 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuArrays.h +++ b/StRoot/StMuDSTMaker/COMMON/StMuArrays.h @@ -26,7 +26,7 @@ enum fcsTypes {muFcsHit=0, muFcsCluster, muFcsPoint, muFcsInfo}; enum fttTypes {muFttRawHit=0, muFttCluster, muFttPoint}; -enum fstTypes {muFstHit=0}; +enum fstTypes {muFstRawHit=0, muFstHit}; #ifndef __NO_STRANGE_MUDST__ /// @enum strangeTypes enumeration to to index the strangeArrays enum strangeTypes {smuEv=0, smuEvMc, smuV0, smuV0Mc, smuV0Assoc, smuXi, smuXiMc, smuXiAssoc, smuKink, smuKinkMc, smuKinkAssoc, smuCut}; @@ -67,7 +67,7 @@ __NPMDARRAYS__ =4 , ///< size of the pmd arrays, i.e. number of TClonesArray __NFMSARRAYS__ =4 , ///< size of the fms arrays, i.e. number of TClonesArrays __NFCSARRAYS__ =4 , ///< size of the fcs arrays, i.e. number of TClonesArrays __NFTTARRAYS__ =3 , ///< size of the ftt arrays, i.e. number of TClonesArrays -__NFSTARRAYS__ =1 , ///< size of the fst arrays, i.e. number of TClonesArrays +__NFSTARRAYS__ =2 , ///< size of the fst arrays, i.e. number of TClonesArrays // run 5 - dongx __NTOFARRAYS__ =3 , ///< size of the tof arrays > __NBTOFARRAYS__ =3 , /// dongx diff --git a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx index a516a6535d9..158a8b81def 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx @@ -71,6 +71,7 @@ #include "StMuFttRawHit.h" #include "StMuFstCollection.h" #include "StMuFstUtil.h" +#include "StMuFstRawHit.h" #include "StMuFstHit.h" #include "StMuEpdHit.h" // MALisa #include "StMuEpdHitCollection.h" // MALisa @@ -1208,7 +1209,19 @@ void StMuDstMaker::fillFst(StEvent* ev) { connectFstCollection(); mStMuDst->set(this); } - mFstUtil->fillMuFst(mFstCollection,fstcol); + + //raw hit data input + TObjectSet* fstDataSet = (TObjectSet*)GetDataSet("fstRawHitAndCluster"); + if (!fstDataSet) { + LOG_WARN << "StMuDstMaker::Make() - there is no fstDataSet (raw hit) " << endm; + } + + StFstCollection* fstCollectionPtr = (StFstCollection*)fstDataSet->GetObject(); + if(!fstCollectionPtr) { + LOG_WARN << "StMuDstMaker::Make() - no fstCollection for FST raw hit."<fillMuFst(mFstCollection,fstcol,fstCollectionPtr); timer.stop(); DEBUGVALUE2(timer.elapsedTime()); @@ -2042,6 +2055,7 @@ void StMuDstMaker::connectFttCollection() { //----------------------------------------------------------------------- void StMuDstMaker::connectFstCollection() { LOG_INFO << "Setting Fst arrays" << endm; + mFstCollection->setFstRawHitArray(mFstArrays[muFstRawHit]); mFstCollection->setFstHitArray(mFstArrays[muFstHit]); } //----------------------------------------------------------------------- diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.cxx index 00f09f94130..9e79a82e77f 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.cxx @@ -5,39 +5,59 @@ * Author: tchuang, 2022 *************************************************************************** * - * Description: Fst data interface to StMuFstHit + * Description: Fst data interface to StMuFstRawHit and StMuFstHit * ***************************************************************************/ #include "StMuDSTMaker/COMMON/StMuFstCollection.h" +#include "StMuDSTMaker/COMMON/StMuFstRawHit.h" #include "StMuDSTMaker/COMMON/StMuFstHit.h" #include "St_base/StMessMgr.h" ClassImp(StMuFstCollection) -StMuFstCollection::StMuFstCollection() { mHits = 0; } +StMuFstCollection::StMuFstCollection() { mRawHits = 0; mHits = 0; } StMuFstCollection::~StMuFstCollection() { + delete mRawHits; delete mHits; + mRawHits = nullptr; mHits = nullptr; } void StMuFstCollection::init() { + mRawHits = new TClonesArray("StMuFstRawHit", 0); mHits = new TClonesArray("StMuFstHit", 0); } +StMuFstRawHit* StMuFstCollection::addRawHit() { + if (!mRawHits) init(); + int counter = mRawHits->GetEntriesFast(); + return new ((*mRawHits)[counter]) StMuFstRawHit; +} + StMuFstHit* StMuFstCollection::addHit() { if (!mHits) init(); int counter = mHits->GetEntriesFast(); return new ((*mHits)[counter]) StMuFstHit; } +unsigned int StMuFstCollection::numberOfRawHits() const { + if (!mRawHits) return 0; + return mRawHits->GetEntriesFast(); +} + unsigned int StMuFstCollection::numberOfHits() const { if (!mHits) return 0; return mHits->GetEntriesFast(); } +StMuFstRawHit* StMuFstCollection::getRawHit(int index) { + if (!mRawHits) return NULL; + return static_cast(mRawHits->At(index)); +} + StMuFstHit* StMuFstCollection::getHit(int index) { if (!mHits) return NULL; return static_cast(mHits->At(index)); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.h b/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.h index 763a6403ab9..1facca6a50b 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.h +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstCollection.h @@ -5,7 +5,7 @@ * Author: tchuang, 2022 *************************************************************************** * - * Description: Fst data interface to StMuFstHit + * Description: Fst data interface to StMuFstRawHit and StMuFstHit * *************************************************************************** * @@ -17,6 +17,7 @@ #include #include "TClonesArray.h" +class StMuFstRawHit; class StMuFstHit; class StMuFstCollection : public TObject { @@ -25,17 +26,23 @@ class StMuFstCollection : public TObject { ~StMuFstCollection(); void init(); + StMuFstRawHit* addRawHit(); StMuFstHit* addHit(); + unsigned int numberOfRawHits() const; unsigned int numberOfHits() const; + void setFstRawHitArray(TClonesArray* array) {mRawHits=array;} void setFstHitArray(TClonesArray* array) {mHits=array;} + StMuFstRawHit* getRawHit(int index); StMuFstHit* getHit(int index); + TClonesArray* getRawHitArray() { return mRawHits; } TClonesArray* getHitArray() { return mHits; } private: + TClonesArray* mRawHits=0; TClonesArray* mHits=0; ClassDef(StMuFstCollection,1) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx new file mode 100644 index 00000000000..8c55ec402a0 --- /dev/null +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx @@ -0,0 +1,160 @@ +/*************************************************************************** + * + * StMuFstRawHit.cxx + * + * Author: tchuang 2022 + *************************************************************************** + * + * Description: Implementation of StMuFstRawHit, the StEvent hit structure + * + ***************************************************************************/ +#include "StMuFstRawHit.h" +#include "St_base/StMessMgr.h" +#include "StEvent/StEnumerations.h" +#include "StRoot/StFstUtil/StFstRawHit.h" +#include "StThreeVector.hh" + +ClassImp(StMuFstRawHit) + +StMuFstRawHit::StMuFstRawHit() : TObject() { /* no op */ } + +StMuFstRawHit::~StMuFstRawHit() { /* no op */ } + +int StMuFstRawHit::getChannelId() const { return mChannelId; }; +int StMuFstRawHit::getGeoId() const { return mGeoId; }; +int StMuFstRawHit::getSeedhitflag() const { return mSeedhitflag; }; +unsigned char StMuFstRawHit::getMaxTimeBin() const { return mMaxTimeBin; }; +unsigned char StMuFstRawHit::getDefaultTimeBin() { return mDefaultTimeBin; }; +unsigned short StMuFstRawHit::getIdTruth() const { return mIdTruth; }; + +unsigned char StMuFstRawHit::getDisk() const +{ + return 1 + mGeoId / ((kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor) * kFstNumWedgePerDisk); +}; + +unsigned char StMuFstRawHit::getWedge() const +{ + return 1 + mGeoId / (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); +}; + +unsigned char StMuFstRawHit::getPhiStrip() const +{ + int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + return strip % kFstNumPhiSegPerWedge; +}; + +unsigned char StMuFstRawHit::getRStrip() const +{ + int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + return strip / kFstNumPhiSegPerWedge; +}; + +unsigned char StMuFstRawHit::getRdo() const +{ + return 1 + mChannelId / (kFstNumArmsPerRdo * kFstNumChanPerArm); +}; + +unsigned char StMuFstRawHit::getArm() const +{ + return (mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) / kFstNumChanPerArm; +}; + +unsigned char StMuFstRawHit::getApv() const +{ + return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) / kFstNumApvChannels; +}; + +unsigned char StMuFstRawHit::getSensor() const +{ + int strip = mChannelId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + if(strip < kFstNumStripsPerInnerSensor) return strip/kFstNumStripsPerInnerSensor; + else return strip / kFstNumStripsPerOuterSensor - 1; +}; + +unsigned char StMuFstRawHit::getChannel() const +{ + return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) % kFstNumApvChannels; +}; + +float StMuFstRawHit::getCharge( int tb ) const +{ + return mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; +}; + +float StMuFstRawHit::getChargeErr( int tb ) const +{ + return mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; +}; + +//modifiers +void StMuFstRawHit::setChannelId(int rChannelId) +{ + mChannelId = rChannelId; +}; + +void StMuFstRawHit::setGeoId(int rGeoId) +{ + mGeoId = rGeoId; +}; + +void StMuFstRawHit::setSeedhitflag(int rSeedhitflag) +{ + mSeedhitflag = rSeedhitflag; +}; + +void StMuFstRawHit::setDefaultTimeBin( int tb ) +{ + mDefaultTimeBin = tb; +}; + +void StMuFstRawHit::setIdTruth(unsigned short idTruth) +{ + mIdTruth = idTruth; +}; + +void StMuFstRawHit::setCharge( float charge, int tb ) +{ + mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = charge; +}; + + +void StMuFstRawHit::setChargeErr(float rChargeErr, int tb) +{ + mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = rChargeErr; +}; + +void StMuFstRawHit::setMaxTimeBin(int tb) +{ + mMaxTimeBin = ((tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb); +}; + + +void StMuFstRawHit::print(int nTimeBins) +{ + cout << " elecId=" << getChannelId() << " Charge=(" ; + for(int i=0; igetNumRawHits() > 0) { + for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); + if( rawHitCollectionPtr ){ + std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); + std::vector< StFstRawHit* >::iterator rawHitIter; + + for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ + StFstRawHit* rawHit = *rawHitIter; + + StMuFstRawHit* muFstRawHit = muFst->addRawHit(); + muFstRawHit->set( rawHit ); + } // for raw hit + } + } // for wedgeIdx + } // if has FST Raw hit + + //fill FST hits for(int wedgeIdx=0; wedgeIdxwedge(wedgeIdx); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h index de199a2a23a..32f5aea8210 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h @@ -6,8 +6,10 @@ class StMuFstCollection; class StFstHitCollection; +class StFstCollection; class StMuDst; class StFstHit; +class StFstRawHit; class StMuFstUtil : public TObject @@ -15,16 +17,16 @@ class StMuFstUtil : public TObject public: StMuFstUtil(); ~StMuFstUtil(); - StMuFstCollection* getMuFst(StFstHitCollection*); + StMuFstCollection* getMuFst(StFstHitCollection*,StFstCollection*); StFstHitCollection* getFst(StMuFstCollection*); - void fillMuFst(StMuFstCollection*,StFstHitCollection*); + void fillMuFst(StMuFstCollection*,StFstHitCollection*,StFstCollection*); void fillFst(StFstHitCollection*,StMuFstCollection*); private: /** Create StMuFstHits from StFstHits and fill StMuFstCollection */ - void fillMuFstHits(StMuFstCollection*, StFstHitCollection*); + void fillMuFstHits(StMuFstCollection*, StFstHitCollection*, StFstCollection*); /** fill the StFstHits from MuDst */ void fillFstHits(StFstHitCollection*, StMuFstCollection*); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuTypes.hh b/StRoot/StMuDSTMaker/COMMON/StMuTypes.hh index 1e35c9f1931..aba6e84da6e 100755 --- a/StRoot/StMuDSTMaker/COMMON/StMuTypes.hh +++ b/StRoot/StMuDSTMaker/COMMON/StMuTypes.hh @@ -45,5 +45,6 @@ #include "StMuFttRawHit.h" #include "StMuFttUtil.h" #include "StMuFstCollection.h" +#include "StMuFstRawHit.h" #include "StMuFstHit.h" #include "StMuFstUtil.h" From 0f449a9c03a0597de4933c58ef177dfe7030908b Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Thu, 4 Aug 2022 00:31:28 +0800 Subject: [PATCH 02/21] Add chain option for FST raw hits in MuDst --- StRoot/StBFChain/BigFullChain.h | 1 + StRoot/StBFChain/StBFChain.cxx | 5 +++ StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx | 19 ++++++----- StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx | 37 +++++++++++---------- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/StRoot/StBFChain/BigFullChain.h b/StRoot/StBFChain/BigFullChain.h index 1b94a53b772..91dae20e061 100644 --- a/StRoot/StBFChain/BigFullChain.h +++ b/StRoot/StBFChain/BigFullChain.h @@ -1587,6 +1587,7 @@ Bfc_st BFC[] = { // standard chains kFALSE}, {"fstHit", "", "fstChain", "event,fstCluster", "StFstHitMaker", "StFstHitMaker","FST Hit Maker", kFALSE}, + {"fstMuRawHit", "", "fstChain", "CMuDST", "","","Store FST Raw Hit in MuDst", kFALSE}, {"ssddat" ,"","","ssd_daq" ,"","","SSD full chain for Real Data",kFALSE}, {"sstdat" ,"","","sst_daq" ,"","","SST full chain for Real Data",kFALSE}, diff --git a/StRoot/StBFChain/StBFChain.cxx b/StRoot/StBFChain/StBFChain.cxx index ea47f651f46..adbe55400f0 100644 --- a/StRoot/StBFChain/StBFChain.cxx +++ b/StRoot/StBFChain/StBFChain.cxx @@ -676,6 +676,11 @@ Int_t StBFChain::Instantiate() ProcessLine(cmd); } + // FST Raw hits in MuDST + if (maker == "StMuDstMaker" && GetOption("fstMuRawHit") ){ + mk->SetAttr("fstMuRawHit", kTRUE); + } + if ( maker == "StPicoDstMaker"){ if ( GetOption("picoWrite") ) mk->SetMode(1); if ( GetOption("picoRead") ) mk->SetMode(2); // possibly more magic diff --git a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx index 158a8b81def..dc152b32c32 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx @@ -1211,14 +1211,17 @@ void StMuDstMaker::fillFst(StEvent* ev) { } //raw hit data input - TObjectSet* fstDataSet = (TObjectSet*)GetDataSet("fstRawHitAndCluster"); - if (!fstDataSet) { - LOG_WARN << "StMuDstMaker::Make() - there is no fstDataSet (raw hit) " << endm; - } - - StFstCollection* fstCollectionPtr = (StFstCollection*)fstDataSet->GetObject(); - if(!fstCollectionPtr) { - LOG_WARN << "StMuDstMaker::Make() - no fstCollection for FST raw hit."<GetObject(); + if(!fstCollectionPtr) { + LOG_WARN << "StMuDstMaker::Make() - no fstCollection for FST raw hit."<fillMuFst(mFstCollection,fstcol,fstCollectionPtr); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx index f8c75fbdf15..190c607d0a1 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx @@ -71,26 +71,29 @@ void StMuFstUtil::fillMuFstHits(StMuFstCollection* muFst, StFstHitCollection* fstcol, StFstCollection *fstCollectionPtr) { - LOG_INFO << "fillMuFstHits" << endm; //fill FST Raw Hits - if(fstCollectionPtr->getNumRawHits() > 0) { - for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); - if( rawHitCollectionPtr ){ - std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); - std::vector< StFstRawHit* >::iterator rawHitIter; - - for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ - StFstRawHit* rawHit = *rawHitIter; - - StMuFstRawHit* muFstRawHit = muFst->addRawHit(); - muFstRawHit->set( rawHit ); - } // for raw hit - } - } // for wedgeIdx - } // if has FST Raw hit + if(fstCollectionPtr) { + LOG_INFO << "fillMuFstHits (raw hits)" << endm; + if(fstCollectionPtr->getNumRawHits() > 0) { + for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); + if( rawHitCollectionPtr ){ + std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); + std::vector< StFstRawHit* >::iterator rawHitIter; + + for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ + StFstRawHit* rawHit = *rawHitIter; + + StMuFstRawHit* muFstRawHit = muFst->addRawHit(); + muFstRawHit->set( rawHit ); + } // for raw hit + } + } // for wedgeIdx + } // if has FST Raw hit + } // if has FST Raw hit/cluster collection //fill FST hits + LOG_INFO << "fillMuFstHits (hits)" << endm; for(int wedgeIdx=0; wedgeIdxwedge(wedgeIdx); From ec8646243c299693e557aa8692a585cfdf6a236a Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Tue, 9 Aug 2022 12:10:40 +0800 Subject: [PATCH 03/21] Remove not used headers --- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx | 1 - StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h | 1 - 2 files changed, 2 deletions(-) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx index 8c55ec402a0..ab3fab338de 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx @@ -12,7 +12,6 @@ #include "St_base/StMessMgr.h" #include "StEvent/StEnumerations.h" #include "StRoot/StFstUtil/StFstRawHit.h" -#include "StThreeVector.hh" ClassImp(StMuFstRawHit) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h index c7ba262476f..1ba4cfb92d1 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h @@ -11,7 +11,6 @@ #ifndef StMuFstRawHit_h #define StMuFstRawHit_h -#include #include #include #include "StEnumerations.h" From e8f264eba20b75c829c19dc9b18d1efb9e3005d7 Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Tue, 9 Aug 2022 12:28:55 +0800 Subject: [PATCH 04/21] Reduce LOG_INFO --- StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx index 190c607d0a1..3a5e577f548 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx @@ -71,9 +71,10 @@ void StMuFstUtil::fillMuFstHits(StMuFstCollection* muFst, StFstHitCollection* fstcol, StFstCollection *fstCollectionPtr) { + LOG_INFO << "fillMuFstHits" << endm; //fill FST Raw Hits if(fstCollectionPtr) { - LOG_INFO << "fillMuFstHits (raw hits)" << endm; + LOG_DEBUG << "fillMuFstHits (raw hits)" << endm; if(fstCollectionPtr->getNumRawHits() > 0) { for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); @@ -93,7 +94,6 @@ void StMuFstUtil::fillMuFstHits(StMuFstCollection* muFst, } // if has FST Raw hit/cluster collection //fill FST hits - LOG_INFO << "fillMuFstHits (hits)" << endm; for(int wedgeIdx=0; wedgeIdxwedge(wedgeIdx); From 85c7d8f778df24bb4dd2dacc947b15a076c2113e Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Wed, 10 Aug 2022 20:54:23 +0800 Subject: [PATCH 05/21] Fixed a possible null pointer issue in StMuDstMaker --- StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx index dc152b32c32..f40b5ab1383 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx @@ -1216,9 +1216,9 @@ void StMuDstMaker::fillFst(StEvent* ev) { TObjectSet* fstDataSet = (TObjectSet*)GetDataSet("fstRawHitAndCluster"); if (!fstDataSet) { LOG_WARN << "StMuDstMaker::Make() - there is no fstDataSet (raw hit) " << endm; - } + } - fstCollectionPtr = (StFstCollection*)fstDataSet->GetObject(); + fstCollectionPtr = (fstDataSet ? (StFstCollection*)fstDataSet->GetObject() : 0); if(!fstCollectionPtr) { LOG_WARN << "StMuDstMaker::Make() - no fstCollection for FST raw hit."< Date: Wed, 10 Aug 2022 20:58:08 +0800 Subject: [PATCH 06/21] fstMuRawHit no need to be included in fstChain --- StRoot/StBFChain/BigFullChain.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StRoot/StBFChain/BigFullChain.h b/StRoot/StBFChain/BigFullChain.h index 91dae20e061..17b39c2232d 100644 --- a/StRoot/StBFChain/BigFullChain.h +++ b/StRoot/StBFChain/BigFullChain.h @@ -1587,7 +1587,7 @@ Bfc_st BFC[] = { // standard chains kFALSE}, {"fstHit", "", "fstChain", "event,fstCluster", "StFstHitMaker", "StFstHitMaker","FST Hit Maker", kFALSE}, - {"fstMuRawHit", "", "fstChain", "CMuDST", "","","Store FST Raw Hit in MuDst", kFALSE}, + {"fstMuRawHit", "", "", "CMuDST", "","","Store FST Raw Hit in MuDst", kFALSE}, {"ssddat" ,"","","ssd_daq" ,"","","SSD full chain for Real Data",kFALSE}, {"sstdat" ,"","","sst_daq" ,"","","SST full chain for Real Data",kFALSE}, From 77f0375d579cfe2f149217526837a7bc351d0ae2 Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Tue, 30 Aug 2022 22:17:24 +0800 Subject: [PATCH 07/21] Add FST raw hits in StEvent and the relevant chain option --- StRoot/StBFChain/BigFullChain.h | 1 + StRoot/StBFChain/StBFChain.cxx | 5 + StRoot/StEvent/StContainers.cxx | 2 + StRoot/StEvent/StContainers.h | 2 + StRoot/StEvent/StEvent.cxx | 24 +++ StRoot/StEvent/StEvent.h | 4 + StRoot/StEvent/StEventClusteringHints.cxx | 2 + StRoot/StEvent/StFstEvtCollection.cxx | 52 ++++++ StRoot/StEvent/StFstEvtCollection.h | 48 ++++++ StRoot/StEvent/StFstRawHit.cxx | 161 ++++++++++++++++++ StRoot/StEvent/StFstRawHit.h | 87 ++++++++++ .../StFstCalibrationMaker.cxx | 2 +- .../StFstClusterMaker/StFstClusterMaker.cxx | 2 +- .../StFstScanRadiusClusterAlgo.cxx | 2 +- StRoot/StFstQAMaker/StFstQAMaker.cxx | 2 +- StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx | 57 ++++++- StRoot/StFstRawHitMaker/StFstRawHitMaker.h | 5 + StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx | 2 +- 18 files changed, 454 insertions(+), 6 deletions(-) create mode 100644 StRoot/StEvent/StFstEvtCollection.cxx create mode 100644 StRoot/StEvent/StFstEvtCollection.h create mode 100644 StRoot/StEvent/StFstRawHit.cxx create mode 100644 StRoot/StEvent/StFstRawHit.h diff --git a/StRoot/StBFChain/BigFullChain.h b/StRoot/StBFChain/BigFullChain.h index 17b39c2232d..90362df333e 100644 --- a/StRoot/StBFChain/BigFullChain.h +++ b/StRoot/StBFChain/BigFullChain.h @@ -1587,6 +1587,7 @@ Bfc_st BFC[] = { // standard chains kFALSE}, {"fstHit", "", "fstChain", "event,fstCluster", "StFstHitMaker", "StFstHitMaker","FST Hit Maker", kFALSE}, + {"fstEvtRawHit", "", "", "fstRawHit", "","","Store FST Raw Hit in StEvent", kFALSE}, {"fstMuRawHit", "", "", "CMuDST", "","","Store FST Raw Hit in MuDst", kFALSE}, {"ssddat" ,"","","ssd_daq" ,"","","SSD full chain for Real Data",kFALSE}, diff --git a/StRoot/StBFChain/StBFChain.cxx b/StRoot/StBFChain/StBFChain.cxx index adbe55400f0..8f5b72eed1e 100644 --- a/StRoot/StBFChain/StBFChain.cxx +++ b/StRoot/StBFChain/StBFChain.cxx @@ -676,6 +676,11 @@ Int_t StBFChain::Instantiate() ProcessLine(cmd); } + // FST Raw hits in StEvent + if (maker == "StFstRawHitMaker" && GetOption("fstEvtRawHit") ){ + mk->SetAttr("fstEvtRawHit", kTRUE); + } + // FST Raw hits in MuDST if (maker == "StMuDstMaker" && GetOption("fstMuRawHit") ){ mk->SetAttr("fstMuRawHit", kTRUE); diff --git a/StRoot/StEvent/StContainers.cxx b/StRoot/StEvent/StContainers.cxx index 23db1a9d077..a8a52fe4c8a 100644 --- a/StRoot/StEvent/StContainers.cxx +++ b/StRoot/StEvent/StContainers.cxx @@ -156,6 +156,7 @@ #include "StHltTriggerReason.h" #include "StHltVpdHit.h" #include "StIstHit.h" +#include "StFstRawHit.h" #include "StFstHit.h" #include "StKinkVertex.h" #include "StL3AlgorithmInfo.h" @@ -228,6 +229,7 @@ StCollectionImp(HltTrackNode) StCollectionImp(HltTriggerReason) StCollectionImp(HltVpdHit) StCollectionImp(IstHit) +StCollectionImp(FstRawHit) StCollectionImp(FstHit) StCollectionImp(KinkVertex) StCollectionImp(L3AlgorithmInfo) diff --git a/StRoot/StEvent/StContainers.h b/StRoot/StEvent/StContainers.h index 7a5c43cc27a..6a1762f2d0e 100644 --- a/StRoot/StEvent/StContainers.h +++ b/StRoot/StEvent/StContainers.h @@ -168,6 +168,7 @@ class StHltTrackNode; class StHltTriggerReason; class StHltVpdHit; class StIstHit; +class StFstRawHit; class StFstHit; class StKinkVertex; class StL3AlgorithmInfo; @@ -244,6 +245,7 @@ StCollectionDef(HltTrackNode) StCollectionDef(HltTriggerReason) StCollectionDef(HltVpdHit) StCollectionDef(IstHit) +StCollectionDef(FstRawHit) StCollectionDef(FstHit) StCollectionDef(KinkVertex) StCollectionDef(L3AlgorithmInfo) diff --git a/StRoot/StEvent/StEvent.cxx b/StRoot/StEvent/StEvent.cxx index 1f27b475156..93d3e86de62 100644 --- a/StRoot/StEvent/StEvent.cxx +++ b/StRoot/StEvent/StEvent.cxx @@ -251,6 +251,7 @@ #include "StFgtCollection.h" #include "StPxlHitCollection.h" #include "StIstHitCollection.h" +#include "StFstEvtCollection.h" #include "StFstHitCollection.h" #include "StTrackNode.h" #include "StTrack.h" @@ -922,6 +923,22 @@ StEvent::istHitCollection() const return istHitCollection; } +StFstEvtCollection* +StEvent::fstEvtCollection() +{ + StFstEvtCollection *fstEvtCollection = 0; + _lookup(fstEvtCollection, mContent); + return fstEvtCollection; +} + +const StFstEvtCollection* +StEvent::fstEvtCollection() const +{ + StFstEvtCollection *fstEvtCollection = 0; + _lookup(fstEvtCollection, mContent); + return fstEvtCollection; +} + StFstHitCollection* StEvent::fstHitCollection() { @@ -1428,6 +1445,12 @@ StEvent::setIstHitCollection(StIstHitCollection* val) _lookupAndSet(val, mContent); } +void +StEvent::setFstEvtCollection(StFstEvtCollection* val) +{ + _lookupAndSet(val, mContent); +} + void StEvent::setFstHitCollection(StFstHitCollection* val) { @@ -1543,6 +1566,7 @@ void StEvent::statistics() cout << "\tStSsdHitCollection: " << static_cast(ssdHitCollection()) << endl; cout << "\tStSstHitCollection: " << static_cast(sstHitCollection()) << endl; cout << "\tStIstHitCollection: " << static_cast(istHitCollection()) << endl; + cout << "\tStFstEvtCollection: " << static_cast(fstEvtCollection()) << endl; cout << "\tStFstHitCollection: " << static_cast(fstHitCollection()) << endl; cout << "\tStPxlHitCollection: " << static_cast(pxlHitCollection()) << endl; cout << "\tStEmcCollection: " << static_cast(emcCollection()) << endl; diff --git a/StRoot/StEvent/StEvent.h b/StRoot/StEvent/StEvent.h index 53b10d1ad53..a17792c17b0 100644 --- a/StRoot/StEvent/StEvent.h +++ b/StRoot/StEvent/StEvent.h @@ -225,6 +225,7 @@ class StHltEvent; class StFgtCollection; class StPxlHitCollection; class StIstHitCollection; +class StFstEvtCollection; class StFstHitCollection; class StEvent : public StXRefMain { @@ -298,6 +299,8 @@ class StEvent : public StXRefMain { const StPxlHitCollection* pxlHitCollection() const; StIstHitCollection* istHitCollection(); const StIstHitCollection* istHitCollection() const; + StFstEvtCollection* fstEvtCollection(); + const StFstEvtCollection* fstEvtCollection() const; StFstHitCollection* fstHitCollection(); const StFstHitCollection* fstHitCollection() const; StEpdCollection* epdCollection(); @@ -373,6 +376,7 @@ class StEvent : public StXRefMain { void setSstHitCollection(StSstHitCollection*); void setPxlHitCollection(StPxlHitCollection*); void setIstHitCollection(StIstHitCollection*); + void setFstEvtCollection(StFstEvtCollection*); void setFstHitCollection(StFstHitCollection*); void setEmcCollection(StEmcCollection*); void setEpdCollection(StEpdCollection*); diff --git a/StRoot/StEvent/StEventClusteringHints.cxx b/StRoot/StEvent/StEventClusteringHints.cxx index 2eddd1ab77f..c3479e9b2c1 100755 --- a/StRoot/StEvent/StEventClusteringHints.cxx +++ b/StRoot/StEvent/StEventClusteringHints.cxx @@ -200,6 +200,7 @@ StEventClusteringHints::StEventClusteringHints() setBranch("StPhmdCollection", "evt_aux", 7); setBranch("StRpsCollection", "evt_aux", 7); setBranch("StFttCollection", "evt_aux", 7); + setBranch("StFstEvtCollection", "evt_aux", 7); setBranch("StSsdHitCollection", "evt_hits", 8); setBranch("StSstHitCollection", "evt_hits", 8); setBranch("StSvtHitCollection", "evt_hits", 8); @@ -235,6 +236,7 @@ StEventClusteringHints::StEventClusteringHints() setBranch("StSstHitCollection", "event", 1); setBranch("StSvtHitCollection", "event", 1); setBranch("StIstHitCollection", "event", 1); + setBranch("StFstEvtCollection", "event", 1); setBranch("StFstHitCollection", "event", 1); setBranch("StPxlHitCollection", "event", 1); setBranch("StTpcHitCollection", "event", 1); diff --git a/StRoot/StEvent/StFstEvtCollection.cxx b/StRoot/StEvent/StFstEvtCollection.cxx new file mode 100644 index 00000000000..2d6722eac56 --- /dev/null +++ b/StRoot/StEvent/StFstEvtCollection.cxx @@ -0,0 +1,52 @@ +/*************************************************************************** + * $Id: StFstEvtCollection.cxx$ + * + * Author: Te-Chuan Huang, Aug. 2022 + **************************************************************************** + * Description: + * See header file. + ***************************************************************************/ + +#include "StFstEvtCollection.h" +#include "StFstRawHit.h" + +ClassImp(StFstEvtCollection) + +StFstEvtCollection::StFstEvtCollection() {/* no operation*/} +StFstEvtCollection::~StFstEvtCollection() +{ + // Usually this wouldn't be necessary but mRawHits is a polymorphic container and StFstRawHit provides + // its own new/delete operator + for (unsigned int i=0; igetChannelId(); + if (elecId < 0 || elecId >= kFstNumElecIds) return; + + unsigned int w = (unsigned int)hit->getWedge() - 1; + if (w >= kFstNumWedges) return; + + mRawHits.push_back(hit); +} + +unsigned int StFstEvtCollection::numberOfRawHits() const { return mRawHits.size(); } + +const StSPtrVecFstRawHit & StFstEvtCollection::rawHits() const { return mRawHits; } +StSPtrVecFstRawHit & StFstEvtCollection::rawHits() { return mRawHits; } + +void StFstEvtCollection::print(int option) { + cout << " *** Print FST raw hit collection *** " << endl; +} + +/*************************************************************************** + * StFstEvtCollection.cxx,v 1.0 + * Revision 1.0 2022/08/25 Te-Chuan Huang + * Initial version + ****************************************************************************/ diff --git a/StRoot/StEvent/StFstEvtCollection.h b/StRoot/StEvent/StFstEvtCollection.h new file mode 100644 index 00000000000..e5dbc80a036 --- /dev/null +++ b/StRoot/StEvent/StFstEvtCollection.h @@ -0,0 +1,48 @@ +/*************************************************************************** +* +* $Id: StFstEvtCollection.h $ +* +* Author: Te-Chuan Huang, Aug. 2022 +**************************************************************************** +* Description: +* Data collection for FST raw hits, and is saved to StEvent. +***************************************************************************/ + +#ifndef StFstEvtCollection_hh +#define StFstEvtCollection_hh + +#include "Stiostream.h" +#include "StObject.h" +#include "StContainers.h" +#include "StEvent/StEnumerations.h" +#include "StEvent/StFstConsts.h" + +class StFstRawHit; + +class StFstEvtCollection : public StObject +{ +public: + StFstEvtCollection(); + ~StFstEvtCollection(); + + void addRawHit(StFstRawHit *); + unsigned int numberOfRawHits() const; + + StSPtrVecFstRawHit &rawHits(); + const StSPtrVecFstRawHit &rawHits() const; + + void print(int option=1); + +private: + StSPtrVecFstRawHit mRawHits; ///< Inherits from StStrArray which takes care of deleting the objects + ///< pointed by the pointers in this array. This is different from the std::vector + + ClassDef(StFstEvtCollection, 1) +}; +#endif + +/*************************************************************************** +* StFstEvtCollection.h,v 1.0 +* Revision 1.0 2022/08/25 Te-Chuan Huang +* Initial version +****************************************************************************/ diff --git a/StRoot/StEvent/StFstRawHit.cxx b/StRoot/StEvent/StFstRawHit.cxx new file mode 100644 index 00000000000..522825efd9a --- /dev/null +++ b/StRoot/StEvent/StFstRawHit.cxx @@ -0,0 +1,161 @@ +#include + +#include "StFstRawHit.h" +#include "St_base/StMessMgr.h" +#include "StEvent/StEnumerations.h" +#include "StEvent/StFstConsts.h" + +bool rawHitPtrLessThan::operator() (const StFstRawHit *rawHit1, const StFstRawHit *rawHit2) const +{ + if ( rawHit1 && rawHit2 ) + return (rawHit1->getGeoId() < rawHit2->getGeoId()); + else + return 0; +} + + +StFstRawHit::StFstRawHit() : StObject(), mChannelId(-1), mGeoId(-1), mCharge(), mChargeErr(), mMaxTimeBin(1), + mIdTruth(0) +{ + std::fill_n(mCharge, kFstNumTimeBins, -999); +} + + +template +StFstRawHit::StFstRawHit(int channelId, int geoId, + const Container &charges, const Container &chargeErrs, + UChar_t maxTimeBin, UShort_t idTruth) : + StObject(), + mChannelId(channelId), mGeoId(geoId), mCharge(), mChargeErr(), + mMaxTimeBin(maxTimeBin), mIdTruth(idTruth) +{ + std::copy(std::begin(charges), std::end(charges), mCharge); + std::copy(std::begin(chargeErrs), std::end(chargeErrs), mChargeErr); +} + + +int StFstRawHit::getChannelId() const { return mChannelId; }; +int StFstRawHit::getGeoId() const { return mGeoId; }; +int StFstRawHit::getSeedhitflag() const { return mSeedhitflag; }; +unsigned char StFstRawHit::getMaxTimeBin() const { return mMaxTimeBin; }; +unsigned char StFstRawHit::getDefaultTimeBin() { return mDefaultTimeBin; }; +unsigned short StFstRawHit::getIdTruth() const { return mIdTruth; }; + +unsigned char StFstRawHit::getDisk() const +{ + return 1 + mGeoId / ((kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor) * kFstNumWedgePerDisk); +}; + +unsigned char StFstRawHit::getWedge() const +{ + return 1 + mGeoId / (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); +}; + +unsigned char StFstRawHit::getPhiStrip() const +{ + int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + return strip % kFstNumPhiSegPerWedge; +}; + +unsigned char StFstRawHit::getRStrip() const +{ + int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + return strip / kFstNumPhiSegPerWedge; +}; + +unsigned char StFstRawHit::getRdo() const +{ + return 1 + mChannelId / (kFstNumArmsPerRdo * kFstNumChanPerArm); +}; + +unsigned char StFstRawHit::getArm() const +{ + return (mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) / kFstNumChanPerArm; +}; + +unsigned char StFstRawHit::getApv() const +{ + return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) / kFstNumApvChannels; +}; + +unsigned char StFstRawHit::getSensor() const +{ + int strip = mChannelId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); + if(strip < kFstNumStripsPerInnerSensor) return strip/kFstNumStripsPerInnerSensor; + else return strip / kFstNumStripsPerOuterSensor - 1; +}; + +unsigned char StFstRawHit::getChannel() const +{ + return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) % kFstNumApvChannels; +}; + +float StFstRawHit::getCharge( int tb ) const +{ + return mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; +}; + +float StFstRawHit::getChargeErr( int tb ) const +{ + return mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; +}; + +//modifiers +void StFstRawHit::setChannelId(int rChannelId) +{ + mChannelId = rChannelId; +}; + +void StFstRawHit::setGeoId(int rGeoId) +{ + mGeoId = rGeoId; +}; + +void StFstRawHit::setSeedhitflag(int rSeedhitflag) +{ + mSeedhitflag = rSeedhitflag; +}; + +void StFstRawHit::setDefaultTimeBin( int tb ) +{ + mDefaultTimeBin = tb; +}; + +void StFstRawHit::setIdTruth(unsigned short idTruth) +{ + mIdTruth = idTruth; +}; + +void StFstRawHit::setCharge( float charge, int tb ) +{ + mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = charge; +}; + + +void StFstRawHit::setChargeErr(float rChargeErr, int tb) +{ + mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = rChargeErr; +}; + +void StFstRawHit::setMaxTimeBin(int tb) +{ + mMaxTimeBin = ((tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb); +}; + + +void StFstRawHit::Print(int nTimeBins) const +{ + LOG_DEBUG << " elecId=" << getChannelId() << " Charge=(" ; + for(int i=0; i + StFstRawHit(int channelId, int geoId, + const Container &charges, const Container &chargeErrs = Container{}, + UChar_t maxTimeBin = 1, UShort_t idTruth = 0); + + //accessors + int getChannelId() const; //!< 0-36863 + int getGeoId() const; //!< 0-36863 + int getSeedhitflag() const; //!< 0 or 1 + unsigned char getDisk() const; //!< 1-3 + unsigned char getWedge() const; //!< 1-36 + unsigned char getPhiStrip() const; //!< 0-127 + unsigned char getRStrip() const; //!< 0-7 + float getCharge(int tb = 0) const; + float getChargeErr(int tb = 0) const; + unsigned char getMaxTimeBin() const; + unsigned char getRdo() const; //!< 1-6 + unsigned char getArm() const; //!< 0-2 + unsigned char getApv() const; //!< 0-15 + unsigned char getSensor() const; //!< 0-2 + unsigned char getChannel() const; //!< 0-127 + static unsigned char getDefaultTimeBin(); + unsigned short getIdTruth() const; //!< for embedding, 0 as background + + //modifiers + void setChannelId(int rChannelId); + void setGeoId(int rChannelId); + void setSeedhitflag(int rSeedhitflag); + void setCharge(float charge, int tb = -1); + + /// Overwrites this channel's charges in all time bins by values in the + /// provided container + template + void setCharges(const Container& charges) { + std::copy( std::begin(charges), std::end(charges), mCharge); + } + + void setChargeErr(float chargeErr, int tb = -1); + void setMaxTimeBin(int tb) ; + static void setDefaultTimeBin( int tb ); + void setIdTruth(unsigned short idTruth); + + using StObject::Print; + void Print(int nTimeBins) const; + +private: + + Int_t mChannelId; ///< channel Id, numbering from 0 to 36863 + Int_t mGeoId; ///< geometry Id, numbering from 0 to 36863 + Int_t mSeedhitflag; ///< seed hit flag, 0 not a seed hit & 1 mean a seed hit + Float_t mCharge[kFstNumTimeBins]; ///< pedestal non-subtracted ADC value saved in calibration mode; + ///< pedestal and CMN subtracted in physics mode + Float_t mChargeErr[kFstNumTimeBins];///< charge error in all time bins + UChar_t mMaxTimeBin; ///< the max ADC time bin index of the raw hit + UShort_t mIdTruth; ///< for embedding, 0 as background + + static UChar_t mDefaultTimeBin; + + ClassDef(StFstRawHit, 1) +}; + + +/*! Functor for sorting raw hits in ascending order by geometry id mGeoId, i.e. the pad Id order. */ +struct rawHitPtrLessThan { + bool operator() (const StFstRawHit *rawHit1, const StFstRawHit *rawHit2) const; +}; + +#endif diff --git a/StRoot/StFstCalibrationMaker/StFstCalibrationMaker.cxx b/StRoot/StFstCalibrationMaker/StFstCalibrationMaker.cxx index 42afe775599..66ba4baa3d7 100644 --- a/StRoot/StFstCalibrationMaker/StFstCalibrationMaker.cxx +++ b/StRoot/StFstCalibrationMaker/StFstCalibrationMaker.cxx @@ -20,7 +20,7 @@ #include "StFstCalibrationMaker.h" #include "StRoot/StFstUtil/StFstCollection.h" #include "StRoot/StFstUtil/StFstRawHitCollection.h" -#include "StRoot/StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" #include "StRoot/StFstDbMaker/StFstDb.h" #include "tables/St_fstMapping_Table.h" diff --git a/StRoot/StFstClusterMaker/StFstClusterMaker.cxx b/StRoot/StFstClusterMaker/StFstClusterMaker.cxx index a213cc44a43..f705225bd8a 100644 --- a/StRoot/StFstClusterMaker/StFstClusterMaker.cxx +++ b/StRoot/StFstClusterMaker/StFstClusterMaker.cxx @@ -4,7 +4,7 @@ #include "StEvent.h" #include "StEvent/StEnumerations.h" #include "StFstUtil/StFstCollection.h" -#include "StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" #include "StFstUtil/StFstRawHitCollection.h" #include "StFstUtil/StFstCluster.h" #include "StFstUtil/StFstClusterCollection.h" diff --git a/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx b/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx index 8b0befe6a8e..de5c610d7ec 100644 --- a/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx +++ b/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx @@ -4,7 +4,7 @@ #include "StFstScanRadiusClusterAlgo.h" #include "StFstUtil/StFstCollection.h" #include "StFstUtil/StFstRawHitCollection.h" -#include "StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" #include "StFstUtil/StFstClusterCollection.h" #include "StFstUtil/StFstCluster.h" #include "StEvent/StFstConsts.h" diff --git a/StRoot/StFstQAMaker/StFstQAMaker.cxx b/StRoot/StFstQAMaker/StFstQAMaker.cxx index 2f5e782593f..83fc2266ec6 100644 --- a/StRoot/StFstQAMaker/StFstQAMaker.cxx +++ b/StRoot/StFstQAMaker/StFstQAMaker.cxx @@ -17,7 +17,7 @@ #include "StFstHit.h" #include "StRoot/StFstUtil/StFstCollection.h" #include "StRoot/StFstUtil/StFstRawHitCollection.h" -#include "StRoot/StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" #include "StIOMaker/StIOMaker.h" #include "StEvent.h" #include "StTrack.h" diff --git a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx index 77601dec861..ccb651eb04b 100644 --- a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx +++ b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx @@ -8,7 +8,8 @@ #include "StFstUtil/StFstCollection.h" #include "StFstUtil/StFstRawHitCollection.h" -#include "StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" +#include "StEvent/StFstEvtCollection.h" #include "StFstDbMaker/StFstDb.h" #include "StEvent/StFstConsts.h" @@ -390,6 +391,60 @@ Int_t StFstRawHitMaker::Make() LOG_INFO << " Total number of FST Raw Hits - Step II = " << mFstCollectionPtr->getNumRawHits() << " w/ idTruth = " << nIdTruth_Fst << endm; + // Fill Fst raw hits we got so far into StEvent if the chain option is called + if(IAttr("fstEvtRawHit")) {//True for storing FST Raw hits + LOG_INFO << " Filling FST Raw Hits into StEvent" << endm; + + //prepare for StEvent + mEvent = (StEvent *) GetInputDS("StEvent"); + + if(mEvent) { + LOG_DEBUG<<"Found StEvent"<fstEvtCollection(); + + // If no fst raw hit collection, create one + if (!mFstEvtCollection) { + mFstEvtCollection = new StFstEvtCollection(); + mEvent->setFstEvtCollection(mFstEvtCollection); + LOG_DEBUG << "Make() - Added new StFstEvtCollection to this StEvent" << endm; + } + + if(mFstCollectionPtr->getNumRawHits() > 0) { + for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); + if( rawHitCollectionPtr ){ + std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); + std::vector< StFstRawHit* >::iterator rawHitIter; + + for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ + StFstRawHit* rawHit = *rawHitIter; + + StFstRawHit* newRawHit = new StFstRawHit(); + newRawHit->setChannelId( rawHit->getChannelId() ); + newRawHit->setGeoId( rawHit->getGeoId() ); + newRawHit->setSeedhitflag( rawHit->getSeedhitflag() ); + for(int itb=0; itbsetCharge( rawHit->getCharge(itb), itb ); + newRawHit->setChargeErr( rawHit->getChargeErr(itb), itb ); + } + newRawHit->setMaxTimeBin( (int)rawHit->getMaxTimeBin() ); + newRawHit->setDefaultTimeBin( (int)rawHit->getDefaultTimeBin() ); + newRawHit->setIdTruth( rawHit->getIdTruth() ); + + mFstEvtCollection->addRawHit(newRawHit); + } + } + } + } + } + return ierr; } diff --git a/StRoot/StFstRawHitMaker/StFstRawHitMaker.h b/StRoot/StFstRawHitMaker/StFstRawHitMaker.h index 36ad11a43e4..126c01c527f 100644 --- a/StRoot/StFstRawHitMaker/StFstRawHitMaker.h +++ b/StRoot/StFstRawHitMaker/StFstRawHitMaker.h @@ -13,7 +13,9 @@ #include "StEvent/StFstConsts.h" +class StEvent; class StFstCollection; +class StFstEvtCollection; /** @@ -84,6 +86,9 @@ class StFstRawHitMaker : public StRTSBaseMaker int FillRawHitCollectionFromSimData(); + StEvent* mEvent; + StFstEvtCollection* mFstEvtCollection; + Int_t mDataType; ///< 0=all, 1=adc only, 2=zs only ClassDef(StFstRawHitMaker, 1); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx index 3a5e577f548..45d5ed8daeb 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx @@ -2,7 +2,7 @@ #include "StEvent/StFstHit.h" #include "StRoot/StFstUtil/StFstCollection.h" #include "StRoot/StFstUtil/StFstRawHitCollection.h" -#include "StRoot/StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" #include "StMuDSTMaker/COMMON/StMuFstHit.h" #include "StMuDSTMaker/COMMON/StMuFstRawHit.h" From 18811d1a51ca59e2fb22cfa6b2351826bed4b1af Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Tue, 30 Aug 2022 22:25:55 +0800 Subject: [PATCH 08/21] Remove StFstRawHit.cxx and StFstRawHit.h from StFstUtil --- StRoot/StFstUtil/StFstRawHit.cxx | 161 ------------------------------- StRoot/StFstUtil/StFstRawHit.h | 87 ----------------- 2 files changed, 248 deletions(-) delete mode 100644 StRoot/StFstUtil/StFstRawHit.cxx delete mode 100644 StRoot/StFstUtil/StFstRawHit.h diff --git a/StRoot/StFstUtil/StFstRawHit.cxx b/StRoot/StFstUtil/StFstRawHit.cxx deleted file mode 100644 index 522825efd9a..00000000000 --- a/StRoot/StFstUtil/StFstRawHit.cxx +++ /dev/null @@ -1,161 +0,0 @@ -#include - -#include "StFstRawHit.h" -#include "St_base/StMessMgr.h" -#include "StEvent/StEnumerations.h" -#include "StEvent/StFstConsts.h" - -bool rawHitPtrLessThan::operator() (const StFstRawHit *rawHit1, const StFstRawHit *rawHit2) const -{ - if ( rawHit1 && rawHit2 ) - return (rawHit1->getGeoId() < rawHit2->getGeoId()); - else - return 0; -} - - -StFstRawHit::StFstRawHit() : StObject(), mChannelId(-1), mGeoId(-1), mCharge(), mChargeErr(), mMaxTimeBin(1), - mIdTruth(0) -{ - std::fill_n(mCharge, kFstNumTimeBins, -999); -} - - -template -StFstRawHit::StFstRawHit(int channelId, int geoId, - const Container &charges, const Container &chargeErrs, - UChar_t maxTimeBin, UShort_t idTruth) : - StObject(), - mChannelId(channelId), mGeoId(geoId), mCharge(), mChargeErr(), - mMaxTimeBin(maxTimeBin), mIdTruth(idTruth) -{ - std::copy(std::begin(charges), std::end(charges), mCharge); - std::copy(std::begin(chargeErrs), std::end(chargeErrs), mChargeErr); -} - - -int StFstRawHit::getChannelId() const { return mChannelId; }; -int StFstRawHit::getGeoId() const { return mGeoId; }; -int StFstRawHit::getSeedhitflag() const { return mSeedhitflag; }; -unsigned char StFstRawHit::getMaxTimeBin() const { return mMaxTimeBin; }; -unsigned char StFstRawHit::getDefaultTimeBin() { return mDefaultTimeBin; }; -unsigned short StFstRawHit::getIdTruth() const { return mIdTruth; }; - -unsigned char StFstRawHit::getDisk() const -{ - return 1 + mGeoId / ((kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor) * kFstNumWedgePerDisk); -}; - -unsigned char StFstRawHit::getWedge() const -{ - return 1 + mGeoId / (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); -}; - -unsigned char StFstRawHit::getPhiStrip() const -{ - int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); - return strip % kFstNumPhiSegPerWedge; -}; - -unsigned char StFstRawHit::getRStrip() const -{ - int strip = mGeoId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); - return strip / kFstNumPhiSegPerWedge; -}; - -unsigned char StFstRawHit::getRdo() const -{ - return 1 + mChannelId / (kFstNumArmsPerRdo * kFstNumChanPerArm); -}; - -unsigned char StFstRawHit::getArm() const -{ - return (mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) / kFstNumChanPerArm; -}; - -unsigned char StFstRawHit::getApv() const -{ - return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) / kFstNumApvChannels; -}; - -unsigned char StFstRawHit::getSensor() const -{ - int strip = mChannelId % (kFstNumInnerSensorsPerWedge * kFstNumStripsPerInnerSensor + kFstNumOuterSensorsPerWedge * kFstNumStripsPerOuterSensor); - if(strip < kFstNumStripsPerInnerSensor) return strip/kFstNumStripsPerInnerSensor; - else return strip / kFstNumStripsPerOuterSensor - 1; -}; - -unsigned char StFstRawHit::getChannel() const -{ - return ((mChannelId % (kFstNumArmsPerRdo * kFstNumChanPerArm)) % kFstNumChanPerArm) % kFstNumApvChannels; -}; - -float StFstRawHit::getCharge( int tb ) const -{ - return mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; -}; - -float StFstRawHit::getChargeErr( int tb ) const -{ - return mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ]; -}; - -//modifiers -void StFstRawHit::setChannelId(int rChannelId) -{ - mChannelId = rChannelId; -}; - -void StFstRawHit::setGeoId(int rGeoId) -{ - mGeoId = rGeoId; -}; - -void StFstRawHit::setSeedhitflag(int rSeedhitflag) -{ - mSeedhitflag = rSeedhitflag; -}; - -void StFstRawHit::setDefaultTimeBin( int tb ) -{ - mDefaultTimeBin = tb; -}; - -void StFstRawHit::setIdTruth(unsigned short idTruth) -{ - mIdTruth = idTruth; -}; - -void StFstRawHit::setCharge( float charge, int tb ) -{ - mCharge[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = charge; -}; - - -void StFstRawHit::setChargeErr(float rChargeErr, int tb) -{ - mChargeErr[ (tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb ] = rChargeErr; -}; - -void StFstRawHit::setMaxTimeBin(int tb) -{ - mMaxTimeBin = ((tb < 0 || tb >= kFstNumTimeBins) ? mDefaultTimeBin : tb); -}; - - -void StFstRawHit::Print(int nTimeBins) const -{ - LOG_DEBUG << " elecId=" << getChannelId() << " Charge=(" ; - for(int i=0; i - StFstRawHit(int channelId, int geoId, - const Container &charges, const Container &chargeErrs = Container{}, - UChar_t maxTimeBin = 1, UShort_t idTruth = 0); - - //accessors - int getChannelId() const; //!< 0-36863 - int getGeoId() const; //!< 0-36863 - int getSeedhitflag() const; //!< 0 or 1 - unsigned char getDisk() const; //!< 1-3 - unsigned char getWedge() const; //!< 1-36 - unsigned char getPhiStrip() const; //!< 0-127 - unsigned char getRStrip() const; //!< 0-7 - float getCharge(int tb = 0) const; - float getChargeErr(int tb = 0) const; - unsigned char getMaxTimeBin() const; - unsigned char getRdo() const; //!< 1-6 - unsigned char getArm() const; //!< 0-2 - unsigned char getApv() const; //!< 0-15 - unsigned char getSensor() const; //!< 0-2 - unsigned char getChannel() const; //!< 0-127 - static unsigned char getDefaultTimeBin(); - unsigned short getIdTruth() const; //!< for embedding, 0 as background - - //modifiers - void setChannelId(int rChannelId); - void setGeoId(int rChannelId); - void setSeedhitflag(int rSeedhitflag); - void setCharge(float charge, int tb = -1); - - /// Overwrites this channel's charges in all time bins by values in the - /// provided container - template - void setCharges(const Container& charges) { - std::copy( std::begin(charges), std::end(charges), mCharge); - } - - void setChargeErr(float chargeErr, int tb = -1); - void setMaxTimeBin(int tb) ; - static void setDefaultTimeBin( int tb ); - void setIdTruth(unsigned short idTruth); - - using StObject::Print; - void Print(int nTimeBins) const; - -private: - - Int_t mChannelId; ///< channel Id, numbering from 0 to 36863 - Int_t mGeoId; ///< geometry Id, numbering from 0 to 36863 - Int_t mSeedhitflag; ///< seed hit flag, 0 not a seed hit & 1 mean a seed hit - Float_t mCharge[kFstNumTimeBins]; ///< pedestal non-subtracted ADC value saved in calibration mode; - ///< pedestal and CMN subtracted in physics mode - Float_t mChargeErr[kFstNumTimeBins];///< charge error in all time bins - UChar_t mMaxTimeBin; ///< the max ADC time bin index of the raw hit - UShort_t mIdTruth; ///< for embedding, 0 as background - - static UChar_t mDefaultTimeBin; - - ClassDef(StFstRawHit, 1) -}; - - -/*! Functor for sorting raw hits in ascending order by geometry id mGeoId, i.e. the pad Id order. */ -struct rawHitPtrLessThan { - bool operator() (const StFstRawHit *rawHit1, const StFstRawHit *rawHit2) const; -}; - -#endif From 7b1302c0c9fd07af3f967b45c6af580303b5a553 Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Tue, 30 Aug 2022 23:08:17 +0800 Subject: [PATCH 09/21] Fixed include path for StFstRawHit.h in StMuFstRawHit.cxx --- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx index ab3fab338de..adf1cde3ca7 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx @@ -11,7 +11,7 @@ #include "StMuFstRawHit.h" #include "St_base/StMessMgr.h" #include "StEvent/StEnumerations.h" -#include "StRoot/StFstUtil/StFstRawHit.h" +#include "StEvent/StFstRawHit.h" ClassImp(StMuFstRawHit) From f5f4c27170f6161e56d20c16869c8e7042a9781a Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Sat, 22 Oct 2022 13:48:06 +0800 Subject: [PATCH 10/21] Fill FST raw hits from StEvent to StMuDst --- StRoot/StBFChain/BigFullChain.h | 2 +- StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx | 16 +++------ StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx | 40 +++++++++------------ StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h | 8 ++--- 4 files changed, 25 insertions(+), 41 deletions(-) diff --git a/StRoot/StBFChain/BigFullChain.h b/StRoot/StBFChain/BigFullChain.h index 90362df333e..83acefc2a3a 100644 --- a/StRoot/StBFChain/BigFullChain.h +++ b/StRoot/StBFChain/BigFullChain.h @@ -1588,7 +1588,7 @@ Bfc_st BFC[] = { // standard chains {"fstHit", "", "fstChain", "event,fstCluster", "StFstHitMaker", "StFstHitMaker","FST Hit Maker", kFALSE}, {"fstEvtRawHit", "", "", "fstRawHit", "","","Store FST Raw Hit in StEvent", kFALSE}, - {"fstMuRawHit", "", "", "CMuDST", "","","Store FST Raw Hit in MuDst", kFALSE}, + {"fstMuRawHit", "", "", "CMuDST,fstEvtRawHit", "","","Store FST Raw Hit in MuDst", kFALSE}, {"ssddat" ,"","","ssd_daq" ,"","","SSD full chain for Real Data",kFALSE}, {"sstdat" ,"","","sst_daq" ,"","","SST full chain for Real Data",kFALSE}, diff --git a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx index f40b5ab1383..e02d02b302a 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuDstMaker.cxx @@ -1200,7 +1200,7 @@ void StMuDstMaker::fillFtt(StEvent* ev) { void StMuDstMaker::fillFst(StEvent* ev) { DEBUGMESSAGE2(""); StFstHitCollection* fstcol=(StFstHitCollection*)ev->fstHitCollection(); - if (!fstcol) return; //throw StMuExceptionNullPointer("no StFstCollection",__PRETTYF__); + if (!fstcol) return; //throw StMuExceptionNullPointer("no StFstHitCollection",__PRETTYF__); StTimer timer; timer.start(); @@ -1211,20 +1211,12 @@ void StMuDstMaker::fillFst(StEvent* ev) { } //raw hit data input - StFstCollection* fstCollectionPtr = 0; + StFstEvtCollection *fstevtcol = 0; if (IAttr("fstMuRawHit")){//True for storing FST Raw hits - TObjectSet* fstDataSet = (TObjectSet*)GetDataSet("fstRawHitAndCluster"); - if (!fstDataSet) { - LOG_WARN << "StMuDstMaker::Make() - there is no fstDataSet (raw hit) " << endm; - } - - fstCollectionPtr = (fstDataSet ? (StFstCollection*)fstDataSet->GetObject() : 0); - if(!fstCollectionPtr) { - LOG_WARN << "StMuDstMaker::Make() - no fstCollection for FST raw hit."<fstEvtCollection(); } - mFstUtil->fillMuFst(mFstCollection,fstcol,fstCollectionPtr); + mFstUtil->fillMuFst(mFstCollection,fstcol,fstevtcol); timer.stop(); DEBUGVALUE2(timer.elapsedTime()); diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx index fbfa2381ef9..13c1bbfd307 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.cxx @@ -1,7 +1,6 @@ #include "StEvent/StFstHitCollection.h" #include "StEvent/StFstHit.h" -#include "StRoot/StFstUtil/StFstCollection.h" -#include "StRoot/StFstUtil/StFstRawHitCollection.h" +#include "StEvent/StFstEvtCollection.h" #include "StEvent/StFstRawHit.h" #include "StMuDSTMaker/COMMON/StMuFstHit.h" @@ -32,12 +31,12 @@ StMuFstUtil::~StMuFstUtil() { } -StMuFstCollection* StMuFstUtil::getMuFst(StFstHitCollection *fstcol, StFstCollection *fstCollectionPtr) +StMuFstCollection* StMuFstUtil::getMuFst(StFstHitCollection *fstcol, StFstEvtCollection *fstevtcol) { LOG_DEBUG << "StMuFstUtil::getMuFst" << endm; if(!fstcol) return NULL; StMuFstCollection* muFst=new StMuFstCollection(); - fillMuFst(muFst,fstcol,fstCollectionPtr); + fillMuFst(muFst,fstcol,fstevtcol); return muFst; } // getMuFst @@ -50,13 +49,13 @@ StFstHitCollection* StMuFstUtil::getFst(StMuFstCollection* muFst) return fst; } //getFst -void StMuFstUtil::fillMuFst(StMuFstCollection *muFst,StFstHitCollection *fstcol,StFstCollection *fstCollectionPtr) +void StMuFstUtil::fillMuFst(StMuFstCollection *muFst,StFstHitCollection *fstcol,StFstEvtCollection *fstevtcol) { LOG_INFO << "fillMuFst" << endm; if(!fstcol) return; if(!muFst) return; - fillMuFstHits(muFst, fstcol, fstCollectionPtr); + fillMuFstHits(muFst, fstcol, fstevtcol); } // fillMuFst @@ -69,29 +68,22 @@ void StMuFstUtil::fillFst(StFstHitCollection* fstcol,StMuFstCollection* muFst) void StMuFstUtil::fillMuFstHits(StMuFstCollection* muFst, StFstHitCollection* fstcol, - StFstCollection *fstCollectionPtr) + StFstEvtCollection *fstevtcol) { LOG_INFO << "fillMuFstHits" << endm; //fill FST Raw Hits - if(fstCollectionPtr) { + if(fstevtcol) { LOG_DEBUG << "fillMuFstHits (raw hits)" << endm; - if(fstCollectionPtr->getNumRawHits() > 0) { - for(int wedgeIdx=0; wedgeIdxgetRawHitCollection( wedgeIdx ); - if( rawHitCollectionPtr ){ - std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); - std::vector< StFstRawHit* >::iterator rawHitIter; - - for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ - StFstRawHit* rawHit = *rawHitIter; - - StMuFstRawHit* muFstRawHit = muFst->addRawHit(); - muFstRawHit->set( rawHit ); - } // for raw hit - } - } // for wedgeIdx + if(fstevtcol->numberOfRawHits() > 0) { + const StSPtrVecFstRawHit &vecRawHit = fstevtcol->rawHits(); + for(unsigned int i=0; inumberOfRawHits(); i++) + { + StMuFstRawHit* muFstRawHit = muFst->addRawHit(); + muFstRawHit->set( vecRawHit[i] ); + } // for i hit } // if has FST Raw hit - } // if has FST Raw hit/cluster collection + + } // if has FST Raw hit collection //fill FST hits for(int wedgeIdx=0; wedgeIdx Date: Fri, 28 Oct 2022 02:20:43 +0800 Subject: [PATCH 11/21] Implement Dmitri's comments --- StRoot/StEvent/StFstConsts.h | 3 ++- StRoot/StEvent/StFstRawHit.cxx | 13 +++++++++++++ StRoot/StEvent/StFstRawHit.h | 2 ++ StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx | 14 +------------- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx | 19 ++++++++++--------- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.h | 10 +++++----- 6 files changed, 33 insertions(+), 28 deletions(-) diff --git a/StRoot/StEvent/StFstConsts.h b/StRoot/StEvent/StFstConsts.h index a3d1f4b68ad..422bcd2702d 100644 --- a/StRoot/StEvent/StFstConsts.h +++ b/StRoot/StEvent/StFstConsts.h @@ -52,7 +52,8 @@ const float kFstrStart[kFstNumRStripsPerWedge]= {5.000, 7.875, 10.750, 13.625, 1 const float kFstrStop[kFstNumRStripsPerWedge] = {7.875, 10.750, 136.25, 16.500, 19.375, 22.250, 25.125, 28.000}; // in cm //general APV chip constants -const unsigned char kFstNumTimeBins = 3; // 9 time bins for ADC sampling (maximum time bin number) +const unsigned char kFstNumTimeBins = 3; // 3 time bins for ADC sampling (maximum time bin number) +const unsigned char kFstDefaultTimeBin = 2; // the default time bin number (2nd time bin) for FST raw hits const int kFstMaxAdc = 4096; // ADC value should be less than 4096 (12 bits ADC) #endif diff --git a/StRoot/StEvent/StFstRawHit.cxx b/StRoot/StEvent/StFstRawHit.cxx index 522825efd9a..f0b4973c62a 100644 --- a/StRoot/StEvent/StFstRawHit.cxx +++ b/StRoot/StEvent/StFstRawHit.cxx @@ -33,6 +33,19 @@ StFstRawHit::StFstRawHit(int channelId, int geoId, std::copy(std::begin(chargeErrs), std::end(chargeErrs), mChargeErr); } +StFstRawHit::StFstRawHit(const StFstRawHit *rawHit) +{ + mChannelId = rawHit->getChannelId(); + mGeoId = rawHit->getGeoId(); + mSeedhitflag = rawHit->getSeedhitflag(); + for(int itb=0; itbgetCharge(itb); + mChargeErr[itb] = rawHit->getChargeErr(itb); + } + mMaxTimeBin = (int)rawHit->getMaxTimeBin(); + mIdTruth = (int)rawHit->getDefaultTimeBin(); + mDefaultTimeBin = rawHit->getIdTruth(); +} int StFstRawHit::getChannelId() const { return mChannelId; }; int StFstRawHit::getGeoId() const { return mGeoId; }; diff --git a/StRoot/StEvent/StFstRawHit.h b/StRoot/StEvent/StFstRawHit.h index 7cdc4c67d42..218907e7fa3 100644 --- a/StRoot/StEvent/StFstRawHit.h +++ b/StRoot/StEvent/StFstRawHit.h @@ -22,6 +22,8 @@ class StFstRawHit : public StObject const Container &charges, const Container &chargeErrs = Container{}, UChar_t maxTimeBin = 1, UShort_t idTruth = 0); + StFstRawHit(const StFstRawHit *rawHit); + //accessors int getChannelId() const; //!< 0-36863 int getGeoId() const; //!< 0-36863 diff --git a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx index ccb651eb04b..8c49280de31 100644 --- a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx +++ b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx @@ -425,19 +425,7 @@ Int_t StFstRawHitMaker::Make() for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ StFstRawHit* rawHit = *rawHitIter; - - StFstRawHit* newRawHit = new StFstRawHit(); - newRawHit->setChannelId( rawHit->getChannelId() ); - newRawHit->setGeoId( rawHit->getGeoId() ); - newRawHit->setSeedhitflag( rawHit->getSeedhitflag() ); - for(int itb=0; itbsetCharge( rawHit->getCharge(itb), itb ); - newRawHit->setChargeErr( rawHit->getChargeErr(itb), itb ); - } - newRawHit->setMaxTimeBin( (int)rawHit->getMaxTimeBin() ); - newRawHit->setDefaultTimeBin( (int)rawHit->getDefaultTimeBin() ); - newRawHit->setIdTruth( rawHit->getIdTruth() ); - + StFstRawHit* newRawHit = new StFstRawHit( rawHit ); mFstEvtCollection->addRawHit(newRawHit); } } diff --git a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx index adf1cde3ca7..e8cbd29d236 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx @@ -15,7 +15,10 @@ ClassImp(StMuFstRawHit) -StMuFstRawHit::StMuFstRawHit() : TObject() { /* no op */ } +StMuFstRawHit::StMuFstRawHit() : TObject() +{ + mDefaultTimeBin = kFstDefaultTimeBin; +} StMuFstRawHit::~StMuFstRawHit() { /* no op */ } @@ -130,19 +133,17 @@ void StMuFstRawHit::setMaxTimeBin(int tb) void StMuFstRawHit::print(int nTimeBins) { - cout << " elecId=" << getChannelId() << " Charge=(" ; + LOG_DEBUG << " elecId=" << getChannelId() << " Charge=(" ; for(int i=0; i Date: Sat, 5 Nov 2022 01:07:12 +0800 Subject: [PATCH 14/21] Implement Dmitri's comments --- StRoot/StEvent/StFstRawHit.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/StRoot/StEvent/StFstRawHit.cxx b/StRoot/StEvent/StFstRawHit.cxx index e2c6917cca1..b4c93ab6808 100644 --- a/StRoot/StEvent/StFstRawHit.cxx +++ b/StRoot/StEvent/StFstRawHit.cxx @@ -35,16 +35,16 @@ StFstRawHit::StFstRawHit(int channelId, int geoId, StFstRawHit::StFstRawHit(const StFstRawHit &rawHit) { - mChannelId = rawHit.getChannelId(); - mGeoId = rawHit.getGeoId(); - mSeedhitflag = rawHit.getSeedhitflag(); + mChannelId = rawHit.mChannelId; + mGeoId = rawHit.mGeoId; + mSeedhitflag = rawHit.mSeedhitflag; for(int itb=0; itb Date: Sat, 5 Nov 2022 12:51:30 +0800 Subject: [PATCH 15/21] Implement Dmitri's comments --- StRoot/StEvent/StFstEvtCollection.cxx | 9 --------- StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx | 12 ++++++------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/StRoot/StEvent/StFstEvtCollection.cxx b/StRoot/StEvent/StFstEvtCollection.cxx index 2d6722eac56..edd73b2f0a2 100644 --- a/StRoot/StEvent/StFstEvtCollection.cxx +++ b/StRoot/StEvent/StFstEvtCollection.cxx @@ -13,15 +13,6 @@ ClassImp(StFstEvtCollection) StFstEvtCollection::StFstEvtCollection() {/* no operation*/} -StFstEvtCollection::~StFstEvtCollection() -{ - // Usually this wouldn't be necessary but mRawHits is a polymorphic container and StFstRawHit provides - // its own new/delete operator - for (unsigned int i=0; igetRawHitCollection( wedgeIdx ); if( rawHitCollectionPtr ){ std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); - std::vector< StFstRawHit* >::iterator rawHitIter; - - for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ - StFstRawHit* rawHit = *rawHitIter; - StFstRawHit* newRawHit = new StFstRawHit( *rawHit ); - mFstEvtCollection->addRawHit(newRawHit); - } + std::transform(begin(rawHitVec), end(rawHitVec), back_inserter(mFstEvtCollection->rawHits()), [](const StFstRawHit* h) { return new StFstRawHit(*h); } ); } } } From bb6b4aa3ef12e00c1790c254cc0edd5b64ff0445 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Sat, 5 Nov 2022 16:11:07 -0400 Subject: [PATCH 19/21] Revert "Copy StFstRawHit's from StFstRawHitCollection to StFstEvtCollection" This reverts commit 2b991652cf5076e9544c39f7232d0e623776f7b3. --- StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx index a42aa1a2ef6..a80e4904f63 100644 --- a/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx +++ b/StRoot/StFstRawHitMaker/StFstRawHitMaker.cxx @@ -1,5 +1,3 @@ -#include - #include "StFstRawHitMaker.h" #include "StEvent.h" @@ -423,7 +421,13 @@ Int_t StFstRawHitMaker::Make() StFstRawHitCollection *rawHitCollectionPtr = mFstCollectionPtr->getRawHitCollection( wedgeIdx ); if( rawHitCollectionPtr ){ std::vector& rawHitVec = rawHitCollectionPtr->getRawHitVec(); - std::transform(begin(rawHitVec), end(rawHitVec), back_inserter(mFstEvtCollection->rawHits()), [](const StFstRawHit* h) { return new StFstRawHit(*h); } ); + std::vector< StFstRawHit* >::iterator rawHitIter; + + for( rawHitIter = rawHitVec.begin(); rawHitIter != rawHitVec.end(); ++rawHitIter ){ + StFstRawHit* rawHit = *rawHitIter; + StFstRawHit* newRawHit = new StFstRawHit( *rawHit ); + mFstEvtCollection->addRawHit(newRawHit); + } } } } From 2aae86ed7c64c1fc07368c271e039144d75b8f0f Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Sat, 5 Nov 2022 16:11:20 -0400 Subject: [PATCH 20/21] Revert "StArray: Expose object type observed by the container" This reverts commit 6cccf095eb049c0d4d27e68d9f5142e2f2fa6e2b. --- StRoot/St_base/StArray.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/StRoot/St_base/StArray.h b/StRoot/St_base/StArray.h index be760d52098..8b26a355f77 100755 --- a/StRoot/St_base/StArray.h +++ b/StRoot/St_base/StArray.h @@ -177,8 +177,6 @@ public: \ StPtrVec ## QWERTY(Int_t sz=0):StRefArray(sz){};\ StPtrVec ## QWERTY(const StPtrVec ## QWERTY &from):StRefArray(from){};\ virtual ~StPtrVec ## QWERTY(){};\ -\ - using value_type = St ## QWERTY *;\ \ St ## QWERTY * const &at(Int_t idx) const {return (St ## QWERTY * const &)fV[idx];}\ St ## QWERTY * &at(Int_t idx) {return (St ## QWERTY * &)fV[idx];}\ @@ -210,8 +208,6 @@ class StSPtrVec ## QWERTY : public StStrArray \ public: \ StSPtrVec ## QWERTY(Int_t sz=0):StStrArray(sz){};\ StSPtrVec ## QWERTY(const StSPtrVec ## QWERTY &from):StStrArray(from){};\ -\ - using value_type = St ## QWERTY *;\ \ St ## QWERTY * const &at(Int_t idx) const {return (St ## QWERTY * const &)fV[idx];}\ St ## QWERTY * &at(Int_t idx) {return (St ## QWERTY * &)fV[idx];}\ From ab0cc18ac122eb12cb1c21e34adb18a6709749df Mon Sep 17 00:00:00 2001 From: Te-Chuan Huang Date: Sun, 1 Oct 2023 16:47:59 -0500 Subject: [PATCH 21/21] Fix memory leak in StFstClusterMaker --- .../StFstScanRadiusClusterAlgo.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx b/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx index af418cde498..c47344cc4db 100644 --- a/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx +++ b/StRoot/StFstClusterMaker/StFstScanRadiusClusterAlgo.cxx @@ -66,6 +66,7 @@ Int_t StFstScanRadiusClusterAlgo::doClustering(const StFstCollection &fstCollect while ( !rawHitsVec[sensorIdx][phiIdx].empty() ) { rawHitTemp = rawHitsVec[sensorIdx][phiIdx].back(); + delete rawHitsVec[sensorIdx][phiIdx].back(); rawHitsVec[sensorIdx][phiIdx].pop_back(); rawHitsToMerge.push_back(rawHitTemp); //count number to merge @@ -77,6 +78,7 @@ Int_t StFstScanRadiusClusterAlgo::doClustering(const StFstCollection &fstCollect // put all raw hits in one phi strip to rawHitsToMerge while (rawHitsToMergePtr != rawHitsToMerge.end() && !rawHitsVec[sensorIdx][phiIdx].empty()) { rawHitTemp = rawHitsVec[sensorIdx][phiIdx].back(); + delete rawHitsVec[sensorIdx][phiIdx].back(); rawHitsVec[sensorIdx][phiIdx].pop_back(); ++nToMerge; @@ -137,14 +139,14 @@ Int_t StFstScanRadiusClusterAlgo::doClustering(const StFstCollection &fstCollect totCharge = tempSumCharge; totChargeErr = sqrt(tempSumChargeErrSquare / nToMerge); - newCluster = new StFstCluster((int)wedge * 10000 + clusterLabel, disk, wedge, sensor, apv, meanRStrip, meanPhiStrip, totCharge, totChargeErr, clusterType); - newCluster->setNRawHits(clusterSize); - newCluster->setNRawHitsR(clusterSizeR); - newCluster->setNRawHitsPhi(clusterSizePhi); - newCluster->setMaxTimeBin(maxTb); - newCluster->setIdTruth(idTruth); - if(nToSeedhit>0) { + newCluster = new StFstCluster((int)wedge * 10000 + clusterLabel, disk, wedge, sensor, apv, meanRStrip, meanPhiStrip, totCharge, totChargeErr, clusterType); + newCluster->setNRawHits(clusterSize); + newCluster->setNRawHitsR(clusterSizeR); + newCluster->setNRawHitsPhi(clusterSizePhi); + newCluster->setMaxTimeBin(maxTb); + newCluster->setIdTruth(idTruth); + clustersVec[sensorIdx][phiIdx].push_back(newCluster); clusterLabel++; } @@ -200,6 +202,7 @@ Int_t StFstScanRadiusClusterAlgo::doClustering(const StFstCollection &fstCollect (*clusterIt2)->setApv(apv); int distance1 = std::distance(clustersVec[sensorIdx][phiIdx1].begin(), clusterIt1); + delete *clusterIt1; clustersVec[sensorIdx][phiIdx1].erase(clusterIt1); if (distance1 == 0)