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

Private Attributes

double alpha_
 
double falpha
 
double fbetastar
 
double femittance
 
CLHEP::RandGaussQ * fRandom
 
double fSigmaZ
 
double fTimeOffset
 
double fX0
 
double fY0
 
double fZ0
 
double phi_
 

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

Constructor & Destructor Documentation

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

Definition at line 36 of file BetafuncEvtVtxGenerator.cc.

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

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

Definition at line 61 of file BetafuncEvtVtxGenerator.cc.

References fRandom.

62 {
63  delete fRandom;
64 }
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 55 of file BetafuncEvtVtxGenerator.h.

References alpha_, and m.

double BetafuncEvtVtxGenerator::BetaFunction ( double  z,
double  z0 
)

beta function

Definition at line 95 of file BetafuncEvtVtxGenerator.cc.

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

Referenced by newVertex().

96 {
97  return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));
98 
99 }
double double double z
T sqrt(T t)
Definition: SSEVec.h:28
void BetafuncEvtVtxGenerator::betastar ( double  m = 0)
inline

set beta_star

Definition at line 58 of file BetafuncEvtVtxGenerator.h.

References fbetastar, and m.

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

emittance (no the normalized)

Definition at line 60 of file BetafuncEvtVtxGenerator.h.

References femittance, and m.

TMatrixD * BetafuncEvtVtxGenerator::GetInvLorentzBoost ( )
virtual

Implements BaseEvtVtxGenerator.

Definition at line 114 of file BetafuncEvtVtxGenerator.cc.

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

114  {
115 
116  //alpha_ = 0;
117  //phi_ = 142.e-6;
118 
119  if (boost_ != 0 ) return boost_;
120 
121  //boost_.ResizeTo(4,4);
122  //boost_ = new TMatrixD(4,4);
123  TMatrixD tmpboost(4,4);
124 
125  //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
126 
127  // Lorentz boost to frame where the collision is head-on
128  // phi is the half crossing angle in the plane ZS
129  // alpha is the angle to the S axis from the X axis in the XY plane
130 
131  tmpboost(0,0) = 1./cos(phi_);
132  tmpboost(0,1) = - cos(alpha_)*sin(phi_);
133  tmpboost(0,2) = - tan(phi_)*sin(phi_);
134  tmpboost(0,3) = - sin(alpha_)*sin(phi_);
135  tmpboost(1,0) = - cos(alpha_)*tan(phi_);
136  tmpboost(1,1) = 1.;
137  tmpboost(1,2) = cos(alpha_)*tan(phi_);
138  tmpboost(1,3) = 0.;
139  tmpboost(2,0) = 0.;
140  tmpboost(2,1) = - cos(alpha_)*sin(phi_);
141  tmpboost(2,2) = cos(phi_);
142  tmpboost(2,3) = - sin(alpha_)*sin(phi_);
143  tmpboost(3,0) = - sin(alpha_)*tan(phi_);
144  tmpboost(3,1) = 0.;
145  tmpboost(3,2) = sin(alpha_)*tan(phi_);
146  tmpboost(3,3) = 1.;
147 
148  tmpboost.Invert();
149  boost_ = new TMatrixD(tmpboost);
150  //boost_->Print();
151 
152  return boost_;
153 }
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 68 of file BetafuncEvtVtxGenerator.cc.

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

68  {
69 
70 
71  double X,Y,Z;
72 
73  double tmp_sigz = fRandom->fire(0., fSigmaZ);
74  Z = tmp_sigz + fZ0;
75 
76  double tmp_sigx = BetaFunction(Z,fZ0);
77  // need sqrt(2) for beamspot width relative to single beam width
78  tmp_sigx /= sqrt(2.0);
79  X = fRandom->fire(0.,tmp_sigx) + fX0; // + Z*fdxdz ;
80 
81  double tmp_sigy = BetaFunction(Z,fZ0);
82  // need sqrt(2) for beamspot width relative to single beam width
83  tmp_sigy /= sqrt(2.0);
84  Y = fRandom->fire(0.,tmp_sigy) + fY0; // + Z*fdydz;
85 
86  double tmp_sigt = fRandom->fire(0., fSigmaZ);
87  double T = tmp_sigt + fTimeOffset;
88 
89  if ( fVertex == 0 ) fVertex = new HepMC::FourVector();
90  fVertex->set(X,Y,Z,T);
91 
92  return fVertex;
93 }
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:28
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 53 of file BetafuncEvtVtxGenerator.h.

References m, and phi_.

void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 102 of file BetafuncEvtVtxGenerator.cc.

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

103 {
104  if (s>=0 ) {
105  fSigmaZ=s;
106  }
107  else {
108  throw cms::Exception("LogicError")
109  << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
110  << "Illegal resolution in Z (negative)";
111  }
112 }
string s
Definition: asciidump.py:422
void BetafuncEvtVtxGenerator::X0 ( double  m = 0)
inline

set mean in X in cm

Definition at line 46 of file BetafuncEvtVtxGenerator.h.

References fX0, and m.

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

set mean in Y in cm

Definition at line 48 of file BetafuncEvtVtxGenerator.h.

References fY0, and m.

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

set mean in Z in cm

Definition at line 50 of file BetafuncEvtVtxGenerator.h.

References fZ0, and m.

Member Data Documentation

double BetafuncEvtVtxGenerator::alpha_
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

Referenced by Alpha(), BetafuncEvtVtxGenerator(), and GetInvLorentzBoost().

double BetafuncEvtVtxGenerator::falpha
private

Definition at line 80 of file BetafuncEvtVtxGenerator.h.

double BetafuncEvtVtxGenerator::fbetastar
private

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::femittance
private

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fTimeOffset
private

Definition at line 81 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and newVertex().

double BetafuncEvtVtxGenerator::fX0
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fY0
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::fZ0
private

Definition at line 76 of file BetafuncEvtVtxGenerator.h.

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

double BetafuncEvtVtxGenerator::phi_
private

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

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