From 557b71804de0247352ffb7f69651b7cc1e4b07d1 Mon Sep 17 00:00:00 2001 From: Glitchmin Date: Fri, 1 Sep 2023 17:07:35 +0200 Subject: [PATCH 1/5] make ProtonReconstructionAlgorithm return invalid ForwardProton with negative chi2 instead of throwing an Exception --- .../ProtonReco/interface/ForwardProton.h | 1 + .../src/ProtonReconstructionAlgorithm.cc | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/DataFormats/ProtonReco/interface/ForwardProton.h b/DataFormats/ProtonReco/interface/ForwardProton.h index 84563ce96e0fc..5ee5c28d91927 100644 --- a/DataFormats/ProtonReco/interface/ForwardProton.h +++ b/DataFormats/ProtonReco/interface/ForwardProton.h @@ -70,6 +70,7 @@ namespace reco { /// chi-squared of the fit float chi2() const { return chi2_; } + void setChi2(double chi2) { chi2_ = chi2; } /// number of degrees of freedom for the track fit unsigned int ndof() const { return ndof_; } /// chi-squared divided by ndof (or chi-squared * 1e6 if ndof is zero) diff --git a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc index 72b23b14e0e53..f66737399f3c3 100644 --- a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc +++ b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc @@ -174,9 +174,14 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const // make sure optics is available for all tracks for (const auto &it : tracks) { auto oit = m_rp_optics_.find(it->rpId()); - if (oit == m_rp_optics_.end()) - throw cms::Exception("ProtonReconstructionAlgorithm") + //if chi2 is negative and `valid` is false it means the optics are missing or xangle is invalid + if (oit == m_rp_optics_.end()) { + edm::LogWarning("ProtonReconstructionAlgorithm") << "Optics data not available for RP " << it->rpId() << ", i.e. " << CTPPSDetId(it->rpId()) << "."; + reco::ForwardProton invalidProton; + invalidProton.setChi2(-std::numeric_limits::max()); + return invalidProton; + } } // initial estimate of xi and th_x @@ -412,9 +417,14 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromSingleRP(const // make sure optics is available for the track auto oit = m_rp_optics_.find(track->rpId()); - if (oit == m_rp_optics_.end()) - throw cms::Exception("ProtonReconstructionAlgorithm") + if (oit == m_rp_optics_.end()) { + //if chi2 is negative and `valid` is false it means the optics are missing or xangle is invalid + edm::LogWarning("ProtonReconstructionAlgorithm") << "Optics data not available for RP " << track->rpId() << ", i.e. " << rpId << "."; + reco::ForwardProton invalidProton; + invalidProton.setChi2(-std::numeric_limits::max()); + return invalidProton; + } // rough estimate of xi and th_y from each track const double x_full = track->x() * 1E-1 + oit->second.x0; // conversion mm --> cm From 2504a16f089d7c724a1f28721d8d4fcf21f8cc15 Mon Sep 17 00:00:00 2001 From: Glitchmin Date: Mon, 4 Sep 2023 17:00:06 +0200 Subject: [PATCH 2/5] set method of reconstruction for invalid proton --- .../ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc index f66737399f3c3..719dd2960aa1b 100644 --- a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc +++ b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc @@ -180,6 +180,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const << "Optics data not available for RP " << it->rpId() << ", i.e. " << CTPPSDetId(it->rpId()) << "."; reco::ForwardProton invalidProton; invalidProton.setChi2(-std::numeric_limits::max()); + invalidProton.setMethod(reco::ForwardProton::ReconstructionMethod::multiRP); return invalidProton; } } @@ -423,6 +424,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromSingleRP(const << "Optics data not available for RP " << track->rpId() << ", i.e. " << rpId << "."; reco::ForwardProton invalidProton; invalidProton.setChi2(-std::numeric_limits::max()); + invalidProton.setMethod(reco::ForwardProton::ReconstructionMethod::singleRP); return invalidProton; } From 7276720b9a1523030290d49dfe985d2ed9705084 Mon Sep 17 00:00:00 2001 From: Glitchmin Date: Thu, 14 Sep 2023 17:41:47 +0200 Subject: [PATCH 3/5] add tracks to invalidProton --- .../ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc index 719dd2960aa1b..91419b4f38741 100644 --- a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc +++ b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc @@ -181,6 +181,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const reco::ForwardProton invalidProton; invalidProton.setChi2(-std::numeric_limits::max()); invalidProton.setMethod(reco::ForwardProton::ReconstructionMethod::multiRP); + invalidProton.setContributingLocalTracks(tracks); return invalidProton; } } @@ -425,6 +426,9 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromSingleRP(const reco::ForwardProton invalidProton; invalidProton.setChi2(-std::numeric_limits::max()); invalidProton.setMethod(reco::ForwardProton::ReconstructionMethod::singleRP); + CTPPSLocalTrackLiteRefVector trk; + trk.push_back(track); + invalidProton.setContributingLocalTracks(trk); return invalidProton; } From 1032d547630eea0d330299da8588f1052fffabdf Mon Sep 17 00:00:00 2001 From: Glitchmin Date: Fri, 15 Sep 2023 11:21:39 +0200 Subject: [PATCH 4/5] return empty LHCInterpolatedOpticalFunctionsSetCollection collection if cannot interpolate --- .../CTPPSInterpolatedOpticalFunctionsESSource.cc | 10 ++++++++-- .../plugins/CTPPSProtonProducer.cc | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc b/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc index e4d0f26bb3c5d..cd26f5b635371 100644 --- a/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc +++ b/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc @@ -114,11 +114,17 @@ std::shared_ptr CTPPSInterpolatedO const auto &it = ofColl.begin(); // does the input xangle correspond to the actual one? - if (fabs(currentCrossingAngle_ - it->first) > 1e-6) - throw cms::Exception("CTPPSInterpolatedOpticalFunctionsESSource") + if (fabs(currentCrossingAngle_ - it->first) > 1e-6) { + edm::LogWarning("CTPPSInterpolatedOpticalFunctionsESSource") << "Cannot interpolate: input given only for xangle " << it->first << " while interpolation requested for " << currentCrossingAngle_ << "."; + currentDataValid_ = false; + currentData_ = std::make_shared(); + + return currentData_; + } + currentData_ = std::make_shared(); for (const auto &rp_p : it->second) { const auto rpId = rp_p.first; diff --git a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc index 73809feb4aae5..eb3ce8a6876a0 100644 --- a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc @@ -219,7 +219,7 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe // re-initialise algorithm upon crossing-angle change if (opticsWatcher_.check(iSetup)) { if (hOpticalFunctions->empty()) { - edm::LogInfo("CTPPSProtonProducer") << "No optical functions available, reconstruction disabled."; + edm::LogWarning("CTPPSProtonProducer") << "No optical functions available, reconstruction disabled."; algorithm_.release(); opticsValid_ = false; } else { From 712294c0b53ac3c3d1ab87f67d55c9b6ee626f8e Mon Sep 17 00:00:00 2001 From: Glitchmin Date: Fri, 15 Sep 2023 12:04:31 +0200 Subject: [PATCH 5/5] Revert "make proton reco use LHCInfoCombined" This reverts commit 438ecaf38d4a3d760e7c9915ea570257ddb0c2b1. --- CalibPPS/ESProducers/plugins/BuildFile.xml | 1 - ...PPSInterpolatedOpticalFunctionsESSource.cc | 28 ++----- ...nterpolatedOpticalFunctionsESSource_cff.py | 3 - .../ESProducers/python/ctppsLHCInfo_cff.py | 13 +++ .../python/ctppsOpticalFunctions_cff.py | 4 +- .../ctppsOpticalFunctions_non_DB_cff.py | 5 +- .../test/test_express_PPSAlCaReco_output.py | 2 +- .../test/test_prompt_PPSAlCaReco_output.py | 2 +- .../interface/CTPPSInterpolatedOpticsRcd.h | 7 +- CondFormats/RunInfo/BuildFile.xml | 1 - CondTools/RunInfo/interface/LHCInfoCombined.h | 82 ------------------- CondTools/RunInfo/src/LHCInfoCombined.cc | 74 ----------------- .../test/2023_lhcinfo_test_recoCTPPS_cfg.py | 66 --------------- .../interface/ProtonReconstructionAlgorithm.h | 5 +- .../plugins/BuildFile.xml | 1 - .../plugins/CTPPSProtonProducer.cc | 54 ++++-------- .../python/ctppsProtons_cff.py | 4 +- .../src/ProtonReconstructionAlgorithm.cc | 8 +- .../python/PPSTransportESSources_cfi.py | 2 +- Validation/CTPPS/plugins/BuildFile.xml | 1 - .../CTPPS/plugins/CTPPSLHCInfoPlotter.cc | 32 +++----- Validation/CTPPS/python/base_cff.py | 1 - .../CTPPS/python/ctppsLHCInfoPlotter_cff.py | 3 - Validation/CTPPS/test/simu/template_cfg.py | 12 +-- 24 files changed, 68 insertions(+), 343 deletions(-) delete mode 100644 CalibPPS/ESProducers/python/ctppsInterpolatedOpticalFunctionsESSource_cff.py create mode 100644 CalibPPS/ESProducers/python/ctppsLHCInfo_cff.py delete mode 100644 CondTools/RunInfo/interface/LHCInfoCombined.h delete mode 100644 CondTools/RunInfo/src/LHCInfoCombined.cc delete mode 100644 RecoPPS/Local/test/2023_lhcinfo_test_recoCTPPS_cfg.py delete mode 100644 Validation/CTPPS/python/ctppsLHCInfoPlotter_cff.py diff --git a/CalibPPS/ESProducers/plugins/BuildFile.xml b/CalibPPS/ESProducers/plugins/BuildFile.xml index 102ad4fe7f4ff..2e94eb3ffead4 100644 --- a/CalibPPS/ESProducers/plugins/BuildFile.xml +++ b/CalibPPS/ESProducers/plugins/BuildFile.xml @@ -22,5 +22,4 @@ - diff --git a/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc b/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc index cd26f5b635371..0401398883b83 100644 --- a/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc +++ b/CalibPPS/ESProducers/plugins/CTPPSInterpolatedOpticalFunctionsESSource.cc @@ -8,8 +8,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "CondTools/RunInfo/interface/LHCInfoCombined.h" - +#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" #include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h" #include "CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h" @@ -29,26 +28,19 @@ class CTPPSInterpolatedOpticalFunctionsESSource : public edm::ESProducer { private: edm::ESGetToken opticsToken_; edm::ESGetToken lhcInfoToken_; - edm::ESGetToken lhcInfoPerLSToken_; - edm::ESGetToken lhcInfoPerFillToken_; std::shared_ptr currentData_; float currentCrossingAngle_; bool currentDataValid_; - const bool useNewLHCInfo_; }; //---------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------- CTPPSInterpolatedOpticalFunctionsESSource::CTPPSInterpolatedOpticalFunctionsESSource(const edm::ParameterSet &iConfig) - : currentCrossingAngle_(LHCInfoCombined::crossingAngleInvalid), - currentDataValid_(false), - useNewLHCInfo_(iConfig.getParameter("useNewLHCInfo")) { + : currentCrossingAngle_(-1.), currentDataValid_(false) { auto cc = setWhatProduced(this, iConfig.getParameter("opticsLabel")); opticsToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter("opticsLabel"))); lhcInfoToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter("lhcInfoLabel"))); - lhcInfoPerLSToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter("lhcInfoPerLSLabel"))); - lhcInfoPerFillToken_ = cc.consumes(edm::ESInputTag("", iConfig.getParameter("lhcInfoPerFillLabel"))); } //---------------------------------------------------------------------------------------------------- @@ -57,10 +49,7 @@ void CTPPSInterpolatedOpticalFunctionsESSource::fillDescriptions(edm::Configurat edm::ParameterSetDescription desc; desc.add("lhcInfoLabel", "")->setComment("label of the LHCInfo record"); - desc.add("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record"); - desc.add("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record"); desc.add("opticsLabel", "")->setComment("label of the optics records"); - desc.add("useNewLHCInfo", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo"); descriptions.add("ctppsInterpolatedOpticalFunctionsESSource", desc); } @@ -72,29 +61,26 @@ std::shared_ptr CTPPSInterpolatedO // get the input data LHCOpticalFunctionsSetCollection const &ofColl = iRecord.get(opticsToken_); - auto lhcInfoCombined = LHCInfoCombined::createLHCInfoCombined< - CTPPSInterpolatedOpticsRcd, - edm::mpl::Vector>( - iRecord, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_); + LHCInfo const &lhcInfo = iRecord.get(lhcInfoToken_); // is there anything to do? - if (currentDataValid_ && lhcInfoCombined.crossingAngle() == currentCrossingAngle_) + if (currentDataValid_ && lhcInfo.crossingAngle() == currentCrossingAngle_) return currentData_; // is crossing angle reasonable (LHCInfo is correctly filled in DB)? - if (lhcInfoCombined.isCrossingAngleInvalid()) { + if (lhcInfo.crossingAngle() == 0.) { edm::LogInfo("CTPPSInterpolatedOpticalFunctionsESSource") << "Invalid crossing angle, no optical functions produced."; currentDataValid_ = false; - currentCrossingAngle_ = LHCInfoCombined::crossingAngleInvalid; + currentCrossingAngle_ = -1; currentData_ = std::make_shared(); return currentData_; } // set new crossing angle - currentCrossingAngle_ = lhcInfoCombined.crossingAngle(); + currentCrossingAngle_ = lhcInfo.crossingAngle(); edm::LogInfo("CTPPSInterpolatedOpticalFunctionsESSource") << "Crossing angle has changed to " << currentCrossingAngle_ << "."; diff --git a/CalibPPS/ESProducers/python/ctppsInterpolatedOpticalFunctionsESSource_cff.py b/CalibPPS/ESProducers/python/ctppsInterpolatedOpticalFunctionsESSource_cff.py deleted file mode 100644 index e6cc78ccdd3f9..0000000000000 --- a/CalibPPS/ESProducers/python/ctppsInterpolatedOpticalFunctionsESSource_cff.py +++ /dev/null @@ -1,3 +0,0 @@ -from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * -from Configuration.Eras.Modifier_run3_common_cff import run3_common -run3_common.toModify(ctppsInterpolatedOpticalFunctionsESSource, useNewLHCInfo = True) \ No newline at end of file diff --git a/CalibPPS/ESProducers/python/ctppsLHCInfo_cff.py b/CalibPPS/ESProducers/python/ctppsLHCInfo_cff.py new file mode 100644 index 0000000000000..3403647fe8463 --- /dev/null +++ b/CalibPPS/ESProducers/python/ctppsLHCInfo_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +# by default, LHCInfo is now loaded from CondDB using a GT +ctppsLHCInfoLabel = cms.string("") + +## minimal LHCInfo for 2016 data +#ctppsLHCInfoLabel = cms.string("ctpps_minimal") +#ctppsLHCInfoESSource_2016 = cms.ESSource("CTPPSLHCInfoESSource", +# label = ctppsLHCInfoLabel, +# validityRange = cms.EventRange("270293:min - 290872:max"), +# beamEnergy = cms.double(6500), # GeV +# xangle = cms.double(185) # murad +#) diff --git a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py index 00017a8690f84..a114bb9ad8249 100644 --- a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py +++ b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_cff.py @@ -1,5 +1,6 @@ import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsLHCInfo_cff import * # by default, (raw) optical functions are now loaded from CondDB using a GT @@ -25,4 +26,5 @@ #ctppsOpticalFunctionsESSource.configuration.append(config_2016_preTS2) # optics interpolation between crossing angles -from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import * +from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * +ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel diff --git a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py index 72f1a07f4bbdd..b8683b5675ea4 100644 --- a/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py +++ b/CalibPPS/ESProducers/python/ctppsOpticalFunctions_non_DB_cff.py @@ -1,5 +1,7 @@ import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsLHCInfo_cff import * + # (source) optical functions sampled at few xangles from CalibPPS.ESProducers.ctppsOpticalFunctionsESSource_cfi import * @@ -136,4 +138,5 @@ ctppsOpticalFunctionsESSource.configuration.append(optics_2022) # optics interpolation between crossing angles -from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import * +from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * +ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = ctppsLHCInfoLabel diff --git a/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.py b/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.py index 5b4aedc191531..d13258ec7028f 100644 --- a/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.py +++ b/Calibration/PPSAlCaRecoProducer/test/test_express_PPSAlCaReco_output.py @@ -6,7 +6,7 @@ process = cms.Process( 'TEST',ctpps_2018) # LHCInfo plotter -process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff') +process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi") process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_express.root" # Load geometry from DB diff --git a/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.py b/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.py index 2b6a2db3240a6..9b61d494952b7 100644 --- a/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.py +++ b/Calibration/PPSAlCaRecoProducer/test/test_prompt_PPSAlCaReco_output.py @@ -6,7 +6,7 @@ process = cms.Process( 'TEST',ctpps_2018) # LHCInfo plotter -process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff') +process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi") process.ctppsLHCInfoPlotter.outputFile = "alcareco_lhc_info_prompt.root" # Load geometry from DB diff --git a/CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h b/CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h index 68bb1b3d6bb1f..13e81fdd146aa 100644 --- a/CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h +++ b/CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h @@ -7,14 +7,11 @@ #include "CondFormats/DataRecord/interface/CTPPSOpticsRcd.h" #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" -#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h" -#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h" #include "FWCore/Utilities/interface/mplVector.h" class CTPPSInterpolatedOpticsRcd - : public edm::eventsetup::DependentRecordImplementation< - CTPPSInterpolatedOpticsRcd, - edm::mpl::Vector> {}; + : public edm::eventsetup::DependentRecordImplementation> {}; #endif diff --git a/CondFormats/RunInfo/BuildFile.xml b/CondFormats/RunInfo/BuildFile.xml index 4d7e80161e6bd..20474830eeb08 100644 --- a/CondFormats/RunInfo/BuildFile.xml +++ b/CondFormats/RunInfo/BuildFile.xml @@ -5,7 +5,6 @@ - diff --git a/CondTools/RunInfo/interface/LHCInfoCombined.h b/CondTools/RunInfo/interface/LHCInfoCombined.h deleted file mode 100644 index 2f6aab4289642..0000000000000 --- a/CondTools/RunInfo/interface/LHCInfoCombined.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef CondTools_RunInfo_LHCInfoCombined_H -#define CondTools_RunInfo_LHCInfoCombined_H - -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/DependentRecordImplementation.h" - -#include "CondFormats/RunInfo/interface/LHCInfo.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" - -#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h" -#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h" -#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" - -#include -#include -#include -#include -#include - -class LHCInfoCombined { -public: - LHCInfoCombined() = default; - - LHCInfoCombined(const LHCInfo& lhcInfo); - LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill); - LHCInfoCombined(const edm::EventSetup& iSetup, - const edm::ESGetToken& tokenInfoPerLS, - const edm::ESGetToken& tokenInfoPerFill, - const edm::ESGetToken& tokenInfo, - bool useNewLHCInfo); - - //this factory method is necessary because constructor can't be a template - template - static LHCInfoCombined createLHCInfoCombined( - const edm::eventsetup::DependentRecordImplementation& iRecord, - const edm::ESGetToken& tokenInfoPerLS, - const edm::ESGetToken& tokenInfoPerFill, - const edm::ESGetToken& tokenInfo, - bool useNewLHCInfo); - - void setFromLHCInfo(const LHCInfo& lhcInfo); - void setFromPerLS(const LHCInfoPerLS& infoPerLS); - void setFromPerFill(const LHCInfoPerFill& infoPerFill); - - float crossingAngle(); - static constexpr float crossingAngleInvalid = -1.; - bool isCrossingAngleInvalid(); - - float crossingAngleX; - float crossingAngleY; - float betaStarX; - float betaStarY; - float energy; - unsigned short fillNumber; - - void print(std::ostream& os) const; -}; - -std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo); - -template -LHCInfoCombined LHCInfoCombined::createLHCInfoCombined( - const edm::eventsetup::DependentRecordImplementation& iRecord, - const edm::ESGetToken& tokenInfoPerLS, - const edm::ESGetToken& tokenInfoPerFill, - const edm::ESGetToken& tokenInfo, - bool useNewLHCInfo) { - LHCInfoCombined lhcInfoCombined; - if (useNewLHCInfo) { - LHCInfoPerLS const& lhcInfoPerLS = iRecord.get(tokenInfoPerLS); - LHCInfoPerFill const& lhcInfoPerFill = iRecord.get(tokenInfoPerFill); - lhcInfoCombined.setFromPerLS(lhcInfoPerLS); - lhcInfoCombined.setFromPerFill(lhcInfoPerFill); - } else { - LHCInfo const& lhcInfo = iRecord.get(tokenInfo); - lhcInfoCombined.setFromLHCInfo(lhcInfo); - } - return lhcInfoCombined; -} - -#endif // CondTools_RunInfo_LHCInfoCombined_H diff --git a/CondTools/RunInfo/src/LHCInfoCombined.cc b/CondTools/RunInfo/src/LHCInfoCombined.cc deleted file mode 100644 index f489adfbbe3d6..0000000000000 --- a/CondTools/RunInfo/src/LHCInfoCombined.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "CondTools/RunInfo/interface/LHCInfoCombined.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -LHCInfoCombined::LHCInfoCombined(const LHCInfo& lhcInfo) { setFromLHCInfo(lhcInfo); } - -LHCInfoCombined::LHCInfoCombined(const LHCInfoPerLS& infoPerLS, const LHCInfoPerFill& infoPerFill) { - setFromPerLS(infoPerLS); - setFromPerFill(infoPerFill); -} - -LHCInfoCombined::LHCInfoCombined(const edm::EventSetup& iSetup, - const edm::ESGetToken& tokenInfoPerLS, - const edm::ESGetToken& tokenInfoPerFill, - const edm::ESGetToken& tokenInfo, - bool useNewLHCInfo) { - if (useNewLHCInfo) { - edm::ESHandle hLHCInfoPerLS = iSetup.getHandle(tokenInfoPerLS); - edm::ESHandle hLHCInfoFill = iSetup.getHandle(tokenInfoPerFill); - setFromPerLS(*hLHCInfoPerLS); - setFromPerFill(*hLHCInfoFill); - } else { - edm::ESHandle hLHCInfo = iSetup.getHandle(tokenInfo); - setFromLHCInfo(*hLHCInfo); - } -} - -void LHCInfoCombined::setFromLHCInfo(const LHCInfo& lhcInfo) { - crossingAngleX = lhcInfo.crossingAngle(); - crossingAngleY = 0; - betaStarX = lhcInfo.betaStar(); - betaStarY = lhcInfo.betaStar(); - energy = lhcInfo.energy(); - fillNumber = lhcInfo.fillNumber(); -} -void LHCInfoCombined::setFromPerLS(const LHCInfoPerLS& infoPerLS) { - crossingAngleX = infoPerLS.crossingAngleX(); - crossingAngleY = infoPerLS.crossingAngleY(); - betaStarX = infoPerLS.betaStarX(); - betaStarY = infoPerLS.betaStarY(); -} -void LHCInfoCombined::setFromPerFill(const LHCInfoPerFill& infoPerFill) { - energy = infoPerFill.energy(); - fillNumber = infoPerFill.fillNumber(); -} - -float LHCInfoCombined::crossingAngle() { - if (crossingAngleX == 0. && crossingAngleY == 0.) { - return crossingAngleInvalid; - } - if (crossingAngleX != 0. && crossingAngleY != 0.) { - edm::LogWarning("LHCInfoCombined") << "crossingAngleX and crossingAngleY are both different from 0"; - return crossingAngleInvalid; - } - return crossingAngleX == 0. ? crossingAngleY : crossingAngleX; -} - -//Comparison with the -1 value from LHC when crossing angle is not set -bool LHCInfoCombined::isCrossingAngleInvalid() { - float comparisonTolerance = 1e-6; - return fabs(crossingAngle() - crossingAngleInvalid) <= comparisonTolerance; -} - -void LHCInfoCombined::print(std::ostream& os) const { - os << "Crossing angle x (urad): " << crossingAngleX << std::endl - << "Crossing angle y (urad): " << crossingAngleY << std::endl - << "Beta star x (m): " << betaStarX << std::endl - << "Beta star y (m): " << betaStarY << std::endl - << "Energy (GeV): " << energy << std::endl; -} - -std::ostream& operator<<(std::ostream& os, LHCInfoCombined beamInfo) { - beamInfo.print(os); - return os; -} diff --git a/RecoPPS/Local/test/2023_lhcinfo_test_recoCTPPS_cfg.py b/RecoPPS/Local/test/2023_lhcinfo_test_recoCTPPS_cfg.py deleted file mode 100644 index 790d9e66b512d..0000000000000 --- a/RecoPPS/Local/test/2023_lhcinfo_test_recoCTPPS_cfg.py +++ /dev/null @@ -1,66 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Run3_cff import Run3 - -process = cms.Process('RECODQM', Run3) - -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) -process.verbosity = cms.untracked.PSet( input = cms.untracked.int32(-1) ) - -# minimum of logs -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - threshold = cms.untracked.string('INFO') - ) -) - -# import of standard configurations -process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") -process.load('Configuration.StandardSequences.Services_cff') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - -# raw data source -process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring( - '/store/data/Run2023D/ZeroBias/RAW/v1/000/369/956/00000/33d5acec-484f-4ac0-9b83-c6a3104ddd2b.root' - ), -) - - -from Configuration.AlCa.GlobalTag import GlobalTag - -process.GlobalTag.globaltag = "130X_dataRun3_Prompt_forLHCInfo_Candidate_2023_08_08_10_52_01" - -# local RP reconstruction chain with standard settings -process.load("RecoPPS.Configuration.recoCTPPS_cff") - - -process.ctppsProtonReconstructionPlotter = cms.EDAnalyzer("CTPPSProtonReconstructionPlotter", - tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), - tagRecoProtonsSingleRP = cms.InputTag("ctppsProtons", "singleRP"), - tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"), - - rpId_45_F = cms.uint32(23), - rpId_45_N = cms.uint32(3), - rpId_56_N = cms.uint32(103), - rpId_56_F = cms.uint32(123), - - outputFile = cms.string("alcareco_protons_express.root"), -) - - -process.path = cms.Path( - process.ctppsRawToDigi - * process.recoCTPPS -) - -process.end_path = cms.EndPath( - process.ctppsProtonReconstructionPlotter -) - -process.schedule = cms.Schedule( - process.path, - process.end_path -) diff --git a/RecoPPS/ProtonReconstruction/interface/ProtonReconstructionAlgorithm.h b/RecoPPS/ProtonReconstruction/interface/ProtonReconstructionAlgorithm.h index 510bc6f27e3f1..dcdad26c8d629 100644 --- a/RecoPPS/ProtonReconstruction/interface/ProtonReconstructionAlgorithm.h +++ b/RecoPPS/ProtonReconstruction/interface/ProtonReconstructionAlgorithm.h @@ -12,6 +12,7 @@ #include "DataFormats/CTPPSReco/interface/CTPPSLocalTrackLiteFwd.h" #include "DataFormats/ProtonReco/interface/ForwardProtonFwd.h" +#include "CondFormats/RunInfo/interface/LHCInfo.h" #include "CondFormats/PPSObjects/interface/LHCInterpolatedOpticalFunctionsSet.h" #include "CondFormats/PPSObjects/interface/LHCInterpolatedOpticalFunctionsSetCollection.h" @@ -35,12 +36,12 @@ class ProtonReconstructionAlgorithm { /// run proton reconstruction using single-RP strategy reco::ForwardProton reconstructFromSingleRP(const CTPPSLocalTrackLiteRef &track, - const float energy, + const LHCInfo &lhcInfo, std::ostream &os) const; /// run proton reconstruction using multiple-RP strategy reco::ForwardProton reconstructFromMultiRP(const CTPPSLocalTrackLiteRefVector &tracks, - const float energy, + const LHCInfo &lhcInfo, std::ostream &os) const; private: diff --git a/RecoPPS/ProtonReconstruction/plugins/BuildFile.xml b/RecoPPS/ProtonReconstruction/plugins/BuildFile.xml index fab0dfb8eeee9..5f15d23e27cb5 100644 --- a/RecoPPS/ProtonReconstruction/plugins/BuildFile.xml +++ b/RecoPPS/ProtonReconstruction/plugins/BuildFile.xml @@ -2,7 +2,6 @@ - diff --git a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc index eb3ce8a6876a0..b1f3a25ce821c 100644 --- a/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc +++ b/RecoPPS/ProtonReconstruction/plugins/CTPPSProtonProducer.cc @@ -25,11 +25,6 @@ #include "CondFormats/RunInfo/interface/LHCInfo.h" #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" -#include "CondTools/RunInfo/interface/LHCInfoCombined.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerLS.h" -#include "CondFormats/DataRecord/interface/LHCInfoPerLSRcd.h" -#include "CondFormats/RunInfo/interface/LHCInfoPerFill.h" -#include "CondFormats/DataRecord/interface/LHCInfoPerFillRcd.h" #include "CondFormats/DataRecord/interface/CTPPSInterpolatedOpticsRcd.h" #include "CondFormats/PPSObjects/interface/LHCInterpolatedOpticalFunctionsSetCollection.h" @@ -56,12 +51,9 @@ class CTPPSProtonProducer : public edm::stream::EDProducer<> { bool pixelDiscardBXShiftedTracks_; - const std::string lhcInfoPerLSLabel_; - const std::string lhcInfoPerFillLabel_; - const std::string lhcInfoLabel_; - const std::string opticsLabel_; - const std::string ppsAssociationCutsLabel_; - const bool useNewLHCInfo_; + std::string lhcInfoLabel_; + std::string opticsLabel_; + std::string ppsAssociationCutsLabel_; unsigned int verbosity_; @@ -81,12 +73,10 @@ class CTPPSProtonProducer : public edm::stream::EDProducer<> { bool opticsValid_; edm::ESWatcher opticsWatcher_; - const edm::ESGetToken lhcInfoPerLSToken_; - const edm::ESGetToken lhcInfoPerFillToken_; - const edm::ESGetToken lhcInfoToken_; - const edm::ESGetToken opticalFunctionsToken_; - const edm::ESGetToken geometryToken_; - const edm::ESGetToken ppsAssociationCutsToken_; + edm::ESGetToken lhcInfoToken_; + edm::ESGetToken opticalFunctionsToken_; + edm::ESGetToken geometryToken_; + edm::ESGetToken ppsAssociationCutsToken_; }; //---------------------------------------------------------------------------------------------------- @@ -96,12 +86,9 @@ CTPPSProtonProducer::CTPPSProtonProducer(const edm::ParameterSet &iConfig) pixelDiscardBXShiftedTracks_(iConfig.getParameter("pixelDiscardBXShiftedTracks")), - lhcInfoPerLSLabel_(iConfig.getParameter("lhcInfoPerLSLabel")), - lhcInfoPerFillLabel_(iConfig.getParameter("lhcInfoPerFillLabel")), lhcInfoLabel_(iConfig.getParameter("lhcInfoLabel")), opticsLabel_(iConfig.getParameter("opticsLabel")), ppsAssociationCutsLabel_(iConfig.getParameter("ppsAssociationCutsLabel")), - useNewLHCInfo_(iConfig.getParameter("useNewLHCInfo")), verbosity_(iConfig.getUntrackedParameter("verbosity", 0)), doSingleRPReconstruction_(iConfig.getParameter("doSingleRPReconstruction")), doMultiRPReconstruction_(iConfig.getParameter("doMultiRPReconstruction")), @@ -121,8 +108,6 @@ CTPPSProtonProducer::CTPPSProtonProducer(const edm::ParameterSet &iConfig) iConfig.getParameter("multiRPAlgorithm"), verbosity_), opticsValid_(false), - lhcInfoPerLSToken_(esConsumes(edm::ESInputTag("", lhcInfoPerLSLabel_))), - lhcInfoPerFillToken_(esConsumes(edm::ESInputTag("", lhcInfoPerFillLabel_))), lhcInfoToken_(esConsumes(edm::ESInputTag("", lhcInfoLabel_))), opticalFunctionsToken_(esConsumes( edm::ESInputTag("", opticsLabel_))), @@ -147,11 +132,7 @@ void CTPPSProtonProducer::fillDescriptions(edm::ConfigurationDescriptions &descr desc.add("pixelDiscardBXShiftedTracks", false) ->setComment("whether to discard pixel tracks built from BX-shifted planes"); - desc.add("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record"); - desc.add("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record"); desc.add("lhcInfoLabel", "")->setComment("label of the LHCInfo record"); - desc.add("useNewLHCInfo", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo"); - desc.add("opticsLabel", "")->setComment("label of the optics record"); desc.add("ppsAssociationCutsLabel", "")->setComment("label of the association cuts record"); @@ -207,7 +188,7 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe // NB: this avoids loading (possibly non-existing) conditions in workflows without proton data if (!hTracks->empty()) { // get conditions - LHCInfoCombined lhcInfoCombined(iSetup, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_); + edm::ESHandle hLHCInfo = iSetup.getHandle(lhcInfoToken_); edm::ESHandle hOpticalFunctions = iSetup.getHandle(opticalFunctionsToken_); @@ -283,7 +264,7 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe ssLog << std::endl << "* reconstruction from track " << idx << std::endl; singleRPResultsIndexed[idx] = - algorithm_.reconstructFromSingleRP(CTPPSLocalTrackLiteRef(hTracks, idx), lhcInfoCombined.energy, ssLog); + algorithm_.reconstructFromSingleRP(CTPPSLocalTrackLiteRef(hTracks, idx), *hLHCInfo, ssLog); } } @@ -318,18 +299,14 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe bool matching = true; - if (!ac.isSatisfied(ac.qX, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), tr_i.x() - tr_j.x())) + if (!ac.isSatisfied(ac.qX, tr_i.x(), tr_i.y(), hLHCInfo->crossingAngle(), tr_i.x() - tr_j.x())) matching = false; - else if (!ac.isSatisfied(ac.qY, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), tr_i.y() - tr_j.y())) + else if (!ac.isSatisfied(ac.qY, tr_i.x(), tr_i.y(), hLHCInfo->crossingAngle(), tr_i.y() - tr_j.y())) matching = false; - else if (!ac.isSatisfied( - ac.qXi, tr_i.x(), tr_i.y(), lhcInfoCombined.crossingAngle(), pr_i.xi() - pr_j.xi())) + else if (!ac.isSatisfied(ac.qXi, tr_i.x(), tr_i.y(), hLHCInfo->crossingAngle(), pr_i.xi() - pr_j.xi())) matching = false; - else if (!ac.isSatisfied(ac.qThetaY, - tr_i.x(), - tr_i.y(), - lhcInfoCombined.crossingAngle(), - pr_i.thetaY() - pr_j.thetaY())) + else if (!ac.isSatisfied( + ac.qThetaY, tr_i.x(), tr_i.y(), hLHCInfo->crossingAngle(), pr_i.thetaY() - pr_j.thetaY())) matching = false; if (!matching) @@ -447,8 +424,7 @@ void CTPPSProtonProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSe ssLog << std::endl << " time = " << time << " +- " << time_unc << std::endl; // process tracking-RP data - reco::ForwardProton proton = - algorithm_.reconstructFromMultiRP(sel_track_for_kin_reco, lhcInfoCombined.energy, ssLog); + reco::ForwardProton proton = algorithm_.reconstructFromMultiRP(sel_track_for_kin_reco, *hLHCInfo, ssLog); // save combined output proton.setContributingLocalTracks(sel_tracks); diff --git a/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py b/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py index 2a564e400b589..392d72ab12c30 100644 --- a/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py +++ b/RecoPPS/ProtonReconstruction/python/ctppsProtons_cff.py @@ -9,9 +9,7 @@ # import and adjust proton-reconstructions settings from RecoPPS.ProtonReconstruction.ctppsProtons_cfi import * +ctppsProtons.lhcInfoLabel = ctppsLHCInfoLabel ctppsProtons.pixelDiscardBXShiftedTracks = True ctppsProtons.default_time = -999. - -from Configuration.Eras.Modifier_run3_common_cff import run3_common -run3_common.toModify(ctppsProtons, useNewLHCInfo = True) \ No newline at end of file diff --git a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc index 91419b4f38741..ce6917c2398c0 100644 --- a/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc +++ b/RecoPPS/ProtonReconstruction/src/ProtonReconstructionAlgorithm.cc @@ -169,7 +169,7 @@ double ProtonReconstructionAlgorithm::newtonGoalFcn(double xi, //---------------------------------------------------------------------------------------------------- reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const CTPPSLocalTrackLiteRefVector &tracks, - const float energy, + const LHCInfo &lhcInfo, std::ostream &os) const { // make sure optics is available for all tracks for (const auto &it : tracks) { @@ -398,7 +398,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const const FP::Point vertex(0., vtx_y, 0.); const double cos_th_sq = 1. - th_x * th_x - th_y * th_y; const double cos_th = (cos_th_sq > 0.) ? sqrt(cos_th_sq) : 1.; - const double p = energy * (1. - xi); + const double p = lhcInfo.energy() * (1. - xi); const FP::Vector momentum(-p * th_x, // the signs reflect change LHC --> CMS convention +p * th_y, sign_z * p * cos_th); @@ -410,7 +410,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromMultiRP(const //---------------------------------------------------------------------------------------------------- reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromSingleRP(const CTPPSLocalTrackLiteRef &track, - const float energy, + const LHCInfo &lhcInfo, std::ostream &os) const { CTPPSDetId rpId(track->rpId()); @@ -457,7 +457,7 @@ reco::ForwardProton ProtonReconstructionAlgorithm::reconstructFromSingleRP(const const FP::Point vertex(0., 0., 0.); const double cos_th_sq = 1. - th_y * th_y; const double cos_th = (cos_th_sq > 0.) ? sqrt(cos_th_sq) : 1.; - const double p = energy * (1. - xi); + const double p = lhcInfo.energy() * (1. - xi); const FP::Vector momentum(0., p * th_y, sign_z * p * cos_th); FP::CovarianceMatrix cm; diff --git a/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py b/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py index 409420fac930c..7e6afe9b0b041 100644 --- a/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py +++ b/SimTransport/PPSProtonTransport/python/PPSTransportESSources_cfi.py @@ -3,7 +3,7 @@ # beam optics from CondCore.CondDB.CondDB_cfi import * from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import * -from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cff import * +from CalibPPS.ESProducers.ctppsInterpolatedOpticalFunctionsESSource_cfi import * ctppsInterpolatedOpticalFunctionsESSource.lhcInfoLabel = "" """ diff --git a/Validation/CTPPS/plugins/BuildFile.xml b/Validation/CTPPS/plugins/BuildFile.xml index 8139c51f08f59..8d5624bb4f00a 100644 --- a/Validation/CTPPS/plugins/BuildFile.xml +++ b/Validation/CTPPS/plugins/BuildFile.xml @@ -2,7 +2,6 @@ - diff --git a/Validation/CTPPS/plugins/CTPPSLHCInfoPlotter.cc b/Validation/CTPPS/plugins/CTPPSLHCInfoPlotter.cc index 8d80b0246ad0a..2ad499b7c6f36 100644 --- a/Validation/CTPPS/plugins/CTPPSLHCInfoPlotter.cc +++ b/Validation/CTPPS/plugins/CTPPSLHCInfoPlotter.cc @@ -11,7 +11,8 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "CondTools/RunInfo/interface/LHCInfoCombined.h" +#include "CondFormats/RunInfo/interface/LHCInfo.h" +#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" #include "TFile.h" #include "TH1D.h" @@ -29,10 +30,7 @@ class CTPPSLHCInfoPlotter : public edm::one::EDAnalyzer<> { void analyze(const edm::Event &, const edm::EventSetup &) override; void endJob() override; - const edm::ESGetToken lhcInfoToken_; - const edm::ESGetToken lhcInfoPerLSToken_; - const edm::ESGetToken lhcInfoPerFillToken_; - const bool useNewLHCInfo_; + edm::ESGetToken lhcInfoESToken_; std::string outputFile_; @@ -53,10 +51,7 @@ using namespace edm; //---------------------------------------------------------------------------------------------------- CTPPSLHCInfoPlotter::CTPPSLHCInfoPlotter(const edm::ParameterSet &iConfig) - : lhcInfoToken_(esConsumes(ESInputTag("", iConfig.getParameter("lhcInfoLabel")))), - lhcInfoPerLSToken_(esConsumes(ESInputTag("", iConfig.getParameter("lhcInfoPerLSLabel")))), - lhcInfoPerFillToken_(esConsumes(ESInputTag("", iConfig.getParameter("lhcInfoPerFillLabel")))), - useNewLHCInfo_(iConfig.getParameter("useNewLHCInfo")), + : lhcInfoESToken_(esConsumes(ESInputTag("", iConfig.getParameter("lhcInfoLabel")))), outputFile_(iConfig.getParameter("outputFile")), h_beamEnergy_(new TH1D("h_beamEnergy", ";beam energy (GeV)", 81, -50., 8050.)), @@ -80,10 +75,6 @@ void CTPPSLHCInfoPlotter::fillDescriptions(edm::ConfigurationDescriptions &descr edm::ParameterSetDescription desc; desc.add("lhcInfoLabel", "")->setComment("label of the LHCInfo record"); - desc.add("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record"); - desc.add("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record"); - desc.add("useNewLHCInfo", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo"); - desc.add("outputFile", "")->setComment("output file"); descriptions.add("ctppsLHCInfoPlotter", desc); @@ -92,17 +83,14 @@ void CTPPSLHCInfoPlotter::fillDescriptions(edm::ConfigurationDescriptions &descr //---------------------------------------------------------------------------------------------------- void CTPPSLHCInfoPlotter::analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) { - LHCInfoCombined lhcInfoCombined(iSetup, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_); + const auto &lhcInfo = iSetup.getData(lhcInfoESToken_); - h_beamEnergy_->Fill(lhcInfoCombined.energy); - h_xangle_->Fill(lhcInfoCombined.crossingAngle()); - h_betaStar_->Fill(lhcInfoCombined.betaStarX); //adjust accordingly to run period - // h_betaStar_->Fill(lhcInfoCombined.betaStarY); - h2_betaStar_vs_xangle_->Fill(lhcInfoCombined.crossingAngle(), - lhcInfoCombined.betaStarX); //adjust accordingly to run period - // h2_betaStar_vs_xangle_->Fill(lhcInfoCombined.crossingAngle(), lhcInfoCombined.betaStarY); + h_beamEnergy_->Fill(lhcInfo.energy()); + h_xangle_->Fill(lhcInfo.crossingAngle()); + h_betaStar_->Fill(lhcInfo.betaStar()); + h2_betaStar_vs_xangle_->Fill(lhcInfo.crossingAngle(), lhcInfo.betaStar()); - h_fill_->Fill(lhcInfoCombined.fillNumber); + h_fill_->Fill(lhcInfo.fillNumber()); h_run_->Fill(iEvent.id().run()); } diff --git a/Validation/CTPPS/python/base_cff.py b/Validation/CTPPS/python/base_cff.py index c22ac2d38b9de..f9349c05440b9 100644 --- a/Validation/CTPPS/python/base_cff.py +++ b/Validation/CTPPS/python/base_cff.py @@ -52,4 +52,3 @@ def UseXangleBetaStarHistogram(process, f="", obj=""): p.ctppsLHCInfo.xangleBetaStarHistogramFile = f if obj: p.ctppsLHCInfo.xangleBetaStarHistogramObject = obj - diff --git a/Validation/CTPPS/python/ctppsLHCInfoPlotter_cff.py b/Validation/CTPPS/python/ctppsLHCInfoPlotter_cff.py deleted file mode 100644 index 66f0c853de77c..0000000000000 --- a/Validation/CTPPS/python/ctppsLHCInfoPlotter_cff.py +++ /dev/null @@ -1,3 +0,0 @@ -from Validation.CTPPS.ctppsLHCInfoPlotter_cfi import * -from Configuration.Eras.Modifier_run3_common_cff import run3_common -run3_common.toModify(ctppsLHCInfoPlotter, useNewLHCInfo = True) \ No newline at end of file diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index 5587411a833b9..6717d3facd383 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -4,7 +4,7 @@ process = cms.Process('CTPPSTest', $ERA) process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cff') +process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cfi') process.load('Configuration.Generator.randomXiThetaGunProducer_cfi') process.load("CondCore.CondDB.CondDB_cfi") @@ -32,14 +32,8 @@ process.CondDB, toGet = cms.VPSet(cms.PSet( record = cms.string('CTPPSPixelAnalysisMaskRcd'), - tag = cms.string("CTPPSPixelAnalysisMask_Run3_v1_hlt")), - cms.PSet( - record = cms.string('LHCInfoPerLSRcd'), - tag = cms.string("LHCInfoPerLS_endFill_Run3_mc_v1")), - cms.PSet( - record = cms.string('LHCInfoPerFillRcd'), - tag = cms.string("LHCInfoPerFill_endFill_Run3_mc_v1")), - ) + tag = cms.string("CTPPSPixelAnalysisMask_Run3_v1_hlt") + )) ) # random seeds