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);
122 if (pset.
exists(
"Alpha")) {
128 if (pset.
exists(
"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();
265 aX = input->begin()->position().x() +
vtxOffset[0];
266 aY = input->begin()->position().y() +
vtxOffset[1];
267 aZ = input->begin()->position().z() +
vtxOffset[2];
270 fVertex =
new HepMC::FourVector();
271 fVertex->set(10.0 * aX, 10.0 * aY, 10.0 * aZ, 0.0);
T getParameter(std::string const &) const
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
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
collection of Vertex objects
~MixBoostEvtVtxGenerator() override
static std::string const input
void sigmaZ(double s=1.0)
set resolution in Z in cm
#define DEFINE_FWK_MODULE(type)
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
const HepMC::GenEvent * GetEvent() const
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
virtual HepMC::FourVector * getRecVertex(edm::Event &)
virtual HepMC::FourVector * getVertex(edm::Event &)
double BetaFunction(double z, double z0)
beta function