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
 
void beginRun (const edm::Run &, const edm::EventSetup &) 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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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

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 29 of file BetafuncEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file BetafuncEvtVtxGenerator.cc.

References Exception, fbetastar, femittance, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, edm::ParameterSet::getParameter(), readDB_, and setBoost().

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

Definition at line 55 of file BetafuncEvtVtxGenerator.cc.

55 {}
BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator ( const BetafuncEvtVtxGenerator p)
privatedelete

Copy constructor

Member Function Documentation

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

Definition at line 57 of file BetafuncEvtVtxGenerator.cc.

References update().

57  {
58  update(iEventSetup);
59 }
void update(const edm::EventSetup &iEventSetup)
void BetafuncEvtVtxGenerator::beginRun ( const edm::Run ,
const edm::EventSetup iEventSetup 
)
override

Definition at line 60 of file BetafuncEvtVtxGenerator.cc.

References update().

60 { update(iEventSetup); }
void update(const edm::EventSetup &iEventSetup)
double BetafuncEvtVtxGenerator::BetaFunction ( double  z,
double  z0 
) const

beta function

Definition at line 101 of file BetafuncEvtVtxGenerator.cc.

References fbetastar, femittance, and mathSSE::sqrt().

Referenced by newVertex().

void BetafuncEvtVtxGenerator::betastar ( double  m = 0)
inline
void BetafuncEvtVtxGenerator::emittance ( double  m = 0)
inline
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 147 of file BetafuncEvtVtxGenerator.cc.

References boost_.

147 { return &boost_; }
HepMC::FourVector BetafuncEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  engine) const
overridevirtual

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 79 of file BetafuncEvtVtxGenerator.cc.

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

79  {
80  double X, Y, Z;
81 
82  double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
83  Z = tmp_sigz + fZ0;
84 
85  double tmp_sigx = BetaFunction(Z, fZ0);
86  // need sqrt(2) for beamspot width relative to single beam width
87  tmp_sigx /= sqrt(2.0);
88  X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) + fX0; // + Z*fdxdz ;
89 
90  double tmp_sigy = BetaFunction(Z, fZ0);
91  // need sqrt(2) for beamspot width relative to single beam width
92  tmp_sigy /= sqrt(2.0);
93  Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) + fY0; // + Z*fdydz;
94 
95  double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
96  double T = tmp_sigt + fTimeOffset;
97 
98  return HepMC::FourVector(X, Y, Z, T);
99 }
#define X(str)
Definition: MuonsGrabber.cc:38
T sqrt(T t)
Definition: SSEVec.h:19
double BetaFunction(double z, double z0) const
beta function
long double T
BetafuncEvtVtxGenerator& BetafuncEvtVtxGenerator::operator= ( const BetafuncEvtVtxGenerator rhs)
privatedelete

Copy assignment operator

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

Definition at line 105 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by BetafuncEvtVtxGenerator(), and update().

105  {
106  //boost_.ResizeTo(4,4);
107  //boost_ = new TMatrixD(4,4);
108  TMatrixD tmpboost(4, 4);
109 
110  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
111 
112  // Lorentz boost to frame where the collision is head-on
113  // phi is the half crossing angle in the plane ZS
114  // alpha is the angle to the S axis from the X axis in the XY plane
115 
116  tmpboost(0, 0) = 1. / cos(phi);
117  tmpboost(0, 1) = -cos(alpha) * sin(phi);
118  tmpboost(0, 2) = -tan(phi) * sin(phi);
119  tmpboost(0, 3) = -sin(alpha) * sin(phi);
120  tmpboost(1, 0) = -cos(alpha) * tan(phi);
121  tmpboost(1, 1) = 1.;
122  tmpboost(1, 2) = cos(alpha) * tan(phi);
123  tmpboost(1, 3) = 0.;
124  tmpboost(2, 0) = 0.;
125  tmpboost(2, 1) = -cos(alpha) * sin(phi);
126  tmpboost(2, 2) = cos(phi);
127  tmpboost(2, 3) = -sin(alpha) * sin(phi);
128  tmpboost(3, 0) = -sin(alpha) * tan(phi);
129  tmpboost(3, 1) = 0.;
130  tmpboost(3, 2) = sin(alpha) * tan(phi);
131  tmpboost(3, 3) = 1.;
132 
133  tmpboost.Invert();
134  boost_ = tmpboost;
135  //boost_->Print();
136 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
alpha
zGenParticlesMatch = cms.InputTag(""),
void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 138 of file BetafuncEvtVtxGenerator.cc.

References Exception, fSigmaZ, and alignCSCRings::s.

138  {
139  if (s >= 0) {
140  fSigmaZ = s;
141  } else {
142  throw cms::Exception("LogicError") << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
143  << "Illegal resolution in Z (negative)";
144  }
145 }
void BetafuncEvtVtxGenerator::update ( const edm::EventSetup iEventSetup)
private

Definition at line 62 of file BetafuncEvtVtxGenerator.cc.

References edm::ESWatcher< T >::check(), SimBeamSpotObjects::fAlpha, SimBeamSpotObjects::fbetastar, fbetastar, SimBeamSpotObjects::femittance, femittance, SimBeamSpotObjects::fPhi, SimBeamSpotObjects::fSigmaZ, fSigmaZ, SimBeamSpotObjects::fTimeOffset, fTimeOffset, SimBeamSpotObjects::fX0, fX0, SimBeamSpotObjects::fY0, fY0, SimBeamSpotObjects::fZ0, fZ0, edm::EventSetup::get(), parameterWatcher_, readDB_, and setBoost().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), beginLuminosityBlock(), beginRun(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

62  {
63  if (readDB_ && parameterWatcher_.check(iEventSetup)) {
65  iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);
66 
67  fX0 = beamhandle->fX0;
68  fY0 = beamhandle->fY0;
69  fZ0 = beamhandle->fZ0;
70  // falpha=beamhandle->fAlpha;
71  fSigmaZ = beamhandle->fSigmaZ;
72  fTimeOffset = beamhandle->fTimeOffset;
73  fbetastar = beamhandle->fbetastar;
74  femittance = beamhandle->femittance;
75  setBoost(beamhandle->fAlpha, beamhandle->fPhi);
76  }
77 }
void setBoost(double alpha, double phi)
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
T get() const
Definition: EventSetup.h:73
void BetafuncEvtVtxGenerator::X0 ( double  m = 0)
inline
void BetafuncEvtVtxGenerator::Y0 ( double  m = 0)
inline
void BetafuncEvtVtxGenerator::Z0 ( double  m = 0)
inline

Member Data Documentation

TMatrixD BetafuncEvtVtxGenerator::boost_
private

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

Referenced by GetInvLorentzBoost(), and setBoost().

double BetafuncEvtVtxGenerator::fbetastar
private

Definition at line 75 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 75 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fSigmaZ
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 72 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 72 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 72 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 82 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

bool BetafuncEvtVtxGenerator::readDB_
private

Definition at line 70 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().