diff --git a/Rich/Panoptes/options/RichRefIndexCalib.py b/Rich/Panoptes/options/RichRefIndexCalib.py index 46bd3787a689666b976e6d4527c5ba9f54b67153..4b8d87a14f049d79cbda60508da7e07c880b2ece 100644 --- a/Rich/Panoptes/options/RichRefIndexCalib.py +++ b/Rich/Panoptes/options/RichRefIndexCalib.py @@ -12,6 +12,7 @@ import multiprocessing import os +from Configurables import Gaudi__Monitoring__MessageSvcSink as MessageSvcSink from Gaudi.Configuration import DEBUG, INFO, VERBOSE from GaudiKernel.SystemOfUnits import GeV from Moore import options @@ -39,9 +40,12 @@ options.n_threads = ( ) # options.n_threads = 1 evtsForQMT = 1000 if options.simulation else 5000 -evtsForInt = 10000 if options.simulation else 50000 +evtsForInt = 100000 if options.simulation else 5000000 options.evt_max = evtsForQMT if isQMTTest else evtsForInt +# Extend title and ID string size in output +MessageSvcSink().HistoStringsWidth = 80 + # Is UT active in this task ? noUT = "noUT" in myName @@ -49,7 +53,7 @@ noUT = "noUT" in myName ckFitForm = ["AsymNormal:FreeNPol"] # Time between periodic calibrations -calibTime = 100000 if isQMTTest else 20 +calibTime = 100000 if isQMTTest else 60 # calibTime = 100000 # Fit retry period @@ -64,6 +68,7 @@ retryPeriod = 20 if isQMTTest else 1 do_moni = True do_det_debug = not isQMTTest do_mc_checking = options.simulation and do_moni +do_mirr_hists = True # Create run by run histos in calibration algorithm run_by_run_histos = False @@ -125,6 +130,7 @@ with ( do_detector_debug=do_det_debug, do_data_monitoring=do_moni, do_mc_checking=do_mc_checking, + enable_mirror_hists=do_mirr_hists, set_scale_factors_to_one=set_scale_to_one, ), ): diff --git a/Rich/Panoptes/python/Panoptes/calibration.py b/Rich/Panoptes/python/Panoptes/calibration.py index f39a0506b61f4723bfdf800ba2f742020409036d..a1b67147534f79ede9af13806a5fea98b1d6bef4 100644 --- a/Rich/Panoptes/python/Panoptes/calibration.py +++ b/Rich/Panoptes/python/Panoptes/calibration.py @@ -43,6 +43,7 @@ def standalone_rich_ref_index_calib( do_data_monitoring=False, do_mc_checking=False, do_detector_debug=False, + enable_mirror_hists=False, set_scale_factors_to_one=False, ): """ @@ -78,6 +79,10 @@ def standalone_rich_ref_index_calib( # Tweak the momentum cuts used for the ref index calib reco_opts["MinP"] = min_p + # Enable per mirror histograms offline + if do_data_monitoring and enable_mirror_hists: + reco_opts["SaveMirrorData"] = True + # As we aren't running PID, we do not need all hypos # reco_opts["Particles"] = ["muon","pion","kaon"] @@ -146,6 +151,8 @@ def standalone_rich_ref_index_calib( moni_set = "RefractiveIndex" # Force same CK theta range as calibration monitor moni_opts["CKResHistoRange"] = CKResHistoRange + # Enable all detailed histograms + moni_opts["DetailedHistograms"] = True moni_algs = make_rich_track_monitors( conf=conf, reco_opts=reco_opts, diff --git a/Rich/Panoptes/tests/options/2024-data.py b/Rich/Panoptes/tests/options/2024-data.py index 3d7480b61113d0edfd351ea33391b9bd63242124..047b8829354e911809501a77d1120f7a13fb2f1c 100644 --- a/Rich/Panoptes/tests/options/2024-data.py +++ b/Rich/Panoptes/tests/options/2024-data.py @@ -9,6 +9,7 @@ # or submit itself to any jurisdiction. # ############################################################################### +import glob import os from Moore import options @@ -21,9 +22,7 @@ options.set_input_and_conds_from_testfiledb("rich-decode-2024-panoptes") # If in Cambridge, use local PFNs jonPath = "/usera/jonesc/NFS/data/RunIII/Hlt2/LHCb/RefIndexCalib/2024/" if not myName and os.path.exists(jonPath): - options.input_files = [ - jonPath + "data-{i:04d}.mdf".format(i=i) for i in range(0, 4) - ] + options.input_files = sorted(glob.glob(jonPath + "/data*.mdf")) print("Data :-", options.input_files) options.evt_max = 1000 diff --git a/Rich/RichOnlineCalib/src/RichCalibUtils.h b/Rich/RichOnlineCalib/src/RichCalibUtils.h index 2e8d5598b02111069e471197597e237342cead9c..1a31263e8052e9cc10d2c2f4d7936cca98c18d12 100644 --- a/Rich/RichOnlineCalib/src/RichCalibUtils.h +++ b/Rich/RichOnlineCalib/src/RichCalibUtils.h @@ -1,5 +1,5 @@ /*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * +* (c) Copyright 2000-2025 CERN for the benefit of the LHCb Collaboration * * * * This software is distributed under the terms of the GNU General Public * * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". * @@ -60,28 +60,6 @@ namespace Rich::Calib::Utils { template <typename TYPE> using RunByRunHists = std::deque<TYPE>; - enum Quadrant : std::uint16_t { Q0 = 0, Q1, Q2, Q3 }; - - inline auto quadrants() { return std::array{ Quadrant::Q0, Quadrant::Q1, Quadrant::Q2, Quadrant::Q3 }; } - - template <typename T> - using QuadArray = Rich::Future::Hist::Array<T, 4, Quadrant>; - - inline std::string quadString( const Quadrant q ) { - switch ( q ) { - case Quadrant::Q0: - return " | Quadrant x>0 y>0"; - case Quadrant::Q1: - return " | Quadrant x<0 y>0"; - case Quadrant::Q2: - return " | Quadrant x>0 y<0"; - case Quadrant::Q3: - return " | Quadrant x<0 y<0"; - default: - return " | Quadrant UNDEFINED"; - } - } - /// Type for value+-error template <typename TYPE> struct ValueWithError { diff --git a/Rich/RichOnlineCalib/src/RichPhotonCounting.cpp b/Rich/RichOnlineCalib/src/RichPhotonCounting.cpp index 2000be661968f58c61ab027cfca244f94b0ba239..eba0464b2c3a0e9e572207980a736222913d0f79 100644 --- a/Rich/RichOnlineCalib/src/RichPhotonCounting.cpp +++ b/Rich/RichOnlineCalib/src/RichPhotonCounting.cpp @@ -45,6 +45,7 @@ namespace Rich::Future::Rec::Counting { using namespace Gaudi::Functional; // Calib Utils using namespace Rich::Calib::Utils; + using namespace Rich::Utils; namespace { using PhotonYield = ValueWithError<double>; @@ -324,22 +325,22 @@ namespace Rich::Future::Rec::Counting { Hist::DetArray<std::unique_ptr<TH1D>> h_ckPhotonYield = { {} }; // Current active run-by-run histograms - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRec_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaExp_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRes_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_tkPtot_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckThetaRes_quadrants_run = { { {} } }; - mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkEntryXY_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckPhotonSig_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckPhotonSig_quadrants_run = { { {} } }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonSigNoSub_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonSigNoSub_quadrants_run = { + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRec_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaExp_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRes_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_tkPtot_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckThetaRes_quadrants_run = { { {} } }; + mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkEntryXY_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckPhotonSig_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckPhotonSig_quadrants_run = { { {} } }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonSigNoSub_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonSigNoSub_quadrants_run = { { {} } }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonBckLow_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonBckLow_quadrants_run = { + mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonBckLow_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonBckLow_quadrants_run = { { {} } }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonBckHigh_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonBckHigh_quadrants_run = { + mutable Hist::DetArray<RunByRunHists<Hist::H1D<unsigned int>>> h_ckPhotonBckHigh_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<unsigned int>>>> h_ckPhotonBckHigh_quadrants_run = { { {} } }; mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkSegMomVSPhotonYield_run = { {} }; mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkpathLengthVSPhotonYield_run = { {} }; @@ -494,8 +495,7 @@ void PhotonCounting::operator()( const LHCb::ODIN& odin, // Segment (x,y) entry point to radiator const auto seg_x = seg.entryPoint().x(); const auto seg_y = seg.entryPoint().y(); - const auto q = ( seg_x > 0 ? ( seg_y > 0 ? Quadrant::Q0 : Quadrant::Q2 ) // - : ( seg_y > 0 ? Quadrant::Q1 : Quadrant::Q3 ) ); + const auto q = quadrant( seg_x, seg_y ); fillRunByRunHist( h_tkEntryXY_run[rich], seg_x, seg_y ); // Loop over scalar entries in SIMD photon for ( std::size_t i = 0; i < SIMDCherenkovPhoton::SIMDFP::Size; ++i ) { diff --git a/Rich/RichOnlineCalib/src/RichRefIndexCalib.cpp b/Rich/RichOnlineCalib/src/RichRefIndexCalib.cpp index cf71afeecb9c542cd1d5a44248d35533ab4f97e8..74177b8d1c52b7ca8ebf94d43571b5acf6a397b0 100644 --- a/Rich/RichOnlineCalib/src/RichRefIndexCalib.cpp +++ b/Rich/RichOnlineCalib/src/RichRefIndexCalib.cpp @@ -56,6 +56,7 @@ namespace Rich::Future::Rec::Calib { using namespace Gaudi::Functional; // Calib Utils using namespace Rich::Calib::Utils; + using namespace Rich::Utils; namespace { using ScaleFactor = ValueWithError<double>; @@ -470,15 +471,15 @@ namespace Rich::Future::Rec::Calib { mutable std::mutex m_mutex; // CK theta histograms for calibration fits - Hist::DetArray<std::unique_ptr<TH1D>> h_ckResAll = { {} }; - Hist::DetArray<QuadArray<std::unique_ptr<TH1D>>> h_ckResAllQuads = { { {} } }; + Hist::DetArray<std::unique_ptr<TH1D>> h_ckResAll = { {} }; + Hist::DetArray<Hist::QuadArray<std::unique_ptr<TH1D>>> h_ckResAllQuads = { { {} } }; // Monitoring histos - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRec_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaExp_run = { {} }; - mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRes_run = { {} }; - mutable Hist::DetArray<QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckThetaRes_quads_run = { { {} } }; - mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkEntryXY_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRec_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaExp_run = { {} }; + mutable Hist::DetArray<RunByRunHists<Hist::H1D<>>> h_ckThetaRes_run = { {} }; + mutable Hist::DetArray<Hist::QuadArray<RunByRunHists<Hist::H1D<>>>> h_ckThetaRes_quads_run = { { {} } }; + mutable Hist::DetArray<RunByRunHists<Hist::H2D<>>> h_tkEntryXY_run = { {} }; /// Publishing service IPublishSvc* m_pPublishSvc = nullptr; @@ -800,8 +801,7 @@ void RefIndexCalib::operator()( const LHCb::ODIN& odin, // Segment (x,y) entry point to radiator const auto seg_x = seg.entryPoint().x(); const auto seg_y = seg.entryPoint().y(); - const auto q = ( seg_x > 0 ? ( seg_y > 0 ? Quadrant::Q0 : Quadrant::Q2 ) // - : ( seg_y > 0 ? Quadrant::Q1 : Quadrant::Q3 ) ); + const auto q = quadrant( seg_x, seg_y ); fillRunByRunHist( h_tkEntryXY_run[rich], seg_x, seg_y ); // Loop over scalar entries in SIMD photon