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> 20 static map<string,Parametrization>
const parMaps = {
35 map<string,Parametrization>::const_iterator itP = parMaps.find(name);
36 if (itP == parMaps.end()) {
37 throw cms::Exception(
"StringResolutionProvider") <<
"Bad parametrization '" << name.c_str() <<
"'";
59 default:
return "UNKNOWN";
68 ROOT::Math::CylindricalEta3D<double>
converter;
70 switch (parametrization) {
74 sqrt(parameters[0]*parameters[0] +
75 parameters[1]*parameters[1] +
76 parameters[2]*parameters[2] +
77 parameters[3]*parameters[3]) );
78 ret.SetM(parameters[3]);
82 sqrt(parameters[0]*parameters[0] +
83 parameters[1]*parameters[1] +
84 parameters[2]*parameters[2] +
85 initialP4.mass()*initialP4.mass()) );
86 ret.SetM(initialP4.mass());
93 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
94 ret.SetCoordinates(converter.Rho(),converter.Eta(),parameters[2],parameters[3]);
97 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
98 ret.SetCoordinates(converter.Rho(),converter.Eta(),parameters[2],initialP4.mass());
101 converter = ROOT::Math::Polar3D<double>(parameters[0], parameters[1], 0);
102 m2 = - parameters[0]*parameters[0] + parameters[3]*parameters[3];
103 ret.SetCoordinates(converter.Rho(),converter.Eta(),parameters[2],(m2 > 0 ?
sqrt(m2) : 0.0));
106 converter = ROOT::Math::Polar3D<double>(1.0/parameters[0], parameters[1], 0);
107 ret.SetCoordinates(converter.Rho(),converter.Eta(),parameters[2],initialP4.mass());
111 converter = ROOT::Math::Polar3D<double>(1.0, parameters[1], 0);
112 ret.SetCoordinates(parameters[0],converter.Eta(),parameters[2],0);
115 ret.SetCoordinates(parameters[0], parameters[1], parameters[2], 0);
123 ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0,0,1), uph, uth;
124 uph = uz.Cross(p).Unit();
125 uth = p.Cross(uph).Unit();
127 p += uth * parameters[1] + uph * parameters[2];
129 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), initialP4.mass() * parameters[3]);
131 double m2 = ROOT::Math::Square(parameters[3] * initialP4.energy()) - p.Mag2();
132 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), (m2 > 0 ?
sqrt(m2) : 0.0));
134 double m2 = ROOT::Math::Square(p.R()*initialP4.E()/initialP4.P()) - p.Mag2();
135 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), (m2 > 0 ?
sqrt(m2) : 0.0));
137 ret.SetCoordinates(p.Rho(), p.Eta(), p.Phi(), initialP4.mass());
155 switch (parametrization) {
158 ret.SetCoordinates(parameters[0], parameters[1], parameters[2],
159 sqrt(parameters[0]*parameters[0] +
160 parameters[1]*parameters[1] +
161 parameters[2]*parameters[2] +
162 parameters[3]*parameters[3]) );
165 ret.SetCoordinates(parameters[0], parameters[1], parameters[2],
166 sqrt(parameters[0]*parameters[0] +
167 parameters[1]*parameters[1] +
168 parameters[2]*parameters[2] +
169 initialP4.mass()*initialP4.mass()) );
172 ret.SetCoordinates(parameters[0], parameters[1], parameters[2], parameters[3]);
180 ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0,0,1), uph, uth;
181 uph = uz.Cross(p).Unit();
182 uth = p.Cross(uph).Unit();
184 p += uth * parameters[1] + uph * parameters[2];
186 ret.SetCoordinates(p.X(), p.Y(), p.Z(),
sqrt(p.Mag2() + ROOT::Math::Square(initialP4.mass() * parameters[3])) );
188 ret.SetCoordinates(p.X(), p.Y(), p.Z(), parameters[3] * initialP4.energy());
190 ret.SetCoordinates(p.X(), p.Y(), p.Z(), p.R() * initialP4.E()/initialP4.P());
192 ret.SetCoordinates(p.X(), p.Y(), p.Z(),
sqrt(p.Mag2() + initialP4.mass()*initialP4.mass()));
203 template <
typename T>
208 switch (parametrization) {
211 ret[0] = p4.px(); ret[1] = p4.py(); ret[2] = p4.pz(); ret[3] = p4.mass();
214 ret[0] = p4.px(); ret[1] = p4.py(); ret[2] = p4.pz(); ret[3] = p4.mass();
217 ret[0] = p4.px(); ret[1] = p4.py(); ret[2] = p4.pz(); ret[3] = p4.energy();
221 ret[0] = p4.P(); ret[1] = p4.theta(); ret[2] = p4.phi(); ret[3] = p4.mass();
224 ret[0] = p4.P(); ret[1] = p4.theta(); ret[2] = p4.phi(); ret[3] = p4.mass();
227 ret[0] = p4.P(); ret[1] = p4.theta(); ret[2] = p4.phi(); ret[3] = p4.energy();
230 ret[0] = 1.0/p4.P(); ret[1] = p4.theta(); ret[2] = p4.phi(); ret[3] = p4.mass();
234 ret[0] = p4.pt(); ret[1] = p4.theta(); ret[2] = p4.phi(); ret[3] = 0;
237 ret[0] = p4.pt(); ret[1] = p4.eta(); ret[2] = p4.phi(); ret[3] = 0;
242 ret[0] = 1.0; ret[1] = 0.0; ret[2] = 0.0; ret[3] = 1.0;
245 ret[0] = 1.0; ret[1] = 0.0; ret[2] = 0.0; ret[3] = p4.mass();
248 ret[0] = 1.0; ret[1] = 0.0; ret[2] = 0.0; ret[3] = p4.E()/p4.P();
289 switch (parametrization) {
302 while(ret[2] > +
M_PI) ret[2] -= (2*
M_PI);
303 while(ret[2] < -
M_PI) ret[2] += (2*
M_PI);
326 switch (parametrization) {
339 while(ret[2] > +
M_PI) ret[2] -= (2*
M_PI);
340 while(ret[2] < -
M_PI) ret[2] += (2*
M_PI);
347 typedef ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D<double> > V3Cart;
348 V3Cart
p1 = p4ini.Vect(),
p2 = p4fin.Vect();
349 V3Cart ur = p1.Unit();
351 V3Cart uph = uz.Cross(ur).Unit();
352 V3Cart uth = ur.Cross(uph).Unit();
353 ret[0] =
p2.Dot(ur)/p1.R() - 1.0;
354 ret[1] = (
p2 -
p1).Dot(uth);
355 ret[2] = (
p2 -
p1).Dot(uph);
357 ret[3] = p4fin.mass()/p4ini.mass() - 1.0;
359 ret[3] = p4fin.energy()/p4ini.energy() - 1.0;
374 switch (parametrization) {
400 switch (parametrization) {
426 switch (parametrization) {
453 switch (parametrization) {
456 return parameters[3] >= 0;
460 return (parameters[0]*parameters[0] + parameters[1]*parameters[1] + parameters[2]*parameters[2] <= parameters[3]*parameters[3]);
462 return (parameters[0] >= 0 ) &&
463 (parameters[3] >= 0 ) &&
464 (parameters[1] >= 0 ) &&
465 (parameters[1] <=
M_PI);
467 return (parameters[0] >= 0 ) &&
468 (parameters[1] >= 0 ) &&
469 (parameters[1] <=
M_PI);
471 return (parameters[0] >= 0 ) &&
472 (parameters[3] >= parameters[0]) &&
473 (parameters[1] >= 0 ) &&
474 (parameters[1] <=
M_PI ) ;
476 return (parameters[0] > 0 ) &&
477 (parameters[1] >= 0 ) &&
478 (parameters[1] <=
M_PI);
481 return (parameters[0] > 0 ) &&
482 (parameters[1] >= 0 ) &&
483 (parameters[1] <=
M_PI);
485 return (parameters[0] > 0);
488 return (parameters[0] >= 0) &&
489 (parameters[3] >= 0);
491 return (parameters[0] >= 0);
495 if (parameters[0] <= 0)
return false;
496 ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D<double> >
p = initialP4.Vect(), uz(0,0,1), uph, uth;
497 uph = uz.Cross(p).Unit();
498 uth = p.Cross(uph).Unit();
500 p += uth * parameters[1] + uph * parameters[2];
502 if (parameters[3] < 0)
return false;
503 double m2 = ROOT::Math::Square(parameters[3] * initialP4.energy()) - p.Mag2();
504 if (m2 < 0)
return false;
506 if (parameters[3] < 0)
return false;
507 double m2 = ROOT::Math::Square(p.R()*initialP4.E()/initialP4.P()) - p.Mag2();
508 if (m2 < 0)
return false;
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.
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.
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.
ROOT::Math::SVector< double, 4 > AlgebraicVector4
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) ...