36 #include "CLHEP/Random/RandGaussQ.h"
37 #include "CLHEP/Units/GlobalSystemOfUnits.h"
38 #include "CLHEP/Units/GlobalPhysicalConstants.h"
40 #include "HepMC/SimpleVector.h"
47 using namespace CLHEP;
59 virtual HepMC::FourVector* newVertex() ;
61 virtual TMatrixD* GetInvLorentzBoost();
62 virtual HepMC::FourVector* getVertex(
edm::Event&);
63 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
66 void sigmaZ(
double s=1.0);
69 void X0(
double m=0) { fX0=
m; }
71 void Y0(
double m=0) { fY0=
m; }
73 void Z0(
double m=0) { fZ0=
m; }
76 void Phi(
double m=0) { phi_=
m; }
87 double BetaFunction(
double z,
double z0);
88 CLHEP::HepRandomEngine& getEngine();
123 fVertex(0), boost_(0), fTimeOffset(0), fEngine(0),
124 signalLabel(pset.getParameter<edm::
InputTag>(
"signalLabel")),
125 hiLabel(pset.getParameter<edm::
InputTag>(
"heavyIonLabel")),
126 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
136 <<
"The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
137 "which is not present in the configuration file. You must add the service\n"
138 "in the configuration file or remove the modules that require it.";
141 CLHEP::HepRandomEngine& engine = rng->
getEngine();
144 produces<bool>(
"matchedVertex");
171 tmp_sigx /=
sqrt(2.0);
176 tmp_sigy /=
sqrt(2.0);
202 <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: "
203 <<
"Illegal resolution in Z (negative)";
215 TMatrixD tmpboost(4,4);
216 TMatrixD tmpboostZ(4,4);
217 TMatrixD tmpboostXYZ(4,4);
245 tmpboostZ(0,2)=-1.0*beta_*gama;
251 tmpboostZ(2,0)=-1.0*beta_*gama;
260 tmpboostXYZ=tmpboost*tmpboostZ;
265 boost_ =
new TMatrixD(tmpboostXYZ);
276 const HepMC::GenEvent* inev = input->GetEvent();
277 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
279 cout<<
"No Signal Process Vertex!"<<endl;
280 HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin();
281 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
282 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
283 if(!genvtx)
cout<<
"No Gen Vertex!"<<endl;
284 if(pt == ptend)
cout<<
"End reached!"<<endl;
285 genvtx = (*pt)->production_vertex();
291 aX = genvtx->position().x();
292 aY = genvtx->position().y();
293 aZ = genvtx->position().z();
294 aT = genvtx->position().t();
311 aX = input->begin()->position().x() +
vtxOffset[0];
312 aY = input->begin()->position().y() +
vtxOffset[1];
313 aZ = input->begin()->position().z() +
vtxOffset[2];
316 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
341 auto_ptr<bool> NewProduct(
new bool(
true)) ;
342 evt.
put( NewProduct ,
"matchedVertex") ;
const double Z[kNumberCalorimeter]
T getParameter(std::string const &) const
CLHEP::HepRandomEngine * fEngine
virtual ~MixBoostEvtVtxGenerator()
CLHEP::RandGaussQ * fRandom
HepMC::FourVector * fVertex
void Z0(double m=0)
set mean in Z in cm
std::vector< double > vtxOffset
#define DEFINE_FWK_MODULE(type)
Sin< T >::type sin(const T &t)
void emittance(double m=0)
emittance (no the normalized)
void X0(double m=0)
set mean in X in cm
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::InputTag signalLabel
void sigmaZ(double s=1.0)
set resolution in Z in cm
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
CLHEP::HepRandomEngine & getEngine()
Cos< T >::type cos(const T &t)
virtual HepMC::FourVector * newVertex()
return a new event vertex
edm::InputTag sourceLabel
virtual TMatrixD * GetInvLorentzBoost()
Tan< T >::type tan(const T &t)
MixBoostEvtVtxGenerator(const edm::ParameterSet &p)
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
void Alpha(double m=0)
angle between crossing plane and horizontal plane
void Phi(double m=0)
set half crossing angle
void betastar(double m=0)
set beta_star
void Y0(double m=0)
set mean in Y in cm
virtual void produce(edm::Event &, const edm::EventSetup &)
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function