Skip to content

Commit

Permalink
Update StPicoEpdHit to include the DEP information
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Mar 20, 2023
1 parent 1186ce6 commit ca42848
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 24 deletions.
2 changes: 1 addition & 1 deletion StRoot/StPicoDstMaker/StPicoDstMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2361,7 +2361,7 @@ void StPicoDstMaker::fillEpdHits() {
StMuEpdHit* aHit = mMuDst->epdHit(i);
if (!aHit) continue;
int counter = mPicoArrays[StPicoArrays::EpdHit]->GetEntries();
new((*(mPicoArrays[StPicoArrays::EpdHit]))[counter]) StPicoEpdHit(aHit->id(), aHit->qtData(), aHit->nMIP());
new((*(mPicoArrays[StPicoArrays::EpdHit]))[counter]) StPicoEpdHit(aHit->id(), aHit->qtData(), aHit->nMIP_QT(), aHit->depData(), aHit->nMIP_DEP()); // added DEP info - March 2023 - mike lisa
} //for (unsigned int i=0; i < mMuDst->numberOfEpdHit(); i++)
}

Expand Down
25 changes: 15 additions & 10 deletions StRoot/StPicoEvent/StPicoEpdHit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,38 +29,43 @@
* 2) there is no "Truth ID" which is used for simulations.
*
* - Mike Lisa March 2018
*
* Updated March 2023 Mike Lisa - see header for details.
************************************************/

ClassImp(StPicoEpdHit)

