Skip to content

Commit

Permalink
Merge pull request cms-sw#23 from jkiesele/from-CMSSW_12_0_0
Browse files Browse the repository at this point in the history
small changes in merging, added option to FlatEtaRangeGunProducer
  • Loading branch information
jkiesele authored Jan 19, 2022
2 parents e840d8f + 3619c0a commit ffc9012
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 4 additions & 4 deletions DPGAnalysis/HGCalNanoAOD/python/simClusters_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
)

hgcSimTruth = cms.EDProducer("simmerger",
useNLayers = cms.int32(1),
searchRadiusScale = cms.double(2.),
useNLayers = cms.int32(3),
searchRadiusScale = cms.double(2.0),
clusterRadiusScale = cms.double(1.5),
mergeRadiusScale = cms.double(1.5),
energyContainment = cms.double(0.5),
mergeRadiusScale = cms.double(1.0),
energyContainment = cms.double(0.7),
relOverlapDistance = cms.double(0.9)
)

Expand Down
2 changes: 2 additions & 0 deletions IOMC/ParticleGuns/interface/FlatEtaRangeGunProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace edm {

double minDr_;

double bsZSmear_;

// debug flag
bool debug_;

Expand Down
11 changes: 10 additions & 1 deletion IOMC/ParticleGuns/src/FlatEtaRangeGunProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "DataFormats/Math/interface/deltaR.h"

#include "CLHEP/Random/RandFlat.h"
#include "CLHEP/Random/RandGauss.h"
#include "CLHEP/Units/GlobalPhysicalConstants.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"

Expand All @@ -37,6 +38,8 @@ void edm::FlatEtaRangeGunProducer::fillDescriptions(edm::ConfigurationDescriptio
desc.add<double>("phiMin", 0.);
desc.add<double>("phiMax", 2 * pi);
desc.add<double>("minDr", -1.);
desc.add<double>("bsZSmear", -1.);

desc.addUntracked<bool>("debug", false);

descriptions.add("FlatEtaRangeGunProducer", desc);
Expand All @@ -54,6 +57,7 @@ edm::FlatEtaRangeGunProducer::FlatEtaRangeGunProducer(const edm::ParameterSet& p
phiMin_(params.getParameter<double>("phiMin")),
phiMax_(params.getParameter<double>("phiMax")),
minDr_(params.getParameter<double>("minDr")),
bsZSmear_(params.getParameter<double>("bsZSmear")),
debug_(params.getUntrackedParameter<bool>("debug")) {
produces<edm::HepMCProduct>("unsmeared");
produces<GenEventInfoProduct>();
Expand Down Expand Up @@ -131,7 +135,12 @@ void edm::FlatEtaRangeGunProducer::produce(edm::Event& event, const edm::EventSe

previousp4.push_back(pVec);

HepMC::GenVertex* vtx = new HepMC::GenVertex(HepMC::FourVector(0, 0, 0, 0));
double vz = 0;
if(bsZSmear_>0){
vz = CLHEP::RandGauss::shoot(engine, 0., bsZSmear_);
}

HepMC::GenVertex* vtx = new HepMC::GenVertex(HepMC::FourVector(0, 0, vz*cm, 0));

// create the GenParticle
HepMC::FourVector fVec(pVec.x(), pVec.y(), pVec.z(), e);
Expand Down

0 comments on commit ffc9012

Please sign in to comment.