35 #include "CLHEP/Units/GlobalSystemOfUnits.h"
36 #include "CLHEP/Units/GlobalPhysicalConstants.h"
38 #include "HepMC/SimpleVector.h"
45 using namespace CLHEP;
57 virtual TMatrixD* GetInvLorentzBoost();
58 virtual HepMC::FourVector* getVertex(
edm::Event&);
59 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
65 void X0(
double m = 0) { fX0 =
m; }
67 void Y0(
double m = 0) { fY0 =
m; }
69 void Z0(
double m = 0) { fZ0 =
m; }
72 void Phi(
double m = 0) { phi_ =
m; }
75 void Beta(
double m = 0) { beta_ =
m; }
83 double BetaFunction(
double z,
double z0);
119 beta_ =
pset.getParameter<
double>(
"Beta");
122 if (
pset.exists(
"Alpha")) {
123 alpha_ =
pset.getParameter<
double>(
"Alpha") * radian;
124 phi_ =
pset.getParameter<
double>(
"Phi") * radian;
128 if (
pset.exists(
"vtxOffset"))
129 vtxOffset =
pset.getParameter<std::vector<double> >(
"vtxOffset");
131 produces<edm::HepMCProduct>();
149 throw cms::Exception(
"LogicError") <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: "
150 <<
"Illegal resolution in Z (negative)";
161 TMatrixD tmpboost(4, 4);
162 TMatrixD tmpboostZ(4, 4);
163 TMatrixD tmpboostXYZ(4, 4);
171 tmpboost(0, 0) = 1. /
cos(
phi_);
189 tmpboostZ(0, 0) = gama;
190 tmpboostZ(0, 1) = 0.;
191 tmpboostZ(0, 2) = -1.0 *
beta_ * gama;
192 tmpboostZ(0, 3) = 0.;
193 tmpboostZ(1, 0) = 0.;
194 tmpboostZ(1, 1) = 1.;
195 tmpboostZ(1, 2) = 0.;
196 tmpboostZ(1, 3) = 0.;
197 tmpboostZ(2, 0) = -1.0 *
beta_ * gama;
198 tmpboostZ(2, 1) = 0.;
199 tmpboostZ(2, 2) = gama;
200 tmpboostZ(2, 3) = 0.;
201 tmpboostZ(3, 0) = 0.;
202 tmpboostZ(3, 1) = 0.;
203 tmpboostZ(3, 2) = 0.;
204 tmpboostZ(3, 3) = 1.;
206 tmpboostXYZ = tmpboostZ * tmpboost;
207 tmpboostXYZ.Invert();
211 boost_ =
new TMatrixD(tmpboostXYZ);
225 if (!(bkg.isVtxGenApplied())) {
226 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
228 inev = bkg.GetEvent();
231 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
233 cout <<
"No Signal Process Vertex!" << endl;
234 HepMC::GenEvent::particle_const_iterator
pt = inev->particles_begin();
235 HepMC::GenEvent::particle_const_iterator ptend = inev->particles_end();
236 while (!genvtx || (genvtx->particles_in_size() == 1 &&
pt != ptend)) {
238 cout <<
"No Gen Vertex!" << endl;
240 cout <<
"End reached!" << endl;
241 genvtx = (*pt)->production_vertex();
245 double aX, aY, aZ, aT;
247 aX = genvtx->position().x();
248 aY = genvtx->position().y();
249 aZ = genvtx->position().z();
250 aT = genvtx->position().t();
253 fVertex =
new HepMC::FourVector();
270 fVertex =
new HepMC::FourVector();
271 fVertex->set(10.0 * aX, 10.0 * aY, 10.0 * aZ, 0.0);