[Rivet-svn] rivet: Add string representations and streamability to the Cut o...

Rivet Mercurial rivet at projects.hepforge.org
Thu Feb 1 14:30:02 GMT 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/0a14d4859966
branches:  release-2-6-x
changeset: 6231:0a14d4859966
user:      Andy Buckley <andy at insectnation.org>
date:      Thu Feb 01 14:29:52 2018 +0000
description:
Add string representations and streamability to the Cut objects, for debugging.

diffs (truncated from 243 to 50 lines):

--- a/ChangeLog	Wed Jan 31 21:09:14 2018 +0000
+++ b/ChangeLog	Thu Feb 01 14:29:52 2018 +0000
@@ -1,3 +1,7 @@
+2018-02-01  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Add string representations and streamability to the Cut objects, for debugging.
+
 2018-01-08  Andy Buckley  <andy.buckley at cern.ch>
 
 	* Add highlighted source to HTML analysis metadata listings.
--- a/include/Rivet/Tools/Cuts.hh	Wed Jan 31 21:09:14 2018 +0000
+++ b/include/Rivet/Tools/Cuts.hh	Thu Feb 01 14:29:52 2018 +0000
@@ -23,6 +23,9 @@
     /// Comparison to another Cut
     virtual bool operator == (const Cut&) const = 0;
 
+    /// String representation
+    virtual std::string toString() const = 0;
+
     /// Default destructor
     virtual ~CutBase() {}
 
@@ -116,6 +119,13 @@
   //@}
 
 
+  /// String representation
+  inline std::ostream& operator << (std::ostream& os, const Cut& cptr) {
+    os << cptr->toString();
+    return os;
+  }
+
+
 }
 
 #endif
--- a/src/Projections/FinalState.cc	Wed Jan 31 21:09:14 2018 +0000
+++ b/src/Projections/FinalState.cc	Thu Feb 01 14:29:52 2018 +0000
@@ -37,7 +37,9 @@
 
   int FinalState::compare(const Projection& p) const {
     const FinalState& other = dynamic_cast<const FinalState&>(p);
-    return _cuts == other._cuts ? EQUIVALENT : UNDEFINED;
+    const bool cutcmp =_cuts == other._cuts;
+    MSG_TRACE(_cuts << " VS " << other._cuts << " -> EQ == " << std::boolalpha << cutcmp);
+    return cutcmp ? EQUIVALENT : UNDEFINED;
   }
 
 
--- a/src/Tools/Cuts.cc	Wed Jan 31 21:09:14 2018 +0000


More information about the Rivet-svn mailing list