//_________________
StPicoEpdHit::StPicoEpdHit() : TObject(), mId(0), mQTdata(0), mnMIP(0) {
StPicoEpdHit::StPicoEpdHit() : TObject(), mId(0), mQTdata(0), mnMIP_QT(0), mDEPdata(0), mnMIP_DEP(0.0) {
/* no-op */
}

//_________________
StPicoEpdHit::StPicoEpdHit(Int_t position, Int_t tile,
Int_t EW, Int_t ADC, Int_t TAC,
Int_t TDC, Bool_t hasTAC, Float_t nMIP,
Bool_t statusIsGood) :
Int_t TDC, Bool_t hasTAC, Float_t nMIP_QT,
Bool_t statusIsGood,
UShort_t DEPdata, Float_t nMIP_DEP) :
TObject(),
mId( (100*position + tile)*EW ),
mQTdata( (ADC & 0x0FFF) | (TAC & 0x0FFF) << 12 | (TDC & 0x001F) << 24 | hasTAC << 29 | statusIsGood << 30 ),
mnMIP(nMIP) {
mnMIP_QT(nMIP_QT), mDEPdata(DEPdata), mnMIP_DEP(nMIP_DEP) {
/* no-op */
}

//_________________
StPicoEpdHit::StPicoEpdHit(Short_t id, Int_t QTdata, Float_t nMIP) :
TObject(), mId(id), mQTdata(QTdata), mnMIP(nMIP) {
StPicoEpdHit::StPicoEpdHit(Short_t id, Int_t QTdata, Float_t nMIP_QT, UShort_t DEPdata, Float_t nMIP_DEP) :
TObject(), mId(id), mQTdata(QTdata), mnMIP_QT(nMIP_QT), mDEPdata(DEPdata), mnMIP_DEP(nMIP_DEP) {
/* no-op */
}

//_________________
StPicoEpdHit::StPicoEpdHit(const StPicoEpdHit &hit) : TObject() {
mId = hit.mId;
mQTdata = hit.mQTdata;
mnMIP = hit.mnMIP;
mId = hit.mId;
mQTdata = hit.mQTdata;
mnMIP_QT = hit.mnMIP_QT;
mDEPdata = hit.mDEPdata;
mnMIP_DEP = hit.mnMIP_DEP;
}

//_________________
Expand All @@ -70,5 +75,5 @@ StPicoEpdHit::~StPicoEpdHit() {

//_________________
void StPicoEpdHit::Print(const Char_t *option __attribute__((unused)) ) const {
LOG_INFO << "EPD hit id: " << mId << " QT data: " << mQTdata << " nMIP: " << mnMIP << endm;
LOG_INFO << "EPD hit id: " << mId << " QT data: " << mQTdata << " nMIP_QT: " << mnMIP_QT << " DEPdata: " << mDEPdata << " nMIP_DEP: " << mnMIP_DEP << endm;
}
63 changes: 50 additions & 13 deletions StRoot/StPicoEvent/StPicoEpdHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
* (Also works for StEpdHit::id() and StMuEpdHit::id())
*
* - Mike Lisa March 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 StPicoEpdHit : public TObject {
Expand All @@ -57,15 +68,20 @@ class StPicoEpdHit : public TObject {
/// \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_QT 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 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

StPicoEpdHit(Int_t position, Int_t tile, Int_t EW, Int_t ADC, Int_t TAC, Int_t TDC,
Bool_t hasTAC, Float_t nMIP, Bool_t statusIsGood);
Bool_t hasTAC, Float_t nMIP_QT, Bool_t statusIsGood, UShort_t DEPdata, Float_t nMIP_DEP);
/// constructor just taking id, QT, nMIP
/// \param id tile id, encoding size, position and tile
/// \param QTdata bit-compressed QT data
/// \nMIP calibrated ADC
StPicoEpdHit(Short_t id, Int_t QTdata, Float_t nMIP);
/// \param nMIP_QT calibrated ADC from QT
/// \param DEPdata raw DEP data - March 2023
/// \param nMIP_DEP calibrated DEP data - March 2023
StPicoEpdHit(Short_t id, Int_t QTdata, Float_t nMIP_QT, UShort_t DEPdata, Float_t nMIP_DEP);
/// Copy constructor
StPicoEpdHit(const StPicoEpdHit &hit);
/// Destructor
Expand Down Expand Up @@ -98,10 +114,6 @@ class StPicoEpdHit : public TObject {
/// bit 29=0/1 for has/does not have TAC;
/// bit 30=0/1 if tile is marked bad/good in database
Int_t qtData() const { return mQTdata; }
/// gain calibrated energy loss in tile, in units of Landau MPV for one MIP
/// if the tile is identified as bad in the database, returns zero. Note you
/// can always access the raw ADC value, regardless of good/bad
Float_t nMIP() const { return this->isGood() ? mnMIP : 0.0; }
/// false if tile is bad or missing, according to (time-dependent) database
Bool_t isGood() const { return (mQTdata >> 30) & 0x1; }
/// truncated nMIP. This is usually the most useful thing to the physics analyzer.
Expand All @@ -119,8 +131,27 @@ class StPicoEpdHit : public TObject {
/// It is expected that this will not be invoked, but rather the constructor used
/// \param id = sign*(100*position+tile) where sign=+/- for West/East wheel
void setId(Short_t id) { mId = id; }
/// \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
void setnMIP_QT(Float_t nMIP_QT) { mnMIP_QT = nMIP_QT; }


// 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 this->isGood() ? mnMIP_DEP : 0.0;}
/// true if there is QT information available for this (will be false for sure at high rates on west side)
bool qtDataAvailable() const {return this->adc()>0;}
/// gain calibrated energy loss in tile based on QT, in units of Landau MPV for one MIP
/// if the tile is identified as bad in the database, returns zero. Note you
/// can always access the raw ADC value, regardless of good/bad
Float_t nMIP_QT() const {return this->isGood() ? mnMIP_QT : 0.0; }
/// 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 {if (!this->isGood()) return 0.0; return (this->qtDataAvailable())?mnMIP_QT:mnMIP_DEP;}

protected:

Expand All @@ -134,10 +165,16 @@ class StPicoEpdHit : public TObject {
/// 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
Float_t mnMIP;
/// gain calibrated energy loss in tile, in units of Landau MPV for one MIP - based on QT data
Float_t mnMIP_QT;

/// 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;

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

#endif
10 changes: 10 additions & 0 deletions StRoot/StPicoEvent/macros/PicoDstAnalyzer.C
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "../StPicoEmcTrigger.h"
#include "../StPicoBTofPidTraits.h"
#include "../StPicoTrackCovMatrix.h"
#include "../StPicoEpdHit.h"

// Load libraries (for ROOT_VERSTION_CODE >= 393215)
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
Expand Down Expand Up @@ -139,6 +140,9 @@ void PicoDstAnalyzer(const Char_t *inFile = "../files/st_physics_12126101_raw_30
TH1F *hBTofTrayHit = new TH1F("hBTofTrayHit","BTof tray number with the hit",
120, -0.5, 119.5);

// Epd - mal 13mar2023
TH1F* hEpdHitsByPP = new TH1F("hEpdHitsByPP","Number of EPD hits by PP",25,-12.5,12.5);
TH1F* hEpdMult = new TH1F("hEpdMult","EPD hit multiplicity",800,0,800);

// Loop over events
for(Long64_t iEvent=0; iEvent<events2read; iEvent++) {
Expand All @@ -156,6 +160,12 @@ void PicoDstAnalyzer(const Char_t *inFile = "../files/st_physics_12126101_raw_30
// Retrieve picoDst
StPicoDst *dst = picoReader->picoDst();

// EPD histograms - mal 13mar2023
hEpdMult->Fill(dst->numberOfEpdHits());
for (unsigned int iepd=0; iepd<dst->numberOfEpdHits(); iepd++){
hEpdHitsByPP->Fill(dst->epdHit(iepd)->position()*dst->epdHit(iepd)->side());
}

// Retrieve event information
StPicoEvent *event = dst->event();
if( !event ) {
Expand Down

0 comments on commit ca42848

Please sign in to comment.