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;
58 virtual HepMC::FourVector* newVertex() ;
60 virtual TMatrixD* GetInvLorentzBoost();
61 virtual HepMC::FourVector* getVertex(
edm::Event&);
62 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
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);
87 CLHEP::HepRandomEngine& getEngine();
122 fVertex(0), boost_(0), fTimeOffset(0), fEngine(0),
123 signalLabel(pset.getParameter<edm::
InputTag>(
"signalLabel")),
124 hiLabel(pset.getParameter<edm::
InputTag>(
"heavyIonLabel")),
125 useRecVertex(pset.exists(
"useRecVertex")?pset.getParameter<bool>(
"useRecVertex"):
false)
135 <<
"The BaseEvtVtxGenerator requires the RandomNumberGeneratorService\n"
136 "which is not present in the configuration file. You must add the service\n"
137 "in the configuration file or remove the modules that require it.";
140 CLHEP::HepRandomEngine& engine = rng->
getEngine();
143 produces<bool>(
"matchedVertex");
170 tmp_sigx /=
sqrt(2.0);
175 tmp_sigy /=
sqrt(2.0);
201 <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: "
202 <<
"Illegal resolution in Z (negative)";
214 TMatrixD tmpboost(4,4);
215 TMatrixD tmpboostZ(4,4);
216 TMatrixD tmpboostXYZ(4,4);
244 tmpboostZ(0,2)=-1.0*beta_*gama;
250 tmpboostZ(2,0)=-1.0*beta_*gama;
259 tmpboostXYZ=tmpboost*tmpboostZ;
264 boost_ =
new TMatrixD(tmpboostXYZ);
275 const HepMC::GenEvent* inev = input->GetEvent();
276 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
278 cout<<
"No Signal Process Vertex!"<<endl;
279 HepMC::GenEvent::particle_const_iterator
pt=inev->particles_begin();
280 HepMC::GenEvent::particle_const_iterator ptend=inev->particles_end();
281 while(!genvtx || ( genvtx->particles_in_size() == 1 && pt != ptend ) ){
282 if(!genvtx)
cout<<
"No Gen Vertex!"<<endl;
283 if(pt == ptend)
cout<<
"End reached!"<<endl;
284 genvtx = (*pt)->production_vertex();
290 aX = genvtx->position().x();
291 aY = genvtx->position().y();
292 aZ = genvtx->position().z();
293 aT = genvtx->position().t();
310 aX = input->begin()->position().x() +
vtxOffset[0];
311 aY = input->begin()->position().y() +
vtxOffset[1];
312 aZ = input->begin()->position().z() +
vtxOffset[2];
315 fVertex->set(10.0*aX,10.0*aY,10.0*aZ,0.0);
340 auto_ptr<bool> NewProduct(
new bool(
true)) ;
341 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
static std::string const input
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()
virtual void produce(edm::Event &, const edm::EventSetup &) override
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
return(e1-e2)*(e1-e2)+dp *dp
virtual HepMC::FourVector * getRecVertex(edm::Event &)
volatile std::atomic< bool > shutdown_flag false
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function