33 #include "CLHEP/Random/RandGaussQ.h"
34 #include "CLHEP/Units/GlobalSystemOfUnits.h"
35 #include "CLHEP/Units/GlobalPhysicalConstants.h"
37 #include "HepMC/SimpleVector.h"
44 using namespace CLHEP;
47 class HepRandomEngine;
57 virtual HepMC::FourVector* newVertex(CLHEP::HepRandomEngine*) ;
59 virtual TMatrixD* GetInvLorentzBoost();
63 void sigmaZ(
double s=1.0);
66 void X0(
double m=0) { fX0=
m; }
68 void Y0(
double m=0) { fY0=
m; }
70 void Z0(
double m=0) { fZ0=
m; }
73 void Phi(
double m=0) { phi_=
m; }
84 double BetaFunction(
double z,
double z0);
112 fVertex(0), boost_(0), fTimeOffset(0),
113 sourceLabel(p.getParameter<edm::
InputTag>(
"src")),
114 verbosity_(p.getUntrackedParameter<bool>(
"verbosity",
false))
128 <<
"Error in BetaBoostEvtVtxGenerator: "
129 <<
"Illegal resolution in Z (SigmaZ is negative)";
148 double tmp_sigz = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
153 tmp_sigx /=
sqrt(2.0);
154 X = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigx) +
fX0;
158 tmp_sigy /=
sqrt(2.0);
159 Y = CLHEP::RandGaussQ::shoot(engine, 0.0, tmp_sigy) +
fY0;
161 double tmp_sigt = CLHEP::RandGaussQ::shoot(engine, 0.0,
fSigmaZ);
184 <<
"Error in BetaBoostEvtVtxGenerator::sigmaZ: "
185 <<
"Illegal resolution in Z (negative)";
197 TMatrixD tmpboost(4,4);
198 TMatrixD tmpboostZ(4,4);
199 TMatrixD tmpboostXYZ(4,4);
227 tmpboostZ(0,2)=-1.0*beta_*gama;
233 tmpboostZ(2,0)=-1.0*beta_*gama;
242 tmpboostXYZ=tmpboostZ*tmpboost;
243 tmpboostXYZ.Invert();
247 boost_ =
new TMatrixD(tmpboostXYZ);
258 <<
"Attempt to get a random engine when the RandomNumberGeneratorService is not configured.\n"
259 "You must configure the service if you want an engine.\n";
269 HepMCEvt->applyVtxGen(
newVertex(engine) ) ;
276 auto_ptr<bool> NewProduct(
new bool(
true)) ;
277 evt.
put( NewProduct ) ;
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)
#define DEFINE_FWK_MODULE(type)
virtual HepMC::FourVector * newVertex(CLHEP::HepRandomEngine *)
return a new event vertex
Sin< T >::type sin(const T &t)
void X0(double m=0)
set mean in X in cm
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
double BetaFunction(double z, double z0)
beta function
void Alpha(double m=0)
angle between crossing plane and horizontal plane
virtual ~BetaBoostEvtVtxGenerator()
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &) const =0
Use this engine in event methods.
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()
edm::InputTag sourceLabel