CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
BetafuncEvtVtxGenerator Class Reference

#include <BetafuncEvtVtxGenerator.h>

Inheritance diagram for BetafuncEvtVtxGenerator:
BaseEvtVtxGenerator edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

void Alpha (double m=0)
 angle between crossing plane and horizontal plane More...
 
virtual void beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run &, const edm::EventSetup &)
 
 BetafuncEvtVtxGenerator (const edm::ParameterSet &p)
 
double BetaFunction (double z, double z0)
 beta function More...
 
void betastar (double m=0)
 set beta_star More...
 
void emittance (double m=0)
 emittance (no the normalized) More...
 
virtual TMatrixD * GetInvLorentzBoost ()
 
virtual HepMC::FourVector * newVertex ()
 return a new event vertex More...
 
void Phi (double m=0)
 set half crossing angle 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...
 
virtual ~BetafuncEvtVtxGenerator ()
 
- Public Member Functions inherited from BaseEvtVtxGenerator
 BaseEvtVtxGenerator (const edm::ParameterSet &)
 
virtual HepMC::FourVector * lastVertex ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
virtual ~BaseEvtVtxGenerator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

 BetafuncEvtVtxGenerator (const BetafuncEvtVtxGenerator &p)
 
BetafuncEvtVtxGeneratoroperator= (const BetafuncEvtVtxGenerator &rhs)
 
void update (const edm::EventSetup &iEventSetup)
 

Private Attributes

double alpha_
 
double fbetastar
 
double femittance
 
CLHEP::RandGaussQ * fRandom
 
double fSigmaZ
 
double fTimeOffset
 
double fX0
 
double fY0
 
double fZ0
 
edm::ESWatcher
< SimBeamSpotObjectsRcd
parameterWatcher_
 
double phi_
 
bool readDB_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from BaseEvtVtxGenerator
CLHEP::HepRandomEngine & getEngine ()
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 
- Protected Attributes inherited from BaseEvtVtxGenerator
TMatrixD * boost_
 
double fTimeOffset
 
HepMC::FourVector * fVertex
 

Detailed Description

Definition at line 30 of file BetafuncEvtVtxGenerator.h.

Constructor & Destructor Documentation

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

Definition at line 41 of file BetafuncEvtVtxGenerator.cc.

References alpha_, edm::hlt::Exception, fbetastar, femittance, fRandom, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, BaseEvtVtxGenerator::getEngine(), edm::ParameterSet::getParameter(), phi_, and readDB_.

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

Definition at line 69 of file BetafuncEvtVtxGenerator.cc.

References fRandom.

70 {
71  delete fRandom;
72 }
BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator ( const BetafuncEvtVtxGenerator p)
private

Copy constructor

Member Function Documentation

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

angle between crossing plane and horizontal plane

Definition at line 59 of file BetafuncEvtVtxGenerator.h.

References alpha_, and m.

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

Reimplemented from edm::EDProducer.

Definition at line 74 of file BetafuncEvtVtxGenerator.cc.

References update().

74  {
75  update(iEventSetup);
76 }
void update(const edm::EventSetup &iEventSetup)
void BetafuncEvtVtxGenerator::beginRun ( edm::Run ,
const edm::EventSetup iEventSetup 
)
virtual

Reimplemented from BaseEvtVtxGenerator.

Definition at line 77 of file BetafuncEvtVtxGenerator.cc.

References update().

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

beta function

Definition at line 131 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by newVertex().

132 {
133  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
134 
135 }
double double double z
T sqrt(T t)
Definition: SSEVec.h:46
void BetafuncEvtVtxGenerator::betastar ( double  m = 0)
inline

set beta_star

Definition at line 62 of file BetafuncEvtVtxGenerator.h.

References fbetastar, and m.

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

emittance (no the normalized)

Definition at line 64 of file BetafuncEvtVtxGenerator.h.

References femittance, and m.

TMatrixD * BetafuncEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Implements BaseEvtVtxGenerator.

Definition at line 150 of file BetafuncEvtVtxGenerator.cc.

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

150  {
151 
152  //alpha_ = 0;
153  //phi_ = 142.e-6;
154 
155  if (boost_ != 0 ) return boost_;
156 
157  //boost_.ResizeTo(4,4);
158  //boost_ = new TMatrixD(4,4);
159  TMatrixD tmpboost(4,4);
160 
161  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
162 
163  // Lorentz boost to frame where the collision is head-on
164  // phi is the half crossing angle in the plane ZS
165  // alpha is the angle to the S axis from the X axis in the XY plane
166 
167  tmpboost(0,0) = 1./cos(phi_);
168  tmpboost(0,1) = - cos(alpha_)*sin(phi_);
169  tmpboost(0,2) = - tan(phi_)*sin(phi_);
170  tmpboost(0,3) = - sin(alpha_)*sin(phi_);
171  tmpboost(1,0) = - cos(alpha_)*tan(phi_);
172  tmpboost(1,1) = 1.;
173  tmpboost(1,2) = cos(alpha_)*tan(phi_);
174  tmpboost(1,3) = 0.;
175  tmpboost(2,0) = 0.;
176  tmpboost(2,1) = - cos(alpha_)*sin(phi_);
177  tmpboost(2,2) = cos(phi_);
178  tmpboost(2,3) = - sin(alpha_)*sin(phi_);
179  tmpboost(3,0) = - sin(alpha_)*tan(phi_);
180  tmpboost(3,1) = 0.;
181  tmpboost(3,2) = sin(alpha_)*tan(phi_);
182  tmpboost(3,3) = 1.;
183 
184  tmpboost.Invert();
185  boost_ = new TMatrixD(tmpboost);
186  //boost_->Print();
187 
188  return boost_;
189 }
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
HepMC::FourVector * BetafuncEvtVtxGenerator::newVertex ( )
virtual

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 104 of file BetafuncEvtVtxGenerator.cc.

