CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GaussEvtVtxGenerator Class Reference

#include <GaussEvtVtxGenerator.h>

Inheritance diagram for GaussEvtVtxGenerator:
BaseEvtVtxGenerator edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 GaussEvtVtxGenerator (const edm::ParameterSet &p)
virtual TMatrixD * GetInvLorentzBoost ()
void meanX (double m=0)
 set mean in X in cm
void meanY (double m=0)
 set mean in Y in cm
void meanZ (double m=0)
 set mean in Z in cm
virtual HepMC::FourVector * newVertex ()
 return a new event vertex
void sigmaX (double s=1.0)
 set resolution in X in cm
void sigmaY (double s=1.0)
 set resolution in Y in cm
void sigmaZ (double s=1.0)
 set resolution in Z in cm
virtual ~GaussEvtVtxGenerator ()

Private Member Functions

 GaussEvtVtxGenerator (const GaussEvtVtxGenerator &p)
GaussEvtVtxGeneratoroperator= (const GaussEvtVtxGenerator &rhs)

Private Attributes

double fMeanX
double fMeanY
double fMeanZ
CLHEP::RandGaussQ * fRandom
double fSigmaX
double fSigmaY
double fSigmaZ
double fTimeOffset

Detailed Description

Definition at line 17 of file GaussEvtVtxGenerator.h.


Constructor & Destructor Documentation

GaussEvtVtxGenerator::GaussEvtVtxGenerator ( const edm::ParameterSet p)

Definition at line 15 of file GaussEvtVtxGenerator.cc.

References Exception, fMeanX, fMeanY, fMeanZ, fRandom, fSigmaX, fSigmaY, fSigmaZ, fTimeOffset, BaseEvtVtxGenerator::getEngine(), and edm::ParameterSet::getParameter().

: BaseEvtVtxGenerator(p)
{ 
  
  fRandom = new CLHEP::RandGaussQ(getEngine());
  
  fMeanX =  p.getParameter<double>("MeanX")*cm;
  fMeanY =  p.getParameter<double>("MeanY")*cm;
  fMeanZ =  p.getParameter<double>("MeanZ")*cm;
  fSigmaX = p.getParameter<double>("SigmaX")*cm;
  fSigmaY = p.getParameter<double>("SigmaY")*cm;
  fSigmaZ = p.getParameter<double>("SigmaZ")*cm;
  fTimeOffset = p.getParameter<double>("TimeOffset")*ns*c_light;
  
  if (fSigmaX < 0) {
    throw cms::Exception("Configuration")
      << "Error in GaussEvtVtxGenerator: "
      << "Illegal resolution in X (SigmaX is negative)";
  }
  if (fSigmaY < 0) {
    throw cms::Exception("Configuration")
      << "Error in GaussEvtVtxGenerator: "
      << "Illegal resolution in Y (SigmaY is negative)";
  }
  if (fSigmaZ < 0) {
    throw cms::Exception("Configuration")
      << "Error in GaussEvtVtxGenerator: "
      << "Illegal resolution in Z (SigmaZ is negative)";
  }
}
GaussEvtVtxGenerator::~GaussEvtVtxGenerator ( ) [virtual]

Definition at line 46 of file GaussEvtVtxGenerator.cc.

References fRandom.

{
  delete fRandom; 
}
GaussEvtVtxGenerator::GaussEvtVtxGenerator ( const GaussEvtVtxGenerator p) [private]

Copy constructor


Member Function Documentation

virtual TMatrixD* GaussEvtVtxGenerator::GetInvLorentzBoost ( ) [inline, virtual]

Implements BaseEvtVtxGenerator.

Definition at line 27 of file GaussEvtVtxGenerator.h.

                                         {
          return 0;
  }
void GaussEvtVtxGenerator::meanX ( double  m = 0) [inline]

set mean in X in cm

Definition at line 40 of file GaussEvtVtxGenerator.h.

References fMeanX, and m.

