FParameter.cc
Go to the documentation of this file.
00001 // -*- C++ -*- 00002 #include "Rivet/Projections/FParameter.hh" 00003 00004 namespace Rivet { 00005 00006 FParameter::FParameter(const FinalState& fsp) { 00007 setName("FParameter"); 00008 addProjection(fsp, "FS"); 00009 clear(); 00010 } 00011 00012 00013 void FParameter::clear() { 00014 _lambdas = vector<double>(2, 0); 00015 } 00016 00017 00018 void FParameter::project(const Event& e) { 00019 const Particles prts = applyProjection<FinalState>(e, "FS").particles(); 00020 calc(prts); 00021 } 00022 00023 00024 void FParameter::calc(const FinalState& fs) { 00025 calc(fs.particles()); 00026 } 00027 00028 void FParameter::calc(const vector<Particle>& fsparticles) { 00029 vector<Vector3> threeMomenta; 00030 threeMomenta.reserve(fsparticles.size()); 00031 foreach (const Particle& p, fsparticles) { 00032 const Vector3 p3 = p.momentum().vector3(); 00033 threeMomenta.push_back(p3); 00034 } 00035 _calcFParameter(threeMomenta); 00036 } 00037 00038 void FParameter::calc(const vector<FourMomentum>& fsmomenta) { 00039 vector<Vector3> threeMomenta; 00040 threeMomenta.reserve(fsmomenta.size()); 00041 foreach (const FourMomentum& v, fsmomenta) { 00042 threeMomenta.push_back(v.vector3()); 00043 } 00044 _calcFParameter(threeMomenta); 00045 } 00046 00047 void FParameter::calc(const vector<Vector3>& fsmomenta) { 00048 _calcFParameter(fsmomenta); 00049 } 00050 00051 // Actually do the calculation 00052 void FParameter::_calcFParameter(const vector<Vector3>& fsmomenta) { 00053 00054 // Return (with "safe nonsense" sphericity params) if there are no final state particles. 00055 if (fsmomenta.empty()) { 00056 MSG_DEBUG("No particles in final state..."); 00057 clear(); 00058 return; 00059 } 00060 00061 // A small iteration over full momenta but set z-coord. to 0.0 to get transverse momenta 00062 vector <Vector3> fsperpmomenta; 00063 foreach (const Vector3& p, fsmomenta) { 00064 fsperpmomenta.push_back(Vector3(p.x(), p.y(), 0.0)); 00065 } 00066 00067 // Iterate over all the final state particles. 00068 Matrix<2> mMom; 00069 MSG_DEBUG("Number of particles = " << fsperpmomenta.size()); 00070 foreach (const Vector3& p3, fsperpmomenta) { 00071 00072 double prefactor = 1.0/p3.mod(); 00073 00074 Matrix<2> mMomPart; 00075 for (size_t i = 0; i < 2; ++i) { 00076 for (size_t j = 0; j < 2; ++j) { 00077 mMomPart.set(i,j, p3[i]*p3[j]); 00078 } 00079 } 00080 mMom += prefactor * mMomPart; 00081 } 00082 00083 MSG_DEBUG("Linearised transverse momentum tensor = " << mMom); 00084 00085 // Check that the matrix is symmetric. 00086 const bool isSymm = mMom.isSymm(); 00087 if (!isSymm) { 00088 MSG_ERROR("Error: momentum tensor not symmetric:"); 00089 MSG_ERROR("[0,1] vs. [1,0]: " << mMom.get(0,1) << ", " << mMom.get(1,0)); 00090 MSG_ERROR("[0,2] vs. [2,0]: " << mMom.get(0,2) << ", " << mMom.get(2,0)); 00091 MSG_ERROR("[1,2] vs. [2,1]: " << mMom.get(1,2) << ", " << mMom.get(2,1)); 00092 } 00093 // If not symmetric, something's wrong (we made sure the error msg appeared first). 00094 assert(isSymm); 00095 00096 // Diagonalize momentum matrix. 00097 const EigenSystem<2> eigen2 = diagonalize(mMom); 00098 MSG_DEBUG("Diag momentum tensor = " << eigen2.getDiagMatrix()); 00099 00100 // Reset and set eigenvalue parameters. 00101 _lambdas.clear(); 00102 const EigenSystem<2>::EigenPairs epairs = eigen2.getEigenPairs(); 00103 assert(epairs.size() == 2); 00104 for (size_t i = 0; i < 2; ++i) { 00105 _lambdas.push_back(epairs[i].first); 00106 } 00107 00108 // Debug output. 00109 MSG_DEBUG("Lambdas = (" 00110 << lambda1() << ", " << lambda2() << ")"); 00111 MSG_DEBUG("Sum of lambdas = " << lambda1() + lambda2()); 00112 } 00113 } Generated on Thu Mar 10 2016 08:29:50 for The Rivet MC analysis system by ![]() |