CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
BetafuncEvtVtxGenerator Class Reference

#include <BetafuncEvtVtxGenerator.h>

Inheritance diagram for BetafuncEvtVtxGenerator:
BaseEvtVtxGenerator edm::stream::EDProducer<>

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
 BetafuncEvtVtxGenerator (const edm::ParameterSet &p)
 
double BetaFunction (double z, double z0) const
 beta function More...
 
void betastar (double m=0)
 set beta_star More...
 
void emittance (double m=0)
 emittance (no the normalized) More...
 
TMatrixD const * GetInvLorentzBoost () const override
 
HepMC::FourVector newVertex (CLHEP::HepRandomEngine *) const override
 return a new event vertex More...
 
void sigmaZ (double s=1.0)
 set resolution in Z in cm More...
 
void X0 (double m=0)
 set mean in X in cm More...
 
void Y0 (double m=0)
 set mean in Y in cm More...
 
void Z0 (double m=0)
 set mean in Z in cm More...
 
 ~BetafuncEvtVtxGenerator () override
 
- Public Member Functions inherited from BaseEvtVtxGenerator
 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~BaseEvtVtxGenerator () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

 BetafuncEvtVtxGenerator (const BetafuncEvtVtxGenerator &p)=delete
 
BetafuncEvtVtxGeneratoroperator= (const BetafuncEvtVtxGenerator &rhs)=delete
 
void setBoost (double alpha, double phi)
 
void update (const edm::EventSetup &iEventSetup)
 

Private Attributes

edm::ESGetToken< SimBeamSpotObjects, SimBeamSpotObjectsRcdbeamToken_
 
TMatrixD boost_
 
double fbetastar
 
double femittance
 
double fSigmaZ
 
double fTimeOffset
 
double fX0
 
double fY0
 
double fZ0
 
edm::ESWatcher< SimBeamSpotObjectsRcdparameterWatcher_
 
bool readDB_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 31 of file BetafuncEvtVtxGenerator.h.

Constructor & Destructor Documentation

◆ BetafuncEvtVtxGenerator() [1/2]

BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator ( const edm::ParameterSet p)

Definition at line 33 of file BetafuncEvtVtxGenerator.cc.

33  : BaseEvtVtxGenerator(p), boost_(4, 4) {
34  readDB_ = p.getParameter<bool>("readDB");
35  if (!readDB_) {
36  fX0 = p.getParameter<double>("X0") * cm;
37  fY0 = p.getParameter<double>("Y0") * cm;
38  fZ0 = p.getParameter<double>("Z0") * cm;
39  fSigmaZ = p.getParameter<double>("SigmaZ") * cm;
40  fbetastar = p.getParameter<double>("BetaStar") * cm;
41  femittance = p.getParameter<double>("Emittance") * cm; // this is not the normalized emittance
42  fTimeOffset = p.getParameter<double>("TimeOffset") * ns * c_light; // HepMC time units are mm
43 
44  setBoost(p.getParameter<double>("Alpha") * radian, p.getParameter<double>("Phi") * radian);
45  if (fSigmaZ <= 0) {
46  throw cms::Exception("Configuration") << "Error in BetafuncEvtVtxGenerator: "
47  << "Illegal resolution in Z (SigmaZ is negative)";
48  }
49  }
50  if (readDB_) {
51  beamToken_ = esConsumes<SimBeamSpotObjects, SimBeamSpotObjectsRcd, edm::Transition::BeginLuminosityBlock>();
52  }
53 }

References beamToken_, Exception, fbetastar, femittance, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, AlCaHLTBitMon_ParallelJobs::p, readDB_, and setBoost().

◆ ~BetafuncEvtVtxGenerator()

BetafuncEvtVtxGenerator::~BetafuncEvtVtxGenerator ( )
override

Definition at line 55 of file BetafuncEvtVtxGenerator.cc.

55 {}

◆ BetafuncEvtVtxGenerator() [2/2]

BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator ( const BetafuncEvtVtxGenerator p)
privatedelete

Copy constructor

Member Function Documentation

◆ beginLuminosityBlock()

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

Definition at line 57 of file BetafuncEvtVtxGenerator.cc.

57  {
58  update(iEventSetup);
59 }

References update().

◆ BetaFunction()

double BetafuncEvtVtxGenerator::BetaFunction ( double  z,
double  z0 
) const

beta function

Definition at line 99 of file BetafuncEvtVtxGenerator.cc.

99  {
100  return sqrt(femittance * (fbetastar + (((z - z0) * (z - z0)) / fbetastar)));
101 }

References fbetastar, femittance, mathSSE::sqrt(), z, and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by newVertex().

◆ betastar()

void BetafuncEvtVtxGenerator::betastar ( double  m = 0)
inline

set beta_star

Definition at line 55 of file BetafuncEvtVtxGenerator.h.

55 { fbetastar = m; }

References fbetastar, and visualization-live-secondInstance_cfg::m.

◆ emittance()

void BetafuncEvtVtxGenerator::emittance ( double  m = 0)
inline

emittance (no the normalized)

