Skip to content

Commit

Permalink
add fillDesc in BetafuncEvtVtxGenerator and GaussEvtVtxGenerator and …
Browse files Browse the repository at this point in the history
…use them
  • Loading branch information
francescobrivio committed Nov 10, 2023
1 parent f88656d commit 1a98ef1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ ________________________________________________________________________

#include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
Expand All @@ -37,6 +38,8 @@ class BetafuncEvtVtxGenerator : public BaseEvtVtxGenerator {
BetafuncEvtVtxGenerator& operator=(const BetafuncEvtVtxGenerator& rhs) = delete;
~BetafuncEvtVtxGenerator() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

/// return a new event vertex
Expand Down
3 changes: 3 additions & 0 deletions IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h"
#include "FWCore/Framework/interface/ESWatcher.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h"
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
Expand All @@ -26,6 +27,8 @@ class GaussEvtVtxGenerator : public BaseEvtVtxGenerator {
GaussEvtVtxGenerator& operator=(const GaussEvtVtxGenerator& rhs) = delete;
~GaussEvtVtxGenerator() override = default;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;

/// return a new event vertex
Expand Down
13 changes: 5 additions & 8 deletions IOMC/EventVertexGenerators/python/VtxSmearedDesign_cfi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import FWCore.ParameterSet.Config as cms

# Load GaussEvtVtx Generator and read parameters from GT (SimBeamSpotObjectRcd)
from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import VtxSmearedCommon
VtxSmeared = cms.EDProducer("GaussEvtVtxGenerator",
VtxSmearedCommon
# Load GaussEvtVtxGenerator and read parameters from GT (SimBeamSpotObjectRcd)
from IOMC.EventVertexGenerators.GaussEvtVtxGenerator_cfi import GaussEvtVtxGenerator
VtxSmeared = GaussEvtVtxGenerator.clone(
src = "generator:unsmeared",
readDB = True
)
VtxSmeared.readDB = True



13 changes: 5 additions & 8 deletions IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import FWCore.ParameterSet.Config as cms

# Load BetafuncEvtVtx Generator and read parameters from GT (SimBeamSpotObjectRcd)
from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import VtxSmearedCommon
VtxSmeared = cms.EDProducer("BetafuncEvtVtxGenerator",
VtxSmearedCommon
# Load BetafuncEvtVtxGenerator and read parameters from GT (SimBeamSpotObjectRcd)
from IOMC.EventVertexGenerators.BetafuncEvtVtxGenerator_cfi import BetafuncEvtVtxGenerator
VtxSmeared = BetafuncEvtVtxGenerator.clone(
src = "generator:unsmeared",
readDB = True
)
VtxSmeared.readDB = True



17 changes: 14 additions & 3 deletions IOMC/EventVertexGenerators/src/BetafuncEvtVtxGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ ________________________________________________________________________
#include "CLHEP/Random/RandGaussQ.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include "CLHEP/Units/GlobalPhysicalConstants.h"
//#include "CLHEP/Vector/ThreeVector.h"
#include "HepMC/SimpleVector.h"

#include <iostream>

BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator(const edm::ParameterSet& p) : BaseEvtVtxGenerator(p), boost_(4, 4) {
readDB_ = p.getParameter<bool>("readDB");
if (!readDB_) {
Expand Down Expand Up @@ -140,3 +137,17 @@ void BetafuncEvtVtxGenerator::sigmaZ(double s) {
}

TMatrixD const* BetafuncEvtVtxGenerator::GetInvLorentzBoost() const { return &boost_; }

void BetafuncEvtVtxGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<double>("X0Incm", 0.0);
desc.add<double>("Y0Incm", 0.0);
desc.add<double>("Z0Incm", 0.0);
desc.add<double>("SigmaZIncm", 0.0);
desc.add<double>("BetaStarIncm", 0.0);
desc.add<double>("EmittanceIncm", 0.0);
desc.add<double>("TimeOffsetInns", 0.0);
desc.add<edm::InputTag>("src");
desc.add<bool>("readDB");
descriptions.add("BetafuncEvtVtxGenerator", desc);
}
20 changes: 15 additions & 5 deletions IOMC/EventVertexGenerators/src/GaussEvtVtxGenerator.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@


#include "IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h"
#include "FWCore/Utilities/interface/Exception.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"

#include "CLHEP/Random/RandGaussQ.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include "CLHEP/Units/GlobalPhysicalConstants.h"
//#include "CLHEP/Vector/ThreeVector.h"
#include "HepMC/SimpleVector.h"

GaussEvtVtxGenerator::GaussEvtVtxGenerator(const edm::ParameterSet& p) : BaseEvtVtxGenerator(p) {
Expand Down Expand Up @@ -95,3 +91,17 @@ void GaussEvtVtxGenerator::sigmaZ(double s) {
<< "Illegal resolution in Z (negative)";
}
}

void GaussEvtVtxGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<double>("MeanXIncm", 0.0);
desc.add<double>("MeanYIncm", 0.0);
desc.add<double>("MeanZIncm", 0.0);
desc.add<double>("SigmaXIncm", 0.0);
desc.add<double>("SigmaYIncm", 0.0);
desc.add<double>("SigmaZIncm", 0.0);
desc.add<double>("TimeOffsetInns", 0.0);
desc.add<edm::InputTag>("src");
desc.add<bool>("readDB");
descriptions.add("GaussEvtVtxGenerator", desc);
}

0 comments on commit 1a98ef1

Please sign in to comment.