From 98e90ea4167402fcd1da57e41789f85ea83c7b44 Mon Sep 17 00:00:00 2001 From: Daniel Torres Valladares Date: Tue, 30 Jan 2024 11:31:59 -0600 Subject: [PATCH 1/4] VPD start mode added and mVpdResConfigs->ingleTubeRes function fixed. --- StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx | 42 ++++++-------------- StRoot/StBTofUtil/StVpdSimConfig.h | 31 ++++++++++----- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx index afc052abba5..89df14c8741 100644 --- a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx +++ b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx @@ -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); + if (mUseVpdStart) + double 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; } diff --git a/StRoot/StBTofUtil/StVpdSimConfig.h b/StRoot/StBTofUtil/StVpdSimConfig.h index 26176a355bd..d7f2d2a99ed 100644 --- a/StRoot/StBTofUtil/StVpdSimConfig.h +++ b/StRoot/StBTofUtil/StVpdSimConfig.h @@ -34,16 +34,29 @@ class StVpdSimConfig : public StMaker { int 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 += 1; + total_vpd_hits += 1; + } + if (1 << i & mVPDHitPatternWest) { + vpdResSumSqr += 1; + 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) From 84f537b82a024f114b7b74ab70a27f8fd689f70b Mon Sep 17 00:00:00 2001 From: Daniel Torres Valladares Date: Tue, 30 Jan 2024 15:08:26 -0600 Subject: [PATCH 2/4] propagation of error in singleTubeRes fixed to go as sqrt(N) --- StRoot/StBTofUtil/StVpdSimConfig.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/StRoot/StBTofUtil/StVpdSimConfig.h b/StRoot/StBTofUtil/StVpdSimConfig.h index d7f2d2a99ed..bcf0e700ff6 100644 --- a/StRoot/StBTofUtil/StVpdSimConfig.h +++ b/StRoot/StBTofUtil/StVpdSimConfig.h @@ -46,15 +46,15 @@ class StVpdSimConfig : public StMaker { int total_vpd_hits = 0; //Total number of vpd tubes used. for (int i=0; i<19; i++){ if (1 << i & mVPDHitPatternEast) { - vpdResSumSqr += 1; + vpdResSumSqr += (mSimParams[i].singleTubeRes)*(mSimParams[i].singleTubeRes); total_vpd_hits += 1; } if (1 << i & mVPDHitPatternWest) { - vpdResSumSqr += 1; + vpdResSumSqr += (mSimParams[i+19].singleTubeRes)*(mSimParams[i+19].singleTubeRes); total_vpd_hits += 1; } } - vpdresolution = sqrt(vpdResSumSqr)/total_vpd_hits; + vpdresolution = sqrt(vpdResSumSqr/total_vpd_hits); return vpdresolution; } From f246b907db439be37cfe8258da0fe4afca6cf7f6 Mon Sep 17 00:00:00 2001 From: Daniel Torres Valladares Date: Tue, 30 Jan 2024 17:20:53 -0600 Subject: [PATCH 3/4] VPD start mode not working due to double definition of start_resolution var --- StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx | 4 ++-- StRoot/StBTofUtil/StVpdSimConfig.h | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx index 89df14c8741..60b8320895a 100644 --- a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx +++ b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx @@ -2843,9 +2843,9 @@ float StBTofCalibMaker::tofCellResolution(const Int_t itray, const Int_t iModule // mBTofRes::timeres_tof() reports in picoseconds float stop_resolution = mBTofRes->timeres_tof(itray, module, cell)/1000.; - float start_resolution(0); + float start_resolution = 0.0; if (mUseVpdStart) - double start_resolution = mVpdResConfig->singleTubeRes(mVPDHitPatternEast, mVPDHitPatternWest)/1000.; + start_resolution = mVpdResConfig->singleTGubeRes(mVPDHitPatternEast, mVPDHitPatternWest)/1000.; else start_resolution = mBTofRes->average_timeres_tof()/sqrt(mNTzero)/1000.; resolution = sqrt(stop_resolution*stop_resolution + start_resolution*start_resolution); diff --git a/StRoot/StBTofUtil/StVpdSimConfig.h b/StRoot/StBTofUtil/StVpdSimConfig.h index bcf0e700ff6..69d6ee0be95 100644 --- a/StRoot/StBTofUtil/StVpdSimConfig.h +++ b/StRoot/StBTofUtil/StVpdSimConfig.h @@ -29,9 +29,9 @@ 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) }; /** @@ -42,8 +42,9 @@ class StVpdSimConfig : public StMaker { * @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. + 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); @@ -54,7 +55,7 @@ class StVpdSimConfig : public StMaker { total_vpd_hits += 1; } } - vpdresolution = sqrt(vpdResSumSqr/total_vpd_hits); + vpdresolution = sqrt(vpdResSumSqr)/total_vpd_hits; return vpdresolution; } From f1fce67046bb5c5f5c283ca97fda594b2f9177a5 Mon Sep 17 00:00:00 2001 From: Daniel Torres Valladares Date: Mon, 5 Feb 2024 14:55:58 -0600 Subject: [PATCH 4/4] typo fixed when calling singleTubeRes --- StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx index 60b8320895a..c82328a3523 100644 --- a/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx +++ b/StRoot/StBTofCalibMaker/StBTofCalibMaker.cxx @@ -2845,7 +2845,7 @@ float StBTofCalibMaker::tofCellResolution(const Int_t itray, const Int_t iModule float start_resolution = 0.0; if (mUseVpdStart) - start_resolution = mVpdResConfig->singleTGubeRes(mVPDHitPatternEast, mVPDHitPatternWest)/1000.; + 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);