Definition at line 57 of file BetafuncEvtVtxGenerator.h.

57 { femittance = m; }

References femittance, and visualization-live-secondInstance_cfg::m.

◆ GetInvLorentzBoost()

TMatrixD const * BetafuncEvtVtxGenerator::GetInvLorentzBoost ( ) const
overridevirtual

This method - and the comment - is a left-over from COBRA-OSCAR time : return the last generated event vertex. If no vertex has been generated yet, a NULL pointer is returned.

Implements BaseEvtVtxGenerator.

Definition at line 145 of file BetafuncEvtVtxGenerator.cc.

145 { return &boost_; }

References boost_.

◆ newVertex()

HepMC::FourVector BetafuncEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  engine) const
overridevirtual

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 77 of file BetafuncEvtVtxGenerator.cc.

77  {
78  double X, Y, Z;
79 
80  double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
81  Z = tmp_sigz + fZ0;
82 
83  double tmp_sigx = BetaFunction(Z, fZ0);
84  // need sqrt(2) for beamspot width relative to single beam width
85  tmp_sigx /= sqrt(2.0);
86  X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) + fX0; // + Z*fdxdz ;
87 
88  double tmp_sigy = BetaFunction(Z, fZ0);
89  // need sqrt(2) for beamspot width relative to single beam width
90  tmp_sigy /= sqrt(2.0);
91  Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) + fY0; // + Z*fdydz;
92 
93  double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
94  double T = tmp_sigt + fTimeOffset;
95 
96  return HepMC::FourVector(X, Y, Z, T);
97 }

References BetaFunction(), fSigmaZ, fTimeOffset, fX0, fY0, fZ0, mathSSE::sqrt(), X, BeamSpotPI::Y, and BeamSpotPI::Z.

◆ operator=()

BetafuncEvtVtxGenerator& BetafuncEvtVtxGenerator::operator= ( const BetafuncEvtVtxGenerator rhs)
privatedelete

Copy assignment operator

◆ setBoost()

void BetafuncEvtVtxGenerator::setBoost ( double  alpha,
double  phi 
)
private

Definition at line 103 of file BetafuncEvtVtxGenerator.cc.

103  {
104  //boost_.ResizeTo(4,4);
105  //boost_ = new TMatrixD(4,4);
106  TMatrixD tmpboost(4, 4);
107 
108  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
109 
110  // Lorentz boost to frame where the collision is head-on
111  // phi is the half crossing angle in the plane ZS
112  // alpha is the angle to the S axis from the X axis in the XY plane
113 
114  tmpboost(0, 0) = 1. / cos(phi);
115  tmpboost(0, 1) = -cos(alpha) * sin(phi);
116  tmpboost(0, 2) = -tan(phi) * sin(phi);
117  tmpboost(0, 3) = -sin(alpha) * sin(phi);
118  tmpboost(1, 0) = -cos(alpha) * tan(phi);
119  tmpboost(1, 1) = 1.;
120  tmpboost(1, 2) = cos(alpha) * tan(phi);
121  tmpboost(1, 3) = 0.;
122  tmpboost(2, 0) = 0.;
123  tmpboost(2, 1) = -cos(alpha) * sin(phi);
124  tmpboost(2, 2) = cos(phi);
125  tmpboost(2, 3) = -sin(alpha) * sin(phi);
126  tmpboost(3, 0) = -sin(alpha) * tan(phi);
127  tmpboost(3, 1) = 0.;
128  tmpboost(3, 2) = sin(alpha) * tan(phi);
129  tmpboost(3, 3) = 1.;
130 
131  tmpboost.Invert();
132  boost_ = tmpboost;
133  //boost_->Print();
134 }

References alpha, boost_, funct::cos(), phi, funct::sin(), and funct::tan().

Referenced by BetafuncEvtVtxGenerator(), and update().

◆ sigmaZ()

void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 136 of file BetafuncEvtVtxGenerator.cc.

136  {
137  if (s >= 0) {
138  fSigmaZ = s;
139  } else {
140  throw cms::Exception("LogicError") << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
141  << "Illegal resolution in Z (negative)";
142  }
143 }

References Exception, fSigmaZ, and alignCSCRings::s.

◆ update()

void BetafuncEvtVtxGenerator::update ( const edm::EventSetup iEventSetup)
private

◆ X0()

void BetafuncEvtVtxGenerator::X0 ( double  m = 0)
inline

set mean in X in cm

Definition at line 48 of file BetafuncEvtVtxGenerator.h.

48 { fX0 = m; }

References fX0, and visualization-live-secondInstance_cfg::m.

◆ Y0()

void BetafuncEvtVtxGenerator::Y0 ( double  m = 0)
inline

set mean in Y in cm

Definition at line 50 of file BetafuncEvtVtxGenerator.h.

50 { fY0 = m; }

References fY0, and visualization-live-secondInstance_cfg::m.

◆ Z0()

void BetafuncEvtVtxGenerator::Z0 ( double  m = 0)
inline

set mean in Z in cm

Definition at line 52 of file BetafuncEvtVtxGenerator.h.

52 { fZ0 = m; }