{ fMeanX=m; }
void GaussEvtVtxGenerator::meanY ( double  m = 0) [inline]

set mean in Y in cm

Definition at line 42 of file GaussEvtVtxGenerator.h.

References fMeanY, and m.

{ fMeanY=m; }
void GaussEvtVtxGenerator::meanZ ( double  m = 0) [inline]

set mean in Z in cm

Definition at line 44 of file GaussEvtVtxGenerator.h.

References fMeanZ, and m.

{ fMeanZ=m; }
HepMC::FourVector * GaussEvtVtxGenerator::newVertex ( ) [virtual]

return a new event vertex

Implements BaseEvtVtxGenerator.

Definition at line 53 of file GaussEvtVtxGenerator.cc.

References fMeanX, fMeanY, fMeanZ, fRandom, fSigmaX, fSigmaY, fSigmaZ, fTimeOffset, BaseEvtVtxGenerator::fVertex, X, and Gflash::Z.

                                                 {
  double X,Y,Z;
  X = fSigmaX * fRandom->fire() + fMeanX ;
  Y = fSigmaY * fRandom->fire() + fMeanY ;
  Z = fSigmaZ * fRandom->fire() + fMeanZ ;

  //if (fVertex == 0) fVertex = new CLHEP::Hep3Vector;
  if ( fVertex == 0 ) fVertex = new HepMC::FourVector() ;
  fVertex->set( X, Y, Z, fTimeOffset ) ;

  return fVertex;
}
GaussEvtVtxGenerator& GaussEvtVtxGenerator::operator= ( const GaussEvtVtxGenerator rhs) [private]

Copy assignment operator

void GaussEvtVtxGenerator::sigmaX ( double  s = 1.0)

set resolution in X in cm

Definition at line 66 of file GaussEvtVtxGenerator.cc.

References Exception, fSigmaX, and asciidump::s.

{ 
  if (s>=0 ) {
    fSigmaX=s; 
  }
  else {
    throw cms::Exception("LogicError")
      << "Error in GaussEvtVtxGenerator::sigmaX: "
      << "Illegal resolution in X (negative)";
  }
}
void GaussEvtVtxGenerator::sigmaY ( double  s = 1.0)

set resolution in Y in cm

Definition at line 78 of file GaussEvtVtxGenerator.cc.

References Exception, fSigmaY, and asciidump::s.

{ 
  if (s>=0 ) {
    fSigmaY=s; 
  }
  else {
    throw cms::Exception("LogicError")
      << "Error in GaussEvtVtxGenerator::sigmaY: "
      << "Illegal resolution in Y (negative)";
  }
}
void GaussEvtVtxGenerator::sigmaZ ( double  s = 1.0)

set resolution in Z in cm

Definition at line 90 of file GaussEvtVtxGenerator.cc.

References Exception, fSigmaZ, and asciidump::s.

{ 
  if (s>=0 ) {
    fSigmaZ=s; 
  }
  else {
    throw cms::Exception("LogicError")
      << "Error in GaussEvtVtxGenerator::sigmaZ: "
      << "Illegal resolution in Z (negative)";
  }
}

Member Data Documentation

double GaussEvtVtxGenerator::fMeanX [private]

Definition at line 53 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), meanX(), and newVertex().

double GaussEvtVtxGenerator::fMeanY [private]

Definition at line 53 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), meanY(), and newVertex().

double GaussEvtVtxGenerator::fMeanZ [private]

Definition at line 53 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), meanZ(), and newVertex().

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

Definition at line 54 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), newVertex(), and ~GaussEvtVtxGenerator().

Definition at line 52 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), newVertex(), and sigmaX().

Definition at line 52 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), newVertex(), and sigmaY().

Definition at line 52 of file GaussEvtVtxGenerator.h.

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

Reimplemented from BaseEvtVtxGenerator.

Definition at line 55 of file GaussEvtVtxGenerator.h.

Referenced by GaussEvtVtxGenerator(), and newVertex().