-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31159 from CTPPS/xangle_beta_filter
Adding xangle and beta* filter
- Loading branch information
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/**************************************************************************** | ||
* Authors: | ||
* Jan Kašpar | ||
****************************************************************************/ | ||
|
||
#include "FWCore/Framework/interface/ESHandle.h" | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "FWCore/Framework/interface/EDFilter.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
|
||
#include "CondFormats/RunInfo/interface/LHCInfo.h" | ||
#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" | ||
|
||
//---------------------------------------------------------------------------------------------------- | ||
|
||
class XangleBetaStarFilter : public edm::EDFilter { | ||
public: | ||
explicit XangleBetaStarFilter(const edm::ParameterSet &); | ||
|
||
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); | ||
|
||
private: | ||
edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcInfoToken_; | ||
|
||
double xangle_min_; | ||
double xangle_max_; | ||
|
||
double beta_star_min_; | ||
double beta_star_max_; | ||
|
||
bool filter(edm::Event &, const edm::EventSetup &) override; | ||
}; | ||
|
||
//---------------------------------------------------------------------------------------------------- | ||
|
||
XangleBetaStarFilter::XangleBetaStarFilter(const edm::ParameterSet &iConfig) | ||
: lhcInfoToken_( | ||
esConsumes<LHCInfo, LHCInfoRcd>(edm::ESInputTag{"", iConfig.getParameter<std::string>("lhcInfoLabel")})), | ||
|
||
xangle_min_(iConfig.getParameter<double>("xangle_min")), | ||
xangle_max_(iConfig.getParameter<double>("xangle_max")), | ||
beta_star_min_(iConfig.getParameter<double>("beta_star_min")), | ||
beta_star_max_(iConfig.getParameter<double>("beta_star_max")) {} | ||
|
||
//---------------------------------------------------------------------------------------------------- | ||
|
||
void XangleBetaStarFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { | ||
edm::ParameterSetDescription desc; | ||
|
||
desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record"); | ||
|
||
desc.add<double>("xangle_min", 0.); | ||
desc.add<double>("xangle_max", 1000.); | ||
|
||
desc.add<double>("beta_star_min", 0.); | ||
desc.add<double>("beta_star_max", 1000.); | ||
|
||
descriptions.add("xangleBetaStarFilter", desc); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------------- | ||
|
||
bool XangleBetaStarFilter::filter(edm::Event & /*iEvent*/, const edm::EventSetup &iSetup) { | ||
const auto &lhcInfo = iSetup.getData(lhcInfoToken_); | ||
|
||
return (xangle_min_ <= lhcInfo.crossingAngle() && lhcInfo.crossingAngle() < xangle_max_) && | ||
(beta_star_min_ <= lhcInfo.betaStar() && lhcInfo.betaStar() < beta_star_max_); | ||
} | ||
|
||
//---------------------------------------------------------------------------------------------------- | ||
|
||
DEFINE_FWK_MODULE(XangleBetaStarFilter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("TEST") | ||
|
||
# define global tag | ||
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') | ||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, '106X_dataRun2_v28', '') | ||
|
||
# minimum of logs | ||
process.MessageLogger = cms.Service("MessageLogger", | ||
statistics = cms.untracked.vstring(), | ||
destinations = cms.untracked.vstring('cout'), | ||
cout = cms.untracked.PSet( | ||
threshold = cms.untracked.string('WARNING') | ||
) | ||
) | ||
|
||
# data source | ||
process.source = cms.Source("PoolSource", | ||
fileNames = cms.untracked.vstring("/store/data/Run2018D/EGamma/MINIAOD/12Nov2019_UL2018-v4/280000/FF9D0498-30CA-7241-A85C-6F4F272A7A16.root") | ||
) | ||
|
||
#process.maxEvents = cms.untracked.PSet( | ||
# input = cms.untracked.int32(1000) | ||
#) | ||
|
||
# filter | ||
process.load("CondTools.RunInfo.xangleBetaStarFilter_cfi") | ||
process.xangleBetaStarFilter.xangle_min = 150 | ||
process.xangleBetaStarFilter.xangle_max = 170 | ||
|
||
# plotters | ||
process.plotterBefore = cms.EDAnalyzer("CTPPSLHCInfoPlotter", | ||
lhcInfoLabel = cms.string(""), | ||
outputFile = cms.string("output_before_filter.root") | ||
) | ||
|
||
process.plotterAfter = cms.EDAnalyzer("CTPPSLHCInfoPlotter", | ||
lhcInfoLabel = cms.string(""), | ||
outputFile = cms.string("output_after_filter.root") | ||
) | ||
|
||
# path | ||
process.p = cms.Path( | ||
process.plotterBefore | ||
* process.xangleBetaStarFilter | ||
* process.plotterAfter | ||
) |