35 #include <CLHEP/Units/SystemOfUnits.h> 36 #include <CLHEP/Units/GlobalPhysicalConstants.h> 38 #include "HepMC/SimpleVector.h" 45 using namespace CLHEP;
61 virtual TMatrixD* GetInvLorentzBoost();
62 virtual HepMC::FourVector* getVertex(
edm::Event&);
63 virtual HepMC::FourVector* getRecVertex(
edm::Event&);
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; }
79 void Beta(
double m = 0) { beta_ =
m; }
87 double BetaFunction(
double z,
double z0);
118 beta_ =
pset.getParameter<
double>(
"Beta");
121 if (
pset.exists(
"Alpha")) {
122 alpha_ =
pset.getParameter<
double>(
"Alpha") * radian;
123 phi_ =
pset.getParameter<
double>(
"Phi") * radian;
127 if (
pset.exists(
"vtxOffset"))
128 vtxOffset =
pset.getParameter<std::vector<double> >(
"vtxOffset");
130 produces<edm::HepMCProduct>();
148 throw cms::Exception(
"LogicError") <<
"Error in MixBoostEvtVtxGenerator::sigmaZ: " 149 <<
"Illegal resolution in Z (negative)";
160 TMatrixD tmpboost(4, 4);
161 TMatrixD tmpboostZ(4, 4);
162 TMatrixD tmpboostXYZ(4, 4);
170 tmpboost(0, 0) = 1. /
cos(
phi_);
188 tmpboostZ(0, 0) = gama;
189 tmpboostZ(0, 1) = 0.;
190 tmpboostZ(0, 2) = -1.0 *
beta_ * gama;
191 tmpboostZ(0, 3) = 0.;
192 tmpboostZ(1, 0) = 0.;
193 tmpboostZ(1, 1) = 1.;
194 tmpboostZ(1, 2) = 0.;
195 tmpboostZ(1, 3) = 0.;
196 tmpboostZ(2, 0) = -1.0 *
beta_ * gama;
197 tmpboostZ(2, 1) = 0.;
198 tmpboostZ(2, 2) = gama;
199 tmpboostZ(2, 3) = 0.;
200 tmpboostZ(3, 0) = 0.;
201 tmpboostZ(3, 1) = 0.;
202 tmpboostZ(3, 2) = 0.;
203 tmpboostZ(3, 3) = 1.;
205 tmpboostXYZ = tmpboostZ * tmpboost;
206 tmpboostXYZ.Invert();
210 boost_ =
new TMatrixD(tmpboostXYZ);
223 if (!(bkg.isVtxGenApplied())) {
224 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
226 inev = bkg.GetEvent();
229 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
231 cout <<
"No Signal Process Vertex!" << endl;
232 HepMC::GenEvent::particle_const_iterator
pt = inev->particles_begin();
233 HepMC::GenEvent::particle_const_iterator ptend = inev->particles_end();
234 while (!genvtx || (genvtx->particles_in_size() == 1 &&
pt != ptend)) {
236 cout <<
"No Gen Vertex!" << endl;
238 cout <<
"End reached!" << endl;
239 genvtx = (*pt)->production_vertex();
243 double aX, aY, aZ, aT;
245 aX = genvtx->position().x();
246 aY = genvtx->position().y();
247 aZ = genvtx->position().z();
248 aT = genvtx->position().t();
251 fVertex =
new HepMC::FourVector();
267 fVertex =
new HepMC::FourVector();
268 fVertex->set(10.0 * aX, 10.0 * aY, 10.0 * aZ, 0.0);
Basic3DVector & operator=(const Basic3DVector &)=default
Assignment operator.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
HepMC::FourVector * fVertex
void Z0(double m=0)
set mean in Z in cm
const edm::EDGetTokenT< CrossingFrame< HepMCProduct > > mixLabel
std::vector< double > vtxOffset
Sin< T >::type sin(const T &t)
void emittance(double m=0)
emittance (no the normalized)
T const * product() const
void X0(double m=0)
set mean in X in cm
std::vector< Vertex > VertexCollection
~MixBoostEvtVtxGenerator() override
static std::string const input
const edm::EDGetTokenT< reco::VertexCollection > vtxLabel
void sigmaZ(double s=1.0)
set resolution in Z in cm
void produce(edm::Event &, const edm::EventSetup &) override
return a new event vertex
const edm::EDGetTokenT< HepMCProduct > signalLabel
Cos< T >::type cos(const T &t)
virtual TMatrixD * GetInvLorentzBoost()
Tan< T >::type tan(const T &t)
MixBoostEvtVtxGenerator(const edm::ParameterSet &p)
#define DEFINE_FWK_MODULE(type)
const HepMC::GenEvent * GetEvent() 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
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function