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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void Alpha (double m=0)
 angle between crossing plane and horizontal plane More...
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 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 &) override
 
virtual ~BaseEvtVtxGenerator ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
- 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::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from BaseEvtVtxGenerator
TMatrixD * boost_
 
double fTimeOffset
 
HepMC::FourVector * fVertex
 

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 alpha_, edm::hlt::Exception, fbetastar, femittance, fRandom, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, BaseEvtVtxGenerator::getEngine(), edm::ParameterSet::getParameter(), phi_, and readDB_.

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

Definition at line 68 of file BetafuncEvtVtxGenerator.cc.

References fRandom.

69 {
70  delete fRandom;
71 }
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 58 of file BetafuncEvtVtxGenerator.h.

References alpha_, and m.

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

Reimplemented from edm::EDProducer.

Definition at line 73 of file BetafuncEvtVtxGenerator.cc.

References update().

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

Reimplemented from edm::EDProducer.

Definition at line 76 of file BetafuncEvtVtxGenerator.cc.

References update().

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

beta function

Definition at line 130 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by newVertex().

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

set beta_star

Definition at line 61 of file BetafuncEvtVtxGenerator.h.

References fbetastar, and m.

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

emittance (no the normalized)

Definition at line 63 of file BetafuncEvtVtxGenerator.h.

References femittance, and m.

TMatrixD * BetafuncEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Implements BaseEvtVtxGenerator.

Definition at line 149 of file BetafuncEvtVtxGenerator.cc.

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

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

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

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

References m, and phi_.

void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 137 of file BetafuncEvtVtxGenerator.cc.

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

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

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

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

set mean in X in cm

Definition at line 49 of file BetafuncEvtVtxGenerator.h.

References fX0, and m.

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

set mean in Y in cm

Definition at line 51 of file BetafuncEvtVtxGenerator.h.

References fY0, and m.

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

set mean in Z in cm

Definition at line 53 of file BetafuncEvtVtxGenerator.h.

References fZ0, and m.

Member Data Documentation

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

Definition at line 84 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 84 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 82 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 86 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 81 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 81 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 81 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 91 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

double BetafuncEvtVtxGenerator::phi_
private

Definition at line 78 of file BetafuncEvtVtxGenerator.h.

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

bool BetafuncEvtVtxGenerator::readDB_
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().