35 #include "CLHEP/Units/GlobalSystemOfUnits.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);
117 useRecVertex(pset.exists(
"useRecVertex") ? pset.getParameter<bool>(
"useRecVertex") :
false) {
121 if (pset.
exists(
"Alpha")) {
127 if (pset.
exists(
"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);
224 if (!(bkg.isVtxGenApplied())) {
225 throw cms::Exception(
"MatchVtx") <<
"Input background does not have smeared vertex!" << endl;
227 inev = bkg.GetEvent();
230 HepMC::GenVertex* genvtx = inev->signal_process_vertex();
232 cout <<
"No Signal Process Vertex!" << endl;
233 HepMC::GenEvent::particle_const_iterator
pt = inev->particles_begin();
234 HepMC::GenEvent::particle_const_iterator ptend = inev->particles_end();
235 while (!genvtx || (genvtx->particles_in_size() == 1 && pt != ptend)) {
237 cout <<
"No Gen Vertex!" << endl;
239 cout <<
"End reached!" << endl;
240 genvtx = (*pt)->production_vertex();
244 double aX, aY, aZ, aT;
246 aX = genvtx->position().x();
247 aY = genvtx->position().y();
248 aZ = genvtx->position().z();
249 aT = genvtx->position().t();
252 fVertex =
new HepMC::FourVector();
264 aX = input->begin()->position().x() +
vtxOffset[0];
265 aY = input->begin()->position().y() +
vtxOffset[1];
266 aZ = input->begin()->position().z() +
vtxOffset[2];
269 fVertex =
new HepMC::FourVector();
270 fVertex->set(10.0 * aX, 10.0 * aY, 10.0 * aZ, 0.0);
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< HepMCProduct > signalLabel
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
std::vector< Vertex > VertexCollection
~MixBoostEvtVtxGenerator() override
static std::string const input
void sigmaZ(double s=1.0)
set resolution in Z in cm
edm::EDGetTokenT< reco::VertexCollection > vtxLabel
void produce(edm::Event &, const edm::EventSetup &) override
return a new event vertex
edm::EDGetTokenT< CrossingFrame< HepMCProduct > > mixLabel
Cos< T >::type cos(const T &t)
virtual TMatrixD * GetInvLorentzBoost()
Tan< T >::type tan(const T &t)
MixBoostEvtVtxGenerator(const edm::ParameterSet &p)
void Alpha(double m=0)
angle between crossing plane and horizontal plane
void Phi(double m=0)
set half crossing angle
T const * product() const
void betastar(double m=0)
set beta_star
void Y0(double m=0)
set mean in Y in cm
T getParameter(std::string const &) const
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function