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

Vpd start mode integrated #645

Merged
merged 5 commits into from
Mar 25, 2024
Merged
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
42 changes: 13 additions & 29 deletions StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2835,36 +2835,20 @@ void StBTofCalibMaker::writePPPAHistograms()
//_____________________________________________________________________________
float StBTofCalibMaker::tofCellResolution(const Int_t itray, const Int_t iModuleChan)
{
float resolution(0.013); // 0.013 by default - 1/beta resolution
if (itray<0){return resolution;}

float resolution(0.013); // 0.013 by default - 1/beta resolution
if (itray<0){return resolution;}

int module = iModuleChan/6 + 1;
int cell = iModuleChan%6 + 1;
// mBTofRes::timeres_tof() reports in picoseconds
float stop_resolution = mBTofRes->timeres_tof(itray, module, cell)/1000.;

float start_resolution(0);
if (mUseVpdStart){

// For VPD timing determine the VPD starttime by combing the resolutions of
// tray == 122 (east)
// mSimParams[singleHit.tubeId-1+19].singleTubeRes
// tray 121 (west)
// mSimParams[singleHit.tubeId-1].singleTubeRes
//
// needs to be implemented

}
else {
// combine an average BTOF resolution based on NT0
// more sophisticated: figure out what BTOF cells actually went into the NT0 count.

// mBTofRes::timeres_tof() reports in picoseconds
start_resolution = mBTofRes->average_timeres_tof()/sqrt(mNTzero)/1000.;
}
int module = iModuleChan/6 + 1;
int cell = iModuleChan%6 + 1;
// mBTofRes::timeres_tof() reports in picoseconds
float stop_resolution = mBTofRes->timeres_tof(itray, module, cell)/1000.;

resolution = sqrt(stop_resolution*stop_resolution + start_resolution*start_resolution);
float start_resolution = 0.0;
if (mUseVpdStart)
start_resolution = mVpdResConfig->singleTubeRes(mVPDHitPatternEast, mVPDHitPatternWest)/1000.;
else
start_resolution = mBTofRes->average_timeres_tof()/sqrt(mNTzero)/1000.;
resolution = sqrt(stop_resolution*stop_resolution + start_resolution*start_resolution);

return resolution;
return resolution;
}
38 changes: 26 additions & 12 deletions StRoot/StBTofUtil/StVpdSimConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,35 @@ class StVpdSimConfig : public StMaker {
//! structure containing tube parameters
struct SingleTubeParams{
float singleTubeRes; //!< Resolution of a particular Vpd tube in ps
int tubeId; //!< Tube Id (number) [0,37] with west Vpd [0,18] and east Vpd [19,37]
int tubeStatusFlag; //!< Status flag for whether tube was active (1) or inactive (0)
int tubeTriggerFlag; //!< Status flag for whether tube was triggered on (1) or not (0)
int tubeId, //!< Tube Id (number) [0,37] with west Vpd [0,18] and east Vpd [19,37]
tubeStatusFlag, //!< Status flag for whether tube was active (1) or inactive (0)
tubeTriggerFlag; //!< Status flag for whether tube was triggered on (1) or not (0)
};

/// calculate correct resolution based on those tubes that were used
double singleTubeRes(UInt_t mVPDHitPatternEast, UInt_t mVPDHitPatternWest){
double vpdResSumSqr(0.), vpdresolution(0.);
for (int i=0; i<19; i++){
if (1 << i && mVPDHitPatternEast) vpdResSumSqr += (mSimParams[i].singleTubeRes)*(mSimParams[i].singleTubeRes);
if (1 << i && mVPDHitPatternWest) vpdResSumSqr += (mSimParams[i+19].singleTubeRes)*(mSimParams[i+19].singleTubeRes);
/**
* @brief Calculate correct resolution based on those tubes that were used.
*
* @param mVPDHitPatternEast 9 digit binary number specifying hit pattern of east VPD tubes.
* @param mVPDHitPatternWest 9 digit binary number specifying hit pattern of west VPD tubes.
* @return double vpd resolution.
*/
double singleTubeRes(UInt_t mVPDHitPatternEast, UInt_t mVPDHitPatternWest){
double vpdResSumSqr(0.),
vpdresolution(0.);
int total_vpd_hits = 0; //Total number of vpd tubes used.
for (int i=0; i<19; i++){
if (1 << i & mVPDHitPatternEast) {
vpdResSumSqr += (mSimParams[i].singleTubeRes)*(mSimParams[i].singleTubeRes);
total_vpd_hits += 1;
}
if (1 << i & mVPDHitPatternWest) {
vpdResSumSqr += (mSimParams[i+19].singleTubeRes)*(mSimParams[i+19].singleTubeRes);
total_vpd_hits += 1;
}
}
vpdresolution = sqrt(vpdResSumSqr);
return vpdresolution;
}
vpdresolution = sqrt(vpdResSumSqr)/total_vpd_hits;
return vpdresolution;
}

/**
* Calculates the average resolution across all 38 tubes (discounts inactive tubes)
Expand Down
Loading