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 (CLHEP::HepRandomEngine *)
 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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 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, fSigmaZ, fTimeOffset, fX0, fY0, fZ0, edm::ParameterSet::getParameter(), phi_, and readDB_.

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

Definition at line 63 of file BetafuncEvtVtxGenerator.cc.

64 {
65 }
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 contentValuesFiles::m.

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

Reimplemented from edm::EDProducer.

Definition at line 67 of file BetafuncEvtVtxGenerator.cc.

References update().

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

Reimplemented from edm::EDProducer.

Definition at line 70 of file BetafuncEvtVtxGenerator.cc.

References update().

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

beta function

Definition at line 124 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by newVertex().

125 {
126  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
127 
128 }
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 contentValuesFiles::m.

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

emittance (no the normalized)

Definition at line 63 of file BetafuncEvtVtxGenerator.h.

References femittance, and contentValuesFiles::m.

TMatrixD * BetafuncEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Implements BaseEvtVtxGenerator.

Definition at line 143 of file BetafuncEvtVtxGenerator.cc.

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

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

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 97 of file BetafuncEvtVtxGenerator.cc.

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

97  {
98 
99 
100  double X,Y,Z;
101 
102  double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
103  Z = tmp_sigz + fZ0;
104 
105  double tmp_sigx = BetaFunction(Z,fZ0);
106  // need sqrt(2) for beamspot width relative to single beam width
107  tmp_sigx /= sqrt(2.0);
108  X = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigx) + fX0; // + Z*fdxdz ;
109 
110  double tmp_sigy = BetaFunction(Z,fZ0);
111  // need sqrt(2) for beamspot width relative to single beam width
112  tmp_sigy /= sqrt(2.0);
113  Y = CLHEP::RandGaussQ::shoot(engine, 0., tmp_sigy) + fY0; // + Z*fdydz;
114 
115  double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0., fSigmaZ);
116  double T = tmp_sigt + fTimeOffset;
117 
118  if ( fVertex == 0 ) fVertex = new HepMC::FourVector();
119  fVertex->set(X,Y,Z,T);
120 
121  return fVertex;
122 }
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 contentValuesFiles::m, and phi_.

void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 131 of file BetafuncEvtVtxGenerator.cc.

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

132 {
133  if (s>=0 ) {
134  fSigmaZ=s;
135  }
136  else {
137  throw cms::Exception("LogicError")
138  << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
139  << "Illegal resolution in Z (negative)";
140  }
141 }
void BetafuncEvtVtxGenerator::update ( const edm::EventSetup iEventSetup)
private

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

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

set mean in X in cm

Definition at line 49 of file BetafuncEvtVtxGenerator.h.

References fX0, and contentValuesFiles::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 contentValuesFiles::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 contentValuesFiles::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().

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 89 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().