CMS 3D CMS Logo

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

List of all members.

Public Member Functions

void Alpha (double m=0)
 angle between crossing plane and horizontal plane
 BetafuncEvtVtxGenerator (const edm::ParameterSet &p)
double BetaFunction (double z, double z0)
 beta function
void betastar (double m=0)
 set beta_star
void emittance (double m=0)
 emittance (no the normalized)
virtual TMatrixD * GetInvLorentzBoost ()
virtual HepMC::FourVector * newVertex ()
 return a new event vertex
void Phi (double m=0)
 set half crossing angle
void sigmaZ (double s=1.0)
 set resolution in Z in cm
void X0 (double m=0)
 set mean in X in cm
void Y0 (double m=0)
 set mean in Y in cm
void Z0 (double m=0)
 set mean in Z in cm
virtual ~BetafuncEvtVtxGenerator ()

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_

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

: BaseEvtVtxGenerator(p)
{ 
  
  fRandom = new CLHEP::RandGaussQ(getEngine());

  fX0 =        p.getParameter<double>("X0")*cm;
  fY0 =        p.getParameter<double>("Y0")*cm;
  fZ0 =        p.getParameter<double>("Z0")*cm;
  fSigmaZ =    p.getParameter<double>("SigmaZ")*cm;
  alpha_ =     p.getParameter<double>("Alpha")*radian;
  phi_ =       p.getParameter<double>("Phi")*radian;
  fbetastar =  p.getParameter<double>("BetaStar")*cm;
  femittance = p.getParameter<double>("Emittance")*cm; // this is not the normalized emittance
  fTimeOffset = p.getParameter<double>("TimeOffset")*ns*c_light; // HepMC time units are mm
 
  if (fSigmaZ <= 0) {
          throw cms::Exception("Configuration")
                  << "Error in BetafuncEvtVtxGenerator: "
                  << "Illegal resolution in Z (SigmaZ is negative)";
  }

  
}
BetafuncEvtVtxGenerator::~BetafuncEvtVtxGenerator ( ) [virtual]

Definition at line 61 of file BetafuncEvtVtxGenerator.cc.

References fRandom.

{
    delete fRandom; 
}
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.

{ alpha_=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().

{
        return sqrt(femittance*(fbetastar+(((z-z0)*(z-z0))/fbetastar)));

}
void BetafuncEvtVtxGenerator::betastar ( double  m = 0) [inline]

set beta_star

Definition at line 58 of file BetafuncEvtVtxGenerator.h.

References fbetastar, and m.

{ fbetastar=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().

                                                      {

        //alpha_ = 0;
        //phi_ = 142.e-6;
        
        if (boost_ != 0 ) return boost_;
        
        //boost_.ResizeTo(4,4);
        //boost_ = new TMatrixD(4,4);
        TMatrixD tmpboost(4,4);
        
        //if ( (alpha_ == 0) && (phi_==0) ) { boost_->Zero(); return boost_; }
        
        // Lorentz boost to frame where the collision is head-on
        // phi is the half crossing angle in the plane ZS
        // alpha is the angle to the S axis from the X axis in the XY plane
        
        tmpboost(0,0) = 1./cos(phi_);
        tmpboost(0,1) = - cos(alpha_)*sin(phi_);
        tmpboost(0,2) = - tan(phi_)*sin(phi_);
        tmpboost(0,3) = - sin(alpha_)*sin(phi_);
        tmpboost(1,0) = - cos(alpha_)*tan(phi_);
        tmpboost(1,1) = 1.;
        tmpboost(1,2) = cos(alpha_)*tan(phi_);
        tmpboost(1,3) = 0.;
        tmpboost(2,0) = 0.;
        tmpboost(2,1) = - cos(alpha_)*sin(phi_);
        tmpboost(2,2) = cos(phi_);
        tmpboost(2,3) = - sin(alpha_)*sin(phi_);
        tmpboost(3,0) = - sin(alpha_)*tan(phi_);
        tmpboost(3,1) = 0.;
        tmpboost(3,2) = sin(alpha_)*tan(phi_);
        tmpboost(3,3) = 1.;

        tmpboost.Invert();
        boost_ = new TMatrixD(tmpboost);
        //boost_->Print();
        
        return boost_;
}
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.

                                                    {

        
        double X,Y,Z;
        
        double tmp_sigz = fRandom->fire(0., fSigmaZ);
        Z = tmp_sigz + fZ0;

        double tmp_sigx = BetaFunction(Z,fZ0); 
        // need sqrt(2) for beamspot width relative to single beam width
        tmp_sigx /= sqrt(2.0);
        X = fRandom->fire(0.,tmp_sigx) + fX0; // + Z*fdxdz ;

        double tmp_sigy = BetaFunction(Z,fZ0);
        // need sqrt(2) for beamspot width relative to single beam width
        tmp_sigy /= sqrt(2.0);
        Y = fRandom->fire(0.,tmp_sigy) + fY0; // + Z*fdydz;

        double tmp_sigt = fRandom->fire(0., fSigmaZ);
        double T = tmp_sigt + fTimeOffset; 

        if ( fVertex == 0 ) fVertex = new HepMC::FourVector();
        fVertex->set(X,Y,Z,T);
                
        return fVertex;
}
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_.

{ phi_=m; }
void BetafuncEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 102 of file BetafuncEvtVtxGenerator.cc.

References Exception, fSigmaZ, and asciidump::s.

{ 
        if (s>=0 ) {
                fSigmaZ=s; 
        }
        else {
                throw cms::Exception("LogicError")
                        << "Error in BetafuncEvtVtxGenerator::sigmaZ: "
                        << "Illegal resolution in Z (negative)";
        }
}
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.

{ fX0=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.

{ fY0=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.

{ fZ0=m; }

Member Data Documentation

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

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

Definition at line 80 of file BetafuncEvtVtxGenerator.h.

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

CLHEP::RandGaussQ* BetafuncEvtVtxGenerator::fRandom [private]

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

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

Reimplemented from BaseEvtVtxGenerator.

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

Definition at line 73 of file BetafuncEvtVtxGenerator.h.

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