References fZ0, and visualization-live-secondInstance_cfg::m.

Member Data Documentation

◆ beamToken_

edm::ESGetToken<SimBeamSpotObjects, SimBeamSpotObjectsRcd> BetafuncEvtVtxGenerator::beamToken_
private

Definition at line 84 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().

◆ boost_

TMatrixD BetafuncEvtVtxGenerator::boost_
private

Definition at line 80 of file BetafuncEvtVtxGenerator.h.

Referenced by GetInvLorentzBoost(), and setBoost().

◆ fbetastar

double BetafuncEvtVtxGenerator::fbetastar
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), BetaFunction(), betastar(), and update().

◆ femittance

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), BetaFunction(), emittance(), and update().

◆ fSigmaZ

double BetafuncEvtVtxGenerator::fSigmaZ
private

Definition at line 74 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), newVertex(), sigmaZ(), and update().

◆ fTimeOffset

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 78 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), newVertex(), and update().

◆ fX0

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), newVertex(), update(), and X0().

◆ fY0

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), newVertex(), update(), and Y0().

◆ fZ0

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), newVertex(), update(), and Z0().

◆ parameterWatcher_

edm::ESWatcher<SimBeamSpotObjectsRcd> BetafuncEvtVtxGenerator::parameterWatcher_
private

Definition at line 83 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

◆ readDB_

bool BetafuncEvtVtxGenerator::readDB_
private

Definition at line 71 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().

edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
SimBeamSpotObjects::fTimeOffset
double fTimeOffset
Definition: SimBeamSpotObjects.h:27
BetafuncEvtVtxGenerator::fZ0
double fZ0
Definition: BetafuncEvtVtxGenerator.h:73
X
#define X(str)
Definition: MuonsGrabber.cc:38
BetafuncEvtVtxGenerator::fbetastar
double fbetastar
Definition: BetafuncEvtVtxGenerator.h:76
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SimBeamSpotObjects::fX0
double fX0
Definition: SimBeamSpotObjects.h:21
BetafuncEvtVtxGenerator::fTimeOffset
double fTimeOffset
Definition: BetafuncEvtVtxGenerator.h:78
SimBeamSpotObjects::fY0
double fY0
Definition: SimBeamSpotObjects.h:21
alpha
float alpha
Definition: AMPTWrapper.h:105
BetafuncEvtVtxGenerator::BetaFunction
double BetaFunction(double z, double z0) const
beta function
Definition: BetafuncEvtVtxGenerator.cc:99
SimBeamSpotObjects::femittance
double femittance
Definition: SimBeamSpotObjects.h:25
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
BetafuncEvtVtxGenerator::fY0
double fY0
Definition: BetafuncEvtVtxGenerator.h:73
alignCSCRings.s
s
Definition: alignCSCRings.py:92
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
BetafuncEvtVtxGenerator::fSigmaZ
double fSigmaZ
Definition: BetafuncEvtVtxGenerator.h:74
BetafuncEvtVtxGenerator::setBoost
void setBoost(double alpha, double phi)
Definition: BetafuncEvtVtxGenerator.cc:103
BetafuncEvtVtxGenerator::femittance
double femittance
Definition: BetafuncEvtVtxGenerator.h:76
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
edm::ESHandle
Definition: DTSurvey.h:22
SimBeamSpotObjects::fbetastar
double fbetastar
Definition: SimBeamSpotObjects.h:25
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
BetafuncEvtVtxGenerator::parameterWatcher_
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
Definition: BetafuncEvtVtxGenerator.h:83
BaseEvtVtxGenerator::BaseEvtVtxGenerator
BaseEvtVtxGenerator(const edm::ParameterSet &)
Definition: BaseEvtVtxGenerator.cc:29
SimBeamSpotObjects::fSigmaZ
double fSigmaZ
Definition: SimBeamSpotObjects.h:24
BetafuncEvtVtxGenerator::beamToken_
edm::ESGetToken< SimBeamSpotObjects, SimBeamSpotObjectsRcd > beamToken_
Definition: BetafuncEvtVtxGenerator.h:84
funct::tan
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
SimBeamSpotObjects::fAlpha
double fAlpha
Definition: SimBeamSpotObjects.h:26
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
SimBeamSpotObjects::fPhi
double fPhi
Definition: SimBeamSpotObjects.h:26
BetafuncEvtVtxGenerator::readDB_
bool readDB_
Definition: BetafuncEvtVtxGenerator.h:71
BetafuncEvtVtxGenerator::update
void update(const edm::EventSetup &iEventSetup)
Definition: BetafuncEvtVtxGenerator.cc:61
DDAxes::phi
T
long double T
Definition: Basic3DVectorLD.h:48
Exception
Definition: hltDiff.cc:245
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
SimBeamSpotObjects::fZ0
double fZ0
Definition: SimBeamSpotObjects.h:21
BetafuncEvtVtxGenerator::boost_
TMatrixD boost_
Definition: BetafuncEvtVtxGenerator.h:80
BetafuncEvtVtxGenerator::fX0
double fX0
Definition: BetafuncEvtVtxGenerator.h:73