Skip to content

Commit

Permalink
update sigmaX and sigmaY to use LPC-like calculation in BetaFunc case
Browse files Browse the repository at this point in the history
  • Loading branch information
francescobrivio committed Nov 1, 2023
1 parent b9a4b4c commit c7f6425
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
8 changes: 4 additions & 4 deletions CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class SimBeamSpotObjects {
fMeanX = 0.0;
fMeanY = 0.0;
fMeanZ = 0.0;
fSigmaX = 0.0;
fSigmaY = 0.0;
fSigmaX = -1.0;
fSigmaY = -1.0;
fSigmaZ = 0.0;
fbetastar = 0.0;
femittance = 0.0;
Expand Down Expand Up @@ -76,8 +76,8 @@ class SimBeamSpotObjects {
double meanY() const { return fMeanY; }
double meanZ() const { return fMeanZ; }
/// get sigmaX, sigmaY, sigmaZ
double sigmaX() const { return fSigmaX; }
double sigmaY() const { return fSigmaY; }
double sigmaX() const;
double sigmaY() const;
double sigmaZ() const { return fSigmaZ; }
/// get BetaStar and Emittance
double betaStar() const { return fbetastar; }
Expand Down
19 changes: 19 additions & 0 deletions CondFormats/BeamSpotObjects/src/SimBeamSpotObjects.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
#include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"

#include <cmath>
#include <iostream>

// Get SigmaX and SigmaY:
// - directly fSigmaX if >= 0 (in case of Gaussian Smearing)
// - else from LPC-like calculation (in case of BetaFunc Smearing)
double SimBeamSpotObjects::sigmaX() const {
if (fSigmaX >= 0.) // Gaussian smearing
return fSigmaX;
else // BetaFunc smearing
return (1 / std::sqrt(2)) * std::sqrt(femittance * fbetastar);
}

double SimBeamSpotObjects::sigmaY() const {
if (fSigmaY >= 0.) // Gaussian smearing
return fSigmaY;
else // BetaFunc smearing
return (1 / std::sqrt(2)) * std::sqrt(femittance * fbetastar);
}

// Printout SimBeamSpotObjects
void SimBeamSpotObjects::print(std::stringstream& ss) const {
ss << "-----------------------------------------------------\n"
<< " Sim Beam Spot Data\n\n"
Expand Down
4 changes: 2 additions & 2 deletions CondTools/BeamSpot/plugins/BeamProfile2DBWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ void BeamProfile2DBWriter::fillDescriptions(edm::ConfigurationDescriptions& desc
desc.add<double>("MeanX", 0.0)->setComment("in cm");
desc.add<double>("MeanY", 0.0)->setComment("in cm");
desc.add<double>("MeanZ", 0.0)->setComment("in cm");
desc.add<double>("SigmaX", 0.0)->setComment("in cm");
desc.add<double>("SigmaY", 0.0)->setComment("in cm");
desc.add<double>("SigmaX", -1.0)->setComment("in cm");
desc.add<double>("SigmaY", -1.0)->setComment("in cm");
desc.add<double>("SigmaZ", 0.0)->setComment("in cm");
desc.add<double>("BetaStar", 0.0)->setComment("in cm");
desc.add<double>("Emittance", 0.0)->setComment("in cm");
Expand Down
11 changes: 11 additions & 0 deletions CondTools/BeamSpot/test/BeamProfile2DBWriter_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,22 @@
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

from CondTools.BeamSpot.beamProfile2DBWriter_cfi import beamProfile2DBWriter
# For the BetaFunc smearing (realistic Beamspot) set the following parameters:
# - X0, Y0, Z0, SigmaZ, BetaStar, Emittance
process.BeamProfile2DBWriter = beamProfile2DBWriter.clone(X0 = 0.0458532,
Y0 = -0.016966,
Z0 = -0.074992,
SigmaZ = 3.6,
BetaStar = 30.0,
Emittance = 3.931e-8,)

# For the Gaussian smearing (ideal Beamspot) set the following parameters:
# - MeanX, MeanY, MeanZ, SigmaX, SigmaY, SigmaZ
#process.BeamProfile2DBWriter = beamProfile2DBWriter.clone(MeanX = 0.0,
# MeanY = 0.0,
# MeanZ = 0.0,
# SigmaX = 0.0015,
# SigmaY = 0.0015,
# SigmaZ = 3.6,)

process.p = cms.Path(process.BeamProfile2DBWriter)

0 comments on commit c7f6425

Please sign in to comment.