|
[Rivet-svn] r3092 - in trunk: include/Rivet/Projections src/Projectionsblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue May 10 13:15:05 BST 2011
Author: buckley Date: Tue May 10 13:15:05 2011 New Revision: 3092 Log: Tidy up the Spherocity code and comments (v minor, mostly whitespace) Modified: trunk/include/Rivet/Projections/Spherocity.hh trunk/src/Projections/Spherocity.cc Modified: trunk/include/Rivet/Projections/Spherocity.hh ============================================================================== --- trunk/include/Rivet/Projections/Spherocity.hh Tue May 10 13:14:31 2011 (r3091) +++ trunk/include/Rivet/Projections/Spherocity.hh Tue May 10 13:15:05 2011 (r3092) @@ -25,10 +25,10 @@ direction, and the vector perpendicular to both the spherocity and spherocity major directions is the spherocity minor. Both the major and minor directions have associated spherocity scalars. - - Care must be taken in the case of Drell-Yann processes - there we should use the - newly proposed observable a_T. - + + Care must be taken in the case of Drell-Yan processes - there we should use the + newly proposed observable \f$ a_T \f$. + */ class Spherocity : public AxesDefinition { public: @@ -46,6 +46,7 @@ return new Spherocity(*this); } + protected: /// Perform the projection on the Event @@ -55,6 +56,7 @@ calc(ps); } + /// Compare projections int compare(const Projection& p) const { return mkNamedPCmp(p, "FS"); @@ -68,6 +70,7 @@ double spherocity() const { return _spherocities[0]; } ///@} + ///@{ Spherocity axis accessors /// The spherocity axis. const Vector3& spherocityAxis() const { return _spherocityAxes[0]; } @@ -77,6 +80,7 @@ const Vector3& spherocityMinorAxis() const { return _spherocityAxes[2]; } ///@} + ///@{ AxesDefinition axis accessors. const Vector3& axis1() const { return spherocityAxis(); } const Vector3& axis2() const { return spherocityMajorAxis(); } @@ -116,6 +120,7 @@ /// Caching flag to avoid costly recalculations. bool _calculatedSpherocity; + private: /// Explicitly calculate the spherocity values. Modified: trunk/src/Projections/Spherocity.cc ============================================================================== --- trunk/src/Projections/Spherocity.cc Tue May 10 13:14:31 2011 (r3091) +++ trunk/src/Projections/Spherocity.cc Tue May 10 13:15:05 2011 (r3092) @@ -10,7 +10,8 @@ void Spherocity::calc(const FinalState& fs) { calc(fs.particles()); } - + + void Spherocity::calc(const vector<Particle>& fsparticles) { vector<Vector3> threeMomenta; threeMomenta.reserve(fsparticles.size()); @@ -20,7 +21,8 @@ } _calcSpherocity(threeMomenta); } - + + void Spherocity::calc(const vector<FourMomentum>& fsmomenta) { vector<Vector3> threeMomenta; threeMomenta.reserve(fsmomenta.size()); @@ -30,6 +32,7 @@ _calcSpherocity(threeMomenta); } + void Spherocity::calc(const vector<Vector3>& fsmomenta) { _calcSpherocity(fsmomenta); } @@ -38,11 +41,11 @@ ///////////////////////////////////////////////// + // Inline functions to avoid template hell inline bool mod2Cmp(const Vector<2>& a, const Vector<2>& b) { return a.mod2() > b.mod2(); } - // Inline functions to avoid template hell inline double dot(const Vector<2>& a, const Vector<2>& b) { return a[0]*b[0] + a[1]*b[1]; } @@ -64,7 +67,7 @@ // direction of one of the transverse momentum vectors of the events particles. // Thus we carry out the calculation of Sphero for all particles and pick the // one that yields the smallerst values - + vector<Vector3> p = perpmomenta; vector<double> sval; @@ -88,7 +91,7 @@ sval.push_back(s); } - + // Pick the solution with the smallest spherocity sphero = 999.; @@ -104,12 +107,12 @@ // Do the full calculation void Spherocity::_calcSpherocity(const vector<Vector3>& fsmomenta) { - + // Make a vector of the three-momenta in the final state // Explicitly set the z-component (parallel to beam axis) to zero // This creates a 3D-vector representation of the transverse momentum // but take the full information momentum vectors as input - + vector<Vector3> fsperpmomenta; // A small iteration over full momenta but set z-coord. to 0.0 to get transverse momenta foreach (const Vector3& p, fsmomenta) { @@ -156,27 +159,25 @@ return; } - // Temporary variables for calcs Vector3 axis(0,0,0); double val = 0.; - // Get spherocity _calcS(fsperpmomenta, val, axis); - getLog() << Log::DEBUG << "Mom sum = " << perpmomentumSum << endl; + MSG_DEBUG("Mom sum = " << perpmomentumSum); double spherocity = PI*PI* val*val / (4 * perpmomentumSum*perpmomentumSum); _spherocities.push_back(spherocity); // See if calclulated spherocity value makes sense if (spherocity < 0.0 || spherocity > 1.0) { - getLog() << Log::WARN << "Spherocity = " << spherocity << endl; + MSG_WARNING("Spherocity = " << spherocity); } - - getLog() << Log::DEBUG << "Spherocity value = " << spherocity << endl; - getLog() << Log::DEBUG << "Sperocity axis = " << axis << endl; - + MSG_DEBUG("Spherocity value = " << spherocity); + + MSG_DEBUG("Sperocity axis = " << axis); + _spherocityAxes.push_back(axis); @@ -209,5 +210,4 @@ } - }
More information about the Rivet-svn mailing list |