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");
168 tmp_sigx /=
sqrt(2.0);
173 tmp_sigy /=
sqrt(2.0);
199 <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: "
200 <<
"Illegal resolution in Z (negative)";
212 TMatrixD tmpboost(4,4);
213 TMatrixD tmpboostZ(4,4);
214 TMatrixD tmpboostXYZ(4,4);
242 tmpboostZ(0,2)=-1.0*beta_*gama;
248 tmpboostZ(2,0)=-1.0*beta_*gama;
257 tmpboostXYZ=tmpboost*tmpboostZ;
262 boost_ =
new TMatrixD(tmpboostXYZ);
273 const HepMC::GenEvent* inev = input->GetEvent();
274 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
276 cout<<
"No Signal Process Vertex!"<<endl;
277 HepMC::GenEvent::particle_const_iterator pt=inev->particles_begin();
278 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
279 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
280 if(!genvtx)
cout<<
"No Gen Vertex!"<<endl;
281 if(pt == ptend)
cout<<
"End reached!"<<endl;
282 genvtx = (*pt)->production_vertex();
288 aX = genvtx->position().x();
289 aY = genvtx->position().y();
290 aZ = genvtx->position().z();
291 aT = genvtx->position().t();
308 aX = input->begin()->position().x() +
vtxOffset[0];
309 aY = input->begin()->position().y() +
vtxOffset[1];
310 aZ = input->begin()->position().z() +
vtxOffset[2];
313 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
338 auto_ptr<bool> NewProduct(
new bool(
true)) ;
339 evt.
put( NewProduct ,
"matchedVertex") ;
const double Z[kNumberCalorimeter]
nocap nocap const skelname & operator=(const skelname &)
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