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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 40 of file BetafuncEvtVtxGenerator.cc.

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

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

Definition at line 64 of file BetafuncEvtVtxGenerator.cc.

65 {
66 }
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 68 of file BetafuncEvtVtxGenerator.cc.

References update().

68  {
69  update(iEventSetup);
70 }
void update(const edm::EventSetup &iEventSetup)
void BetafuncEvtVtxGenerator::beginRun ( const edm::Run ,
const edm::EventSetup iEventSetup 
)
override

Definition at line 71 of file BetafuncEvtVtxGenerator.cc.

References update().

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

beta function

Definition at line 117 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by newVertex().

118 {
119  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
120 
121 }
T sqrt(T t)
Definition: SSEVec.h:18
void BetafuncEvtVtxGenerator::betastar ( double  m = 0)
inline

set beta_star

Definition at line 56 of file BetafuncEvtVtxGenerator.h.

References funct::m.

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

emittance (no the normalized)

Definition at line 58 of file BetafuncEvtVtxGenerator.h.

References alpha, and funct::m.

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 169 of file BetafuncEvtVtxGenerator.cc.

References boost_.

169  {
170 
171  return &boost_;
172 }
HepMC::FourVector BetafuncEvtVtxGenerator::newVertex ( CLHEP::HepRandomEngine *  engine) const
overridevirtual

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 93 of file BetafuncEvtVtxGenerator.cc.

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

93  {
94 
95 
96  double X,Y,Z;
97 
98  double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
99  Z = tmp_sigz + fZ0;
100 
101  double tmp_sigx = BetaFunction(Z,fZ0);
102  // need sqrt(2) for beamspot width relative to single beam width
103  tmp_sigx /= sqrt(2.0);
104  X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) + fX0; // + Z*fdxdz ;
105 
106  double tmp_sigy = BetaFunction(Z,fZ0);
107  // need sqrt(2) for beamspot width relative to single beam width
108  tmp_sigy /= sqrt(2.0);
109  Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) + fY0; // + Z*fdydz;
110 
111  double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
112  double T = tmp_sigt + fTimeOffset;
113 
114  return HepMC::FourVector(X,Y,Z,T);
115 }
#define X(str)
Definition: MuonsGrabber.cc:48
T sqrt(T t)
Definition: SSEVec.h:18
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 123 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by BetafuncEvtVtxGenerator(), and update().

124 {
125  //boost_.ResizeTo(4,4);
126  //boost_ = new TMatrixD(4,4);
127  TMatrixD tmpboost(4,4);
128 
129  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
130 
131  // Lorentz boost to frame where the collision is head-on
132  // phi is the half crossing angle in the plane ZS
133  // alpha is the angle to the S axis from the X axis in the XY plane
134 
135  tmpboost(0,0) = 1./cos(phi);
136  tmpboost(0,1) = - cos(alpha)*sin(phi);
137  tmpboost(0,2) = - tan(phi)*sin(phi);
138  tmpboost(0,3) = - sin(alpha)*sin(phi);
139  tmpboost(1,0) = - cos(alpha)*tan(phi);
140  tmpboost(1,1) = 1.;
141  tmpboost(1,2) = cos(alpha)*tan(phi);
142  tmpboost(1,3) = 0.;
143  tmpboost(2,0) = 0.;
144  tmpboost(2,1) = - cos(alpha)*sin(phi);
145  tmpboost(2,2) = cos(phi);
146  tmpboost(2,3) = - sin(alpha)*sin(phi);
147  tmpboost(3,0) = - sin(alpha)*tan(phi);
148  tmpboost(3,1) = 0.;
149  tmpboost(3,2) = sin(alpha)*tan(phi);
150  tmpboost(3,3) = 1.;
151 
152  tmpboost.Invert();
153  boost_ = tmpboost;
154  //boost_->Print();
155 }
float alpha
Definition: AMPTWrapper.h:95
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
void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 157 of file BetafuncEvtVtxGenerator.cc.

References Exception, fSigmaZ, and alignCSCRings::s.

158 {
159  if (s>=0 ) {
160  fSigmaZ=s;
161  }
162  else {
163  throw cms::Exception("LogicError")
164  << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
165  << "Illegal resolution in Z (negative)";
166  }
167 }
void BetafuncEvtVtxGenerator::update ( const edm::EventSetup iEventSetup)
private

Definition at line 75 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().

75  {
76  if (readDB_ && parameterWatcher_.check(iEventSetup)){
78  iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);
79 
80  fX0=beamhandle->fX0;
81  fY0=beamhandle->fY0;
82  fZ0=beamhandle->fZ0;
83  // falpha=beamhandle->fAlpha;
84  fSigmaZ=beamhandle->fSigmaZ;
85  fTimeOffset=beamhandle->fTimeOffset;
86  fbetastar=beamhandle->fbetastar;
87  femittance=beamhandle->femittance;
88  setBoost(beamhandle->fAlpha,beamhandle->fPhi);
89 
90  }
91 }
void setBoost(double alpha, double phi)
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
T get() const
Definition: EventSetup.h:68
void BetafuncEvtVtxGenerator::X0 ( double  m = 0)
inline

set mean in X in cm

Definition at line 49 of file BetafuncEvtVtxGenerator.h.

References funct::m.

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

set mean in Y in cm

Definition at line 51 of file BetafuncEvtVtxGenerator.h.

References funct::m.

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

set mean in Z in cm

Definition at line 53 of file BetafuncEvtVtxGenerator.h.

References funct::m.

Member Data Documentation

TMatrixD BetafuncEvtVtxGenerator::boost_
private

Definition at line 81 of file BetafuncEvtVtxGenerator.h.

Referenced by GetInvLorentzBoost(), and setBoost().

double BetafuncEvtVtxGenerator::fbetastar
private

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fSigmaZ
private

Definition at line 75 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 74 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 74 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 74 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 84 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

bool BetafuncEvtVtxGenerator::readDB_
private

Definition at line 72 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().