From 1a7d657aca2bcb988215b7748fc5a07bf4e7abb5 Mon Sep 17 00:00:00 2001 From: Eric Torrence <eric.torrence@cern.ch> Date: Sat, 12 Feb 2022 11:52:02 -0800 Subject: [PATCH] Fix missing trigger scintillators, add some counters to waveform reco, cleanup excessive INFO output --- .../Reconstruction/scripts/faser_reco.py | 8 +++++--- .../src/FaserSCT_SpacePointContainerCnv.cxx | 4 ++-- .../WaveRecAlgs/python/WaveRecAlgsConfig.py | 5 ++--- .../WaveRecAlgs/src/RawWaveformRecAlg.cxx | 20 +++++++++++++++++++ Waveform/WaveRecAlgs/src/RawWaveformRecAlg.h | 13 ++++++++++++ Waveform/WaveRecAlgs/src/WaveClockRecAlg.cxx | 5 ++++- Waveform/WaveRecAlgs/src/WaveClockRecAlg.h | 10 ++++++++++ 7 files changed, 56 insertions(+), 9 deletions(-) diff --git a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py index f0fa35b4a..9810f9606 100755 --- a/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py +++ b/Control/CalypsoExample/Reconstruction/scripts/faser_reco.py @@ -46,10 +46,12 @@ if len(args.run_type) > 0: # i.e.: TestBeamData/Run-004150/Faser-Physics-004150-00000.raw" else: if len(filepath.parts) < 3: - print("Can't determine run type from path - specify on command line instead") - sys.exit(-1) + print("Can't determine run type from path - guessing TI12Data!") + print("If this is not correct, specify on command line") + runtype = "TI12Data" - runtype = filepath.parts[-3] + else: + runtype = filepath.parts[-3] # Fix TI12 geometry versions as well (needed in production) # Probably better to do this from configuration in upstream production scripts, diff --git a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/FaserSCT_SpacePointContainerCnv.cxx b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/FaserSCT_SpacePointContainerCnv.cxx index 5a63749a5..b1402a22a 100644 --- a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/FaserSCT_SpacePointContainerCnv.cxx +++ b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/FaserSCT_SpacePointContainerCnv.cxx @@ -48,7 +48,7 @@ StatusCode FaserSCT_SpacePointContainerCnv::initialize() { FaserSCT_SpacePointContainer_PERS* FaserSCT_SpacePointContainerCnv::createPersistent (FaserSCT_SpacePointContainer* transObj) { - ATH_MSG_INFO("FaserSCT_SpacePointContainerCnv::createPersistent()"); + ATH_MSG_DEBUG("FaserSCT_SpacePointContainerCnv::createPersistent()"); FaserSCT_SpacePointContainerCnv_PERS converter; @@ -60,7 +60,7 @@ FaserSCT_SpacePointContainerCnv::createPersistent (FaserSCT_SpacePointContainer* FaserSCT_SpacePointContainer* FaserSCT_SpacePointContainerCnv::createTransient() { - ATH_MSG_INFO("FaserSCT_SpacePointContainerCnv::createTransient()"); + ATH_MSG_DEBUG("FaserSCT_SpacePointContainerCnv::createTransient()"); static const pool::Guid p0_guid("DB0397F9-A163-496F-BC17-C7E507A1FA50"); FaserSCT_SpacePointContainer* transObj(nullptr); diff --git a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py index 64764cd1c..d38eb4fd0 100644 --- a/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py +++ b/Waveform/WaveRecAlgs/python/WaveRecAlgsConfig.py @@ -20,14 +20,13 @@ def WaveformReconstructionCfg(flags, naive = False): if flags.Input.isMC and naive: if "TB" not in flags.GeoModel.FaserVersion: - acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoTimingHitWaveformRecAlg", "Trigger")) + acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoTriggerHitWaveformRecAlg", "Trigger")) acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoVetoHitToWaveformRecAlg", "Veto")) acc.merge(PseudoScintHitToWaveformRecCfg(flags, "PseudoPresehowerHitWaveformRecAlg", "Preshower")) acc.merge(PseudoCaloHitToWaveformRecCfg(flags, "PseudoCaloHitWaveformRecAlg")) return acc - if "TB" not in flags.GeoModel.FaserVersion: - acc.merge(WaveformHitRecCfg(flags, "TimingWaveformRecAlg", "Trigger")) + acc.merge(WaveformHitRecCfg(flags, "TriggerWaveformRecAlg", "Trigger")) acc.merge(WaveformHitRecCfg(flags, "VetoWaveformRecAlg", "Veto")) acc.merge(WaveformHitRecCfg(flags, "PreshowerWaveformRecAlg", "Preshower")) acc.merge(WaveformHitRecCfg(flags, "CaloWaveformRecAlg", "Calo")) diff --git a/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.cxx b/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.cxx index f1320c41e..97f122e50 100644 --- a/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.cxx +++ b/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.cxx @@ -29,6 +29,13 @@ StatusCode RawWaveformRecAlg::finalize() { ATH_MSG_INFO(name() << "::finalize()"); + ATH_MSG_INFO( m_numberOfEvents << " events processed" ); + if ( m_numberOfEvents > 0) { + ATH_MSG_INFO( m_numberOfWaveforms << " waveforms found" ); + ATH_MSG_INFO( m_numberOfOverflows << " overflows" ); + ATH_MSG_INFO( m_numberOfFitErrors << " fit errors" ); + } + return StatusCode::SUCCESS; } @@ -74,6 +81,19 @@ RawWaveformRecAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("WaveformsHitContainer '" << hitContainerHandle.name() << "' filled with "<< hitContainerHandle->size() <<" items"); + // Keep track of some statistics + m_numberOfEvents++; + for (const auto& hit : *(hitContainerHandle.ptr())) { + if (hit->status_bit(xAOD::WaveformStatus::THRESHOLD_FAILED)) continue; + m_numberOfWaveforms++; + if (hit->status_bit(xAOD::WaveformStatus::WAVE_OVERFLOW)) m_numberOfOverflows++; + if (hit->status_bit(xAOD::WaveformStatus::GFIT_FAILED)) { + m_numberOfFitErrors++; + } else if (hit->status_bit(xAOD::WaveformStatus::CBFIT_FAILED)) { + m_numberOfFitErrors++; + } + } + return StatusCode::SUCCESS; } diff --git a/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.h b/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.h index a7120b835..e57501a73 100644 --- a/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.h +++ b/Waveform/WaveRecAlgs/src/RawWaveformRecAlg.h @@ -81,6 +81,19 @@ class RawWaveformRecAlg : public AthReentrantAlgorithm { {this, "WaveformHitContainerKey", ""}; //@} + /** + * @name Counters + * Use mutable to be updated in const methods. + * AthReentrantAlgorithm is const during event processing. + * Use std::atomic to be multi-thread safe. + */ + //@{ + mutable std::atomic<int> m_numberOfEvents{0}; + mutable std::atomic<int> m_numberOfWaveforms{0}; + mutable std::atomic<int> m_numberOfOverflows{0}; + mutable std::atomic<int> m_numberOfFitErrors{0}; + //@} + }; #endif // WAVERECALGS_RAWWAVEFORMRECALG_H diff --git a/Waveform/WaveRecAlgs/src/WaveClockRecAlg.cxx b/Waveform/WaveRecAlgs/src/WaveClockRecAlg.cxx index 36891e70d..4dc401423 100644 --- a/Waveform/WaveRecAlgs/src/WaveClockRecAlg.cxx +++ b/Waveform/WaveRecAlgs/src/WaveClockRecAlg.cxx @@ -24,7 +24,7 @@ WaveClockRecAlg::initialize() { StatusCode WaveClockRecAlg::finalize() { ATH_MSG_INFO(name() << "::finalize()"); - + ATH_MSG_INFO( m_numberOfEvents << " events processed" ); return StatusCode::SUCCESS; } @@ -83,6 +83,9 @@ WaveClockRecAlg::execute(const EventContext& ctx) const { // Reconstruct the hits CHECK( m_recoTool->reconstruct(*wave, clock) ); + // Keep track of how many we reconstructed + m_numberOfEvents++; + // Only do one if there happen to be more break; } diff --git a/Waveform/WaveRecAlgs/src/WaveClockRecAlg.h b/Waveform/WaveRecAlgs/src/WaveClockRecAlg.h index e6e61cfd2..771b0e868 100644 --- a/Waveform/WaveRecAlgs/src/WaveClockRecAlg.h +++ b/Waveform/WaveRecAlgs/src/WaveClockRecAlg.h @@ -67,6 +67,16 @@ class WaveClockRecAlg : public AthReentrantAlgorithm { {this, "WaveformClockKey", "WaveformClock"}; //@} + /** + * @name Counters + * Use mutable to be updated in const methods. + * AthReentrantAlgorithm is const during event processing. + * Use std::atomic to be multi-thread safe. + */ + //@{ + mutable std::atomic<int> m_numberOfEvents{0}; + //@} + }; #endif // WAVERECALGS_WAVECLOCKRECALG_H -- GitLab