diff --git a/StRoot/StEpdHitMaker/StEpdHitMaker.cxx b/StRoot/StEpdHitMaker/StEpdHitMaker.cxx index c17a34d4d86..055c8ee72cf 100644 --- a/StRoot/StEpdHitMaker/StEpdHitMaker.cxx +++ b/StRoot/StEpdHitMaker/StEpdHitMaker.cxx @@ -12,11 +12,15 @@ If it is not there, it creates one and fills it from the StTriggerData object and info from the StEpdDbMaker (database) + + Update March 2023 - Mike Lisa + Updated to pull DEP information from the TriggerData and store in the newly-updated StEpdHit object + */ #include "StEpdHitMaker.h" #include "StMaker.h" -#include "StEventTypes.h" +#include "StEvent/StEventTypes.h" #include "StEvent/StTriggerData.h" #include "StEpdHit.h" #include @@ -138,12 +142,12 @@ void StEpdHitMaker::FillStEpdData(){ int nHitsAdded=0; for (short ew=0; ew<2; ew++){ // EastWest (ew) = 0,1 for east,west + short EWforHit=(ew==0)?-1:+1; for (short PP=1; PP<13; PP++){ // note position (PP) goes from 1..12 for (short TT=1; TT<32; TT++){ // note tile number (TT) goes from 1..31 short crateAdc = mEpdDbMaker->GetCrateAdc(ew,PP,TT); - short EWforHit=(ew==0)?-1:+1; //--------------------------------------------------- // This below is for debugging only... @@ -194,10 +198,14 @@ void StEpdHitMaker::FillStEpdData(){ double gain = mEpdDbMaker->GetMip(ew,PP,TT); if (gain<=0.0) gain = 1.0; // not yet calibrated. Give it a gain of unity - float nMIP = (ADC + mEpdDbMaker->GetOffset(ew,PP,TT)) / mEpdDbMaker->GetMip(ew,PP,TT); + float nMIP_QT = (ADC + mEpdDbMaker->GetOffset(ew,PP,TT)) / mEpdDbMaker->GetMip(ew,PP,TT); int truthId=0; // this is for simulation + // March 2023 - now add DEP information + unsigned short rawDEP; + float calibratedDEP; + getEpdDepInfo(ew,PP,TT,rawDEP,calibratedDEP); // EpdOfs2 << ew << "\t" << PP << "\t" << TT << "\t" // << mEpdDbMaker->GetCrateAdc(ew,PP,TT) << "\t" @@ -208,14 +216,24 @@ void StEpdHitMaker::FillStEpdData(){ // << mEpdDbMaker->GetChannelTac(ew,PP,TT) << "\t" // << ADC << "\t" << nMIP << endl; - StEpdHit* hit = new StEpdHit(PP,TT,EWforHit,ADC,TAC,TDC,HasTac,nMIP,isGood,truthId); + StEpdHit* hit = new StEpdHit(PP,TT,EWforHit,ADC,TAC,TDC,HasTac,nMIP_QT,isGood,truthId,rawDEP,calibratedDEP); mEpdCollection->addHit(hit); nHitsAdded++; + } // if ADC>0 + else{ // even if there is no ADC from the QT, there might still be info from the DEP - March 2023 + unsigned short rawDEP; + float calibratedDEP; + getEpdDepInfo(ew,PP,TT,rawDEP,calibratedDEP); + if (rawDEP>0){ + StEpdHit* hit = new StEpdHit((int)PP,(int)TT,EWforHit,0,0,0,false,0.0,true,0,rawDEP,calibratedDEP); + mEpdCollection->addHit(hit); + nHitsAdded++; + } } - } - } - } - } + } // if crateADC>0 + } // loop over TT + } // loop over PP + } // loop over ew // EpdOfs.close(); // EpdOfs2.close(); @@ -223,3 +241,25 @@ void StEpdHitMaker::FillStEpdData(){ LOG_INFO << "StEpdHitMaker::FillStEpdData - added " << nHitsAdded << " to StEpdHitCollection" << endm; } + +// +// March 2023 - get DEP data +void StEpdHitMaker::getEpdDepInfo(short ew, short pp, short tt, unsigned short& rawDEP, float& calibratedDEP){ + if (ew==0){ rawDEP=0; calibratedDEP=0.0; return;} // only DEP on the west side + + // -------------------------- March 2023 --------------------------------- + // Here is where I must fill in the code to + // 1) Get the raw DEP waveform from the TriggerData + // 2) Sum up the appropriate time buckets (this is DEPdata) + // 3) Get the gain constant from the database (which needs to exist!!!) + // 4) mnMIP_DEP = DEPdata / gain + // 5) put mnMIP_DEP and rawDEPdata into the StEpdHit + // + // 6) might want to impose a "zero suppression threshold" here, too + + + // right now I just return zero + rawDEP=0; + calibratedDEP=0.0; + return; +} diff --git a/StRoot/StEpdHitMaker/StEpdHitMaker.h b/StRoot/StEpdHitMaker/StEpdHitMaker.h index 5a0c6ceefc9..b6139b45a3f 100644 --- a/StRoot/StEpdHitMaker/StEpdHitMaker.h +++ b/StRoot/StEpdHitMaker/StEpdHitMaker.h @@ -13,6 +13,10 @@ If it is not there, it creates one and fills it from the StTriggerData object and info from the StEpdDbMaker (database) + + Update March 2023 - Mike Lisa + now must read in DEP data and store it in the newly-updated StEpdHit objects + */ @@ -51,6 +55,10 @@ class StEpdHitMaker : public StMaker { /// Returns a pointer to the StEvent object StEvent* GetStEvent(){return mStEvent;} + /// update March 2023 Mike Lisa - method to get and calibrate DEP information + /// This does not NEED to be public, but no harm and may be useful for debugging + void getEpdDepInfo(short ew, short pp, short tt, unsigned short& rawDEP, float& calibratedDEP); + virtual const char *GetCVS() const {static const char cvs[]="Tag " __DATE__ " " __TIME__ ; return cvs;} diff --git a/StRoot/StEvent/StEpdHit.cxx b/StRoot/StEvent/StEpdHit.cxx index c0e7726c62b..bfb8e409a99 100644 --- a/StRoot/StEvent/StEpdHit.cxx +++ b/StRoot/StEvent/StEpdHit.cxx @@ -32,13 +32,24 @@ StEpdHit::StEpdHit() : StEpdHit(0, 0, 0, 0, 0, 0, false, 0.0, false, 0) StEpdHit::StEpdHit(int position, int tile, short EW, int ADC, int TAC, int TDC, bool hasTAC, float nMIP, - bool statusIsGood, int truthId) : + bool statusIsGood, int truthId) : StEpdHit(position, tile, EW, ADC, TAC, TDC, hasTAC, nMIP, statusIsGood, truthId, 0, 0) +{ + /* no-op */ +} + +// March 2023: +// * add arguments for DEPdata and nMIP_DEP +StEpdHit::StEpdHit(int position, int tile, + short EW, int ADC, int TAC, + int TDC, bool hasTAC, float nMIP_QT, + bool statusIsGood, int truthId, + unsigned short DEPdata, float nMIP_DEP) : mId( (100*position + tile)*EW ), mQTdata( (ADC & 0x0FFF) | (TAC & 0x0FFF) << 12 | (TDC & 0x001F) << 24 | hasTAC << 29 | statusIsGood << 30 ), - mnMIP(nMIP), - mTruthId(truthId) + mnMIP(nMIP_QT), + mTruthId(truthId), + mDEPdata(DEPdata), + mnMIP_DEP(nMIP_DEP) { /* no-op */ } - - diff --git a/StRoot/StEvent/StEpdHit.h b/StRoot/StEvent/StEpdHit.h index 770a39a4fdc..9956bf19e02 100644 --- a/StRoot/StEvent/StEpdHit.h +++ b/StRoot/StEvent/StEpdHit.h @@ -27,6 +27,13 @@ * * - Mike Lisa Jan 2018 * + * Update March 2023 - Mike Lisa + * - Add two data members (mDEPdata and mnMIP_DEP) to StEpdHit and StMuEpdHit and StPicoEpdHit + * in order to include the DEP information. Note that this will be the *only* information + * available for the West side, when STAR runs at high rate. The QTs will not be read out. + * + * - Okay so now the size of a StEpdHit is 16 bytes. + * *************************************************************************** * * $Log: StEpdHit.h,v $ @@ -55,10 +62,13 @@ class StEpdHit : public StObject /// \param TAC TAC reported by QT board (if there is one) [0,4095] /// \param TDC TDC reported by QT board [0,32] /// \param hasTAC true/fals if this channel has a TAC - /// \param nMIP gain-calibrated signal; energy loss in terms of MPV of Landau for a MIP + /// \param nMIP gain-calibrated signal from QT; energy loss in terms of MPV of Landau for a MIP /// \param statusIsGood good status, according to database /// \param truthId particle id of particle most responsible for energy loss (simulation) StEpdHit(int position, int tile, short EW, int ADC, int TAC, int TDC, bool hasTAC, float nMIP, bool statusIsGood, int truthId); + /// \param DEPdata raw DEP data, in summed ADCs - added May 2023 + /// \param nMIP_DEP gain-calibrated signal from DEP; energy loss in terms of MPV of Landau for a MIP - added May 2023 + StEpdHit(int position, int tile, short EW, int ADC, int TAC, int TDC, bool hasTAC, float nMIP_QT, bool statusIsGood, int truthId, unsigned short DEPdata, float nMIP_DEP); // virtual void Print(const char *option = "") const; @@ -94,6 +104,8 @@ class StEpdHit : public StObject int qtData() const; /// gain calibrated energy loss in tile, in units of Landau MPV for one MIP + /// Now returns QT-based nMIP if QT data is available (this is like before 2023) + /// but if there is no QT data available, then returns DEP-based nMIP - March 2023 float nMIP() const; /// false if tile is bad or missing, according to (time-dependent) database @@ -106,8 +118,9 @@ class StEpdHit : public StObject /// bit 30=0/1 if tile is marked bad/good in database void setQTdata(int packedData); - /// \param gain calibrated energy loss in tile, in units of Landau MPV for one MIP + /// \param gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT data void setnMIP(float nMIP); + void setnMIP_QT(float nMIP_QT); /// set identifier of particle most responsible for energy loss (simulation) void setIdTruth(int id); @@ -115,6 +128,24 @@ class StEpdHit : public StObject /// identifier of particle most responsible for energy loss (simulation) int idTruth() const; + /// \param DEPdata: raw DEP data (sum of buckets), in ADC counts - added March 2023 + void setDEPdata(unsigned short DEPdata); + + /// \param nMIP_DEP: gain-calibrated energy loss in tile, in units of Landau MPV for one MIP, from DEP data - added March 2023 + void setnMIP_DEP(float nMIP_DEP); + + /// gain-calibrated energy loss in tile, in units of Landau MPV for one MIP, from DEP data - added March 2023 + Float_t nMIP_DEP() const; + + /// raw DEP data (sum of buckets), in ADC counts - added March 2023 + Int_t depData() const; + + /// gain-calibrated energy loss in tile, in units of Landau MPV for one MIP, from QT data - added March 2023 + Float_t nMIP_QT() const; + + /// returns true if there is QT data stored - added March 2023 + bool qtDataAvailable() const; + protected: /// Packed channel Id: @@ -122,27 +153,34 @@ class StEpdHit : public StObject /// sign(mID) = +/- = West/East Short_t mId; - /// Packed channel data: bits 0-11 are ADC; bits 12-23 are TAC; - /// bits 24-28 are TDC; bit 29 is noTAC flag - /// bit 30 is the good/bad (1/0) status flag + /// Packed QT channel data: bits 0-11 are ADC; bits 12-23 are TAC; + /// bits 24-28 are TDC; bit 29 is noTAC flag + /// bit 30 is the good/bad (1/0) status flag Int_t mQTdata; /// gain calibrated energy loss in tile, in units of Landau MPV for one MIP + /// important: prior to 2023, the ONLY information came from the QTs. Now we also have the DEP Float_t mnMIP; /// identifier of particle most responsible for energy loss (simulation) Int_t mTruthId; + + /// DEP readout data - added March 2023 + UShort_t mDEPdata; + + /// gain calibrated energy loss based on DEP data - added March 2023 + Float_t mnMIP_DEP; - ClassDef(StEpdHit, 1) + ClassDef(StEpdHit, 2) }; -inline int StEpdHit::qtData() const {return mQTdata;} -inline float StEpdHit::nMIP() const {return mnMIP;} -inline void StEpdHit::setQTdata(int packedData) {mQTdata=packedData;} -inline void StEpdHit::setnMIP(float nMIP) {mnMIP = nMIP;} -inline void StEpdHit::setIdTruth(int id) {mTruthId = id;} -inline int StEpdHit::idTruth() const {return mTruthId;} -inline short StEpdHit::side() const { return mId < 0 ? -1 : +1;} +inline int StEpdHit::qtData() const {return mQTdata; } +inline float StEpdHit::nMIP() const { return qtDataAvailable() ? mnMIP : mnMIP_DEP; } +inline void StEpdHit::setQTdata(int packedData) { mQTdata = packedData; } +inline void StEpdHit::setnMIP(float nMIP) { mnMIP = nMIP; } +inline void StEpdHit::setIdTruth(int id) { mTruthId = id; } +inline int StEpdHit::idTruth() const { return mTruthId; } +inline short StEpdHit::side() const { return mId < 0 ? -1 : +1; } inline short StEpdHit::id() const { return mId; } inline int StEpdHit::position() const { return std::abs(mId / 100); } inline int StEpdHit::tile() const { return std::abs(mId % 100); } @@ -151,4 +189,11 @@ inline int StEpdHit::tac() const { return (mQTdata >> 12) & 0x0FFF; } inline int StEpdHit::tdc() const { return (mQTdata >> 24) & 0x001F; } inline bool StEpdHit::hasTac() const { return (mQTdata >> 29) & 0x1; } inline bool StEpdHit::isGood() const { return (mQTdata >> 30) & 0x1; } +inline void StEpdHit::setDEPdata(unsigned short DEPdata) { mDEPdata = DEPdata; } +inline void StEpdHit::setnMIP_DEP(float nMIP_DEP) { mnMIP_DEP = nMIP_DEP; } +inline int StEpdHit::depData() const { return mDEPdata; } +inline float StEpdHit::nMIP_DEP() const { return mnMIP_DEP; } +inline bool StEpdHit::qtDataAvailable() const { return adc() != 0; } +inline float StEpdHit::nMIP_QT() const { return mnMIP; } +inline void StEpdHit::setnMIP_QT(float nMIP_QT){ mnMIP = nMIP_QT; } #endif