Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14_0_X] Update LHCInfoProducer to use LHCInfoCombined #43993

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h"
// Condition Format
#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h"
// LHCinfo
//#include "CondFormats/RunInfo/interface/LHCInfo.h"
//#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"

// CondOutput
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
Expand Down
7 changes: 0 additions & 7 deletions DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
#include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h"
#include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h"

// #include "CondFormats/RunInfo/interface/LHCInfo.h"
// #include "CondFormats/DataRecord/interface/LHCInfoRcd.h"

#include <string>

//----------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -220,7 +217,6 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<

edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> ctppsGeometryRunToken_;
edm::ESGetToken<CTPPSGeometry, VeryForwardRealGeometryRecord> ctppsGeometryEventToken_;
// edm::ESGetToken<LHCInfo, LHCInfoRcd> ctppsLhcInfoToken_;

bool excludeMultipleHits_;
const bool extract_digi_info_;
Expand Down Expand Up @@ -594,7 +590,6 @@ CTPPSDiamondDQMSource::CTPPSDiamondDQMSource(const edm::ParameterSet& ps)
ps.getUntrackedParameter<edm::InputTag>("tagDiamondLocalTracks"))),
ctppsGeometryRunToken_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord, edm::Transition::BeginRun>()),
ctppsGeometryEventToken_(esConsumes<CTPPSGeometry, VeryForwardRealGeometryRecord>()),
// ctppsLhcInfoToken_(esConsumes<LHCInfo, LHCInfoRcd>()),
excludeMultipleHits_(ps.getParameter<bool>("excludeMultipleHits")),
extract_digi_info_(ps.getParameter<bool>("extractDigiInfo")),
centralOOT_(-999),
Expand Down Expand Up @@ -725,7 +720,6 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet
event.getByToken(tokenDiamondTrack_, diamondLocalTracks);

const CTPPSGeometry* ctppsGeometry = &iSetup.getData(ctppsGeometryEventToken_);
// const LHCInfo* hLhcInfo = &iSetup.getData(ctppsLhcInfoToken_);

// check validity
bool valid = true;
Expand Down Expand Up @@ -990,7 +984,6 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet
if (plotOffline_ && !perLSsaving_) {
// potPlots_[detId_pot].trackTimeVsLS->Fill(event.luminosityBlock(),track.time());
potPlots_[detId_pot].trackTimeVsBX->Fill(event.bunchCrossing(), track.time());
//potPlots_[detId_pot].trackTimeVsXAngle->Fill(hLhcInfo->crossingAngle(), track.time());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/NanoAOD/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<use name="CondFormats/BTauObjects"/>
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/L1TObjects"/>
<use name="CondFormats/RunInfo"/>
<use name="CondTools/BTau"/>
<use name="CondTools/RunInfo"/>
<use name="DQMServices/Core"/>
<use name="DataFormats/CTPPSDetId"/>
<use name="DataFormats/CTPPSReco"/>
Expand Down
28 changes: 21 additions & 7 deletions PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@

#include "FWCore/Utilities/interface/transform.h"

#include "CondFormats/RunInfo/interface/LHCInfo.h"
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
#include "CondTools/RunInfo/interface/LHCInfoCombined.h"

class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlockProducer> {
public:
LHCInfoProducer(edm::ParameterSet const&) : lhcinfoToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()) {
LHCInfoProducer(edm::ParameterSet const& iConfig)
: lhcinfoToken_(esConsumes<edm::Transition::BeginLuminosityBlock>(
edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoLabel")))),
lhcinfoPerLSToken_(esConsumes<edm::Transition::BeginLuminosityBlock>(
edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerLSLabel")))),
lhcinfoPerFillToken_(esConsumes<edm::Transition::BeginLuminosityBlock>(
edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerFillLabel")))),
useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")) {
produces<nanoaod::MergeableCounterTable, edm::Transition::BeginLuminosityBlock>();
}
~LHCInfoProducer() override {}
Expand All @@ -59,20 +65,28 @@ class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlock
void produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const override {}

void globalBeginLuminosityBlockProduce(edm::LuminosityBlock& iLumi, edm::EventSetup const& iSetup) const override {
const auto& info = iSetup.getData(lhcinfoToken_);
LHCInfoCombined lhcInfoCombined(iSetup, lhcinfoPerLSToken_, lhcinfoPerFillToken_, lhcinfoToken_, useNewLHCInfo_);
auto out = std::make_unique<nanoaod::MergeableCounterTable>();
out->addFloat("crossingAngle", "LHC crossing angle", info.crossingAngle());
out->addFloat("betaStar", "LHC beta star", info.betaStar());
out->addFloat("energy", "LHC beam energy", info.energy());
out->addFloat("crossingAngle", "LHC crossing angle", lhcInfoCombined.crossingAngle());
out->addFloat("betaStar", "LHC beta star", lhcInfoCombined.betaStarX);
out->addFloat("energy", "LHC beam energy", lhcInfoCombined.energy);
iLumi.put(std::move(out));
}

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<std::string>("lhcInfoLabel", "")->setComment("label used for LHCInfo");
desc.add<std::string>("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record");
desc.add<std::string>("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record");
desc.add<bool>("useNewLHCInfo", true)
->setComment("flag whether to use new LHCInfoPerLS/Fill records or old LHCInfo");
descriptions.addWithDefaultLabel(desc);
}
edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcinfoToken_;
edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> lhcinfoPerLSToken_;
edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd> lhcinfoPerFillToken_;
bool useNewLHCInfo_;
};

DEFINE_FWK_MODULE(LHCInfoProducer);
6 changes: 5 additions & 1 deletion PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
linkedObjects, boostedTaus=None,
)

lhcInfoTable = cms.EDProducer("LHCInfoProducer")
from PhysicsTools.NanoAOD.lhcInfoProducer_cfi import lhcInfoProducer
lhcInfoTable = lhcInfoProducer.clone()
(~run3_common).toModify(
lhcInfoTable, useNewLHCInfo=False
)

nanoTableTaskCommon = cms.Task(
cms.Task(nanoMetadata),
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/python/nano_eras_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from Configuration.Eras.Modifier_run2_nanoAOD_106Xv2_cff import run2_nanoAOD_106Xv2
from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016

from Configuration.Eras.Modifier_run3_common_cff import run3_common
from Configuration.Eras.Modifier_run3_nanoAOD_122_cff import run3_nanoAOD_122
from Configuration.Eras.Modifier_run3_nanoAOD_124_cff import run3_nanoAOD_124
from Configuration.Eras.Modifier_run3_jme_Winter22runsBCDEprompt_cff import run3_jme_Winter22runsBCDEprompt
Expand Down