35 #include "CLHEP/Random/RandGaussQ.h"
36 #include "CLHEP/Units/GlobalSystemOfUnits.h"
37 #include "CLHEP/Units/GlobalPhysicalConstants.h"
39 #include "HepMC/SimpleVector.h"
46 using namespace CLHEP;
49 class HepRandomEngine;
59 virtual HepMC::FourVector* newVertex(CLHEP::HepRandomEngine*) ;
61 virtual TMatrixD* GetInvLorentzBoost();
65 void sigmaZ(
double s=1.0);
68 void X0(
double m=0) { fX0=
m; }
70 void Y0(
double m=0) { fY0=
m; }
72 void Z0(
double m=0) { fZ0=
m; }
75 void Phi(
double m=0) { phi_=
m; }
86 double BetaFunction(
double z,
double z0);
114 fVertex(0), boost_(0), fTimeOffset(0),
116 verbosity_(p.getUntrackedParameter<bool>(
"verbosity",
false))
130 <<
"Error in BetaBoostEvtVtxGenerator: "
131 <<
"Illegal resolution in Z (SigmaZ is negative)";
134 produces<edm::HepMCProduct>();
150 double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
155 tmp_sigx /=
sqrt(2.0);
156 X = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigx) +
fX0;
160 tmp_sigy /=
sqrt(2.0);
161 Y = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigy) +
fY0;
163 double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
186 <<
"Error in BetaBoostEvtVtxGenerator::sigmaZ: "
187 <<
"Illegal resolution in Z (negative)";
199 TMatrixD tmpboost(4,4);
200 TMatrixD tmpboostZ(4,4);
201 TMatrixD tmpboostXYZ(4,4);
229 tmpboostZ(0,2)=-1.0*beta_*gama;
235 tmpboostZ(2,0)=-1.0*beta_*gama;
244 tmpboostXYZ=tmpboostZ*tmpboost;
245 tmpboostXYZ.Invert();
249 boost_ =
new TMatrixD(tmpboostXYZ);
260 <<
"Attempt to get a random engine when the RandomNumberGeneratorService is not configured.\n"
261 "You must configure the service if you want an engine.\n";
269 HepMC::GenEvent* genevt =
new HepMC::GenEvent(*HepUnsmearedMCEvt->GetEvent());
274 HepMCEvt->applyVtxGen(
newVertex(engine) ) ;
const double Z[kNumberCalorimeter]
T getParameter(std::string const &) const
void Y0(double m=0)
set mean in Y in cm
void emittance(double m=0)
emittance (no the normalized)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)
return a new event vertex
Sin< T >::type sin(const T &t)
edm::EDGetTokenT< HepMCProduct > sourceLabel
void X0(double m=0)
set mean in X in cm
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
void sigmaZ(double s=1.0)
set resolution in Z in cm
HepMC::FourVector * fVertex
BetaBoostEvtVtxGenerator(const edm::ParameterSet &p)
void Phi(double m=0)
set half crossing angle
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
virtual void produce(edm::Event &, const edm::EventSetup &) override
void betastar(double m=0)
set beta_star
double BetaFunction(double z, double z0)
beta function
void Alpha(double m=0)
angle between crossing plane and horizontal plane
virtual ~BetaBoostEvtVtxGenerator()
return(e1-e2)*(e1-e2)+dp *dp
StreamID streamID() const
volatile std::atomic< bool > shutdown_flag false
void Z0(double m=0)
set mean in Z in cm
virtual TMatrixD * GetInvLorentzBoost()