Skip to content
Snippets Groups Projects
Commit 2899bc31 authored by Eric Torrence's avatar Eric Torrence
Browse files

Merge branch 'torrence-digifix' into 'master'

Tracker RDO timing fix

See merge request !338
parents b839a17e 99d44e89
No related branches found
No related tags found
1 merge request!338Tracker RDO timing fix
Pipeline #5157162 passed
...@@ -25,6 +25,8 @@ parser.add_argument("-g", "--geom", default="TI12MC", ...@@ -25,6 +25,8 @@ parser.add_argument("-g", "--geom", default="TI12MC",
help="Specify geometry (default: TI12MC, alt: TestBeamMC)") help="Specify geometry (default: TI12MC, alt: TestBeamMC)")
parser.add_argument("-t", "--tag", default="", parser.add_argument("-t", "--tag", default="",
help="Specify digi tag (to append to output filename)") help="Specify digi tag (to append to output filename)")
parser.add_argument("--subtractTime", type=float, default=-999.,
help="Subtract time parameter for SCT RDOs")
parser.add_argument("--digiTag", default="", parser.add_argument("--digiTag", default="",
help="Specify tag for waveform digi folder") help="Specify tag for waveform digi folder")
parser.add_argument("--short", default="", parser.add_argument("--short", default="",
...@@ -161,6 +163,10 @@ acc.merge(FaserGeometryCfg(ConfigFlags)) ...@@ -161,6 +163,10 @@ acc.merge(FaserGeometryCfg(ConfigFlags))
from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_DigitizationCfg from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_DigitizationCfg
acc.merge(FaserSCT_DigitizationCfg(ConfigFlags)) acc.merge(FaserSCT_DigitizationCfg(ConfigFlags))
# Set the time offset for SCT RDOs
pualg = acc.getEventAlgo("StandardPileUpToolsAlg")
pualg.PileUpTools['FaserSCT_DigitizationTool'].SurfaceChargesGenerator.SubtractTime = args.subtractTime
# Pass something to set folder tag # Pass something to set folder tag
from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg
acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag))
......
...@@ -33,6 +33,8 @@ parser.add_argument("--complete", action="store_true", ...@@ -33,6 +33,8 @@ parser.add_argument("--complete", action="store_true",
help="This is the complete run, remove segment numbers") help="This is the complete run, remove segment numbers")
parser.add_argument("-t", "--tag", default="", parser.add_argument("-t", "--tag", default="",
help="Specify digi tag (to append to output filename)") help="Specify digi tag (to append to output filename)")
parser.add_argument("--subtractTime", type=float, default=-999.,
help="Subtract time parameter for SCT RDOs")
parser.add_argument("--digiTag", default="", parser.add_argument("--digiTag", default="",
help="Specify tag for waveform digi folder") help="Specify tag for waveform digi folder")
parser.add_argument("--short", default="", parser.add_argument("--short", default="",
...@@ -231,6 +233,10 @@ acc.merge(FaserGeometryCfg(ConfigFlags)) ...@@ -231,6 +233,10 @@ acc.merge(FaserGeometryCfg(ConfigFlags))
from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_DigitizationCfg from FaserSCT_Digitization.FaserSCT_DigitizationConfigNew import FaserSCT_DigitizationCfg
acc.merge(FaserSCT_DigitizationCfg(ConfigFlags)) acc.merge(FaserSCT_DigitizationCfg(ConfigFlags))
# Set the time offset for SCT RDOs
pualg = acc.getEventAlgo("StandardPileUpToolsAlg")
pualg.PileUpTools['FaserSCT_DigitizationTool'].SurfaceChargesGenerator.SubtractTime = args.subtractTime
# Pass something to set folder tag # Pass something to set folder tag
from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg from CaloDigiAlgs.CaloDigiAlgsConfig import CaloWaveformDigitizationCfg
acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag)) acc.merge(CaloWaveformDigitizationCfg(ConfigFlags, digiTag=args.digiTag))
......
...@@ -34,6 +34,12 @@ do ...@@ -34,6 +34,12 @@ do
shift; shift;
shift;; shift;;
--subtractTime)
echo "Subtract $2 ns from SCT RDOs"
timestr="--subtractTime $2"
shift;
shift;;
-g | --geom) -g | --geom)
geomstr="--geom $2"; geomstr="--geom $2";
shift; shift;
...@@ -115,6 +121,7 @@ echo `date` - $HOSTNAME ...@@ -115,6 +121,7 @@ echo `date` - $HOSTNAME
echo "File: $file_name" echo "File: $file_name"
echo "Geom: $geomstr" echo "Geom: $geomstr"
echo "Gain: $gainstr" echo "Gain: $gainstr"
echo "Time: $timestr"
echo "Release: $release_directory" echo "Release: $release_directory"
echo "Output: $output_directory" echo "Output: $output_directory"
echo "Starting: $starting_directory" echo "Starting: $starting_directory"
...@@ -178,9 +185,10 @@ cd "$file_stem" ...@@ -178,9 +185,10 @@ cd "$file_stem"
# #
# Run job # Run job
# #
faser_digi.py $geomstr $gainstr $tagstr "$file_path" faser_digi.py $geomstr $gainstr $timestr $tagstr "$file_path"
digi_code=$? digi_code=$?
echo "Return code: $digi_code" echo "Return code: $digi_code"
# #
# Print out ending time # Print out ending time
date date
......
...@@ -29,6 +29,7 @@ SECONDS=0 ...@@ -29,6 +29,7 @@ SECONDS=0
# #
# Job options strings # Job options strings
gainstr="" gainstr=""
timestr=""
partialstr="" partialstr=""
geomstr="" geomstr=""
# #
...@@ -42,6 +43,12 @@ do ...@@ -42,6 +43,12 @@ do
shift; shift;
shift;; shift;;
--subtractTime)
echo "Subtract $2 ns from SCT RDOs"
timestr="--subtractTime $2"
shift;
shift;;
--partial) --partial)
echo "Allowing partial merge" echo "Allowing partial merge"
partialstr="--partial" partialstr="--partial"
...@@ -147,6 +154,7 @@ echo `date` - $HOSTNAME ...@@ -147,6 +154,7 @@ echo `date` - $HOSTNAME
echo "Directory: $dir_path" echo "Directory: $dir_path"
echo "Geom: $geomstr" echo "Geom: $geomstr"
echo "Gain: $gainstr" echo "Gain: $gainstr"
echo "Time: $timestr"
echo "Slice: $slice" echo "Slice: $slice"
echo "NFiles: $nfiles" echo "NFiles: $nfiles"
echo "Release: $release_directory" echo "Release: $release_directory"
...@@ -213,7 +221,7 @@ cd "$file_stem" ...@@ -213,7 +221,7 @@ cd "$file_stem"
# #
# Run job # Run job
# #
faser_digi_merge.py $partialstr $geomstr $gainstr $tagstr --slice $slice --files $nfiles $dir_path faser_digi_merge.py $partialstr $geomstr $gainstr $timestr $tagstr --slice $slice --files $nfiles $dir_path
digi_code=$? digi_code=$?
echo "Return code: $digi_code" echo "Return code: $digi_code"
# #
......
...@@ -170,6 +170,20 @@ StatusCode FaserSCT_SurfaceChargesGenerator::initialize() { ...@@ -170,6 +170,20 @@ StatusCode FaserSCT_SurfaceChargesGenerator::initialize() {
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
StatusCode FaserSCT_SurfaceChargesGenerator::finalize() { StatusCode FaserSCT_SurfaceChargesGenerator::finalize() {
ATH_MSG_DEBUG("FaserSCT_SurfaceChargesGenerator::finalize()"); ATH_MSG_DEBUG("FaserSCT_SurfaceChargesGenerator::finalize()");
if (m_tofNum > 0) {
float mean_TOF = m_tofSum / m_tofNum;
float rms_TOF = sqrt(m_tofSum2 / m_tofNum - mean_TOF*mean_TOF);
ATH_MSG_INFO("TOF hits: " << m_tofNum);
ATH_MSG_INFO("Mean TOF: " << mean_TOF);
ATH_MSG_INFO("RMS TOF: " << rms_TOF);
}
if (m_tfix > -998.) {
ATH_MSG_INFO("Used fixed value: " << m_tfix.value());
}
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -335,13 +349,22 @@ void FaserSCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* ele ...@@ -335,13 +349,22 @@ void FaserSCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* ele
float timeOfFlight{p_eventTime + hitTime(phit)}; float timeOfFlight{p_eventTime + hitTime(phit)};
// Kondo 19/09/2007: Use the coordinate of the center of the module to calculate the time of flight // Kondo 19/09/2007: Use the coordinate of the center of the module to calculate the time of flight
timeOfFlight -= (element->center().mag()) / CLHEP::c_light; // Torrence 19/02/2023: Use global z coordinate rather than distance to origin for FASER
timeOfFlight -= (element->center().z()) / CLHEP::c_light;
// !< extract the distance to the origin of the module to Time of flight // !< extract the distance to the origin of the module to Time of flight
// !< timing set from jo to adjust (subtract) the timing // !< timing set from jo to adjust (subtract) the timing
if (m_tsubtract > -998.) { if (m_tsubtract > -998.) {
timeOfFlight -= m_tsubtract; timeOfFlight -= m_tsubtract;
} }
ATH_MSG_DEBUG("Time of flight: " << timeOfFlight);
// Keep some stats
m_tofNum += 1;
m_tofSum += timeOfFlight;
m_tofSum2 += (timeOfFlight * timeOfFlight);
// ---************************************** // ---**************************************
const CLHEP::Hep3Vector pos{phit.localStartPosition()}; const CLHEP::Hep3Vector pos{phit.localStartPosition()};
...@@ -512,6 +535,7 @@ void FaserSCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* ele ...@@ -512,6 +535,7 @@ void FaserSCT_SurfaceChargesGenerator::processSiHit(const SiDetectorElement* ele
const float sdist{static_cast<float>(design->scaledDistanceToNearestDiode(position))}; // !< dist on the surface from the hit point to the nearest strip (diode) const float sdist{static_cast<float>(design->scaledDistanceToNearestDiode(position))}; // !< dist on the surface from the hit point to the nearest strip (diode)
const float t_surf{surfaceDriftTime(2.0 * sdist)}; // !< Surface drift time const float t_surf{surfaceDriftTime(2.0 * sdist)}; // !< Surface drift time
const float totaltime{(m_tfix > -998.) ? m_tfix.value() : t_drift + timeOfFlight + t_surf}; // !< Total drift time const float totaltime{(m_tfix > -998.) ? m_tfix.value() : t_drift + timeOfFlight + t_surf}; // !< Total drift time
ATH_MSG_VERBOSE(std::fixed << std::setprecision(4) << "Surface time: " << t_surf << " Drift time: " << t_drift << " TOF: " << timeOfFlight << " Total: " << totaltime);
inserter(SiSurfaceCharge(position, SiCharge(q1, totaltime, hitproc, trklink))); inserter(SiSurfaceCharge(position, SiCharge(q1, totaltime, hitproc, trklink)));
} else { } else {
ATH_MSG_VERBOSE(std::fixed << std::setprecision(8) << "Local position (phi, eta, depth): (" ATH_MSG_VERBOSE(std::fixed << std::setprecision(8) << "Local position (phi, eta, depth): ("
......
...@@ -137,6 +137,12 @@ class FaserSCT_SurfaceChargesGenerator : public extends<AthAlgTool, ISCT_Surface ...@@ -137,6 +137,12 @@ class FaserSCT_SurfaceChargesGenerator : public extends<AthAlgTool, ISCT_Surface
bool m_SurfaceDriftFlag{false}; //!< surface drift ON/OFF bool m_SurfaceDriftFlag{false}; //!< surface drift ON/OFF
// Keep track of TOF
// These are updated in processSiHit which is const, so make mutable
mutable int m_tofNum{0};
mutable float m_tofSum{0.};
mutable float m_tofSum2{0.};
// -- Histograms // -- Histograms
// TProfile* m_h_efieldz{nullptr}; // TProfile* m_h_efieldz{nullptr};
// TH1F* m_h_efield{nullptr}; // TH1F* m_h_efield{nullptr};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment