3 #include <Math/CylindricalEta3D.h> 4 #include <Math/Polar3D.h> 5 #include <Math/Cartesian3D.h> 6 #include <Math/DisplacementVector3D.h> 7 #include <Math/Functions.h> 32 map<string, Parametrization>::const_iterator itP = parMaps.find(name);
33 if (itP == parMaps.end()) {
34 throw cms::Exception(
"StringResolutionProvider") <<
"Bad parametrization '" << name.c_str() <<
"'";
66 return "EScaledMomDev";
79 ROOT::Math::CylindricalEta3D<double>
converter;
81 switch (parametrization) {
87 sqrt(parameters[0] * parameters[0] + parameters[1] * parameters[1] +
88 parameters[2] * parameters[2] + parameters[3] * parameters[3]));
89 ret.SetM(parameters[3]);
95 sqrt(parameters[0] * parameters[0] + parameters[1] * parameters[1] +
96 parameters[2] * parameters[2] + initialP4.mass() * initialP4.mass()));
97 ret.SetM(initialP4.mass());
104 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
105 ret.SetCoordinates(converter.Rho(), converter.Eta(), parameters[2], parameters[3]);
108 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
109 ret.SetCoordinates(converter.Rho(), converter.Eta(), parameters[2], initialP4.mass());
112 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
113 m2 = -parameters[0] * parameters[0] + parameters[3] * parameters[3];
114 ret.SetCoordinates(converter.Rho(), converter.Eta(), parameters[2], (m2 > 0 ?
sqrt(m2) : 0.0));
117 converter = ROOT::Math::Polar3D<double>(1.0 / parameters[0], parameters[1], 0);
118 ret.SetCoordinates(converter.Rho(), converter.Eta(), parameters[2], initialP4.mass());
122 converter = ROOT::Math::Polar3D<double>(1.0, parameters[1], 0);
123 ret.SetCoordinates(parameters[0], converter.Eta(), parameters[2], 0);
126 ret.SetCoordinates(parameters[0], parameters[1], parameters[2], 0);
133 ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0, 0, 1), uph, uth;
134 uph = uz.Cross(p).Unit();
135 uth = p.Cross(uph).Unit();
137 p += uth * parameters[1] + uph * parameters[2];
139 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), initialP4.mass() * parameters[3]);
142 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), (m2 > 0 ?
sqrt(m2) : 0.0));
145 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), (m2 > 0 ?
sqrt(m2) : 0.0));
147 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), initialP4.mass());
156 <<
"getResolEta not yet implemented for parametrization " <<
parametrization;
166 switch (parametrization) {
169 ret.SetCoordinates(parameters[0],
172 sqrt(parameters[0] * parameters[0] + parameters[1] * parameters[1] +
173 parameters[2] * parameters[2] + parameters[3] * parameters[3]));
176 ret.SetCoordinates(parameters[0],
179 sqrt(parameters[0] * parameters[0] + parameters[1] * parameters[1] +
180 parameters[2] * parameters[2] + initialP4.mass() * initialP4.mass()));
183 ret.SetCoordinates(parameters[0], parameters[1], parameters[2], parameters[3]);
190 ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0, 0, 1), uph, uth;
191 uph = uz.Cross(p).Unit();
192 uth = p.Cross(uph).Unit();
194 p += uth * parameters[1] + uph * parameters[2];
196 ret.SetCoordinates(p.X(), p.Y(), p.Z(),
sqrt(p.Mag2() +
ROOT::Math::Square(initialP4.mass() * parameters[3])));
198 ret.SetCoordinates(p.X(), p.Y(), p.Z(), parameters[3] * initialP4.energy());
200 ret.SetCoordinates(p.X(), p.Y(), p.Z(), p.R() * initialP4.E() / initialP4.P());
202 ret.SetCoordinates(p.X(), p.Y(), p.Z(),
sqrt(p.Mag2() + initialP4.mass() * initialP4.mass()));
213 template <
typename T>
216 switch (parametrization) {
234 ret[3] = p4.energy();
253 ret[3] = p4.energy();
256 ret[0] = 1.0 / p4.P();
292 ret[3] = p4.E() / p4.P();
299 <<
"getResolEta not yet implemented for parametrization " <<
parametrization;
334 switch (parametrization) {
347 while (ret[2] > +
M_PI)
348 ret[2] -= (2 *
M_PI);
349 while (ret[2] < -
M_PI)
350 ret[2] += (2 *
M_PI);
361 <<
"diffToParameters not yet implemented for parametrization " <<
parametrization;
371 switch (parametrization) {
384 while (ret[2] > +
M_PI)
385 ret[2] -= (2 *
M_PI);
386 while (ret[2] < -
M_PI)
387 ret[2] += (2 *
M_PI);
393 typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> > V3Cart;
394 V3Cart
p1 = p4ini.Vect(),
p2 = p4fin.Vect();
395 V3Cart ur = p1.Unit();
397 V3Cart uph = uz.Cross(ur).Unit();
398 V3Cart uth = ur.Cross(uph).Unit();
399 ret[0] =
p2.Dot(ur) / p1.R() - 1.0;
400 ret[1] = (
p2 -
p1).Dot(uth);
401 ret[2] = (
p2 -
p1).Dot(uph);
403 ret[3] = p4fin.mass() / p4ini.mass() - 1.0;
405 ret[3] = p4fin.energy() / p4ini.energy() - 1.0;
412 <<
"diffToParameters not yet implemented for parametrization " <<
parametrization;
418 switch (parametrization) {
438 <<
"isAlwaysMassless not yet implemented for parametrization " <<
parametrization;
443 switch (parametrization) {
463 <<
"isAlwaysMassless not yet implemented for parametrization " <<
parametrization;
468 switch (parametrization) {
488 <<
"isAlwaysMassless not yet implemented for parametrization " <<
parametrization;
495 switch (parametrization) {
498 return parameters[3] >= 0;
502 return (parameters[0] * parameters[0] + parameters[1] * parameters[1] + parameters[2] * parameters[2] <=
503 parameters[3] * parameters[3]);
505 return (parameters[0] >= 0) &&
506 (parameters[3] >= 0) &&
507 (parameters[1] >= 0) &&
508 (parameters[1] <=
M_PI);
510 return (parameters[0] >= 0) &&
511 (parameters[1] >= 0) &&
512 (parameters[1] <=
M_PI);
514 return (parameters[0] >= 0) &&
515 (parameters[3] >= parameters[0]) &&
516 (parameters[1] >= 0) &&
517 (parameters[1] <=
M_PI);
519 return (parameters[0] > 0) &&
520 (parameters[1] >= 0) &&
521 (parameters[1] <=
M_PI);
524 return (parameters[0] > 0) &&
525 (parameters[1] >= 0) &&
526 (parameters[1] <=
M_PI);
528 return (parameters[0] > 0);
531 return (parameters[0] >= 0) &&
532 (parameters[3] >= 0);
534 return (parameters[0] >= 0);
537 if (parameters[0] <= 0)
539 ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0, 0, 1), uph, uth;
540 uph = uz.Cross(p).Unit();
541 uth = p.Cross(uph).Unit();
543 p += uth * parameters[1] + uph * parameters[2];
545 if (parameters[3] < 0)
551 if (parameters[3] < 0)
564 <<
"getResolEta not yet implemented for parametrization " <<
parametrization;
AlgebraicVector4 parametersFromP4(pat::CandKinResolution::Parametrization parametrization, const math::XYZTLorentzVector &p4)
Returns a vector of coordinates values given a coordinate frame and a 4-vector.
const char * name(pat::CandKinResolution::Parametrization param)
Convert a number into a string.
ret
prodAgent to be discontinued
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
parametrization
specify parametrization (see SWGuidePATKinematicResolutions for more details)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setParametersFromP4(pat::CandKinResolution::Parametrization parametrization, AlgebraicVector4 &pars, const math::XYZTLorentzVector &p4)
Set the values of the parameters for a given 4-momentum.
ROOT::Math::SVector< double, 4 > AlgebraicVector4
bool isAlwaysMassive(pat::CandKinResolution::Parametrization parametrization)
Is this parametrization usable only with massive objects?
math::PtEtaPhiMLorentzVector polarP4fromParameters(pat::CandKinResolution::Parametrization parametrization, const AlgebraicVector4 ¶meters, const math::PtEtaPhiMLorentzVector &initialP4)
AlgebraicVector4 diffToParameters(pat::CandKinResolution::Parametrization parametrization, const math::XYZTLorentzVector &p4ini, const math::XYZTLorentzVector &p4fin)
Expresses the difference between two 4-momentum vectors as a shift in coordinates in a given frame...
bool isPhysical(pat::CandKinResolution::Parametrization parametrization, const AlgebraicVector4 &v4, const math::PtEtaPhiMLorentzVector &initialP4)
math::XYZTLorentzVector p4fromParameters(pat::CandKinResolution::Parametrization parametrization, const AlgebraicVector4 ¶meters, const math::XYZTLorentzVector &initialP4)
void setParametersFromAnyVector(pat::CandKinResolution::Parametrization parametrization, AlgebraicVector4 &pars, const T &p4)
For internal use only, so we provide only the interface. Use the 'setParametersFromP4'.
pat::CandKinResolution::Parametrization fromString(const std::string &name)
Convert a name into a parametrization code.
bool isAlwaysMassless(pat::CandKinResolution::Parametrization parametrization)
Is this parametrization usable only with massless objects?
bool isMassConstrained(pat::CandKinResolution::Parametrization parametrization)
If this parametrization has a mass constraint (including the 'isAlwaysMassless' case) ...