References BetaFunction(), fRandom, fSigmaZ, fTimeOffset, BaseEvtVtxGenerator::fVertex, fX0, fY0, fZ0, mathSSE::sqrt(), X, and Gflash::Z.

104  {
105 
106 
107  double X,Y,Z;
108 
109  double tmp_sigz = fRandom->fire(0., fSigmaZ);
110  Z = tmp_sigz + fZ0;
111 
112  double tmp_sigx = BetaFunction(Z,fZ0);
113  // need sqrt(2) for beamspot width relative to single beam width
114  tmp_sigx /= sqrt(2.0);
115  X = fRandom->fire(0.,tmp_sigx) + fX0; // + Z*fdxdz ;
116 
117  double tmp_sigy = BetaFunction(Z,fZ0);
118  // need sqrt(2) for beamspot width relative to single beam width
119  tmp_sigy /= sqrt(2.0);
120  Y = fRandom->fire(0.,tmp_sigy) + fY0; // + Z*fdydz;
121 
122  double tmp_sigt = fRandom->fire(0., fSigmaZ);
123  double T = tmp_sigt + fTimeOffset;
124 
125  if ( fVertex == 0 ) fVertex = new HepMC::FourVector();
126  fVertex->set(X,Y,Z,T);
127 
128  return fVertex;
129 }
const double Z[kNumberCalorimeter]
HepMC::FourVector * fVertex
#define X(str)
Definition: MuonsGrabber.cc:49
double BetaFunction(double z, double z0)
beta function
T sqrt(T t)
Definition: SSEVec.h:46
long double T
BetafuncEvtVtxGenerator& BetafuncEvtVtxGenerator::operator= ( const BetafuncEvtVtxGenerator rhs)
private

Copy assignment operator

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

set half crossing angle

Definition at line 57 of file BetafuncEvtVtxGenerator.h.

References m, and phi_.

void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 138 of file BetafuncEvtVtxGenerator.cc.

References edm::hlt::Exception, fSigmaZ, and alignCSCRings::s.

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

Definition at line 81 of file BetafuncEvtVtxGenerator.cc.

References alpha_, BaseEvtVtxGenerator::boost_, edm::ESWatcher< T >::check(), fbetastar, femittance, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, edm::EventSetup::get(), parameterWatcher_, phi_, and readDB_.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

81  {
82  if (readDB_ && parameterWatcher_.check(iEventSetup)){
84  iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);
85 
86  fX0=beamhandle->fX0;
87  fY0=beamhandle->fY0;
88  fZ0=beamhandle->fZ0;
89  // falpha=beamhandle->fAlpha;
90  alpha_=beamhandle->fAlpha;
91  phi_=beamhandle->fPhi;
92  fSigmaZ=beamhandle->fSigmaZ;
93  fTimeOffset=beamhandle->fTimeOffset;
94  fbetastar=beamhandle->fbetastar;
95  femittance=beamhandle->femittance;
96 
97  //re-initialize the boost matrix
98  delete boost_;
99  boost_=0;
100  }
101 }
edm::ESWatcher< SimBeamSpotObjectsRcd > parameterWatcher_
const T & get() const
Definition: EventSetup.h:55
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
void BetafuncEvtVtxGenerator::X0 ( double  m = 0)
inline

set mean in X in cm

Definition at line 50 of file BetafuncEvtVtxGenerator.h.

References fX0, and m.

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

set mean in Y in cm

Definition at line 52 of file BetafuncEvtVtxGenerator.h.

References fY0, and m.

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

set mean in Z in cm

Definition at line 54 of file BetafuncEvtVtxGenerator.h.

References fZ0, and m.

Member Data Documentation

double BetafuncEvtVtxGenerator::alpha_
private
double BetafuncEvtVtxGenerator::fbetastar
private

Definition at line 85 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 85 of file BetafuncEvtVtxGenerator.h.

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

CLHEP::RandGaussQ* BetafuncEvtVtxGenerator::fRandom
private
double BetafuncEvtVtxGenerator::fSigmaZ
private

Definition at line 83 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 87 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 82 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 82 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 82 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 92 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

double BetafuncEvtVtxGenerator::phi_
private

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), GetInvLorentzBoost(), Phi(), and update().

bool BetafuncEvtVtxGenerator::readDB_
private

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().