File indexing completed on 2023-03-17 10:48:36
0001
0002
0003
0004
0005
0006 #include "FWCore/Framework/interface/MakerMacros.h"
0007 #include "FWCore/Utilities/interface/Exception.h"
0008 #include "FWCore/Framework/interface/stream/EDFilter.h"
0009 #include "FWCore/Framework/interface/Event.h"
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "CondFormats/RunInfo/interface/LHCInfo.h"
0013 #include "CondFormats/DataRecord/interface/LHCInfoRcd.h"
0014
0015
0016
0017 class XangleBetaStarFilter : public edm::stream::EDFilter<> {
0018 public:
0019 explicit XangleBetaStarFilter(const edm::ParameterSet &);
0020
0021 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0022
0023 private:
0024 edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcInfoToken_;
0025
0026 double xangle_min_;
0027 double xangle_max_;
0028
0029 double beta_star_min_;
0030 double beta_star_max_;
0031
0032 bool filter(edm::Event &, const edm::EventSetup &) override;
0033 };
0034
0035
0036
0037 XangleBetaStarFilter::XangleBetaStarFilter(const edm::ParameterSet &iConfig)
0038 : lhcInfoToken_(
0039 esConsumes<LHCInfo, LHCInfoRcd>(edm::ESInputTag{"", iConfig.getParameter<std::string>("lhcInfoLabel")})),
0040
0041 xangle_min_(iConfig.getParameter<double>("xangle_min")),
0042 xangle_max_(iConfig.getParameter<double>("xangle_max")),
0043 beta_star_min_(iConfig.getParameter<double>("beta_star_min")),
0044 beta_star_max_(iConfig.getParameter<double>("beta_star_max")) {}
0045
0046
0047
0048 void XangleBetaStarFilter::fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0049 edm::ParameterSetDescription desc;
0050
0051 desc.add<std::string>("lhcInfoLabel", "")->setComment("label of the LHCInfo record");
0052
0053 desc.add<double>("xangle_min", 0.);
0054 desc.add<double>("xangle_max", 1000.);
0055
0056 desc.add<double>("beta_star_min", 0.);
0057 desc.add<double>("beta_star_max", 1000.);
0058
0059 descriptions.add("xangleBetaStarFilter", desc);
0060 }
0061
0062
0063
0064 bool XangleBetaStarFilter::filter(edm::Event & , const edm::EventSetup &iSetup) {
0065 const auto &lhcInfo = iSetup.getData(lhcInfoToken_);
0066
0067 return (xangle_min_ <= lhcInfo.crossingAngle() && lhcInfo.crossingAngle() < xangle_max_) &&
0068 (beta_star_min_ <= lhcInfo.betaStar() && lhcInfo.betaStar() < beta_star_max_);
0069 }
0070
0071
0072
0073 DEFINE_FWK_MODULE(XangleBetaStarFilter);