diff --git a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc b/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc index 6a922283d057a..78d59250fef9c 100644 --- a/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc +++ b/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc @@ -48,7 +48,6 @@ class BeamProfile2DB : public edm::global::EDAnalyzer<> { static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - void beginJob() override; void analyze(edm::StreamID, const edm::Event&, const edm::EventSetup&) const override; void endJob() override; @@ -72,23 +71,13 @@ namespace { } } // namespace -// -// constants, enums and typedefs -// - -// -// static data member definitions -// // // constructors and destructor // BeamProfile2DB::BeamProfile2DB(const edm::ParameterSet& iConfig) : beamSpot_(read(iConfig)) {} -BeamProfile2DB::~BeamProfile2DB() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} +BeamProfile2DB::~BeamProfile2DB() = default; // // member functions @@ -97,9 +86,6 @@ BeamProfile2DB::~BeamProfile2DB() { // ------------ method called for each event ------------ void BeamProfile2DB::analyze(edm::StreamID, const edm::Event& iEvent, const edm::EventSetup& iSetup) const {} -// ------------ method called once each job just before starting event loop ------------ -void BeamProfile2DB::beginJob() {} - // ------------ method called once each job just after ending the event loop ------------ void BeamProfile2DB::endJob() { edm::Service poolDbService; @@ -117,9 +103,9 @@ void BeamProfile2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add("SigmaZ")->setComment("in cm"); desc.add("BetaStar")->setComment("in cm"); desc.add("Emittance")->setComment("in cm"); - desc.add("Alpha")->setComment("in radians"); - desc.add("Phi")->setComment("in radians"); - desc.add("TimeOffset")->setComment("in ns"); + desc.add("Alpha", 0.0)->setComment("in radians"); + desc.add("Phi", 0.0)->setComment("in radians"); + desc.add("TimeOffset", 0.0)->setComment("in ns"); descriptions.addDefault(desc); } diff --git a/IOMC/EventVertexGenerators/test/BeamProfile2DBWriter_cfg.py b/IOMC/EventVertexGenerators/test/BeamProfile2DBWriter_cfg.py new file mode 100644 index 0000000000000..4077b19e9fa27 --- /dev/null +++ b/IOMC/EventVertexGenerators/test/BeamProfile2DBWriter_cfg.py @@ -0,0 +1,53 @@ +import FWCore.ParameterSet.Config as cms +import FWCore.ParameterSet.VarParsing as VarParsing + +process = cms.Process("writeBeamProfile2DB") + +options = VarParsing.VarParsing() +options.register('unitTest', + False, # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.bool, # string, int, or float + "are we running the unit test?") +options.register('inputTag', + "myTagName", # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output tag name") +options.parseArguments() + + +process.load("FWCore.MessageLogger.MessageLogger_cfi") +from CondCore.CondDB.CondDB_cfi import * + +if options.unitTest : + tag_name = 'simBS_tag' +else: + tag_name = options.inputTag + +################################# +# Produce a SQLITE FILE +################################# +CondDBSimBeamSpotObjects = CondDB.clone(connect = cms.string('sqlite_file:test_%s.db' % tag_name)) # choose an output name +process.PoolDBOutputService = cms.Service("PoolDBOutputService", + CondDBSimBeamSpotObjects, + timetype = cms.untracked.string('runnumber'), + toPut = cms.VPSet(cms.PSet(record = cms.string("SimBeamSpotObjectsRcd"), # SimBeamSpot record + tag = cms.string(tag_name))), # choose your favourite tag + loadBlobStreamer = cms.untracked.bool(False) + ) + +process.source = cms.Source("EmptySource") + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1)) + +process.simbeamspotwriter = cms.EDAnalyzer("BeamProfile2DB", + X0 = cms.double(0.0458532), # in cm + Y0 = cms.double(-0.016966), # in cm + Z0 = cms.double(-0.074992), # in cm + SigmaZ = cms.double(3.6), # in cm + BetaStar = cms.double(30.0), # in cm + Emittance = cms.double(3.931e-8) # in cm + ) + +process.p = cms.Path(process.simbeamspotwriter)