Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update StMuEpdHit to include the DEP information #502

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions StRoot/StEvent/StEpdHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}


71 changes: 58 additions & 13 deletions StRoot/StEvent/StEpdHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 $
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -106,43 +118,69 @@ 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);

/// 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:
/// abs(mID) = 100*positionId + tileId
/// 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); }
Expand All @@ -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
20 changes: 17 additions & 3 deletions StRoot/StMuDSTMaker/COMMON/StMuEpdHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* the StEpdHit object in StEvent
*
* - Mike Lisa Jan 2018
*
* - Updated March 2023 - Mike Lisa - see header for details.
*
************************************************/

#include "StEvent/StEpdHit.h"
Expand All @@ -38,17 +41,28 @@ StMuEpdHit::StMuEpdHit() : StMuEpdHit(0, 0, 0, 0, 0, 0, false, 0.0, false, 0){
StMuEpdHit::StMuEpdHit(Int_t position, Int_t tile,
Short_t EW, Int_t ADC, Int_t TAC,
Int_t TDC, bool hasTAC, Float_t nMIP,
bool statusIsGood, Int_t truthId) :
bool statusIsGood, Int_t truthId) : StMuEpdHit(position, tile, EW, ADC, TAC, TDC, hasTAC, nMIP, statusIsGood, truthId, 0, 0)
{
/* no-op */
}

StMuEpdHit::StMuEpdHit(Int_t position, Int_t tile,
Short_t EW, Int_t ADC, Int_t TAC,
Int_t TDC, bool hasTAC, Float_t nMIP,
bool statusIsGood, Int_t truthId,
UShort_t DEPdata, Float_t nMIP_DEP) :
mId( (100*position + tile)*EW ),
mQTdata( (ADC & 0x0FFF) | (TAC & 0x0FFF) << 12 | (TDC & 0x001F) << 24 | hasTAC << 29 | statusIsGood << 30 ),
mnMIP(nMIP),
mTruthId(truthId)
mTruthId(truthId),
mDEPdata(DEPdata),
mnMIP_DEP(nMIP_DEP)
{
/* no-op */
}

StMuEpdHit::StMuEpdHit(StEpdHit* epdHit) :
mId(epdHit->id()), mQTdata(epdHit->qtData()), mnMIP(epdHit->nMIP()), mTruthId(epdHit->idTruth())
mId(epdHit->id()), mQTdata(epdHit->qtData()), mnMIP(epdHit->nMIP_QT()), mTruthId(epdHit->idTruth()), mDEPdata(epdHit->depData()), mnMIP_DEP(epdHit->nMIP_DEP())
{
/* no-op */
}
Expand Down
46 changes: 43 additions & 3 deletions StRoot/StMuDSTMaker/COMMON/StMuEpdHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
* the StEpdHit object in StEvent
*
* - Mike Lisa Jan 2018
*
*
* Update March 2023 (More than 5 years later. Not bad.) Mike Lisa
* - We now have the DAQ upgrade and DEP readout on the West side.
* DEP information will *always* be there. QT only at low rate.
* So, now have to store DEP information.
*
* It means several new methods, and two new data members:
* 1) unsigned short DEPdata
* 2) float nMIP_DEP
* So, now the size of one StMuEpdHit is 16 bytes
************************************************/
class StEpdHit;

Expand All @@ -44,10 +55,13 @@ class StMuEpdHit : 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; energy loss in terms of MPV of Landau for a MIP - based on QT data
/// \param statusIsGood good status, according to database
/// \param truthId id of particle most responsible for energy loss (simulation)
StMuEpdHit(Int_t position, Int_t tile, Short_t EW, Int_t ADC, Int_t TAC, Int_t TDC, bool hasTAC, Float_t nMIP, bool statusIsGood, Int_t truthId);
/// \param DEPdata raw data from DEP - March 2023
/// \param nMIP_DEP gain-calibrated signal; energy loss in terms of MPV of Landau for a MIP - based on DEP data - March 2023
StMuEpdHit(Int_t position, Int_t tile, Short_t EW, Int_t ADC, Int_t TAC, Int_t TDC, bool hasTAC, Float_t nMIP_QT, bool statusIsGood, Int_t truthId, UShort_t DEPdata, Float_t nMIP_DEP);

/// constructor based on StEpdHit
/// this is what will be used in constructing the StMuDst from the StEvent
Expand Down Expand Up @@ -95,12 +109,30 @@ class StMuEpdHit : public StObject
/// \param gain calibrated energy loss in tile, in units of Landau MPV for one MIP
void SetnMIP(Float_t nMIP){mnMIP = nMIP;}

/// \param gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT data - March 2023
void setnMIP_QT(Float_t nMIP_QT){mnMIP_QT = nMIP_QT;}
/// set the id of particle most responsible for energy loss in tile (monte carlo)
void setIdTruth(Int_t id){mTruthId = id;}

/// returns the particle number for the particle most responsible for energy loss (monte carlo)
Int_t idTruth(){return mTruthId;}

// Now a bunch of methods for DEP - March 2023
/// store the raw DEP data
void setDEPdata(unsigned short DEPdata){mDEPdata=DEPdata;}
/// store the gain-calibrated energy loss based on DEP data
void setnMIP_DEP(float nMipDep){mnMIP_DEP=nMipDep;}
/// get the raw DEP data
UShort_t depData() const {return mDEPdata;}
/// get the gain-calibrated energy loss based on DEP data
Float_t nMIP_DEP() const {return mnMIP_DEP;}
/// true if there is QT information available for this (will be false for sure at high rates on west side)
bool qtDataAvailable() const;
/// gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT data
Float_t nMIP_QT() const {return mnMIP_QT;}
/// gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT data if there is QT data. Otherwise from DEP
Float_t nMIP() const {return (this->qtDataAvailable())?mnMIP_QT:mnMIP_DEP;}

protected:

/// Packed channel Id:
Expand All @@ -113,13 +145,19 @@ class StMuEpdHit : public StObject
/// 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
/// gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT
Float_t mnMIP;

/// raw DEP data - March 2023
UShort_t mDEPdata;

/// gain-calibrated energy loss in tile, in units of Landau MPV for one MIP - based on DEP - March 2023
Float_t mnMIP_DEP;

/// greatest contributer to energy deposition (MC)
Int_t mTruthId;

ClassDef(StMuEpdHit, 1)
ClassDef(StMuEpdHit, 2)
};

inline Short_t StMuEpdHit::side() const { return mId < 0 ? -1 : +1;}
Expand All @@ -133,4 +171,6 @@ inline Int_t StMuEpdHit::tac() const { return (mQTdata >> 12) & 0x0FFF; }
inline Int_t StMuEpdHit::tdc() const { return (mQTdata >> 24) & 0x001F; }
inline bool StMuEpdHit::hasTac() const { return (mQTdata >> 29) & 0x1; }
inline bool StMuEpdHit::isGood() const { return (mQTdata >> 30) & 0x1; }
inline bool StMuEpdHit::qtDataAvailable() const {return (this->adc()!=0);}

#endif