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

Fix BeamSpotAnalyzer::fillDescriptions #37085

Merged
merged 3 commits into from
Mar 1, 2022
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
18 changes: 10 additions & 8 deletions RecoVertex/BeamSpotProducer/plugins/BeamSpotAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ________________________________________________________________**/

// C++ standard
#include <string>
#include <string>

// CMS
#include "DataFormats/BeamSpot/interface/BeamSpot.h"
Expand Down Expand Up @@ -216,13 +215,16 @@ void BeamSpotAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descript
desc.setComment("Analyzer of BeamSpot Objects");

edm::ParameterSetDescription bsAnalyzerParamsDesc;
std::vector<edm::ParameterSet> bsAnaDefaults(1);
bsAnaDefaults[0].addParameter("WriteToDB", false);
bsAnaDefaults[0].addParameter("RunAllFitters", false);
bsAnaDefaults[0].addUntrackedParameter("fitEveryNLumi", -1);
bsAnaDefaults[0].addUntrackedParameter("resetEveryNLumi", -1);
bsAnaDefaults[0].addParameter("RunBeamWidthFit", false);
desc.addVPSet("BSAnalyzerParameters", bsAnalyzerParamsDesc, bsAnaDefaults);
bsAnalyzerParamsDesc.add("WriteToDB", false);
bsAnalyzerParamsDesc.add("RunAllFitters", false);
bsAnalyzerParamsDesc.addUntracked("fitEveryNLumi", -1);
bsAnalyzerParamsDesc.addUntracked("resetEveryNLumi", -1);
bsAnalyzerParamsDesc.add("RunBeamWidthFit", false);
desc.add<edm::ParameterSetDescription>("BSAnalyzerParameters", bsAnalyzerParamsDesc);

BeamFitter::fillDescription(desc);
PVFitter::fillDescription(desc);

descriptions.addWithDefaultLabel(desc);
}

Expand Down
5 changes: 5 additions & 0 deletions RecoVertex/BeamSpotProducer/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@
<flags TEST_RUNNER_ARGS="/bin/bash RecoVertex/BeamSpotProducer/test testReadWriteBSFromDB.sh"/>
</bin>
</environment>

<bin file="testBeamSpotAnalyzer.cc">
<use name="FWCore/TestProcessor"/>
<use name="catch2"/>
</bin>
22 changes: 22 additions & 0 deletions RecoVertex/BeamSpotProducer/test/testBeamSpotAnalyzer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "FWCore/TestProcessor/interface/TestProcessor.h"

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE("BeamSpotAnalyzer tests", "[BeamSpotAnalyzer]") {
//The python configuration
edm::test::TestProcessor::Config config{
R"_(from FWCore.TestProcessor.TestProcess import *
from RecoVertex.BeamSpotProducer.d0_phi_analyzer_cff import d0_phi_analyzer
process = TestProcess()
process.beamAnalyzer = d0_phi_analyzer
process.moduleToTest(process.beamAnalyzer)
)_"};

SECTION("Run with no Lumis") {
edm::test::TestProcessor tester{config};
tester.testRunWithNoLuminosityBlocks();
//get here without an exception or crashing
REQUIRE(true);
};
}