Skip to content

Commit

Permalink
make HLTPPSJetComparisonFilter use LHCInfoCombiend
Browse files Browse the repository at this point in the history
  • Loading branch information
Glitchmin committed Feb 13, 2024
1 parent 6e8031b commit ede3e41
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions HLTrigger/special/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<use name="CondFormats/DataRecord"/>
<use name="CondFormats/EcalObjects"/>
<use name="CondFormats/RunInfo"/>
<use name="CondTools/RunInfo"/>
<use name="DataFormats/CSCDigi"/>
<use name="DataFormats/CSCRecHit"/>
<use name="DataFormats/CTPPSDetId"/>
Expand Down
29 changes: 17 additions & 12 deletions HLTrigger/special/plugins/HLTPPSJetComparisonFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ Matching can be done on the xi and/or mass+rapidity variables, using the do_xi a
#include "DataFormats/JetReco/interface/PFJetCollection.h"
#include "DataFormats/ProtonReco/interface/ForwardProton.h"

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

#include "FWCore/Framework/interface/MakerMacros.h"

Expand All @@ -37,7 +36,10 @@ class HLTPPSJetComparisonFilter : public edm::global::EDFilter<> {

private:
// ----------member data ---------------------------
edm::ESGetToken<LHCInfo, LHCInfoRcd> const lhcInfoRcdToken_;
const edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcInfoToken_;
const edm::ESGetToken<LHCInfoPerLS, LHCInfoPerLSRcd> lhcInfoPerLSToken_;
const edm::ESGetToken<LHCInfoPerFill, LHCInfoPerFillRcd> lhcInfoPerFillToken_;
const bool useNewLHCInfo_;

edm::ParameterSet param_;

Expand All @@ -47,8 +49,6 @@ class HLTPPSJetComparisonFilter : public edm::global::EDFilter<> {
edm::InputTag forwardProtonInputTag_; // Input tag identifying the forward proton collection
edm::EDGetTokenT<std::vector<reco::ForwardProton>> recoProtonSingleRPToken_;

std::string lhcInfoLabel_;

double maxDiffxi_;
double maxDiffm_;
double maxDiffy_;
Expand All @@ -69,7 +69,10 @@ void HLTPPSJetComparisonFilter::fillDescriptions(edm::ConfigurationDescriptions
desc.add<edm::InputTag>("forwardProtonInputTag", edm::InputTag("ctppsProtons", "singleRP"))
->setComment("input tag of the forward proton collection");

desc.add<std::string>("lhcInfoLabel", std::string(""))->setComment("label used for LHCInfo");
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", false)->setComment("flag whether to use new LHCInfoPer* records or old LHCInfo");

desc.add<double>("maxDiffxi", 1.)
->setComment("maximum relative deviation of RP xi from dijet xi. Used with do_xi option");
Expand All @@ -83,7 +86,7 @@ void HLTPPSJetComparisonFilter::fillDescriptions(edm::ConfigurationDescriptions
desc.add<bool>("do_xi", true)->setComment("flag to require xi matching");
desc.add<bool>("do_my", false)->setComment("flag to require m,y matching");

descriptions.addWithDefaultLabel(desc);
descriptions.add("hltppsJetComparisonFilterDefault", desc);
return;
}

Expand All @@ -92,15 +95,17 @@ void HLTPPSJetComparisonFilter::fillDescriptions(edm::ConfigurationDescriptions
HLTPPSJetComparisonFilter::~HLTPPSJetComparisonFilter() = default;

HLTPPSJetComparisonFilter::HLTPPSJetComparisonFilter(const edm::ParameterSet &iConfig)
: lhcInfoRcdToken_(esConsumes()),
: lhcInfoToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoLabel")))),
lhcInfoPerLSToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerLSLabel")))),
lhcInfoPerFillToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("lhcInfoPerFillLabel")))),
useNewLHCInfo_(iConfig.getParameter<bool>("useNewLHCInfo")),

jetInputTag_(iConfig.getParameter<edm::InputTag>("jetInputTag")),
jet_token_(consumes<reco::PFJetCollection>(jetInputTag_)),

forwardProtonInputTag_(iConfig.getParameter<edm::InputTag>("forwardProtonInputTag")),
recoProtonSingleRPToken_(consumes<std::vector<reco::ForwardProton>>(forwardProtonInputTag_)),

lhcInfoLabel_(iConfig.getParameter<std::string>("lhcInfoLabel")),

maxDiffxi_(iConfig.getParameter<double>("maxDiffxi")),
maxDiffm_(iConfig.getParameter<double>("maxDiffm")),
maxDiffy_(iConfig.getParameter<double>("maxDiffy")),
Expand All @@ -113,8 +118,8 @@ HLTPPSJetComparisonFilter::HLTPPSJetComparisonFilter(const edm::ParameterSet &iC
// member functions
//
bool HLTPPSJetComparisonFilter::filter(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const {
auto const &hLHCInfo = iSetup.getHandle(lhcInfoRcdToken_);
float sqs = 2. * hLHCInfo->energy(); // get sqrt(s)
LHCInfoCombined lhcInfoCombined(iSetup, lhcInfoPerLSToken_, lhcInfoPerFillToken_, lhcInfoToken_, useNewLHCInfo_);
float sqs = 2. * lhcInfoCombined.energy; // get sqrt(s)

edm::Handle<reco::PFJetCollection> jets;
iEvent.getByToken(jet_token_, jets); // get jet collection
Expand Down
8 changes: 8 additions & 0 deletions HLTrigger/special/python/hltppsJetComparisonFilter_cfi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from HLTrigger.special.hltppsJetComparisonFilterDefault_cfi import HLTPPSJetComparisonFilterDefault as _HLTPPSJetComparisonFilterDefault
HLTPPSJetComparisonFilter = _HLTPPSJetComparisonFilterDefault.clone()

from Configuration.Eras.Modifier_run3_common_cff import run3_common
run3_common.toModify(HLTPPSJetComparisonFilter, useNewLHCInfo = True)

from Configuration.Eras.Modifier_ctpps_directSim_cff import ctpps_directSim
ctpps_directSim.toModify(HLTPPSJetComparisonFilter, useNewLHCInfo = False)

0 comments on commit ede3e41

Please sign in to comment.