diff --git a/StRoot/StBFChain/BigFullChain.h b/StRoot/StBFChain/BigFullChain.h index 1b94a53b772..83acefc2a3a 100644 --- a/StRoot/StBFChain/BigFullChain.h +++ b/StRoot/StBFChain/BigFullChain.h @@ -1587,6 +1587,8 @@ 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,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/StBFChain/StBFChain.cxx b/StRoot/StBFChain/StBFChain.cxx index 2dfb57120c3..6efb7623ef5 100644 --- a/StRoot/StBFChain/StBFChain.cxx +++ b/StRoot/StBFChain/StBFChain.cxx @@ -676,6 +676,16 @@ 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); + } + if ( maker == "StPicoDstMaker"){ if ( GetOption("picoWrite") ) mk->SetMode(1); if ( GetOption("picoRead") ) mk->SetMode(2); // possibly more magic 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/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/StFstEvtCollection.cxx b/StRoot/StEvent/StFstEvtCollection.cxx new file mode 100644 index 00000000000..edd73b2f0a2 --- /dev/null +++ b/StRoot/StEvent/StFstEvtCollection.cxx @@ -0,0 +1,43 @@ +/*************************************************************************** + * $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*/} + +void StFstEvtCollection::addRawHit(StFstRawHit *hit) +{ + if (!hit) return; + + int elecId = hit->getChannelId(); + 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..d9e7c221bbf --- /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/StFstUtil/StFstRawHit.cxx b/StRoot/StEvent/StFstRawHit.cxx similarity index 92% rename from StRoot/StFstUtil/StFstRawHit.cxx rename to StRoot/StEvent/StFstRawHit.cxx index 522825efd9a..b4c93ab6808 100644 --- a/StRoot/StFstUtil/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.mChannelId; + mGeoId = rawHit.mGeoId; + mSeedhitflag = rawHit.mSeedhitflag; + for(int itb=0; itbfstEvtCollection(); + + // 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( *rawHit ); + 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/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..e02d02b302a 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 @@ -1199,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(); @@ -1208,7 +1209,14 @@ void StMuDstMaker::fillFst(StEvent* ev) { connectFstCollection(); mStMuDst->set(this); } - mFstUtil->fillMuFst(mFstCollection,fstcol); + + //raw hit data input + StFstEvtCollection *fstevtcol = 0; + if (IAttr("fstMuRawHit")){//True for storing FST Raw hits + fstevtcol=(StFstEvtCollection*)ev->fstEvtCollection(); + } + + mFstUtil->fillMuFst(mFstCollection,fstcol,fstevtcol); timer.stop(); DEBUGVALUE2(timer.elapsedTime()); @@ -2042,6 +2050,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..af5e8ead5e4 --- /dev/null +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstRawHit.cxx @@ -0,0 +1,159 @@ +/*************************************************************************** + * + * 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 "StEvent/StFstRawHit.h" + +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) +{ + LOG_DEBUG << " elecId=" << getChannelId() << " Charge=(" ; + for(int i=0; inumberOfRawHits() > 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 collection + //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..7cd463cf750 100644 --- a/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h +++ b/StRoot/StMuDSTMaker/COMMON/StMuFstUtil.h @@ -6,8 +6,10 @@ class StMuFstCollection; class StFstHitCollection; +class StFstEvtCollection; 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*,StFstEvtCollection*); StFstHitCollection* getFst(StMuFstCollection*); - void fillMuFst(StMuFstCollection*,StFstHitCollection*); + void fillMuFst(StMuFstCollection*,StFstHitCollection*,StFstEvtCollection*); void fillFst(StFstHitCollection*,StMuFstCollection*); private: /** Create StMuFstHits from StFstHits and fill StMuFstCollection */ - void fillMuFstHits(StMuFstCollection*, StFstHitCollection*); + void fillMuFstHits(StMuFstCollection*, StFstHitCollection*, StFstEvtCollection*); /** 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"