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

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

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

  readDB_=p.getParameter<bool>("readDB");
  if (!readDB_){
    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 69 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 59 of file BetafuncEvtVtxGenerator.h.

References alpha_, and m.

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

                                                                                                       {
  update(iEventSetup);
}
void BetafuncEvtVtxGenerator::beginRun ( edm::Run ,
const edm::EventSetup iEventSetup 
) [virtual]

Reimplemented from BaseEvtVtxGenerator.

Definition at line 77 of file BetafuncEvtVtxGenerator.cc.

References update().

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

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

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

set beta_star

Definition at line 62 of file BetafuncEvtVtxGenerator.h.

References fbetastar, and m.

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

                                                      {

        //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 104 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 57 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 138 of file BetafuncEvtVtxGenerator.cc.

References Exception, fSigmaZ, and alignCSCRings::s.

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

                                                                    {
  if (readDB_ &&  parameterWatcher_.check(iEventSetup)){
    edm::ESHandle< SimBeamSpotObjects > beamhandle;
    iEventSetup.get<SimBeamSpotObjectsRcd>().get(beamhandle);

    fX0=beamhandle->fX0;
    fY0=beamhandle->fY0;
    fZ0=beamhandle->fZ0;
    //    falpha=beamhandle->fAlpha;
    alpha_=beamhandle->fAlpha;
    phi_=beamhandle->fPhi;
    fSigmaZ=beamhandle->fSigmaZ;
    fTimeOffset=beamhandle->fTimeOffset;
    fbetastar=beamhandle->fbetastar;
    femittance=beamhandle->femittance;

    //re-initialize the boost matrix
    delete boost_;
    boost_=0;
  }
}
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.

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

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

{ fZ0=m; }

Member Data Documentation

Definition at line 85 of file BetafuncEvtVtxGenerator.h.

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

Definition at line 85 of file BetafuncEvtVtxGenerator.h.

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

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

Definition at line 83 of file BetafuncEvtVtxGenerator.h.

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

Reimplemented from BaseEvtVtxGenerator.

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

Definition at line 92 of file BetafuncEvtVtxGenerator.h.

Referenced by update().

Definition at line 79 of file BetafuncEvtVtxGenerator.h.

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

Definition at line 77 of file BetafuncEvtVtxGenerator.h.

Referenced by BetafuncEvtVtxGenerator(), and update().